Home | History | Annotate | Download | only in rfcomm

Lines Matching refs:p_port

39 UINT32 port_rfc_send_tx_data (tPORT *p_port);
40 void port_rfc_closed (tPORT *p_port, UINT8 res);
41 void port_get_credits (tPORT *p_port, UINT8 k);
54 int port_open_continue (tPORT *p_port)
61 if ((p_mcb = rfc_alloc_multiplexer_channel (p_port->bd_addr, TRUE)) == NULL)
64 port_release_port (p_port);
68 p_port->rfc.p_mcb = p_mcb;
70 p_mcb->port_inx[p_port->dlci] = p_port->inx;
73 port_select_mtu (p_port);
77 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu);
107 void port_start_control (tPORT *p_port)
109 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
114 RFCOMM_ControlReq (p_mcb, p_port->dlci, &p_port->local_ctrl);
128 void port_start_par_neg (tPORT *p_port)
130 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
135 RFCOMM_PortNegReq (p_mcb, p_port->dlci, &p_port->user_port_pars);
149 void port_start_close (tPORT *p_port)
151 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
156 p_port->line_status |= LINE_STATUS_FAILED;
157 old_signals = p_port->peer_ctrl.modem_signal;
159 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON);
161 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal);
163 if(p_port->ev_mask & PORT_EV_CONNECT_ERR)
166 if(p_port->ev_mask & PORT_EV_ERR)
169 if ((p_port->p_callback != NULL) && events)
170 p_port->p_callback (events, p_port->inx);
174 if ((p_mcb == NULL) || (p_port->rfc.state == RFC_STATE_CLOSED))
177 if (p_port->p_mgmt_callback)
178 p_port->p_mgmt_callback (PORT_CLOSED, p_port->inx);
180 port_release_port (p_port);
184 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci);
201 tPORT *p_port;
207 p_port = &rfc_cb.port.port[0];
208 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
210 if (p_port->rfc.p_mcb == p_mcb)
215 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu);
223 p_port->error = PORT_PAGE_TIMEOUT;
225 p_port->error = PORT_START_FAILED;
228 p_port->rfc.p_mcb = NULL;
231 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECT_ERR))
232 (p_port->p_callback)(PORT_EV_CONNECT_ERR, p_port->inx);
234 if (p_port->p_mgmt_callback)
235 p_port->p_mgmt_callback (PORT_START_FAILED, p_port->inx);
237 port_release_port (p_port);
263 tPORT *p_port;
268 p_port = &rfc_cb.port.port[0];
269 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
271 if ((p_port->rfc.p_mcb == NULL)
272 || (p_port->rfc.p_mcb == p_mcb))
294 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
300 if (!p_port)
303 p_port = port_find_dlci_port (dlci);
304 if (!p_port)
314 p_mcb->port_inx[dlci] = p_port->inx;
317 memcpy (p_port->bd_addr, p_mcb->bd_addr, BD_ADDR_LEN);
320 port_select_mtu (p_port);
322 p_port->rfc.p_mcb = p_mcb;
323 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu;
324 p_port->peer_mtu = p_port->mtu;
355 port_get_credits (p_port, k);
359 our_k = (p_port->credit_rx_max < RFCOMM_K_MAX) ? p_port->credit_rx_max : RFCOMM_K_MAX;
360 p_port->credit_rx = our_k;
368 RFCOMM_ParNegRsp (p_mcb, dlci, p_port->mtu, our_cl, our_k);
385 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
389 if (!p_port)
399 rfc_send_disc (p_mcb, p_port->dlci);
400 rfc_port_closed (p_port);
418 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu;
419 p_port->peer_mtu = p_port->mtu;
423 port_get_credits (p_port, k);
426 if (p_port->state == PORT_STATE_OPENING)
427 RFCOMM_DlcEstablishReq (p_mcb, p_port->dlci, p_port->mtu);
446 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
450 if (!p_port)
453 p_port = port_find_dlci_port (dlci);
454 if (!p_port)
459 p_mcb->port_inx[dlci] = p_port->inx;
463 if (mtu && (mtu < p_port->peer_mtu))
464 p_port->peer_mtu = mtu;
469 RFCOMM_DlcEstablishRsp (p_mcb, dlci, p_port->mtu, RFCOMM_SUCCESS);
473 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED))
474 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx);
476 if (p_port->p_mgmt_callback)
477 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx);
479 p_port
495 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
499 if (!p_port)
504 p_port->error = PORT_START_FAILED;
505 port_rfc_closed (p_port, PORT_START_FAILED);
510 if (mtu && (mtu < p_port->peer_mtu))
511 p_port->peer_mtu = mtu;
516 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED))
517 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx);
519 if (p_port->p_mgmt_callback)
520 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx);
522 p_port->state = PORT_STATE_OPENED;
525 if ((p_port->uuid == UUID_SERVCLASS_DIALUP_NETWORKING)
526 || (p_port->uuid == UUID_SERVCLASS_FAX))
527 RFCOMM_PortNegReq (p_port->rfc.p_mcb, p_port->dlci, NULL);
529 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
547 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
551 if (!p_port)
554 p_port = port_find_dlci_port (dlci);
555 if (!p_port)
560 p_mcb->port_inx[dlci] = p_port->inx;
564 p_port->peer_port_pars = *p_pars;
579 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
583 if (!p_port)
591 p_port->error = PORT_PORT_NEG_FAILED;
593 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci);
595 port_rfc_closed (p_port, PORT_PORT_NEG_FAILED);
599 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT))
601 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
620 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
626 if (!p_port)
629 old_signals = p_port->peer_ctrl.modem_signal;
631 event = port_get_signal_changes (p_port, old_signals, p_pars->modem_signal);
633 p_port->peer_ctrl = *p_pars;
635 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT))
636 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
640 if (!(p_port->port_ctrl & PORT_CTRL_IND_RECEIVED))
642 event |= (PORT_EV_CONNECTED & p_port->ev_mask);
645 if (p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED)
647 event |= port_rfc_send_tx_data(p_port);
651 p_port->port_ctrl |= (PORT_CTRL_IND_RECEIVED | PORT_CTRL_IND_RESPONDED);
654 event |= (PORT_EV_BREAK & p_port->ev_mask);
657 if (event && p_port->p_callback)
658 (p_port->p_callback)(event, p_port->inx);
661 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DTRDSR) ? 1 : 0),
662 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RTSCTS) ? 1 : 0),
663 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RI) ? 1 : 0),
664 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DCD) ? 1 : 0));
679 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
684 if (!p_port)
687 if (!(p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED))
689 p_port->port_ctrl |= PORT_CTRL_REQ_CONFIRMED;
691 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)
692 event = (p_port->ev_mask & PORT_EV_CONNECTED);
695 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)
697 event |= port_rfc_send_tx_data(p_port);
701 if (event && p_port->p_callback)
702 (p_port->p_callback)(event, p_port->inx);
716 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
721 if (!p_port)
724 p_port->line_status |= line_status;
735 if ((p_port->p_callback != NULL) && (p_port->ev_mask & event))
736 p_port->p_callback ((p_port->ev_mask & event), p_port->inx);
750 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
754 if (!p_port)
757 port_rfc_closed (p_port, PORT_CLOSED);
771 tPORT *p_port;
776 p_port = &rfc_cb.port.port[0];
777 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
779 if (p_port->rfc.p_mcb == p_mcb)
781 port_rfc_closed (p_port, PORT_PEER_CONNECTION_FAILED);
797 tPORT *p_port;
802 p_port = &rfc_cb.port.port[0];
803 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
805 if (p_port->rfc.p_mcb == p_mcb)
807 port_rfc_closed (p_port, PORT_PEER_TIMEOUT);
823 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
830 if (!p_port)
836 if (p_port->p_data_co_callback)
840 if(p_port->p_data_co_callback(p_port->inx, (UINT8*)p_buf, -1, DATA_CO_CALLBACK_TYPE_INCOMING))
841 port_flow_control_peer(p_port, TRUE, 1);
842 else port_flow_control_peer(p_port, FALSE, 0);
848 if (p_port->p_data_callback)
851 port_flow_control_peer(p_port, TRUE, 1);
853 p_port->p_data_callback (p_port->inx, (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
859 if ((p_port->rx.queue_size + p_buf->len > PORT_RX_CRITICAL_WM)
860 || (p_port->rx.queue.count + 1 > p_port->rx_buf_critical))
871 if (((rx_char1 = p_port->user_port_pars.rx_char1) != 0)
872 && (p_port->ev_mask & PORT_EV_RXFLAG))
886 GKI_enqueue (&p_port->rx.queue, p_buf);
887 p_port->rx.queue_size += p_buf->len;
892 port_flow_control_peer(p_port, FALSE, 0);
895 if (p_port->rx.user_fc)
898 p_port->rx_flag_ev_pending = TRUE;
906 events &= p_port->ev_mask;
908 if (p_port->p_callback && events)
909 p_port->p_callback (events, p_port->inx);
923 tPORT *p_port = (tPORT *)NULL;
935 if ((p_port = port_find_mcb_dlci_port (p_mcb, dlci)) == NULL)
938 p_port->tx.peer_fc = !enable_data;
946 p_port = &rfc_cb.port.port[i];
947 if (!p_port->in_use
948 || (p_port->rfc.p_mcb != p_mcb)
949 || (p_port->rfc.state != RFC_STATE_OPENED))
955 events |= port_flow_control_user (p_port);
958 events |= port_rfc_send_tx_data (p_port);
961 events &= p_port->ev_mask;
964 if (p_port->p_callback && events)
965 (p_port->p_callback)(events, p_port->inx);
981 UINT32 port_rfc_send_tx_data (tPORT *p_port)
987 if (p_port->tx.queue_size > 0)
990 while (!p_port->tx.peer_fc && p_port->rfc.p_mcb && p_port->rfc.p_mcb->peer_ready)
995 if ((p_buf = (BT_HDR *)GKI_dequeue (&p_port->tx.queue)) != NULL)
997 p_port->tx.queue_size -= p_buf->len;
1001 RFCOMM_TRACE_DEBUG1 ("Sending RFCOMM_DataReq tx.queue_size=%d", p_port->tx.queue_size);
1003 RFCOMM_DataReq (p_port->rfc.p_mcb, p_port->dlci, p_buf);
1007 if (p_port->tx.queue_size == 0)
1023 events |= port_flow_control_user (p_port);
1025 return (events & p_port->ev_mask);
1036 void port_rfc_closed (tPORT *p_port, UINT8 res)
1040 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
1042 if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server))
1047 rfc_port_timer_stop (p_port);
1048 p_port->rfc.state = RFC_STATE_CLOSED;
1052 p_mcb->port_inx[p_port->dlci] = 0;
1056 p_port->rfc.p_mcb = NULL;
1062 p_port->dlci &= 0xfe;
1067 if ((p_port->state != PORT_STATE_CLOSING) && (p_port->state != PORT_STATE_CLOSED))
1069 p_port->line_status |= LINE_STATUS_FAILED;
1071 old_signals = p_port->peer_ctrl.modem_signal;
1073 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON);
1075 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal);
1077 if(p_port->ev_mask & PORT_EV_CONNECT_ERR)
1080 RFCOMM_TRACE_EVENT2 ("port_rfc_closed state:%d sending events:%x", p_port->state, events);
1082 if ((p_port->p_callback != NULL) && events)
1083 p_port->p_callback (events, p_port->inx);
1085 if (p_port->p_mgmt_callback)
1086 p_port->p_mgmt_callback (res, p_port->inx);
1088 p_port->rfc.state = RFC_STATE_CLOSED;
1090 port_release_port (p_port);
1104 void port_get_credits (tPORT *p_port, UINT8 k)
1106 p_port->credit_tx = k;
1107 if (p_port->credit_tx == 0)
1108 p_port->tx.peer_fc = TRUE;