13 #ifndef __CAPIUTIL_H__
14 #define __CAPIUTIL_H__
16 #include <asm/types.h>
18 #define CAPIMSG_BASELEN 8
19 #define CAPIMSG_U8(m, off) (m[off])
20 #define CAPIMSG_U16(m, off) (m[off]|(m[(off)+1]<<8))
21 #define CAPIMSG_U32(m, off) (m[off]|(m[(off)+1]<<8)|(m[(off)+2]<<16)|(m[(off)+3]<<24))
22 #define CAPIMSG_LEN(m) CAPIMSG_U16(m,0)
23 #define CAPIMSG_APPID(m) CAPIMSG_U16(m,2)
24 #define CAPIMSG_COMMAND(m) CAPIMSG_U8(m,4)
25 #define CAPIMSG_SUBCOMMAND(m) CAPIMSG_U8(m,5)
26 #define CAPIMSG_CMD(m) (((m[4])<<8)|(m[5]))
27 #define CAPIMSG_MSGID(m) CAPIMSG_U16(m,6)
28 #define CAPIMSG_CONTROLLER(m) (m[8] & 0x7f)
29 #define CAPIMSG_CONTROL(m) CAPIMSG_U32(m, 8)
30 #define CAPIMSG_NCCI(m) CAPIMSG_CONTROL(m)
31 #define CAPIMSG_DATALEN(m) CAPIMSG_U16(m,16)
33 static inline void capimsg_setu8(
void *
m,
int off,
__u8 val)
38 static inline void capimsg_setu16(
void *
m,
int off,
__u16 val)
40 ((
__u8 *)m)[off] = val & 0xff;
41 ((
__u8 *)m)[off+1] = (val >> 8) & 0xff;
44 static inline void capimsg_setu32(
void *
m,
int off,
__u32 val)
46 ((
__u8 *)m)[off] = val & 0xff;
47 ((
__u8 *)m)[off+1] = (val >> 8) & 0xff;
48 ((
__u8 *)m)[off+2] = (val >> 16) & 0xff;
49 ((
__u8 *)m)[off+3] = (val >> 24) & 0xff;
52 #define CAPIMSG_SETLEN(m, len) capimsg_setu16(m, 0, len)
53 #define CAPIMSG_SETAPPID(m, applid) capimsg_setu16(m, 2, applid)
54 #define CAPIMSG_SETCOMMAND(m,cmd) capimsg_setu8(m, 4, cmd)
55 #define CAPIMSG_SETSUBCOMMAND(m, cmd) capimsg_setu8(m, 5, cmd)
56 #define CAPIMSG_SETMSGID(m, msgid) capimsg_setu16(m, 6, msgid)
57 #define CAPIMSG_SETCONTROL(m, contr) capimsg_setu32(m, 8, contr)
58 #define CAPIMSG_SETDATALEN(m, len) capimsg_setu16(m, 16, len)
187 #define CDEBUG_SIZE 1024
188 #define CDEBUG_GSIZE 4096
199 static inline void capi_cmsg_answer(
_cmsg * cmsg)
206 static inline void capi_fill_CONNECT_B3_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
214 static inline void capi_fill_FACILITY_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
216 __u16 FacilitySelector,
224 static inline void capi_fill_INFO_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
240 static inline void capi_fill_LISTEN_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
256 static inline void capi_fill_ALERT_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
270 static inline void capi_fill_CONNECT_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
313 static inline void capi_fill_DATA_B3_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
328 static inline void capi_fill_DISCONNECT_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
343 static inline void capi_fill_DISCONNECT_B3_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
352 static inline void capi_fill_MANUFACTURER_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
367 static inline void capi_fill_RESET_B3_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
376 static inline void capi_fill_SELECT_B_PROTOCOL_REQ(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
395 static inline void capi_fill_CONNECT_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
429 static inline void capi_fill_CONNECT_ACTIVE_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
436 static inline void capi_fill_CONNECT_B3_ACTIVE_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
443 static inline void capi_fill_CONNECT_B3_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
453 static inline void capi_fill_CONNECT_B3_T90_ACTIVE_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
460 static inline void capi_fill_DATA_B3_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
469 static inline void capi_fill_DISCONNECT_B3_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
476 static inline void capi_fill_DISCONNECT_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
483 static inline void capi_fill_FACILITY_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
485 __u16 FacilitySelector)
492 static inline void capi_fill_INFO_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
499 static inline void capi_fill_MANUFACTURER_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,
514 static inline void capi_fill_RESET_B3_RESP(
_cmsg * cmsg,
__u16 ApplId,
__u16 Messagenumber,