Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
csr
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
{
30
u16
msgType
;
31
CsrMsgSizeofFunc
*
sizeofFunc
;
32
CsrMsgSerializeFunc
*
serFunc
;
33
CsrMsgDeserializeFunc
*
deserFunc
;
34
CsrMsgFreeFunc
*
freeFunc
;
35
}
CsrMsgConvMsgEntry
;
36
37
/* Optional lookup function */
38
typedef
CsrMsgConvMsgEntry
*(
CsrMsgCustomLookupFunc
)(
CsrMsgConvMsgEntry
*
ce
,
u16
msgType);
39
40
/* All converter entries for one specific primitive */
41
typedef
struct
CsrMsgConvPrimEntry
42
{
43
u16
primType
;
44
const
CsrMsgConvMsgEntry
*
conv
;
45
CsrMsgCustomLookupFunc
*
lookupFunc
;
46
struct
CsrMsgConvPrimEntry
*
next
;
47
}
CsrMsgConvPrimEntry
;
48
49
typedef
struct
50
{
51
CsrMsgConvPrimEntry
*
profile_converters
;
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
);
58
}
CsrMsgConvEntry
;
59
60
size_t
CsrMsgConvSizeof
(
u16
primType
,
void
*
msg
);
61
u8
*
CsrMsgConvSerialize
(
u8
*
buffer
,
size_t
maxBufferOffset,
size_t
*
offset
,
u16
primType
,
void
*
msg
);
62
void
CsrMsgConvCustomLookupRegister
(
u16
primType
,
CsrMsgCustomLookupFunc
*
lookupFunc
);
63
void
CsrMsgConvInsert
(
u16
primType
,
const
CsrMsgConvMsgEntry
*
ce
);
64
CsrMsgConvPrimEntry
*
CsrMsgConvFind
(
u16
primType
);
65
CsrMsgConvMsgEntry
*
CsrMsgConvFindEntry
(
u16
primType
,
u16
msgType);
66
CsrMsgConvMsgEntry
*
CsrMsgConvFindEntryByMsg
(
u16
primType
,
const
void
*
msg
);
67
CsrMsgConvEntry
*
CsrMsgConvInit
(
void
);
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
Generated on Thu Jan 10 2013 14:27:36 for Linux Kernel by
1.8.2