Lines Matching refs:p_mcb
43 static void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
44 static void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
45 static void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
46 static void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
47 static void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
48 static void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
49 static void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
51 static void rfc_mx_send_config_req (tRFC_MCB *p_mcb);
52 static void rfc_mx_conf_ind (tRFC_MCB *p_mcb, tL2CAP_CFG_INFO *p_cfg);
53 static void rfc_mx_conf_cnf (tRFC_MCB *p_mcb, tL2CAP_CFG_INFO *p_cfg);
67 void rfc_mx_sm_execute (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_execute() argument
69 switch (p_mcb->state) in rfc_mx_sm_execute()
72 rfc_mx_sm_state_idle (p_mcb, event, p_data); in rfc_mx_sm_execute()
76 rfc_mx_sm_state_wait_conn_cnf (p_mcb, event, p_data); in rfc_mx_sm_execute()
80 rfc_mx_sm_state_configure (p_mcb, event, p_data); in rfc_mx_sm_execute()
84 rfc_mx_sm_sabme_wait_ua (p_mcb, event, p_data); in rfc_mx_sm_execute()
88 rfc_mx_sm_state_wait_sabme (p_mcb, event, p_data); in rfc_mx_sm_execute()
92 rfc_mx_sm_state_connected (p_mcb, event, p_data); in rfc_mx_sm_execute()
96 rfc_mx_sm_state_disc_wait_ua (p_mcb, event, p_data); in rfc_mx_sm_execute()
114 void rfc_mx_sm_state_idle (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_idle() argument
122 p_mcb->peer_l2cap_mtu = L2CAP_DEFAULT_MTU - RFCOMM_MIN_OFFSET - 1; in rfc_mx_sm_state_idle()
124 UINT16 lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr); in rfc_mx_sm_state_idle()
126 rfc_save_lcid_mcb(NULL, p_mcb->lcid); in rfc_mx_sm_state_idle()
127 p_mcb->lcid = 0; in rfc_mx_sm_state_idle()
128 PORT_StartCnf(p_mcb, RFCOMM_ERROR); in rfc_mx_sm_state_idle()
131 p_mcb->lcid = lcid; in rfc_mx_sm_state_idle()
133 rfc_save_lcid_mcb (p_mcb, p_mcb->lcid); in rfc_mx_sm_state_idle()
135 p_mcb->state = RFC_MX_STATE_WAIT_CONN_CNF; in rfc_mx_sm_state_idle()
142 RFCOMM_TRACE_ERROR ("Mx error state %d event %d", p_mcb->state, event); in rfc_mx_sm_state_idle()
147 rfc_timer_start (p_mcb, RFCOMM_CONN_TIMEOUT); in rfc_mx_sm_state_idle()
148 L2CA_ConnectRsp (p_mcb->bd_addr, *((UINT8 *)p_data), p_mcb->lcid, L2CAP_CONN_OK, 0); in rfc_mx_sm_state_idle()
150 rfc_mx_send_config_req (p_mcb); in rfc_mx_sm_state_idle()
152 p_mcb->state = RFC_MX_STATE_CONFIGURE; in rfc_mx_sm_state_idle()
163 rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, TRUE); in rfc_mx_sm_state_idle()
167 rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, FALSE); in rfc_mx_sm_state_idle()
170 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_idle()
184 void rfc_mx_sm_state_wait_conn_cnf (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_wait_conn_cnf() argument
190 RFCOMM_TRACE_ERROR ("Mx error state %d event %d", p_mcb->state, event); in rfc_mx_sm_state_wait_conn_cnf()
196 rfc_mx_conf_ind (p_mcb, (tL2CAP_CFG_INFO *)p_data); in rfc_mx_sm_state_wait_conn_cnf()
202 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_wait_conn_cnf()
204 PORT_StartCnf (p_mcb, *((UINT16 *)p_data)); in rfc_mx_sm_state_wait_conn_cnf()
207 p_mcb->state = RFC_MX_STATE_CONFIGURE; in rfc_mx_sm_state_wait_conn_cnf()
208 rfc_mx_send_config_req (p_mcb); in rfc_mx_sm_state_wait_conn_cnf()
212 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_wait_conn_cnf()
213 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_wait_conn_cnf()
217 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_wait_conn_cnf()
218 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_state_wait_conn_cnf()
221 if (p_mcb->pending_lcid) in rfc_mx_sm_state_wait_conn_cnf()
226 …_DEBUG ("RFCOMM MX retry as acceptor in collision case - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_wait_conn_cnf()
228 rfc_save_lcid_mcb (NULL, p_mcb->lcid); in rfc_mx_sm_state_wait_conn_cnf()
229 p_mcb->lcid = p_mcb->pending_lcid; in rfc_mx_sm_state_wait_conn_cnf()
230 rfc_save_lcid_mcb (p_mcb, p_mcb->lcid); in rfc_mx_sm_state_wait_conn_cnf()
232 p_mcb->is_initiator = FALSE; in rfc_mx_sm_state_wait_conn_cnf()
237 if ((idx = p_mcb->port_inx[i]) != 0) in rfc_mx_sm_state_wait_conn_cnf()
239 p_mcb->port_inx[i] = 0; in rfc_mx_sm_state_wait_conn_cnf()
240 p_mcb->port_inx[i+1] = idx; in rfc_mx_sm_state_wait_conn_cnf()
246 rfc_mx_sm_execute (p_mcb, RFC_MX_EVENT_CONN_IND, &(p_mcb->pending_id)); in rfc_mx_sm_state_wait_conn_cnf()
250 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_wait_conn_cnf()
254 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_wait_conn_cnf()
268 void rfc_mx_sm_state_configure (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_configure() argument
276 RFCOMM_TRACE_ERROR ("Mx error state %d event %d", p_mcb->state, event); in rfc_mx_sm_state_configure()
280 rfc_mx_conf_ind (p_mcb, (tL2CAP_CFG_INFO *)p_data); in rfc_mx_sm_state_configure()
284 rfc_mx_conf_cnf (p_mcb, (tL2CAP_CFG_INFO *)p_data); in rfc_mx_sm_state_configure()
288 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_configure()
289 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_configure()
293 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_configure()
294 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_state_configure()
296 PORT_StartCnf (p_mcb, RFCOMM_ERROR); in rfc_mx_sm_state_configure()
299 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_configure()
313 void rfc_mx_sm_sabme_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_sabme_wait_ua() argument
322 RFCOMM_TRACE_ERROR ("Mx error state %d event %d", p_mcb->state, event); in rfc_mx_sm_sabme_wait_ua()
337 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_sabme_wait_ua()
338 PORT_CloseInd (p_mcb); in rfc_mx_sm_sabme_wait_ua()
342 rfc_timer_stop (p_mcb); in rfc_mx_sm_sabme_wait_ua()
344 p_mcb->state = RFC_MX_STATE_CONNECTED; in rfc_mx_sm_sabme_wait_ua()
345 p_mcb->peer_ready = TRUE; in rfc_mx_sm_sabme_wait_ua()
347 PORT_StartCnf (p_mcb, RFCOMM_SUCCESS); in rfc_mx_sm_sabme_wait_ua()
351 rfc_timer_stop (p_mcb); in rfc_mx_sm_sabme_wait_ua()
357 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_sabme_wait_ua()
358 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_sabme_wait_ua()
360 PORT_StartCnf (p_mcb, RFCOMM_ERROR); in rfc_mx_sm_sabme_wait_ua()
363 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_sabme_wait_ua()
376 void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_wait_sabme() argument
382 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_wait_sabme()
383 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_wait_sabme()
388 if (p_mcb->pending_lcid) in rfc_mx_sm_state_wait_sabme()
390 p_mcb->pending_lcid = 0; in rfc_mx_sm_state_wait_sabme()
392 rfc_send_ua (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_sm_state_wait_sabme()
394 rfc_timer_stop (p_mcb); in rfc_mx_sm_state_wait_sabme()
395 p_mcb->state = RFC_MX_STATE_CONNECTED; in rfc_mx_sm_state_wait_sabme()
396 p_mcb->peer_ready = TRUE; in rfc_mx_sm_state_wait_sabme()
399 PORT_StartCnf (p_mcb, RFCOMM_SUCCESS); in rfc_mx_sm_state_wait_sabme()
403 rfc_timer_stop (p_mcb); in rfc_mx_sm_state_wait_sabme()
404 PORT_StartInd (p_mcb); in rfc_mx_sm_state_wait_sabme()
410 rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, TRUE); in rfc_mx_sm_state_wait_sabme()
413 rfc_send_ua (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_sm_state_wait_sabme()
415 p_mcb->state = RFC_MX_STATE_CONNECTED; in rfc_mx_sm_state_wait_sabme()
416 p_mcb->peer_ready = TRUE; in rfc_mx_sm_state_wait_sabme()
417 PORT_StartCnf (p_mcb, RFCOMM_SUCCESS); in rfc_mx_sm_state_wait_sabme()
424 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_wait_sabme()
425 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_state_wait_sabme()
427 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_wait_sabme()
430 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_wait_sabme()
444 void rfc_mx_sm_state_connected (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_connected() argument
454 rfc_timer_start (p_mcb, RFC_DISC_TIMEOUT); in rfc_mx_sm_state_connected()
455 p_mcb->state = RFC_MX_STATE_DISC_WAIT_UA; in rfc_mx_sm_state_connected()
456 rfc_send_disc (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_sm_state_connected()
460 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_connected()
461 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_connected()
467 rfc_send_ua (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_sm_state_connected()
468 if (p_mcb->is_initiator) in rfc_mx_sm_state_connected()
470 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_state_connected()
473 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_connected()
476 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_connected()
490 void rfc_mx_sm_state_disc_wait_ua (tRFC_MCB *p_mcb, UINT16 event, void *p_data) in rfc_mx_sm_state_disc_wait_ua() argument
500 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_sm_state_disc_wait_ua()
502 if (p_mcb->restart_required) in rfc_mx_sm_state_disc_wait_ua()
505 UINT16 lcid = L2CA_ConnectReq(BT_PSM_RFCOMM, p_mcb->bd_addr); in rfc_mx_sm_state_disc_wait_ua()
507 rfc_save_lcid_mcb(NULL, p_mcb->lcid); in rfc_mx_sm_state_disc_wait_ua()
508 p_mcb->lcid = 0; in rfc_mx_sm_state_disc_wait_ua()
509 PORT_StartCnf(p_mcb, RFCOMM_ERROR); in rfc_mx_sm_state_disc_wait_ua()
512 p_mcb->lcid = lcid; in rfc_mx_sm_state_disc_wait_ua()
514 rfc_save_lcid_mcb (p_mcb, p_mcb->lcid); in rfc_mx_sm_state_disc_wait_ua()
517 while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_mcb->cmd_q)) != NULL) in rfc_mx_sm_state_disc_wait_ua()
520 rfc_timer_start (p_mcb, RFC_MCB_INIT_INACT_TIMER); in rfc_mx_sm_state_disc_wait_ua()
522 p_mcb->is_initiator = TRUE; in rfc_mx_sm_state_disc_wait_ua()
523 p_mcb->restart_required = FALSE; in rfc_mx_sm_state_disc_wait_ua()
524 p_mcb->local_cfg_sent = FALSE; in rfc_mx_sm_state_disc_wait_ua()
525 p_mcb->peer_cfg_rcvd = FALSE; in rfc_mx_sm_state_disc_wait_ua()
527 p_mcb->state = RFC_MX_STATE_WAIT_CONN_CNF; in rfc_mx_sm_state_disc_wait_ua()
530 rfc_release_multiplexer_channel (p_mcb); in rfc_mx_sm_state_disc_wait_ua()
534 rfc_send_ua (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_sm_state_disc_wait_ua()
539 rfc_send_dm (p_mcb, RFCOMM_MX_DLCI, FALSE); in rfc_mx_sm_state_disc_wait_ua()
543 p_mcb->restart_required = TRUE; in rfc_mx_sm_state_disc_wait_ua()
547 p_mcb->state = RFC_MX_STATE_IDLE; in rfc_mx_sm_state_disc_wait_ua()
548 PORT_CloseInd (p_mcb); in rfc_mx_sm_state_disc_wait_ua()
557 RFCOMM_TRACE_EVENT ("RFCOMM MX ignored - evt:%d in state:%d", event, p_mcb->state); in rfc_mx_sm_state_disc_wait_ua()
569 static void rfc_mx_send_config_req (tRFC_MCB *p_mcb) in rfc_mx_send_config_req() argument
588 L2CA_ConfigReq (p_mcb->lcid, &cfg); in rfc_mx_send_config_req()
602 static void rfc_mx_conf_cnf (tRFC_MCB *p_mcb, tL2CAP_CFG_INFO *p_cfg) in rfc_mx_conf_cnf() argument
608 if (p_mcb->is_initiator) in rfc_mx_conf_cnf()
610 PORT_StartCnf (p_mcb, p_cfg->result); in rfc_mx_conf_cnf()
611 L2CA_DisconnectReq (p_mcb->lcid); in rfc_mx_conf_cnf()
613 rfc_release_multiplexer_channel (p_mcb); in rfc_mx_conf_cnf()
617 p_mcb->local_cfg_sent = TRUE; in rfc_mx_conf_cnf()
618 if ((p_mcb->state == RFC_MX_STATE_CONFIGURE) && p_mcb->peer_cfg_rcvd) in rfc_mx_conf_cnf()
620 if (p_mcb->is_initiator) in rfc_mx_conf_cnf()
622 p_mcb->state = RFC_MX_STATE_SABME_WAIT_UA; in rfc_mx_conf_cnf()
623 rfc_send_sabme (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_conf_cnf()
624 rfc_timer_start (p_mcb, RFC_T1_TIMEOUT); in rfc_mx_conf_cnf()
628 p_mcb->state = RFC_MX_STATE_WAIT_SABME; in rfc_mx_conf_cnf()
629 rfc_timer_start (p_mcb, RFCOMM_CONN_TIMEOUT); /* - increased from T2=20 to CONN=120 in rfc_mx_conf_cnf()
645 static void rfc_mx_conf_ind (tRFC_MCB *p_mcb, tL2CAP_CFG_INFO *p_cfg) in rfc_mx_conf_ind() argument
650 p_mcb->peer_l2cap_mtu = p_cfg->mtu - RFCOMM_MIN_OFFSET - 1; in rfc_mx_conf_ind()
652 p_mcb->peer_l2cap_mtu = L2CAP_DEFAULT_MTU - RFCOMM_MIN_OFFSET - 1; in rfc_mx_conf_ind()
660 L2CA_ConfigRsp (p_mcb->lcid, p_cfg); in rfc_mx_conf_ind()
662 p_mcb->peer_cfg_rcvd = TRUE; in rfc_mx_conf_ind()
663 if ((p_mcb->state == RFC_MX_STATE_CONFIGURE) && p_mcb->local_cfg_sent) in rfc_mx_conf_ind()
665 if (p_mcb->is_initiator) in rfc_mx_conf_ind()
667 p_mcb->state = RFC_MX_STATE_SABME_WAIT_UA; in rfc_mx_conf_ind()
668 rfc_send_sabme (p_mcb, RFCOMM_MX_DLCI); in rfc_mx_conf_ind()
669 rfc_timer_start (p_mcb, RFC_T1_TIMEOUT); in rfc_mx_conf_ind()
673 p_mcb->state = RFC_MX_STATE_WAIT_SABME; in rfc_mx_conf_ind()
674 rfc_timer_start (p_mcb, RFCOMM_CONN_TIMEOUT); /* - increased from T2=20 to CONN=120 in rfc_mx_conf_ind()