• Home
  • Raw
  • Download

Lines Matching refs:p_port

44 uint32_t port_rfc_send_tx_data(tPORT* p_port);
45 void port_rfc_closed(tPORT* p_port, uint8_t res);
46 void port_get_credits(tPORT* p_port, uint8_t k);
58 int port_open_continue(tPORT* p_port) { in port_open_continue() argument
59 RFCOMM_TRACE_EVENT("port_open_continue, p_port:%p", p_port); in port_open_continue()
62 tRFC_MCB* p_mcb = rfc_alloc_multiplexer_channel(p_port->bd_addr, true); in port_open_continue()
65 port_release_port(p_port); in port_open_continue()
69 p_port->rfc.p_mcb = p_mcb; in port_open_continue()
71 p_mcb->port_handles[p_port->dlci] = p_port->handle; in port_open_continue()
74 port_select_mtu(p_port); in port_open_continue()
77 RFCOMM_ParameterNegotiationRequest(p_mcb, p_port->dlci, p_port->mtu); in port_open_continue()
104 void port_start_control(tPORT* p_port) { in port_start_control() argument
105 tRFC_MCB* p_mcb = p_port->rfc.p_mcb; in port_start_control()
109 RFCOMM_ControlReq(p_mcb, p_port->dlci, &p_port->local_ctrl); in port_start_control()
122 void port_start_par_neg(tPORT* p_port) { in port_start_par_neg() argument
123 tRFC_MCB* p_mcb = p_port->rfc.p_mcb; in port_start_par_neg()
127 RFCOMM_PortParameterNegotiationRequest(p_mcb, p_port->dlci, in port_start_par_neg()
128 &p_port->user_port_pars); in port_start_par_neg()
141 void port_start_close(tPORT* p_port) { in port_start_close() argument
142 tRFC_MCB* p_mcb = p_port->rfc.p_mcb; in port_start_close()
148 p_port->line_status |= LINE_STATUS_FAILED; in port_start_close()
149 old_signals = p_port->peer_ctrl.modem_signal; in port_start_close()
151 p_port->peer_ctrl.modem_signal &= in port_start_close()
154 events |= port_get_signal_changes(p_port, old_signals, in port_start_close()
155 p_port->peer_ctrl.modem_signal); in port_start_close()
157 if (p_port->ev_mask & PORT_EV_CONNECT_ERR) events |= PORT_EV_CONNECT_ERR; in port_start_close()
159 if (p_port->ev_mask & PORT_EV_ERR) events |= PORT_EV_ERR; in port_start_close()
161 if ((p_port->p_callback != NULL) && events) in port_start_close()
162 p_port->p_callback(events, p_port->handle); in port_start_close()
165 if ((p_mcb == NULL) || (p_port->rfc.state == RFC_STATE_CLOSED)) { in port_start_close()
168 if (p_port->p_mgmt_callback) in port_start_close()
169 p_port->p_mgmt_callback(PORT_CLOSED, p_port->handle); in port_start_close()
171 port_release_port(p_port); in port_start_close()
173 RFCOMM_DlcReleaseReq(p_mcb, p_port->dlci); in port_start_close()
192 tPORT* p_port = &rfc_cb.port.port[0]; in PORT_StartCnf() local
193 for (int i = 0; i < MAX_RFC_PORTS; i++, p_port++) { in PORT_StartCnf()
194 if (p_port->rfc.p_mcb == p_mcb) { in PORT_StartCnf()
198 RFCOMM_TRACE_EVENT("%s: dlci %d", __func__, p_port->dlci); in PORT_StartCnf()
199 RFCOMM_ParameterNegotiationRequest(p_mcb, p_port->dlci, p_port->mtu); in PORT_StartCnf()
206 p_port->error = PORT_PAGE_TIMEOUT; in PORT_StartCnf()
208 p_port->error = PORT_START_FAILED; in PORT_StartCnf()
214 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECT_ERR)) { in PORT_StartCnf()
215 (p_port->p_callback)(PORT_EV_CONNECT_ERR, p_port->handle); in PORT_StartCnf()
218 if (p_port->p_mgmt_callback) { in PORT_StartCnf()
219 p_port->p_mgmt_callback(PORT_START_FAILED, p_port->handle); in PORT_StartCnf()
222 port_release_port(p_port); in PORT_StartCnf()
245 tPORT* p_port; in PORT_StartInd() local
250 p_port = &rfc_cb.port.port[0]; in PORT_StartInd()
251 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) { in PORT_StartInd()
252 if ((p_port->rfc.p_mcb == NULL) || (p_port->rfc.p_mcb == p_mcb)) { in PORT_StartInd()
276 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_ParNegInd() local
277 if (!p_port) { in PORT_ParNegInd()
279 p_port = port_find_dlci_port(dlci); in PORT_ParNegInd()
280 if (!p_port) { in PORT_ParNegInd()
292 p_mcb->port_handles[dlci], p_port->handle); in PORT_ParNegInd()
293 p_mcb->port_handles[dlci] = p_port->handle; in PORT_ParNegInd()
296 p_port->bd_addr = p_mcb->bd_addr; in PORT_ParNegInd()
299 port_select_mtu(p_port); in PORT_ParNegInd()
301 p_port->rfc.p_mcb = p_mcb; in PORT_ParNegInd()
302 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu; in PORT_ParNegInd()
303 p_port->peer_mtu = p_port->mtu; in PORT_ParNegInd()
335 port_get_credits(p_port, k); in PORT_ParNegInd()
339 our_k = (p_port->credit_rx_max < RFCOMM_K_MAX) ? p_port->credit_rx_max in PORT_ParNegInd()
341 p_port->credit_rx = our_k; in PORT_ParNegInd()
347 RFCOMM_ParameterNegotiationResponse(p_mcb, dlci, p_port->mtu, our_cl, our_k); in PORT_ParNegInd()
365 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_ParNegCnf() local
366 if (!p_port) { in PORT_ParNegCnf()
379 p_port->handle); in PORT_ParNegCnf()
380 rfc_send_disc(p_mcb, p_port->dlci); in PORT_ParNegCnf()
381 rfc_port_closed(p_port); in PORT_ParNegCnf()
397 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu; in PORT_ParNegCnf()
398 p_port->peer_mtu = p_port->mtu; in PORT_ParNegCnf()
401 port_get_credits(p_port, k); in PORT_ParNegCnf()
404 if (p_port->state == PORT_STATE_OPENING) in PORT_ParNegCnf()
405 RFCOMM_DlcEstablishReq(p_mcb, p_port->dlci, p_port->mtu); in PORT_ParNegCnf()
422 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_DlcEstablishInd() local
426 mtu, p_port); in PORT_DlcEstablishInd()
429 if (!p_port) { in PORT_DlcEstablishInd()
431 p_port = port_find_dlci_port(dlci); in PORT_DlcEstablishInd()
432 if (!p_port) { in PORT_DlcEstablishInd()
436 p_mcb->port_handles[dlci] = p_port->handle; in PORT_DlcEstablishInd()
440 if (mtu && (mtu < p_port->peer_mtu)) p_port->peer_mtu = mtu; in PORT_DlcEstablishInd()
445 RFCOMM_DlcEstablishRsp(p_mcb, dlci, p_port->mtu, RFCOMM_SUCCESS); in PORT_DlcEstablishInd()
449 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED)) in PORT_DlcEstablishInd()
450 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->handle); in PORT_DlcEstablishInd()
452 if (p_port->p_mgmt_callback) in PORT_DlcEstablishInd()
453 p_port->p_mgmt_callback(PORT_SUCCESS, p_port->handle); in PORT_DlcEstablishInd()
455 p_port->state = PORT_STATE_OPENED; in PORT_DlcEstablishInd()
470 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_DlcEstablishCnf() local
475 if (!p_port) return; in PORT_DlcEstablishCnf()
478 p_port->error = PORT_START_FAILED; in PORT_DlcEstablishCnf()
479 port_rfc_closed(p_port, PORT_START_FAILED); in PORT_DlcEstablishCnf()
484 if (mtu && (mtu < p_port->peer_mtu)) p_port->peer_mtu = mtu; in PORT_DlcEstablishCnf()
489 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED)) in PORT_DlcEstablishCnf()
490 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->handle); in PORT_DlcEstablishCnf()
492 if (p_port->p_mgmt_callback) in PORT_DlcEstablishCnf()
493 p_port->p_mgmt_callback(PORT_SUCCESS, p_port->handle); in PORT_DlcEstablishCnf()
495 p_port->state = PORT_STATE_OPENED; in PORT_DlcEstablishCnf()
499 if ((p_port->uuid == UUID_SERVCLASS_DIALUP_NETWORKING) || in PORT_DlcEstablishCnf()
500 (p_port->uuid == UUID_SERVCLASS_FAX)) in PORT_DlcEstablishCnf()
501 RFCOMM_PortParameterNegotiationRequest(p_port->rfc.p_mcb, p_port->dlci, in PORT_DlcEstablishCnf()
504 RFCOMM_ControlReq(p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_DlcEstablishCnf()
520 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_PortNegInd() local
524 if (!p_port) { in PORT_PortNegInd()
526 p_port = port_find_dlci_port(dlci); in PORT_PortNegInd()
527 if (!p_port) { in PORT_PortNegInd()
531 p_mcb->port_handles[dlci] = p_port->handle; in PORT_PortNegInd()
535 p_port->peer_port_pars = *p_pars; in PORT_PortNegInd()
549 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_PortNegCnf() local
553 if (!p_port) { in PORT_PortNegCnf()
559 p_port->error = PORT_PORT_NEG_FAILED; in PORT_PortNegCnf()
561 RFCOMM_DlcReleaseReq(p_mcb, p_port->dlci); in PORT_PortNegCnf()
563 port_rfc_closed(p_port, PORT_PORT_NEG_FAILED); in PORT_PortNegCnf()
567 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT)) { in PORT_PortNegCnf()
568 RFCOMM_ControlReq(p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_PortNegCnf()
583 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_ControlInd() local
589 if (!p_port) return; in PORT_ControlInd()
591 old_signals = p_port->peer_ctrl.modem_signal; in PORT_ControlInd()
593 event = port_get_signal_changes(p_port, old_signals, p_pars->modem_signal); in PORT_ControlInd()
595 p_port->peer_ctrl = *p_pars; in PORT_ControlInd()
597 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT)) { in PORT_ControlInd()
598 RFCOMM_ControlReq(p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl); in PORT_ControlInd()
601 if (!(p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)) { in PORT_ControlInd()
602 event |= (PORT_EV_CONNECTED & p_port->ev_mask); in PORT_ControlInd()
605 if (p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED) { in PORT_ControlInd()
606 event |= port_rfc_send_tx_data(p_port); in PORT_ControlInd()
610 p_port->port_ctrl |= (PORT_CTRL_IND_RECEIVED | PORT_CTRL_IND_RESPONDED); in PORT_ControlInd()
612 if (p_pars->break_signal) event |= (PORT_EV_BREAK & p_port->ev_mask); in PORT_ControlInd()
616 if (event && p_port->p_callback) (p_port->p_callback)(event, p_port->handle); in PORT_ControlInd()
620 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DTRDSR) ? 1 : 0), in PORT_ControlInd()
621 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RTSCTS) ? 1 : 0), in PORT_ControlInd()
622 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RI) ? 1 : 0), in PORT_ControlInd()
623 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DCD) ? 1 : 0)); in PORT_ControlInd()
636 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_ControlCnf() local
641 if (!p_port) return; in PORT_ControlCnf()
643 if (!(p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED)) { in PORT_ControlCnf()
644 p_port->port_ctrl |= PORT_CTRL_REQ_CONFIRMED; in PORT_ControlCnf()
646 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED) in PORT_ControlCnf()
647 event = (p_port->ev_mask & PORT_EV_CONNECTED); in PORT_ControlCnf()
650 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED) { in PORT_ControlCnf()
651 event |= port_rfc_send_tx_data(p_port); in PORT_ControlCnf()
656 if (event && p_port->p_callback) (p_port->p_callback)(event, p_port->handle); in PORT_ControlCnf()
668 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_LineStatusInd() local
673 if (!p_port) return; in PORT_LineStatusInd()
675 p_port->line_status |= line_status; in PORT_LineStatusInd()
683 if ((p_port->p_callback != NULL) && (p_port->ev_mask & event)) in PORT_LineStatusInd()
684 p_port->p_callback((p_port->ev_mask & event), p_port->handle); in PORT_LineStatusInd()
698 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_DlcReleaseInd() local
699 if (!p_port) return; in PORT_DlcReleaseInd()
700 port_rfc_closed(p_port, PORT_CLOSED); in PORT_DlcReleaseInd()
712 tPORT* p_port; in PORT_CloseInd() local
717 p_port = &rfc_cb.port.port[0]; in PORT_CloseInd()
718 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) { in PORT_CloseInd()
719 if (p_port->rfc.p_mcb == p_mcb) { in PORT_CloseInd()
720 port_rfc_closed(p_port, PORT_PEER_CONNECTION_FAILED); in PORT_CloseInd()
735 tPORT* p_port; in Port_TimeOutCloseMux() local
740 p_port = &rfc_cb.port.port[0]; in Port_TimeOutCloseMux()
741 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++) { in Port_TimeOutCloseMux()
742 if (p_port->rfc.p_mcb == p_mcb) { in Port_TimeOutCloseMux()
743 port_rfc_closed(p_port, PORT_PEER_TIMEOUT); in Port_TimeOutCloseMux()
757 tPORT* p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_DataInd() local
765 p_buf->len, p_mcb, p_port, dlci); in PORT_DataInd()
766 if (!p_port) { in PORT_DataInd()
772 if (p_port->p_data_co_callback) { in PORT_DataInd()
774 if (p_port->p_data_co_callback(p_port->handle, (uint8_t*)p_buf, -1, in PORT_DataInd()
776 port_flow_control_peer(p_port, true, 1); in PORT_DataInd()
778 port_flow_control_peer(p_port, false, 0); in PORT_DataInd()
784 if (p_port->p_data_callback) { in PORT_DataInd()
786 port_flow_control_peer(p_port, true, 1); in PORT_DataInd()
787 p_port->p_data_callback(p_port->handle, in PORT_DataInd()
793 if ((p_port->rx.queue_size + p_buf->len > PORT_RX_CRITICAL_WM) || in PORT_DataInd()
794 (fixed_queue_length(p_port->rx.queue) + 1 > p_port->rx_buf_critical)) { in PORT_DataInd()
802 if (((rx_char1 = p_port->user_port_pars.rx_char1) != 0) && in PORT_DataInd()
803 (p_port->ev_mask & PORT_EV_RXFLAG)) { in PORT_DataInd()
815 fixed_queue_enqueue(p_port->rx.queue, p_buf); in PORT_DataInd()
816 p_port->rx.queue_size += p_buf->len; in PORT_DataInd()
821 port_flow_control_peer(p_port, false, 0); in PORT_DataInd()
824 if (p_port->rx.user_fc) { in PORT_DataInd()
826 p_port->rx_flag_ev_pending = true; in PORT_DataInd()
834 events &= p_port->ev_mask; in PORT_DataInd()
836 if (p_port->p_callback && events) p_port->p_callback(events, p_port->handle); in PORT_DataInd()
848 tPORT* p_port = (tPORT*)NULL; in PORT_FlowInd() local
857 p_port = port_find_mcb_dlci_port(p_mcb, dlci); in PORT_FlowInd()
858 if (p_port == NULL) return; in PORT_FlowInd()
860 p_port->tx.peer_fc = !enable_data; in PORT_FlowInd()
866 p_port = &rfc_cb.port.port[i]; in PORT_FlowInd()
867 if (!p_port->in_use || (p_port->rfc.p_mcb != p_mcb) || in PORT_FlowInd()
868 (p_port->rfc.state != RFC_STATE_OPENED)) in PORT_FlowInd()
874 events |= port_flow_control_user(p_port); in PORT_FlowInd()
877 events |= port_rfc_send_tx_data(p_port); in PORT_FlowInd()
880 events &= p_port->ev_mask; in PORT_FlowInd()
883 if (p_port->p_callback && events) in PORT_FlowInd()
884 (p_port->p_callback)(events, p_port->handle); in PORT_FlowInd()
898 uint32_t port_rfc_send_tx_data(tPORT* p_port) { in port_rfc_send_tx_data() argument
903 if (p_port->tx.queue_size > 0) { in port_rfc_send_tx_data()
905 while (!p_port->tx.peer_fc && p_port->rfc.p_mcb && in port_rfc_send_tx_data()
906 p_port->rfc.p_mcb->peer_ready) { in port_rfc_send_tx_data()
910 p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_port->tx.queue); in port_rfc_send_tx_data()
912 p_port->tx.queue_size -= p_buf->len; in port_rfc_send_tx_data()
917 p_port->tx.queue_size); in port_rfc_send_tx_data()
919 RFCOMM_DataReq(p_port->rfc.p_mcb, p_port->dlci, p_buf); in port_rfc_send_tx_data()
923 if (p_port->tx.queue_size == 0) { in port_rfc_send_tx_data()
937 events |= port_flow_control_user(p_port); in port_rfc_send_tx_data()
939 return (events & p_port->ev_mask); in port_rfc_send_tx_data()
949 void port_rfc_closed(tPORT* p_port, uint8_t res) { in port_rfc_closed() argument
952 tRFC_MCB* p_mcb = p_port->rfc.p_mcb; in port_rfc_closed()
954 if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server)) { in port_rfc_closed()
958 rfc_port_timer_stop(p_port); in port_rfc_closed()
959 p_port->rfc.state = RFC_STATE_CLOSED; in port_rfc_closed()
962 p_mcb->port_handles[p_port->dlci] = 0; in port_rfc_closed()
966 p_port->rfc.p_mcb = NULL; in port_rfc_closed()
972 p_port->dlci &= 0xfe; in port_rfc_closed()
977 if ((p_port->state != PORT_STATE_CLOSING) && in port_rfc_closed()
978 (p_port->state != PORT_STATE_CLOSED)) { in port_rfc_closed()
979 p_port->line_status |= LINE_STATUS_FAILED; in port_rfc_closed()
981 old_signals = p_port->peer_ctrl.modem_signal; in port_rfc_closed()
983 p_port->peer_ctrl.modem_signal &= in port_rfc_closed()
986 events |= port_get_signal_changes(p_port, old_signals, in port_rfc_closed()
987 p_port->peer_ctrl.modem_signal); in port_rfc_closed()
989 if (p_port->ev_mask & PORT_EV_CONNECT_ERR) events |= PORT_EV_CONNECT_ERR; in port_rfc_closed()
992 if ((p_port->p_callback != NULL) && events) in port_rfc_closed()
993 p_port->p_callback(events, p_port->handle); in port_rfc_closed()
995 if (p_port->p_mgmt_callback) p_port->p_mgmt_callback(res, p_port->handle); in port_rfc_closed()
997 p_port->rfc.state = RFC_STATE_CLOSED; in port_rfc_closed()
1000 << std::to_string(p_port->handle) in port_rfc_closed()
1001 << ", state=" << std::to_string(p_port->state) in port_rfc_closed()
1003 << std::to_string(res) << "], UUID=" << loghex(p_port->uuid) in port_rfc_closed()
1004 << ", bd_addr=" << p_port->bd_addr in port_rfc_closed()
1005 << ", is_server=" << p_port->is_server; in port_rfc_closed()
1007 port_release_port(p_port); in port_rfc_closed()
1020 void port_get_credits(tPORT* p_port, uint8_t k) { in port_get_credits() argument
1021 p_port->credit_tx = k; in port_get_credits()
1022 if (p_port->credit_tx == 0) p_port->tx.peer_fc = true; in port_get_credits()