8 #define HIDP_PSM 0x0011 9 #define INTR_PSM 0x0013 12 #define L2CAP_HDR_LEN 4 13 #define L2CAP_SIGHDR_LEN 4 14 #define L2CAP_CFGOPTHDR_LEN 2 17 #define L2CAP_CONN_REQ_SIZE 4 18 #define L2CAP_CONN_RSP_SIZE 8 19 #define L2CAP_CFG_RSP_SIZE 6 20 #define L2CAP_DISCONN_RSP_SIZE 4 22 #define L2CAP_CFG_REQ_SIZE 4 24 #define L2CAP_DISCONN_REQ_SIZE 4 25 #define L2CAP_CMD_REJ_SIZE 2 28 #define L2CAP_CMD_REJ 0x01 29 #define L2CAP_CONN_REQ 0x02 30 #define L2CAP_CONN_RSP 0x03 31 #define L2CAP_CFG_REQ 0x04 32 #define L2CAP_CFG_RSP 0x05 33 #define L2CAP_DISCONN_REQ 0x06 34 #define L2CAP_DISCONN_RSP 0x07 35 #define L2CAP_ECHO_REQ 0x08 36 #define L2CAP_ECHO_RSP 0x09 37 #define L2CAP_INFO_REQ 0x0A 38 #define L2CAP_INFO_RSP 0x0B 41 #define L2CAP_NULL_CID 0x0000 42 #define L2CAP_SIG_CID 0x0001 43 #define L2CAP_CONNLESS_CID 0x0002 46 #define L2CAP_MIN_CID 0x0040 47 #define L2CAP_MAX_CID 0xFFFF 50 #define L2CAP_CFG_MTU 0x01 51 #define L2CAP_FLUSHTO 0x02 52 #define L2CAP_QOS 0x03 55 #define L2CAP_MTU_LEN 2 56 #define L2CAP_FLUSHTO_LEN 2 57 #define L2CAP_QOS_LEN 22 60 #define L2CAP_CFG_SUCCESS 0x0000 61 #define L2CAP_CFG_UNACCEPT 0x0001 62 #define L2CAP_CFG_REJ 0x0002 63 #define L2CAP_CFG_UNKNOWN 0x0003 64 #define L2CAP_CFG_TIMEOUT 0xEEEE 67 #define L2CAP_QOS_NO_TRAFFIC 0x00 68 #define L2CAP_QOS_BEST_EFFORT 0x01 69 #define L2CAP_QOS_GUARANTEED 0x02 72 #define L2CAP_CMD_NOT_UNDERSTOOD 0x0000 73 #define L2CAP_MTU_EXCEEDED 0x0001 74 #define L2CAP_INVALID_CID 0x0002 77 #define L2CAP_CONN_SUCCESS 0x0000 78 #define L2CAP_CONN_PND 0x0001 79 #define L2CAP_CONN_REF_PSM 0x0002 80 #define L2CAP_CONN_REF_SEC 0x0003 81 #define L2CAP_CONN_REF_RES 0x0004 82 #define L2CAP_CONN_CFG_TO 0x0005 85 #define L2CAP_ECHO_RCVD 0x00 86 #define L2CAP_ECHO_TO 0x01 89 #define L2CAP_ACL_START 0x02 90 #define L2CAP_ACL_CONT 0x01 93 #define L2CAP_CFG_DEFAULT_INMTU 672 95 #define L2CAP_CFG_DEFAULT_OUTFLUSHTO 0xFFFF 98 #define L2CAP_CFG_IR 0x01 99 #define L2CAP_CFG_IN_SUCCESS 0x02 100 #define L2CAP_CFG_OUT_SUCCESS 0x04 101 #define L2CAP_CFG_OUT_REQ 0x08 218 #define l2cap_psm(pcb) ((pcb)->psm) 252 #define L2CA_ACTION_CONN_CFM(pcb,result,status,ret) if((pcb)->l2ca_connect_cfm != NULL) (ret = (pcb)->l2ca_connect_cfm((pcb)->callback_arg,(pcb),(result),(status))) 253 #define L2CA_ACTION_DISCONN_CFM(pcb,ret) if((pcb)->l2ca_disconnect_cfm != NULL) (ret = (pcb)->l2ca_disconnect_cfm((pcb)->callback_arg,(pcb))) 254 #define L2CA_ACTION_PING_CFM(pcb,result,ret) if((pcb)->l2ca_pong != NULL) (ret = (pcb)->l2ca_pong((pcb)->callback_arg,(pcb),(result))) 256 #define L2CA_ACTION_CONN_IND(pcb,err,ret) if((pcb)->l2ca_connect_ind != NULL) (ret = (pcb)->l2ca_connect_ind((pcb)->callback_arg,(pcb),(err))) 257 #define L2CA_ACTION_DISCONN_IND(pcb,err,ret) \ 258 if((pcb)->l2ca_disconnect_ind != NULL) { \ 259 LOG("l2cap_disconnect_ind called\n"); \ 260 (ret = (pcb)->l2ca_disconnect_ind((pcb)->callback_arg,(pcb),(err))); \ 264 #define L2CA_ACTION_TO_IND(pcb,err,ret) if((pcb)->l2ca_timeout_ind != NULL) (ret = (pcb)->l2ca_timeout_ind((pcb)->callback_arg,(pcb),(err))) 265 #define L2CA_ACTION_RECV(pcb,p,err,ret) \ 266 if((pcb)->l2ca_recv != NULL) { \ 267 (ret = (pcb)->l2ca_recv((pcb)->callback_arg,(pcb),(p),(err))); \ 272 #define L2CAP_OPTH_TYPE(hdr) (((hdr)->type) & 0x7f) 273 #define L2CAP_OPTH_TOA(hdr) (((hdr)->type) >> 7) 284 #define L2CAP_REG(pcbs, npcb) do { \ 286 _CPU_ISR_Disable(level); \ 287 npcb->next = *pcbs; \ 289 _CPU_ISR_Restore(level); \ 291 #define L2CAP_RMV(pcbs, npcb) do { \ 293 _CPU_ISR_Disable(level); \ 294 if(*pcbs == npcb) { \ 295 *pcbs = (*pcbs)->next; \ 296 } else for(l2cap_tmp_pcb = *pcbs; l2cap_tmp_pcb != NULL; l2cap_tmp_pcb = l2cap_tmp_pcb->next) { \ 297 if(l2cap_tmp_pcb->next != NULL && l2cap_tmp_pcb->next == npcb) { \ 298 l2cap_tmp_pcb->next = npcb->next; \ 303 _CPU_ISR_Restore(level); \ 309 #define L2CAP_SIG_REG(ursp_sigs, nsig) do { \ 311 _CPU_ISR_Disable(level); \ 312 nsig->next = *ursp_sigs; \ 314 _CPU_ISR_Restore(level); \ 316 #define L2CAP_SIG_RMV(ursp_sigs, nsig) do { \ 318 _CPU_ISR_Disable(level); \ 319 if(*ursp_sigs == nsig) { \ 320 *ursp_sigs = (*ursp_sigs)->next; \ 321 } else for(l2cap_tmp_sig = *ursp_sigs; l2cap_tmp_sig != NULL; l2cap_tmp_sig = l2cap_tmp_sig->next) { \ 322 if(l2cap_tmp_sig->next != NULL && l2cap_tmp_sig->next == nsig) { \ 323 l2cap_tmp_sig->next = nsig->next; \ 328 _CPU_ISR_Restore(level); \ 334 #define L2CAP_SEG_REG(segs, nseg) do { \ 336 _CPU_ISR_Disable(level); \ 337 nseg->next = *segs; \ 339 _CPU_ISR_Restore(level); \ 341 #define L2CAP_SEG_RMV(segs, nseg) do { \ 343 _CPU_ISR_Disable(level); \ 344 if(*segs == nseg) { \ 345 *segs = (*segs)->next; \ 346 } else for(l2cap_tmp_inseg = *segs; l2cap_tmp_inseg != NULL; l2cap_tmp_inseg = l2cap_tmp_inseg->next) { \ 347 if(l2cap_tmp_inseg->next != NULL && l2cap_tmp_inseg->next == nseg) { \ 348 l2cap_tmp_inseg->next = nseg->next; \ 353 _CPU_ISR_Restore(level); \
struct l2cap_hdr * l2caphdr
Definition: l2cap.h:157
err_t(* l2ca_pong)(void *arg, struct l2cap_pcb *pcb, u8_t result)
Definition: l2cap.h:189
u8_t encrypt
Definition: l2cap.h:174
err_t l2ca_datawrite(struct l2cap_pcb *pcb, struct pbuf *p)
Definition: l2cap.c:1290
u8_t nrtx
Definition: l2cap.h:135
err_t(* l2ca_timeout_ind)(void *arg, struct l2cap_pcb *newpcb, err_t err)
Definition: l2cap.h:198
struct l2cap_pcb * l2cap_tmp_pcb
Definition: l2cap.c:22
u16_t dcid
Definition: l2cap.h:169
err_t l2cap_close(struct l2cap_pcb *pcb)
Definition: l2cap.c:967
void l2cap_tmr()
Definition: l2cap.c:78
s8_t err_t
Definition: err.h:39
struct l2cap_seg * next
Definition: l2cap.h:153
u16_t psm
Definition: l2cap.h:210
err_t l2ca_disconnect_req(struct l2cap_pcb *pcb, err_t(*l2ca_disconnect_cfm)(void *arg, struct l2cap_pcb *pcb))
Definition: l2cap.c:1257
struct pbuf * opt
Definition: l2cap.h:145
u8_t l2capcfg
Definition: l2cap.h:148
u16_t ertx
Definition: l2cap.h:133
enum l2cap_state state
Definition: l2cap.h:164
err_t(* l2ca_connect_ind)(void *arg, struct l2cap_pcb *pcb, err_t err)
Definition: l2cap.h:215
GLenum GLsizei len
Definition: glext.h:7389
struct l2cap_pcb_listen * next
Definition: l2cap.h:204
struct bd_addr bdaddr
Definition: l2cap.h:154
err_t(* l2ca_recv)(void *arg, struct l2cap_pcb *pcb, struct pbuf *p, err_t err)
Definition: l2cap.h:200
err_t l2cap_connect_ind(struct l2cap_pcb *npcb, struct bd_addr *bdaddr, u16_t psm, err_t(*l2ca_connect_ind)(void *arg, struct l2cap_pcb *pcb, err_t err))
Definition: l2cap.c:1499
u16_t len
Definition: l2cap.h:110
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
void lp_disconnect_ind(struct bd_addr *bdaddr, u8_t reason)
Definition: l2cap.c:1425
err_t(* l2ca_connect_cfm)(void *arg, struct l2cap_pcb *pcb, u16_t result, u16_t status)
Definition: l2cap.h:185
struct l2cap_sig * l2cap_tmp_sig
Definition: l2cap.c:25
struct l2cap_hdr ATTRIBUTE_PACKED
err_t l2ca_connect_req(struct l2cap_pcb *pcb, struct bd_addr *bdaddr, u16_t psm, u8_t role_switch, err_t(*l2ca_connect_cfm)(void *arg, struct l2cap_pcb *lpcb, u16_t result, u16_t status))
Definition: l2cap.c:1131
u8_t type
Definition: l2cap.h:123
struct l2cap_sig * unrsp_sigs
Definition: l2cap.h:176
u16_t psm
Definition: l2cap.h:171
struct l2cap_seg * l2cap_tmp_inseg
Definition: l2cap.c:29
u16_t scid
Definition: l2cap.h:168
u16_t len
Definition: l2cap.h:156
err_t l2cap_rexmit_signal(struct l2cap_pcb *pcb, struct l2cap_sig *sig)
Definition: l2cap.c:1108
void l2cap_process_sig(struct pbuf *q, struct l2cap_hdr *l2caphdr, struct bd_addr *bdaddr)
Definition: l2cap.c:225
u16_t outflushto
Definition: l2cap.h:143
u16_t inmtu
Definition: l2cap.h:140
void lp_connect_ind(struct bd_addr *bdaddr)
Definition: l2cap.c:1413
struct bd_addr bdaddr
Definition: l2cap.h:211
void * callback_arg
Definition: l2cap.h:208
struct l2cap_pcb * pcb
Definition: l2cap.h:158
u8_t l2cap_next_sigid(void)
Definition: l2cap.c:1468
err_t l2cap_write(struct bd_addr *bdaddr, struct pbuf *p, u16_t len)
Definition: l2cap.c:168
struct l2cap_sig * next
Definition: l2cap.h:129
u8_t rtx
Definition: l2cap.h:134
GLuint64EXT * result
Definition: glext.h:12211
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:6414
u16_t len
Definition: l2cap.h:118
Definition: inftrees.h:27
u8_t id
Definition: l2cap.h:117
void lp_connect_cfm(struct bd_addr *bdaddr, u8_t encrypt_mode, err_t err)
Definition: l2cap.c:1369
GLfloat GLfloat p
Definition: glext.h:9809
err_t(* l2ca_disconnect_cfm)(void *arg, struct l2cap_pcb *pcb)
Definition: l2cap.h:187
u16_t outmtu
Definition: l2cap.h:141
err_t l2cap_signal(struct l2cap_pcb *pcb, u8_t code, u16_t ursp_id, struct bd_addr *remote_bdaddr, struct pbuf *data)
Definition: l2cap.c:1034
void l2cap_recv(struct l2cap_pcb *pcb, err_t(*l2ca_recv)(void *arg, struct l2cap_pcb *pcb, struct pbuf *p, err_t err))
Definition: l2cap.c:1551
void l2cap_init()
Definition: l2cap.c:49
struct l2cap_pcb * l2cap_active_pcbs
Definition: l2cap.c:19
err_t l2ca_ping(struct bd_addr *bdaddr, struct l2cap_pcb *tpcb, err_t(*l2ca_pong)(void *arg, struct l2cap_pcb *pcb, u8_t result))
Definition: l2cap.c:1340
struct pbuf * p
Definition: l2cap.h:155
struct l2cap_pcb * next
Definition: l2cap.h:162
struct l2cap_pcb_listen * l2cap_listen_pcbs
Definition: l2cap.c:17
u8 u8_t
Definition: cc.h:43
struct l2cap_cfg cfg
Definition: l2cap.h:180
struct pbuf * p
Definition: l2cap.h:131
void(*)(struct bd_addr *bdaddr, u8_t reason) l2cap_disconnect_bb(void(*l2ca_disconnect_bb)(struct bd_addr *bdaddr, u8_t reason))
Definition: l2cap.h:249
err_t(* l2ca_disconnect_ind)(void *arg, struct l2cap_pcb *pcb, err_t err)
Definition: l2cap.h:196
void l2cap_arg(struct l2cap_pcb *pcb, void *arg)
Definition: l2cap.c:1483
u16_t ursp_id
Definition: l2cap.h:173
u16_t sigid
Definition: l2cap.h:132
err_t l2ca_config_req(struct l2cap_pcb *pcb)
Definition: l2cap.c:1179
void l2cap_reset_all(void)
Definition: l2cap.c:995
u8_t len
Definition: l2cap.h:124
enum l2cap_state state
Definition: l2cap.h:206
struct l2cap_pcb * l2cap_new(void)
Definition: l2cap.c:929
void l2cap_timeout_ind(struct l2cap_pcb *pcb, err_t(*l2ca_timeout_ind)(void *arg, struct l2cap_pcb *newpcb, err_t err))
Definition: l2cap.c:1539
void * callback_arg
Definition: l2cap.h:166
u8_t cfgto
Definition: l2cap.h:147
void l2cap_input(struct pbuf *p, struct bd_addr *bdaddr)
Definition: l2cap.c:758
struct bd_addr remote_bdaddr
Definition: l2cap.h:178
u16_t influshto
Definition: l2cap.h:142
u16_t cid
Definition: l2cap.h:111
err_t(* l2ca_connect_ind)(void *arg, struct l2cap_pcb *pcb, err_t err)
Definition: l2cap.h:194
u16 u16_t
Definition: cc.h:45
l2cap_state
Definition: l2cap.h:103
u8_t code
Definition: l2cap.h:116
void l2cap_disconnect_ind(struct l2cap_pcb *pcb, err_t(*l2ca_disconnect_ind)(void *arg, struct l2cap_pcb *newpcb, err_t err))
Definition: l2cap.c:1528