Lines Matching refs:p_port
42 UINT32 port_rfc_send_tx_data (tPORT *p_port);
43 void port_rfc_closed (tPORT *p_port, UINT8 res);
44 void port_get_credits (tPORT *p_port, UINT8 k);
57 int port_open_continue (tPORT *p_port) in port_open_continue() argument
61 RFCOMM_TRACE_EVENT ("port_open_continue, p_port:%p", p_port); in port_open_continue()
64 if ((p_mcb = rfc_alloc_multiplexer_channel (p_port->bd_addr, TRUE)) == NULL) in port_open_continue()
67 port_release_port (p_port); in port_open_continue()
71 p_port->rfc.p_mcb = p_mcb; in port_open_continue()
73 p_mcb->port_inx[p_port->dlci] = p_port->inx; in port_open_continue()
76 port_select_mtu (p_port); in port_open_continue()
80 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu); in port_open_continue()
110 void port_start_control (tPORT *p_port) in port_start_control() argument
112 tRFC_MCB *p_mcb = p_port->rfc.p_mcb; in port_start_control()
117 RFCOMM_ControlReq (p_mcb, p_port->dlci, &p_port->local_ctrl); in port_start_control()
131 void port_start_par_neg (tPORT *p_port) in port_start_par_neg() argument
133 tRFC_MCB *p_mcb = p_port->rfc.p_mcb; in port_start_par_neg()
138 RFCOMM_PortNegReq (p_mcb, p_port->dlci, &p_port->user_port_pars); in port_start_par_neg()
152 void port_start_close (tPORT *p_port) in port_start_close() argument
154 tRFC_MCB *p_mcb = p_port->rfc.p_mcb; in port_start_close()
159 p_port->line_status |= LINE_STATUS_FAILED; in port_start_close()
160 old_signals = p_port->peer_ctrl.modem_signal; in port_start_close()
162 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON); in port_start_close()
164 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal); in port_start_close()
166 if(p_port->ev_mask & PORT_EV_CONNECT_ERR) in port_start_close()
169 if(p_port->ev_mask & PORT_EV_ERR) in port_start_close()
172 if ((p_port->p_callback != NULL) && events) in port_start_close()
173 p_port->p_callback (events, p_port->inx); in port_start_close()
177 if ((p_mcb == NULL) || (p_port->rfc.state == RFC_STATE_CLOSED)) in port_start_close()
180 if (p_port->p_mgmt_callback) in port_start_close()
181 p_port->p_mgmt_callback (PORT_CLOSED, p_port->inx); in port_start_close()
183 port_release_port (p_port); in port_start_close()
187 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci); in port_start_close()
204 tPORT *p_port; in PORT_StartCnf() local
210 p_port = &rfc_cb.port.port[0]; in PORT_StartCnf()
211 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) in PORT_StartCnf()
213 if (p_port->rfc.p_mcb == p_mcb) in PORT_StartCnf()
218 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu); in PORT_StartCnf()
226 p_port->error = PORT_PAGE_TIMEOUT; in PORT_StartCnf()
228 p_port->error = PORT_START_FAILED; in PORT_StartCnf()
233 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECT_ERR)) in PORT_StartCnf()
234 (p_port->p_callback)(PORT_EV_CONNECT_ERR, p_port->inx); in PORT_StartCnf()
236 if (p_port->p_mgmt_callback) in PORT_StartCnf()
237 p_port->p_mgmt_callback (PORT_START_FAILED, p_port->inx); in PORT_StartCnf()
239 port_release_port (p_port); in PORT_StartCnf()
265 tPORT *p_port; in PORT_StartInd() local
270 p_port = &rfc_cb.port.port[0]; in PORT_StartInd()
271 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) in PORT_StartInd()
273 if ((p_port->rfc.p_mcb == NULL) in PORT_StartInd()
274 || (p_port->rfc.p_mcb == p_mcb)) in PORT_StartInd()
297 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_ParNegInd() local
303 if (!p_port) in PORT_ParNegInd()
306 p_port = port_find_dlci_port (dlci); in PORT_ParNegInd()
307 if (!p_port) in PORT_ParNegInd()
317 p_mcb->port_inx[dlci] = p_port->inx; in PORT_ParNegInd()
320 memcpy (p_port->bd_addr, p_mcb->bd_addr, BD_ADDR_LEN); in PORT_ParNegInd()
323 port_select_mtu (p_port); in PORT_ParNegInd()
325 p_port->rfc.p_mcb = p_mcb; in PORT_ParNegInd()
326 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu; in PORT_ParNegInd()
327 p_port->peer_mtu = p_port->mtu; in PORT_ParNegInd()
358 port_get_credits (p_port, k); in PORT_ParNegInd()
362 our_k = (p_port->credit_rx_max < RFCOMM_K_MAX) ? p_port->credit_rx_max : RFCOMM_K_MAX; in PORT_ParNegInd()
363 p_port->credit_rx = our_k; in PORT_ParNegInd()
371 RFCOMM_ParNegRsp (p_mcb, dlci, p_port->mtu, our_cl, our_k); in PORT_ParNegInd()
388 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_ParNegCnf() local
392 if (!p_port) in PORT_ParNegCnf()
402 rfc_send_disc (p_mcb, p_port->dlci); in PORT_ParNegCnf()
403 rfc_port_closed (p_port); in PORT_ParNegCnf()
421 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu; in PORT_ParNegCnf()
422 p_port->peer_mtu = p_port->mtu; in PORT_ParNegCnf()
426 port_get_credits (p_port, k); in PORT_ParNegCnf()
429 if (p_port->state == PORT_STATE_OPENING) in PORT_ParNegCnf()
430 RFCOMM_DlcEstablishReq (p_mcb, p_port->dlci, p_port->mtu); in PORT_ParNegCnf()
449 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_DlcEstablishInd() local
451 …RACE_DEBUG ("PORT_DlcEstablishInd p_mcb:%p, dlci:%d mtu:%di, p_port:%p", p_mcb, dlci, mtu, p_port); in PORT_DlcEstablishInd()
456 if (!p_port) in PORT_DlcEstablishInd()
459 p_port = port_find_dlci_port (dlci); in PORT_DlcEstablishInd()
460 if (!p_port) in PORT_DlcEstablishInd()
465 p_mcb->port_inx[dlci] = p_port->inx; in PORT_DlcEstablishInd()
469 if (mtu && (mtu < p_port->peer_mtu)) in PORT_DlcEstablishInd()
470 p_port->peer_mtu = mtu; in PORT_DlcEstablishInd()
475 RFCOMM_DlcEstablishRsp (p_mcb, dlci, p_port->mtu, RFCOMM_SUCCESS); in PORT_DlcEstablishInd()
479 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED)) in PORT_DlcEstablishInd()
480 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx); in PORT_DlcEstablishInd()
482 if (p_port->p_mgmt_callback) in PORT_DlcEstablishInd()
483 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx); in PORT_DlcEstablishInd()
485 p_port->state = PORT_STATE_OPENED; in PORT_DlcEstablishInd()
501 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_DlcEstablishCnf() local
505 if (!p_port) in PORT_DlcEstablishCnf()
510 p_port->error = PORT_START_FAILED; in PORT_DlcEstablishCnf()
511 port_rfc_closed (p_port, PORT_START_FAILED); in PORT_DlcEstablishCnf()
516 if (mtu && (mtu < p_port->peer_mtu)) in PORT_DlcEstablishCnf()
517 p_port->peer_mtu = mtu; in PORT_DlcEstablishCnf()
522 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED)) in PORT_DlcEstablishCnf()
523 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx); in PORT_DlcEstablishCnf()
525 if (p_port->p_mgmt_callback) in PORT_DlcEstablishCnf()
526 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx); in PORT_DlcEstablishCnf()
528 p_port->state = PORT_STATE_OPENED; in PORT_DlcEstablishCnf()
531 if ((p_port->uuid == UUID_SERVCLASS_DIALUP_NETWORKING) in PORT_DlcEstablishCnf()
532 || (p_port->uuid == UUID_SERVCLASS_FAX)) in PORT_DlcEstablishCnf()
533 RFCOMM_PortNegReq (p_port->rfc.p_mcb, p_port->dlci, NULL); in PORT_DlcEstablishCnf()
535 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_DlcEstablishCnf()
553 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_PortNegInd() local
557 if (!p_port) in PORT_PortNegInd()
560 p_port = port_find_dlci_port (dlci); in PORT_PortNegInd()
561 if (!p_port) in PORT_PortNegInd()
566 p_mcb->port_inx[dlci] = p_port->inx; in PORT_PortNegInd()
570 p_port->peer_port_pars = *p_pars; in PORT_PortNegInd()
585 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_PortNegCnf() local
590 if (!p_port) in PORT_PortNegCnf()
598 p_port->error = PORT_PORT_NEG_FAILED; in PORT_PortNegCnf()
600 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci); in PORT_PortNegCnf()
602 port_rfc_closed (p_port, PORT_PORT_NEG_FAILED); in PORT_PortNegCnf()
606 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT)) in PORT_PortNegCnf()
608 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_PortNegCnf()
627 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_ControlInd() local
633 if (!p_port) in PORT_ControlInd()
636 old_signals = p_port->peer_ctrl.modem_signal; in PORT_ControlInd()
638 event = port_get_signal_changes (p_port, old_signals, p_pars->modem_signal); in PORT_ControlInd()
640 p_port->peer_ctrl = *p_pars; in PORT_ControlInd()
642 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT)) in PORT_ControlInd()
643 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_ControlInd()
647 if (!(p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)) in PORT_ControlInd()
649 event |= (PORT_EV_CONNECTED & p_port->ev_mask); in PORT_ControlInd()
652 if (p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED) in PORT_ControlInd()
654 event |= port_rfc_send_tx_data(p_port); in PORT_ControlInd()
658 p_port->port_ctrl |= (PORT_CTRL_IND_RECEIVED | PORT_CTRL_IND_RESPONDED); in PORT_ControlInd()
661 event |= (PORT_EV_BREAK & p_port->ev_mask); in PORT_ControlInd()
664 if (event && p_port->p_callback) in PORT_ControlInd()
665 (p_port->p_callback)(event, p_port->inx); in PORT_ControlInd()
668 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DTRDSR) ? 1 : 0), in PORT_ControlInd()
669 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RTSCTS) ? 1 : 0), in PORT_ControlInd()
670 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RI) ? 1 : 0), in PORT_ControlInd()
671 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DCD) ? 1 : 0)); in PORT_ControlInd()
686 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_ControlCnf() local
692 if (!p_port) in PORT_ControlCnf()
695 if (!(p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED)) in PORT_ControlCnf()
697 p_port->port_ctrl |= PORT_CTRL_REQ_CONFIRMED; in PORT_ControlCnf()
699 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED) in PORT_ControlCnf()
700 event = (p_port->ev_mask & PORT_EV_CONNECTED); in PORT_ControlCnf()
703 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED) in PORT_ControlCnf()
705 event |= port_rfc_send_tx_data(p_port); in PORT_ControlCnf()
709 if (event && p_port->p_callback) in PORT_ControlCnf()
710 (p_port->p_callback)(event, p_port->inx); in PORT_ControlCnf()
724 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_LineStatusInd() local
729 if (!p_port) in PORT_LineStatusInd()
732 p_port->line_status |= line_status; in PORT_LineStatusInd()
743 if ((p_port->p_callback != NULL) && (p_port->ev_mask & event)) in PORT_LineStatusInd()
744 p_port->p_callback ((p_port->ev_mask & event), p_port->inx); in PORT_LineStatusInd()
758 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_DlcReleaseInd() local
762 if (!p_port) in PORT_DlcReleaseInd()
765 port_rfc_closed (p_port, PORT_CLOSED); in PORT_DlcReleaseInd()
779 tPORT *p_port; in PORT_CloseInd() local
784 p_port = &rfc_cb.port.port[0]; in PORT_CloseInd()
785 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) in PORT_CloseInd()
787 if (p_port->rfc.p_mcb == p_mcb) in PORT_CloseInd()
789 port_rfc_closed (p_port, PORT_PEER_CONNECTION_FAILED); in PORT_CloseInd()
805 tPORT *p_port; in Port_TimeOutCloseMux() local
810 p_port = &rfc_cb.port.port[0]; in Port_TimeOutCloseMux()
811 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) in Port_TimeOutCloseMux()
813 if (p_port->rfc.p_mcb == p_mcb) in Port_TimeOutCloseMux()
815 port_rfc_closed (p_port, PORT_PEER_TIMEOUT); in Port_TimeOutCloseMux()
831 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci); in PORT_DataInd() local
838 p_buf->len, p_mcb, p_port, dlci); in PORT_DataInd()
839 if (!p_port) in PORT_DataInd()
845 if (p_port->p_data_co_callback) in PORT_DataInd()
849 … if(p_port->p_data_co_callback(p_port->inx, (UINT8*)p_buf, -1, DATA_CO_CALLBACK_TYPE_INCOMING)) in PORT_DataInd()
850 port_flow_control_peer(p_port, TRUE, 1); in PORT_DataInd()
851 else port_flow_control_peer(p_port, FALSE, 0); in PORT_DataInd()
855 else RFCOMM_TRACE_ERROR("PORT_DataInd, p_port:%p, p_data_co_callback is null", p_port); in PORT_DataInd()
857 if (p_port->p_data_callback) in PORT_DataInd()
860 port_flow_control_peer(p_port, TRUE, 1); in PORT_DataInd()
862 p_port->p_data_callback (p_port->inx, (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len); in PORT_DataInd()
868 if ((p_port->rx.queue_size + p_buf->len > PORT_RX_CRITICAL_WM) in PORT_DataInd()
869 || (fixed_queue_length(p_port->rx.queue) + 1 > p_port->rx_buf_critical)) in PORT_DataInd()
880 if (((rx_char1 = p_port->user_port_pars.rx_char1) != 0) in PORT_DataInd()
881 && (p_port->ev_mask & PORT_EV_RXFLAG)) in PORT_DataInd()
895 fixed_queue_enqueue(p_port->rx.queue, p_buf); in PORT_DataInd()
896 p_port->rx.queue_size += p_buf->len; in PORT_DataInd()
901 port_flow_control_peer(p_port, FALSE, 0); in PORT_DataInd()
904 if (p_port->rx.user_fc) in PORT_DataInd()
907 p_port->rx_flag_ev_pending = TRUE; in PORT_DataInd()
915 events &= p_port->ev_mask; in PORT_DataInd()
917 if (p_port->p_callback && events) in PORT_DataInd()
918 p_port->p_callback (events, p_port->inx); in PORT_DataInd()
932 tPORT *p_port = (tPORT *)NULL; in PORT_FlowInd() local
944 if ((p_port = port_find_mcb_dlci_port (p_mcb, dlci)) == NULL) in PORT_FlowInd()
947 p_port->tx.peer_fc = !enable_data; in PORT_FlowInd()
955 p_port = &rfc_cb.port.port[i]; in PORT_FlowInd()
956 if (!p_port->in_use in PORT_FlowInd()
957 || (p_port->rfc.p_mcb != p_mcb) in PORT_FlowInd()
958 || (p_port->rfc.state != RFC_STATE_OPENED)) in PORT_FlowInd()
964 events |= port_flow_control_user (p_port); in PORT_FlowInd()
967 events |= port_rfc_send_tx_data (p_port); in PORT_FlowInd()
970 events &= p_port->ev_mask; in PORT_FlowInd()
973 if (p_port->p_callback && events) in PORT_FlowInd()
974 (p_port->p_callback)(events, p_port->inx); in PORT_FlowInd()
990 UINT32 port_rfc_send_tx_data (tPORT *p_port) in port_rfc_send_tx_data() argument
996 if (p_port->tx.queue_size > 0) in port_rfc_send_tx_data()
999 while (!p_port->tx.peer_fc && p_port->rfc.p_mcb && p_port->rfc.p_mcb->peer_ready) in port_rfc_send_tx_data()
1004 if ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->tx.queue)) != NULL) in port_rfc_send_tx_data()
1006 p_port->tx.queue_size -= p_buf->len; in port_rfc_send_tx_data()
1010 … RFCOMM_TRACE_DEBUG ("Sending RFCOMM_DataReq tx.queue_size=%d", p_port->tx.queue_size); in port_rfc_send_tx_data()
1012 RFCOMM_DataReq (p_port->rfc.p_mcb, p_port->dlci, p_buf); in port_rfc_send_tx_data()
1016 if (p_port->tx.queue_size == 0) in port_rfc_send_tx_data()
1032 events |= port_flow_control_user (p_port); in port_rfc_send_tx_data()
1034 return (events & p_port->ev_mask); in port_rfc_send_tx_data()
1045 void port_rfc_closed (tPORT *p_port, UINT8 res) in port_rfc_closed() argument
1049 tRFC_MCB *p_mcb = p_port->rfc.p_mcb; in port_rfc_closed()
1051 if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server)) in port_rfc_closed()
1056 rfc_port_timer_stop (p_port); in port_rfc_closed()
1057 p_port->rfc.state = RFC_STATE_CLOSED; in port_rfc_closed()
1061 p_mcb->port_inx[p_port->dlci] = 0; in port_rfc_closed()
1065 p_port->rfc.p_mcb = NULL; in port_rfc_closed()
1071 p_port->dlci &= 0xfe; in port_rfc_closed()
1076 if ((p_port->state != PORT_STATE_CLOSING) && (p_port->state != PORT_STATE_CLOSED)) in port_rfc_closed()
1078 p_port->line_status |= LINE_STATUS_FAILED; in port_rfc_closed()
1080 old_signals = p_port->peer_ctrl.modem_signal; in port_rfc_closed()
1082 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON); in port_rfc_closed()
1084 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal); in port_rfc_closed()
1086 if(p_port->ev_mask & PORT_EV_CONNECT_ERR) in port_rfc_closed()
1089 RFCOMM_TRACE_EVENT ("port_rfc_closed state:%d sending events:%x", p_port->state, events); in port_rfc_closed()
1091 if ((p_port->p_callback != NULL) && events) in port_rfc_closed()
1092 p_port->p_callback (events, p_port->inx); in port_rfc_closed()
1094 if (p_port->p_mgmt_callback) in port_rfc_closed()
1095 p_port->p_mgmt_callback (res, p_port->inx); in port_rfc_closed()
1097 p_port->rfc.state = RFC_STATE_CLOSED; in port_rfc_closed()
1100 __func__, p_port->state, PORT_GetResultString(res), res); in port_rfc_closed()
1102 port_release_port (p_port); in port_rfc_closed()
1116 void port_get_credits (tPORT *p_port, UINT8 k) in port_get_credits() argument
1118 p_port->credit_tx = k; in port_get_credits()
1119 if (p_port->credit_tx == 0) in port_get_credits()
1120 p_port->tx.peer_fc = TRUE; in port_get_credits()