Root/drivers/staging/csr/csr_wifi_router_serialize.c

1/*****************************************************************************
2
3            (c) Cambridge Silicon Radio Limited 2011
4            All rights reserved and confidential information of CSR
5
6            Refer to LICENSE.txt included with this source for details
7            on the license terms.
8
9*****************************************************************************/
10
11/* Note: this is an auto-generated file. */
12#include <linux/slab.h>
13#include "csr_msgconv.h"
14#include "csr_wifi_router_prim.h"
15#include "csr_wifi_router_serialize.h"
16
17void CsrWifiRouterPfree(void *ptr)
18{
19    kfree(ptr);
20}
21
22
23size_t CsrWifiRouterMaPacketSubscribeReqSizeof(void *msg)
24{
25    size_t bufferSize = 2;
26
27    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 12) */
28    bufferSize += 2; /* u16 primitive->interfaceTag */
29    bufferSize += 1; /* CsrWifiRouterEncapsulation primitive->encapsulation */
30    bufferSize += 2; /* u16 primitive->protocol */
31    bufferSize += 4; /* u32 primitive->oui */
32    return bufferSize;
33}
34
35
36u8* CsrWifiRouterMaPacketSubscribeReqSer(u8 *ptr, size_t *len, void *msg)
37{
38    CsrWifiRouterMaPacketSubscribeReq *primitive = (CsrWifiRouterMaPacketSubscribeReq *)msg;
39    *len = 0;
40    CsrUint16Ser(ptr, len, primitive->common.type);
41    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
42    CsrUint8Ser(ptr, len, (u8) primitive->encapsulation);
43    CsrUint16Ser(ptr, len, (u16) primitive->protocol);
44    CsrUint32Ser(ptr, len, (u32) primitive->oui);
45    return(ptr);
46}
47
48
49void* CsrWifiRouterMaPacketSubscribeReqDes(u8 *buffer, size_t length)
50{
51    CsrWifiRouterMaPacketSubscribeReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeReq), GFP_KERNEL);
52    size_t offset;
53    offset = 0;
54
55    CsrUint16Des(&primitive->common.type, buffer, &offset);
56    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
57    CsrUint8Des((u8 *) &primitive->encapsulation, buffer, &offset);
58    CsrUint16Des((u16 *) &primitive->protocol, buffer, &offset);
59    CsrUint32Des((u32 *) &primitive->oui, buffer, &offset);
60
61    return primitive;
62}
63
64
65size_t CsrWifiRouterMaPacketReqSizeof(void *msg)
66{
67    CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) msg;
68    size_t bufferSize = 2;
69
70    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 20) */
71    bufferSize += 2; /* u16 primitive->interfaceTag */
72    bufferSize += 1; /* u8 primitive->subscriptionHandle */
73    bufferSize += 2; /* u16 primitive->frameLength */
74    bufferSize += primitive->frameLength; /* u8 primitive->frame */
75    bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
76    bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
77    bufferSize += 4; /* u32 primitive->hostTag */
78    bufferSize += 1; /* u8 primitive->cfmRequested */
79    return bufferSize;
80}
81
82
83u8* CsrWifiRouterMaPacketReqSer(u8 *ptr, size_t *len, void *msg)
84{
85    CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *)msg;
86    *len = 0;
87    CsrUint16Ser(ptr, len, primitive->common.type);
88    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
89    CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
90    CsrUint16Ser(ptr, len, (u16) primitive->frameLength);
91    if (primitive->frameLength)
92    {
93        CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength)));
94    }
95    CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
96    CsrUint16Ser(ptr, len, (u16) primitive->priority);
97    CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
98    CsrUint8Ser(ptr, len, (u8) primitive->cfmRequested);
99    return(ptr);
100}
101
102
103void* CsrWifiRouterMaPacketReqDes(u8 *buffer, size_t length)
104{
105    CsrWifiRouterMaPacketReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketReq), GFP_KERNEL);
106    size_t offset;
107    offset = 0;
108
109    CsrUint16Des(&primitive->common.type, buffer, &offset);
110    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
111    CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
112    CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset);
113    if (primitive->frameLength)
114    {
115        primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL);
116        CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength)));
117    }
118    else
119    {
120        primitive->frame = NULL;
121    }
122    primitive->freeFunction = NULL; /* Special for Function Pointers... */
123    offset += 4;
124    CsrUint16Des((u16 *) &primitive->priority, buffer, &offset);
125    CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
126    CsrUint8Des((u8 *) &primitive->cfmRequested, buffer, &offset);
127
128    return primitive;
129}
130
131
132void CsrWifiRouterMaPacketReqSerFree(void *voidPrimitivePointer)
133{
134    CsrWifiRouterMaPacketReq *primitive = (CsrWifiRouterMaPacketReq *) voidPrimitivePointer;
135    kfree(primitive->frame);
136    kfree(primitive);
137}
138
139
140size_t CsrWifiRouterMaPacketResSizeof(void *msg)
141{
142    size_t bufferSize = 2;
143
144    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 8) */
145    bufferSize += 2; /* u16 primitive->interfaceTag */
146    bufferSize += 1; /* u8 primitive->subscriptionHandle */
147    bufferSize += 2; /* CsrResult primitive->result */
148    return bufferSize;
149}
150
151
152u8* CsrWifiRouterMaPacketResSer(u8 *ptr, size_t *len, void *msg)
153{
154    CsrWifiRouterMaPacketRes *primitive = (CsrWifiRouterMaPacketRes *)msg;
155    *len = 0;
156    CsrUint16Ser(ptr, len, primitive->common.type);
157    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
158    CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
159    CsrUint16Ser(ptr, len, (u16) primitive->result);
160    return(ptr);
161}
162
163
164void* CsrWifiRouterMaPacketResDes(u8 *buffer, size_t length)
165{
166    CsrWifiRouterMaPacketRes *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketRes), GFP_KERNEL);
167    size_t offset;
168    offset = 0;
169
170    CsrUint16Des(&primitive->common.type, buffer, &offset);
171    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
172    CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
173    CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
174
175    return primitive;
176}
177
178
179size_t CsrWifiRouterMaPacketCancelReqSizeof(void *msg)
180{
181    size_t bufferSize = 2;
182
183    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 17) */
184    bufferSize += 2; /* u16 primitive->interfaceTag */
185    bufferSize += 4; /* u32 primitive->hostTag */
186    bufferSize += 2; /* CsrWifiRouterPriority primitive->priority */
187    bufferSize += 6; /* u8 primitive->peerMacAddress.a[6] */
188    return bufferSize;
189}
190
191
192u8* CsrWifiRouterMaPacketCancelReqSer(u8 *ptr, size_t *len, void *msg)
193{
194    CsrWifiRouterMaPacketCancelReq *primitive = (CsrWifiRouterMaPacketCancelReq *)msg;
195    *len = 0;
196    CsrUint16Ser(ptr, len, primitive->common.type);
197    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
198    CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
199    CsrUint16Ser(ptr, len, (u16) primitive->priority);
200    CsrMemCpySer(ptr, len, (const void *) primitive->peerMacAddress.a, ((u16) (6)));
201    return(ptr);
202}
203
204
205void* CsrWifiRouterMaPacketCancelReqDes(u8 *buffer, size_t length)
206{
207    CsrWifiRouterMaPacketCancelReq *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCancelReq), GFP_KERNEL);
208    size_t offset;
209    offset = 0;
210
211    CsrUint16Des(&primitive->common.type, buffer, &offset);
212    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
213    CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
214    CsrUint16Des((u16 *) &primitive->priority, buffer, &offset);
215    CsrMemCpyDes(primitive->peerMacAddress.a, buffer, &offset, ((u16) (6)));
216
217    return primitive;
218}
219
220
221size_t CsrWifiRouterMaPacketSubscribeCfmSizeof(void *msg)
222{
223    size_t bufferSize = 2;
224
225    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 10) */
226    bufferSize += 2; /* u16 primitive->interfaceTag */
227    bufferSize += 1; /* u8 primitive->subscriptionHandle */
228    bufferSize += 2; /* CsrResult primitive->status */
229    bufferSize += 2; /* u16 primitive->allocOffset */
230    return bufferSize;
231}
232
233
234u8* CsrWifiRouterMaPacketSubscribeCfmSer(u8 *ptr, size_t *len, void *msg)
235{
236    CsrWifiRouterMaPacketSubscribeCfm *primitive = (CsrWifiRouterMaPacketSubscribeCfm *)msg;
237    *len = 0;
238    CsrUint16Ser(ptr, len, primitive->common.type);
239    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
240    CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
241    CsrUint16Ser(ptr, len, (u16) primitive->status);
242    CsrUint16Ser(ptr, len, (u16) primitive->allocOffset);
243    return(ptr);
244}
245
246
247void* CsrWifiRouterMaPacketSubscribeCfmDes(u8 *buffer, size_t length)
248{
249    CsrWifiRouterMaPacketSubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketSubscribeCfm), GFP_KERNEL);
250    size_t offset;
251    offset = 0;
252
253    CsrUint16Des(&primitive->common.type, buffer, &offset);
254    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
255    CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
256    CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
257    CsrUint16Des((u16 *) &primitive->allocOffset, buffer, &offset);
258
259    return primitive;
260}
261
262
263size_t CsrWifiRouterMaPacketUnsubscribeCfmSizeof(void *msg)
264{
265    size_t bufferSize = 2;
266
267    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 7) */
268    bufferSize += 2; /* u16 primitive->interfaceTag */
269    bufferSize += 2; /* CsrResult primitive->status */
270    return bufferSize;
271}
272
273
274u8* CsrWifiRouterMaPacketUnsubscribeCfmSer(u8 *ptr, size_t *len, void *msg)
275{
276    CsrWifiRouterMaPacketUnsubscribeCfm *primitive = (CsrWifiRouterMaPacketUnsubscribeCfm *)msg;
277    *len = 0;
278    CsrUint16Ser(ptr, len, primitive->common.type);
279    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
280    CsrUint16Ser(ptr, len, (u16) primitive->status);
281    return(ptr);
282}
283
284
285void* CsrWifiRouterMaPacketUnsubscribeCfmDes(u8 *buffer, size_t length)
286{
287    CsrWifiRouterMaPacketUnsubscribeCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketUnsubscribeCfm), GFP_KERNEL);
288    size_t offset;
289    offset = 0;
290
291    CsrUint16Des(&primitive->common.type, buffer, &offset);
292    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
293    CsrUint16Des((u16 *) &primitive->status, buffer, &offset);
294
295    return primitive;
296}
297
298
299size_t CsrWifiRouterMaPacketCfmSizeof(void *msg)
300{
301    size_t bufferSize = 2;
302
303    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 13) */
304    bufferSize += 2; /* u16 primitive->interfaceTag */
305    bufferSize += 2; /* CsrResult primitive->result */
306    bufferSize += 4; /* u32 primitive->hostTag */
307    bufferSize += 2; /* u16 primitive->rate */
308    return bufferSize;
309}
310
311
312u8* CsrWifiRouterMaPacketCfmSer(u8 *ptr, size_t *len, void *msg)
313{
314    CsrWifiRouterMaPacketCfm *primitive = (CsrWifiRouterMaPacketCfm *)msg;
315    *len = 0;
316    CsrUint16Ser(ptr, len, primitive->common.type);
317    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
318    CsrUint16Ser(ptr, len, (u16) primitive->result);
319    CsrUint32Ser(ptr, len, (u32) primitive->hostTag);
320    CsrUint16Ser(ptr, len, (u16) primitive->rate);
321    return(ptr);
322}
323
324
325void* CsrWifiRouterMaPacketCfmDes(u8 *buffer, size_t length)
326{
327    CsrWifiRouterMaPacketCfm *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketCfm), GFP_KERNEL);
328    size_t offset;
329    offset = 0;
330
331    CsrUint16Des(&primitive->common.type, buffer, &offset);
332    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
333    CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
334    CsrUint32Des((u32 *) &primitive->hostTag, buffer, &offset);
335    CsrUint16Des((u16 *) &primitive->rate, buffer, &offset);
336
337    return primitive;
338}
339
340
341size_t CsrWifiRouterMaPacketIndSizeof(void *msg)
342{
343    CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) msg;
344    size_t bufferSize = 2;
345
346    /* Calculate the Size of the Serialised Data. Could be more efficient (Try 21) */
347    bufferSize += 2; /* u16 primitive->interfaceTag */
348    bufferSize += 1; /* u8 primitive->subscriptionHandle */
349    bufferSize += 2; /* CsrResult primitive->result */
350    bufferSize += 2; /* u16 primitive->frameLength */
351    bufferSize += primitive->frameLength; /* u8 primitive->frame */
352    bufferSize += 4; /* CsrWifiRouterFrameFreeFunction primitive->freeFunction */
353    bufferSize += 2; /* s16 primitive->rssi */
354    bufferSize += 2; /* s16 primitive->snr */
355    bufferSize += 2; /* u16 primitive->rate */
356    return bufferSize;
357}
358
359
360u8* CsrWifiRouterMaPacketIndSer(u8 *ptr, size_t *len, void *msg)
361{
362    CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *)msg;
363    *len = 0;
364    CsrUint16Ser(ptr, len, primitive->common.type);
365    CsrUint16Ser(ptr, len, (u16) primitive->interfaceTag);
366    CsrUint8Ser(ptr, len, (u8) primitive->subscriptionHandle);
367    CsrUint16Ser(ptr, len, (u16) primitive->result);
368    CsrUint16Ser(ptr, len, (u16) primitive->frameLength);
369    if (primitive->frameLength)
370    {
371        CsrMemCpySer(ptr, len, (const void *) primitive->frame, ((u16) (primitive->frameLength)));
372    }
373    CsrUint32Ser(ptr, len, 0); /* Special for Function Pointers... primitive->freeFunction */
374    CsrUint16Ser(ptr, len, (u16) primitive->rssi);
375    CsrUint16Ser(ptr, len, (u16) primitive->snr);
376    CsrUint16Ser(ptr, len, (u16) primitive->rate);
377    return(ptr);
378}
379
380
381void* CsrWifiRouterMaPacketIndDes(u8 *buffer, size_t length)
382{
383    CsrWifiRouterMaPacketInd *primitive = kmalloc(sizeof(CsrWifiRouterMaPacketInd), GFP_KERNEL);
384    size_t offset;
385    offset = 0;
386
387    CsrUint16Des(&primitive->common.type, buffer, &offset);
388    CsrUint16Des((u16 *) &primitive->interfaceTag, buffer, &offset);
389    CsrUint8Des((u8 *) &primitive->subscriptionHandle, buffer, &offset);
390    CsrUint16Des((u16 *) &primitive->result, buffer, &offset);
391    CsrUint16Des((u16 *) &primitive->frameLength, buffer, &offset);
392    if (primitive->frameLength)
393    {
394        primitive->frame = kmalloc(primitive->frameLength, GFP_KERNEL);
395        CsrMemCpyDes(primitive->frame, buffer, &offset, ((u16) (primitive->frameLength)));
396    }
397    else
398    {
399        primitive->frame = NULL;
400    }
401    primitive->freeFunction = NULL; /* Special for Function Pointers... */
402    offset += 4;
403    CsrUint16Des((u16 *) &primitive->rssi, buffer, &offset);
404    CsrUint16Des((u16 *) &primitive->snr, buffer, &offset);
405    CsrUint16Des((u16 *) &primitive->rate, buffer, &offset);
406
407    return primitive;
408}
409
410
411void CsrWifiRouterMaPacketIndSerFree(void *voidPrimitivePointer)
412{
413    CsrWifiRouterMaPacketInd *primitive = (CsrWifiRouterMaPacketInd *) voidPrimitivePointer;
414    kfree(primitive->frame);
415    kfree(primitive);
416}
417
418
419

Archive Download this file



interactive