HSS1394  Release1.00
HSS1394Types.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
24 
25 #ifndef _HSS1394Types_
26 #define _HSS1394Types_
27 
28 //*** Defines
29 //*****************************************************************************
30 #ifndef NULL
31  #define NULL ((void*)0x0)
32 #endif
33 
34 // Some useful constants
36 #define HSS1394_k (1024)
37 #define HSS1394_M (HSS1394_k*HSS1394_k)
39 
40 
41 //*** Types
42 //*****************************************************************************
43 namespace hss1394 {
44  // THSS1394Tags
46  //-----------------------------------------------------------------------------
47  typedef enum {
48  // Must match with defines in NodeHSS1394.cpp on embedded endpoint.
49  kUserData = 0x00,
50  kDebugData = 0x01,
51  kUserTagBase = 0x10,
52  kUserTagTop = 0xEF,
53  kReset = 0xF0,
54  kChangeAddress = 0xF1,
55  kPing = 0xF2,
56  kPingResponse = 0xF3,
57  kEchoAsUserData = 0xF4,
58  kUndefined = 0xFF
59  }THSS1394Tags;
60 
61 
62  // Useful bit-counted type definitions
63  // Potentially Platform-dependent, however 32-bit assumptions can be made.
64  //-----------------------------------------------------------------------------
65  #ifdef _WIN32_
66  typedef unsigned __int64 _u64;
67  #else // We assume Mac
68  typedef uint64_t _u64;
69  #endif
70 
71  // 32-bit machine/compiler assumption
72  typedef unsigned int uint;
73  typedef unsigned char uint8;
74  typedef unsigned short uint16;
75  typedef unsigned int uint32;
76 
78  class uint48 {
79  public:
80  uint32 mu32Low;
81  uint16 mu16High;
82  uint16 mu16Guard;
83 
85  inline uint48(void) :
86  mu16Guard(0x0), mu16High(0x0), mu32Low(0x0) {
87  }
88 
90  inline uint48(uint16 u16High, uint32 u32Low) :
91  mu16Guard(0x0), mu16High(u16High), mu32Low(u32Low) {
92  }
93 
95  inline bool operator==(const uint48 &other) const {
96  return ((mu16High == other.mu16High) && (mu32Low == other.mu32Low));
97  }
98 
100  inline uint48 &operator=(const uint48 &other) {
101  mu16Guard = other.mu16Guard;
102  mu16High = other.mu16High;
103  mu32Low = other.mu32Low;
104  return *this;
105  }
106  };
107 
109  class uint64 {
110  public:
111  uint32 mu32Low;
112  uint32 mu32High;
113 
115  inline uint64(void) :
116  mu32High(0x0), mu32Low(0x0) {
117  }
118 
120  inline uint64(uint32 u32High, uint32 u32Low) :
121  mu32High(u32High), mu32Low(u32Low) {
122  }
123 
125  inline bool operator==(const uint64 &other) const {
126  return ((mu32High == other.mu32High) && (mu32Low == other.mu32Low));
127  }
128 
130  inline uint64 &operator=(const uint64 &other) {
131  mu32High = other.mu32High;
132  mu32Low = other.mu32Low;
133  return *this;
134  }
135 
137  inline uint64 &operator=(const int other) {
138  mu32High = 0x0;
139  mu32Low = other;
140  return *this;
141  }
142  };
143 
144 }; // ::hss1394
145 
146 #endif // _HSS1394Types_
147 
Data is for debug channel.
Definition: HSS1394Types.h:50
Ping message tag. Reply is a kPingResponse packet.
Definition: HSS1394Types.h:55
Data is 'user' data to be delivered to app.
Definition: HSS1394Types.h:49
Ping response packet tag.
Definition: HSS1394Types.h:56
Undefined tag.
Definition: HSS1394Types.h:58
uint48(uint16 u16High, uint32 u32Low)
Construct instance from MS16 and LS32 bits.
Definition: HSS1394Types.h:90
uint48 & operator=(const uint48 &other)
Assignment operator.
Definition: HSS1394Types.h:100
Reset node message.
Definition: HSS1394Types.h:53
48-bit unsigned integer
Definition: HSS1394Types.h:78
uint32 mu32Low
LS32 of value.
Definition: HSS1394Types.h:111
Base of user special tag space.
Definition: HSS1394Types.h:51
HSS1394 namespace encapsulates all HSS1394 functionality.
Definition: HSS1394.h:66
64-bit unsigned integer
Definition: HSS1394Types.h:109
unsigned short uint16
16-bit unsigned int
Definition: HSS1394Types.h:74
uint16 mu16Guard
Redundant 16-bit guard.
Definition: HSS1394Types.h:82
bool operator==(const uint48 &other) const
Equivalence test.
Definition: HSS1394Types.h:95
uint64(void)
Construct a zero-valued instance.
Definition: HSS1394Types.h:115
unsigned int uint
Machine native unsigned int.
Definition: HSS1394Types.h:72
THSS1394Tags
Message tags used in HSS1394 protocol.
Definition: HSS1394Types.h:47
uint48(void)
Construct zero-valued instance.
Definition: HSS1394Types.h:85
Change address message tag.
Definition: HSS1394Types.h:54
uint64 & operator=(const uint64 &other)
Assignment operator.
Definition: HSS1394Types.h:130
uint16 mu16High
MS16 of value.
Definition: HSS1394Types.h:81
unsigned int uint32
32-bit unsigned int
Definition: HSS1394Types.h:75
Debug tag. Echo data back 'as-if' sent from node.
Definition: HSS1394Types.h:57
uint32 mu32High
MS32 of value.
Definition: HSS1394Types.h:112
uint64 & operator=(const int other)
Partial assignment operator - sets MS32 of result as zero.
Definition: HSS1394Types.h:137
Top of user special tag space.
Definition: HSS1394Types.h:52
unsigned char uint8
8-bit unsigned int
Definition: HSS1394Types.h:73
bool operator==(const uint64 &other) const
Equvalence test.
Definition: HSS1394Types.h:125
uint32 mu32Low
LS32 of value.
Definition: HSS1394Types.h:80
uint64(uint32 u32High, uint32 u32Low)
Construct instance by specifying MS32 and LS32.
Definition: HSS1394Types.h:120