41 #define SERIALIZE_ALIGN4(d) ((d+3) & ~3)
42 #define SERIALIZE_ALIGN2(d) ((d+1) & ~1)
44 #define SERIALIZE_ALIGN4_PTR(p) p = ((CPUINT8*)0 + ((((CPUINT8*)(p) - (CPUINT8*)0) + 3) & ~3))
45 #define SERIALIZE_ALIGN2_PTR(p) p = ((CPUINT8*)0 + ((((CPUINT8*)(p) - (CPUINT8*)0) + 1) & ~1))
47 #define CLCDESERIALIZE_DEVICEID(deviceID, p) DESERIALIZE_UINT16((deviceID).wBrandID, p); \
48 DESERIALIZE_UINT16((deviceID).wModelID, p); \
50 CPUINT16 wTmp1, wTmp2; \
51 DESERIALIZE_UINT16(wTmp1, p); \
52 DESERIALIZE_UINT16(wTmp2, p); \
53 (deviceID).dwDuplicateNumber = ((CPUINT32) wTmp2 << 16) | wTmp1; \
55 DESERIALIZE_UINT16((deviceID).wModuleID, p);
57 #define CLCSERIALIZE_DEVICEID(p, deviceID) SERIALIZE_UINT16(p, (deviceID).wBrandID); \
58 SERIALIZE_UINT16(p, (deviceID).wModelID); \
59 SERIALIZE_UINT16(p, ((CPUINT16) (deviceID).dwDuplicateNumber)); \
60 SERIALIZE_UINT16(p, ((CPUINT16) ((deviceID).dwDuplicateNumber >> 16))); \
61 SERIALIZE_UINT16(p, (deviceID).wModuleID);
63 #define CLCDESERIALIZE_SECTIONID(sectionID, p) { \
64 CPUINT16 w1, w2, w3, w4; \
65 DESERIALIZE_UINT16(w1, p); \
66 DESERIALIZE_UINT16(w2, p); \
67 DESERIALIZE_UINT16(w3, p); \
68 DESERIALIZE_UINT16(w4, p); \
69 (sectionID).qwSectionType = ((CPUINT64) w1) << 48 | ((CPUINT64) w2) << 32 | ((CPUINT32) w3) << 16 | w4; \
70 DESERIALIZE_UINT16((sectionID).wInstance, p); \
73 #define CLCSERIALIZE_SECTIONID(p, sectionID) SERIALIZE_UINT16(p, ((CPUINT16) ((sectionID).qwSectionType >> 48))); \
74 SERIALIZE_UINT16(p, ((CPUINT16) ((sectionID).qwSectionType >> 32))); \
75 SERIALIZE_UINT16(p, ((CPUINT16) ((sectionID).qwSectionType >> 16))); \
76 SERIALIZE_UINT16(p, ((CPUINT16) (sectionID).qwSectionType)); \
77 SERIALIZE_UINT16(p, (sectionID).wInstance);
79 #define CLCDESERIALIZE_PARAMETERID(paramID, p) DESERIALIZE_UINT16((paramID).wInputID, p); \
80 DESERIALIZE_UINT16((paramID).wMsgType, p); \
81 DESERIALIZE_UINT16((paramID).wMsgNum, p); \
82 DESERIALIZE_UINT16((paramID).wMsgIndex, p);
84 #define CLCSERIALIZE_PARAMETERID(p, paramID) SERIALIZE_UINT16(p, (paramID).wInputID); \
85 SERIALIZE_UINT16(p, (paramID).wMsgType); \
86 SERIALIZE_UINT16(p, (paramID).wMsgNum); \
87 SERIALIZE_UINT16(p, (paramID).wMsgIndex);
89 #define CLCDESERIALIZE_CONTROLLERID(ctrlID, p) DESERIALIZE_UINT16((ctrlID).wOutputID, p); \
90 DESERIALIZE_UINT16((ctrlID).wCtrlType, p); \
91 DESERIALIZE_UINT16((ctrlID).wCtrlInstance, p);
93 #define CLCSERIALIZE_CONTROLLERID(p, ctrlID) SERIALIZE_UINT16(p, (ctrlID).wOutputID); \
94 SERIALIZE_UINT16(p, (ctrlID).wCtrlType); \
95 SERIALIZE_UINT16(p, (ctrlID).wCtrlInstance);
97 #define CLCDESERIALIZE_CONTROLLERASSIGNMENT(ctrlAssignment, p) \
98 CLCDESERIALIZE_ENDPOINT((ctrlAssignment).target, p); \
99 DESERIALIZE_UINT16((ctrlAssignment).wMsgType, p); \
100 DESERIALIZE_UINT16((ctrlAssignment).wMsgNum, p); \
101 DESERIALIZE_UINT16((ctrlAssignment).wMsgIndex, p); \
102 DESERIALIZE_UINT16((ctrlAssignment).wInformationProfile, p); \
103 DESERIALIZE_UINT16((ctrlAssignment).wValueDown, p); \
104 DESERIALIZE_UINT16((ctrlAssignment).wValueUp, p); \
105 DESERIALIZE_UINT8((ctrlAssignment).bAvailableValues, p); \
106 p += sizeof(CPUINT8); // for 2 bytes alignment
108 #define CLCSERIALIZE_CONTROLLERASSIGNMENT(p, ctrlAssignment) \
109 CLCSERIALIZE_ENDPOINT(p, (ctrlAssignment).target); \
110 SERIALIZE_UINT16(p, (ctrlAssignment).wMsgType); \
111 SERIALIZE_UINT16(p, (ctrlAssignment).wMsgNum); \
112 SERIALIZE_UINT16(p, (ctrlAssignment).wMsgIndex); \
113 SERIALIZE_UINT16(p, (ctrlAssignment).wInformationProfile); \
114 SERIALIZE_UINT16(p, (ctrlAssignment).wValueDown); \
115 SERIALIZE_UINT16(p, (ctrlAssignment).wValueUp); \
116 SERIALIZE_UINT8(p, (ctrlAssignment).bAvailableValues); \
117 SERIALIZE_UINT8(p, 0); // for 2 bytes alignment
119 #define CLCDESERIALIZE_SMARTCONNECTSECTIONITEM(scSectionItem, p) \
120 DESERIALIZE_UINT64((scSectionItem).qwSectionType, p); \
121 CLCDESERIALIZE_DEVICEID((scSectionItem).DevID, p); \
122 DESERIALIZE_UINT16((scSectionItem).wInstanceCount, p);
124 #define CLCSERIALIZE_SMARTCONNECTSECTIONITEM(p, ctrlAssignment) \
125 SERIALIZE_UINT64(p, (scSectionItem).qwSectionType); \
126 CLCSERIALIZE_DEVICEID(p, (scSectionItem).DevID); \
127 SERIALIZE_UINT16(p, (scSectionItem).wInstanceCount);
129 #define CLCDESERIALIZE_SMARTCONNECTCONTROLLERITEM(scControllerItem, p) \
130 DESERIALIZE_UINT16((scControllerItem).wControllerID, p); \
131 DESERIALIZE_UINT16((scControllerItem).wControllerTypes, p); \
132 DESERIALIZE_UINT16((scControllerItem).wPreferredMsgType, p); \
133 DESERIALIZE_UINT16((scControllerItem).wPreferredMsgNum, p); \
134 DESERIALIZE_UINT16((scControllerItem).wGroup, p);
136 #define CLCSERIALIZE_SMARTCONNECTCONTROLLERITEM(p, scControllerItem) \
137 SERIALIZE_UINT16(p, (scControllerItem).wControllerID); \
138 SERIALIZE_UINT16(p, (scControllerItem).wControllerTypes); \
139 SERIALIZE_UINT16(p, (scControllerItem).wPreferredMsgType); \
140 SERIALIZE_UINT16(p, (scControllerItem).wPreferredMsgNum); \
141 SERIALIZE_UINT16(p, (scControllerItem).wGroup);
143 #define CLCDESERIALIZE_INTERNALVALUE(val, p) DESERIALIZE_UINT16((val).wRawValue, p); \
144 DESERIALIZE_UINT16((val).wDataType, p); \
145 switch((val).wDataType & _DT_LengthMask_) \
148 DESERIALIZE_UINT16((val).value.u16, p); \
152 DESERIALIZE_UINT32((val).value.u32, p); \
156 DESERIALIZE_UINT64((val).value.u64, p); \
161 #define CLCSERIALIZE_INTERNALVALUE(p, val) SERIALIZE_UINT16(p, (val).wRawValue); \
162 SERIALIZE_UINT16(p, (val).wDataType); \
163 switch((val).wDataType & _DT_LengthMask_) \
166 SERIALIZE_UINT16(p, (val).value.u16); \
170 SERIALIZE_UINT32(p, (val).value.u32); \
174 SERIALIZE_UINT64(p, (val).value.u64); \
179 #define CLCDESERIALIZE_ENDPOINT(ep, p) DESERIALIZE_UINT16((ep).deviceID.wBrandID, p); \
180 DESERIALIZE_UINT16((ep).deviceID.wModelID, p); \
182 CPUINT16 wTmp1, wTmp2; \
183 DESERIALIZE_UINT16(wTmp1, p); \
184 DESERIALIZE_UINT16(wTmp2, p); \
185 (ep).deviceID.dwDuplicateNumber = (((CPUINT32) wTmp2) << 16) | wTmp1; \
187 DESERIALIZE_UINT16((ep).deviceID.wModuleID, p); \
188 DESERIALIZE_UINT16((ep).wInOutID, p);
191 #define CLCSERIALIZE_ENDPOINT(p, ep) SERIALIZE_UINT16(p, (ep).deviceID.wBrandID); \
192 SERIALIZE_UINT16(p, (ep).deviceID.wModelID); \
193 SERIALIZE_UINT16(p, ((CPUINT16) (ep).deviceID.dwDuplicateNumber)); \
194 SERIALIZE_UINT16(p, ((CPUINT16) ((ep).deviceID.dwDuplicateNumber >> 16))); \
195 SERIALIZE_UINT16(p, (ep).deviceID.wModuleID); \
196 SERIALIZE_UINT16(p, (ep).wInOutID);
198 #define CLCSERIALIZE_APPEVENTMSG(p, msg) SERIALIZE_UINT16(p, (msg).wProfiles); \
199 SERIALIZE_UINT16(p, (msg).Profile.DataArray[0]); \
200 SERIALIZE_UINT16(p, (msg).Profile.DataArray[1]); \
201 SERIALIZE_UINT16(p, (msg).Profile.DataArray[2]); \
202 SERIALIZE_UINT16(p, (msg).Profile.DataArray[3]); \
203 SERIALIZE_UINT16(p, (msg).Profile.DataArray[4]); \
204 SERIALIZE_UINT16(p, (msg).Profile.DataArray[5]); \
205 SERIALIZE_UINT16(p, (msg).Profile.DataArray[6]); \
206 SERIALIZE_UINT16(p, (msg).Profile.DataArray[7]);
208 #define CLCDESERIALIZE_APPEVENTMSG(msg, p) DESERIALIZE_UINT16((msg).wProfiles, p); \
209 DESERIALIZE_UINT16((msg).Profile.DataArray[0], p); \
210 DESERIALIZE_UINT16((msg).Profile.DataArray[1], p); \
211 DESERIALIZE_UINT16((msg).Profile.DataArray[2], p); \
212 DESERIALIZE_UINT16((msg).Profile.DataArray[3], p); \
213 DESERIALIZE_UINT16((msg).Profile.DataArray[4], p); \
214 DESERIALIZE_UINT16((msg).Profile.DataArray[5], p); \
215 DESERIALIZE_UINT16((msg).Profile.DataArray[6], p); \
216 DESERIALIZE_UINT16((msg).Profile.DataArray[7], p);
218 #define CLCSERIALIZE_APPMODIFIERMSG(p, msg) SERIALIZE_UINT16(p, (msg).wProfiles); \
219 SERIALIZE_UINT16(p, (msg).wNumber); \
220 SERIALIZE_UINT16(p, (msg).Profile.DataArray[0]); \
221 SERIALIZE_UINT16(p, (msg).Profile.DataArray[1]); \
222 SERIALIZE_UINT16(p, (msg).Profile.DataArray[2]); \
223 SERIALIZE_UINT16(p, (msg).Profile.DataArray[3]); \
224 SERIALIZE_UINT16(p, (msg).Profile.DataArray[4]); \
225 SERIALIZE_UINT16(p, (msg).Profile.DataArray[5]); \
226 SERIALIZE_UINT16(p, (msg).Profile.DataArray[6]); \
227 SERIALIZE_UINT16(p, (msg).Profile.DataArray[7]); \
228 CLCSERIALIZE_INTERNALVALUE(p, (msg).Value);
230 #define CLCDESERIALIZE_APPMODIFIERMSG(msg, p) DESERIALIZE_UINT16((msg).wProfiles, p); \
231 DESERIALIZE_UINT16((msg).wNumber, p); \
232 DESERIALIZE_UINT16((msg).Profile.DataArray[0], p); \
233 DESERIALIZE_UINT16((msg).Profile.DataArray[1], p); \
234 DESERIALIZE_UINT16((msg).Profile.DataArray[2], p); \
235 DESERIALIZE_UINT16((msg).Profile.DataArray[3], p); \
236 DESERIALIZE_UINT16((msg).Profile.DataArray[4], p); \
237 DESERIALIZE_UINT16((msg).Profile.DataArray[5], p); \
238 DESERIALIZE_UINT16((msg).Profile.DataArray[6], p); \
239 DESERIALIZE_UINT16((msg).Profile.DataArray[7], p); \
240 CLCDESERIALIZE_INTERNALVALUE((msg).Value, p);
242 #define CLCSERIALIZE_APPSELECTORMSG(p, msg) SERIALIZE_UINT16(p, (msg).wProfiles); \
243 SERIALIZE_UINT16(p, (msg).wNumber); \
244 SERIALIZE_UINT16(p, (msg).Profile.DataArray[0]); \
245 SERIALIZE_UINT16(p, (msg).Profile.DataArray[1]); \
246 SERIALIZE_UINT16(p, (msg).Profile.DataArray[2]); \
247 SERIALIZE_UINT16(p, (msg).Profile.DataArray[3]); \
248 SERIALIZE_UINT16(p, (msg).Profile.DataArray[4]); \
249 SERIALIZE_UINT16(p, (msg).Profile.DataArray[5]); \
250 SERIALIZE_UINT16(p, (msg).Profile.DataArray[6]); \
251 SERIALIZE_UINT16(p, (msg).Profile.DataArray[7]); \
252 SERIALIZE_UINT16(p, (msg).wValue);
254 #define CLCDESERIALIZE_APPSELECTORMSG(msg, p) DESERIALIZE_UINT16((msg).wProfiles, p); \
255 DESERIALIZE_UINT16((msg).wNumber, p); \
256 DESERIALIZE_UINT16((msg).Profile.DataArray[0], p); \
257 DESERIALIZE_UINT16((msg).Profile.DataArray[1], p); \
258 DESERIALIZE_UINT16((msg).Profile.DataArray[2], p); \
259 DESERIALIZE_UINT16((msg).Profile.DataArray[3], p); \
260 DESERIALIZE_UINT16((msg).Profile.DataArray[4], p); \
261 DESERIALIZE_UINT16((msg).Profile.DataArray[5], p); \
262 DESERIALIZE_UINT16((msg).Profile.DataArray[6], p); \
263 DESERIALIZE_UINT16((msg).Profile.DataArray[7], p); \
264 DESERIALIZE_UINT16((msg).wValue, p);
266 #define CLCSERIALIZE_APPTEXTMSG_BASE(p, msg) SERIALIZE_UINT16(p, (msg).wProfiles); \
267 SERIALIZE_UINT16(p, (msg).wNumber); \
268 SERIALIZE_UINT16(p, (msg).Profile.DataArray[0]); \
269 SERIALIZE_UINT16(p, (msg).Profile.DataArray[1]); \
270 SERIALIZE_UINT16(p, (msg).Profile.DataArray[2]); \
271 SERIALIZE_UINT16(p, (msg).Profile.DataArray[3]); \
272 SERIALIZE_UINT16(p, (msg).Profile.DataArray[4]); \
273 SERIALIZE_UINT16(p, (msg).Profile.DataArray[5]); \
274 SERIALIZE_UINT16(p, (msg).Profile.DataArray[6]); \
275 SERIALIZE_UINT16(p, (msg).Profile.DataArray[7]);
277 #define CLCDESERIALIZE_APPTEXTMSG_BASE(msg, p) DESERIALIZE_UINT16((msg).wProfiles, p); \
278 DESERIALIZE_UINT16((msg).wNumber, p); \
279 DESERIALIZE_UINT16((msg).Profile.DataArray[0], p); \
280 DESERIALIZE_UINT16((msg).Profile.DataArray[1], p); \
281 DESERIALIZE_UINT16((msg).Profile.DataArray[2], p); \
282 DESERIALIZE_UINT16((msg).Profile.DataArray[3], p); \
283 DESERIALIZE_UINT16((msg).Profile.DataArray[4], p); \
284 DESERIALIZE_UINT16((msg).Profile.DataArray[5], p); \
285 DESERIALIZE_UINT16((msg).Profile.DataArray[6], p); \
286 DESERIALIZE_UINT16((msg).Profile.DataArray[7], p);
288 #define CLCDESERIALIZE_TIMESTAMPINFO(ts, p) DESERIALIZE_UINT64((ts).systemTime, p); \
289 DESERIALIZE_UINT32((ts).songPosition, p); \
290 DESERIALIZE_UINT16((ts).wTimeStampFlags, p);
330 #endif // _CLC_UTILS_H_
CPBOOLEAN SectionID_Match(CPSECTIONID const *const pSectionID1, CPSECTIONID const *const pSectionID2)
Checks if two Section IDs match taking care of wildcards.
Container structure for Section ID Each Input is associated to a SectionID giving information about i...
Definition: CLC_Types.h:67
CLC_ErrorCode
Error code Enumeration. Error codes from 0x01 to 0xFF are related to a CopperLan functions return cod...
Definition: CLCm_Defines.h:469
void SectionID_Init(CPSECTIONID *const pSectionID)
Initialize a Section ID to NullSectionID.
void SectionID_SetAnyInstanceOf(CPSECTIONID *const pSectionID, CPUINT64 const sectionType)
Set a Section ID to an AnyInstanceOf wildcard Section ID.
CPUINT32 CPHOBJECT
Handle on Object.
Definition: CLCm_Types.h:57
CPBOOLEAN SectionID_IsEmpty(CPSECTIONID const *const pSectionID)
Empty checks a Section ID.