Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
csr_msgconv.h
Go to the documentation of this file.
1 #ifndef CSR_MSGCONV_H__
2 #define CSR_MSGCONV_H__
3 
4 /*****************************************************************************
5 
6  (c) Cambridge Silicon Radio Limited 2010
7  All rights reserved and confidential information of CSR
8 
9  Refer to LICENSE.txt included with this source for details
10  on the license terms.
11 
12 *****************************************************************************/
13 
14 #include <linux/types.h>
15 #include "csr_prim_defs.h"
16 #include "csr_sched.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 typedef size_t (CsrMsgSizeofFunc)(void *msg);
23 typedef u8 *(CsrMsgSerializeFunc)(u8 *buffer, size_t *length, void *msg);
24 typedef void (CsrMsgFreeFunc)(void *msg);
25 typedef void *(CsrMsgDeserializeFunc)(u8 *buffer, size_t length);
26 
27 /* Converter entry for one message type */
28 typedef struct CsrMsgConvMsgEntry
29 {
36 
37 /* Optional lookup function */
39 
40 /* All converter entries for one specific primitive */
41 typedef struct CsrMsgConvPrimEntry
42 {
48 
49 typedef struct
50 {
52  void *(*deserialize_data)(u16 primType, size_t length, u8 * data);
53  u8 (*free_message)(u16 primType, u8 *data);
54  size_t (*sizeof_message)(u16 primType, void *msg);
55  u8 *(*serialize_message)(u16 primType, void *msg,
56  size_t * length,
57  u8 * buffer);
59 
60 size_t CsrMsgConvSizeof(u16 primType, void *msg);
61 u8 *CsrMsgConvSerialize(u8 *buffer, size_t maxBufferOffset, size_t *offset, u16 primType, void *msg);
68 
69 /* Prototypes for primitive type serializers */
70 void CsrUint8Ser(u8 *buffer, size_t *offset, u8 value);
71 void CsrUint16Ser(u8 *buffer, size_t *offset, u16 value);
72 void CsrUint32Ser(u8 *buffer, size_t *offset, u32 value);
73 void CsrMemCpySer(u8 *buffer, size_t *offset, const void *value, size_t length);
74 void CsrCharStringSer(u8 *buffer, size_t *offset, const char *value);
75 
76 void CsrUint8Des(u8 *value, u8 *buffer, size_t *offset);
77 void CsrUint16Des(u16 *value, u8 *buffer, size_t *offset);
78 void CsrUint32Des(u32 *value, u8 *buffer, size_t *offset);
79 void CsrMemCpyDes(void *value, u8 *buffer, size_t *offset, size_t length);
80 void CsrCharStringDes(char **value, u8 *buffer, size_t *offset);
81 
82 
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif