Lines Matching defs:p_port
40 UINT32 port_rfc_send_tx_data (tPORT *p_port);
41 void port_rfc_closed (tPORT *p_port, UINT8 res);
42 void port_get_credits (tPORT *p_port, UINT8 k);
55 int port_open_continue (tPORT *p_port)
59 RFCOMM_TRACE_EVENT ("port_open_continue, p_port:%p", p_port);
62 if ((p_mcb = rfc_alloc_multiplexer_channel (p_port->bd_addr, TRUE)) == NULL)
65 port_release_port (p_port);
69 p_port->rfc.p_mcb = p_mcb;
71 p_mcb->port_inx[p_port->dlci] = p_port->inx;
74 port_select_mtu (p_port);
78 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu);
108 void port_start_control (tPORT *p_port)
110 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
115 RFCOMM_ControlReq (p_mcb, p_port->dlci, &p_port->local_ctrl);
129 void port_start_par_neg (tPORT *p_port)
131 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
136 RFCOMM_PortNegReq (p_mcb, p_port->dlci, &p_port->user_port_pars);
150 void port_start_close (tPORT *p_port)
152 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
157 p_port->line_status |= LINE_STATUS_FAILED;
158 old_signals = p_port->peer_ctrl.modem_signal;
160 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON);
162 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal);
164 if(p_port->ev_mask & PORT_EV_CONNECT_ERR)
167 if(p_port->ev_mask & PORT_EV_ERR)
170 if ((p_port->p_callback != NULL) && events)
171 p_port->p_callback (events, p_port->inx);
175 if ((p_mcb == NULL) || (p_port->rfc.state == RFC_STATE_CLOSED))
178 if (p_port->p_mgmt_callback)
179 p_port->p_mgmt_callback (PORT_CLOSED, p_port->inx);
181 port_release_port (p_port);
185 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci);
202 tPORT *p_port;
208 p_port = &rfc_cb.port.port[0];
209 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
211 if (p_port->rfc.p_mcb == p_mcb)
216 RFCOMM_ParNegReq (p_mcb, p_port->dlci, p_port->mtu);
224 p_port->error = PORT_PAGE_TIMEOUT;
226 p_port->error = PORT_START_FAILED;
229 p_port->rfc.p_mcb = NULL;
232 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECT_ERR))
233 (p_port->p_callback)(PORT_EV_CONNECT_ERR, p_port->inx);
235 if (p_port->p_mgmt_callback)
236 p_port->p_mgmt_callback (PORT_START_FAILED, p_port->inx);
238 port_release_port (p_port);
264 tPORT *p_port;
269 p_port = &rfc_cb.port.port[0];
270 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
272 if ((p_port->rfc.p_mcb == NULL)
273 || (p_port->rfc.p_mcb == p_mcb))
296 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
302 if (!p_port)
305 p_port = port_find_dlci_port (dlci);
306 if (!p_port)
316 p_mcb->port_inx[dlci] = p_port->inx;
319 memcpy (p_port->bd_addr, p_mcb->bd_addr, BD_ADDR_LEN);
322 port_select_mtu (p_port);
324 p_port->rfc.p_mcb = p_mcb;
325 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu;
326 p_port->peer_mtu = p_port->mtu;
357 port_get_credits (p_port, k);
361 our_k = (p_port->credit_rx_max < RFCOMM_K_MAX) ? p_port->credit_rx_max : RFCOMM_K_MAX;
362 p_port->credit_rx = our_k;
370 RFCOMM_ParNegRsp (p_mcb, dlci, p_port->mtu, our_cl, our_k);
387 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
391 if (!p_port)
401 rfc_send_disc (p_mcb, p_port->dlci);
402 rfc_port_closed (p_port);
420 p_port->mtu = (p_port->mtu < mtu) ? p_port->mtu : mtu;
421 p_port->peer_mtu = p_port->mtu;
425 port_get_credits (p_port, k);
428 if (p_port->state == PORT_STATE_OPENING)
429 RFCOMM_DlcEstablishReq (p_mcb, p_port->dlci, p_port->mtu);
448 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
450 RFCOMM_TRACE_DEBUG ("PORT_DlcEstablishInd p_mcb:%p, dlci:%d mtu:%di, p_port:%p", p_mcb, dlci, mtu, p_port);
455 if (!p_port)
458 p_port = port_find_dlci_port (dlci);
459 if (!p_port)
464 p_mcb->port_inx[dlci] = p_port->inx;
468 if (mtu && (mtu < p_port->peer_mtu))
469 p_port->peer_mtu = mtu;
474 p_port->mtu, RFCOMM_SUCCESS);
478 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED))
479 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx);
481 if (p_port->p_mgmt_callback)
482 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx);
484 p_port->state = PORT_STATE_OPENED;
500 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
504 if (!p_port)
509 p_port->error = PORT_START_FAILED;
510 port_rfc_closed (p_port, PORT_START_FAILED);
515 if (mtu && (mtu < p_port->peer_mtu))
516 p_port->peer_mtu = mtu;
521 if (p_port->p_callback && (p_port->ev_mask & PORT_EV_CONNECTED))
522 (p_port->p_callback)(PORT_EV_CONNECTED, p_port->inx);
524 if (p_port->p_mgmt_callback)
525 p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx);
527 p_port->state = PORT_STATE_OPENED;
530 if ((p_port->uuid == UUID_SERVCLASS_DIALUP_NETWORKING)
531 || (p_port->uuid == UUID_SERVCLASS_FAX))
532 RFCOMM_PortNegReq (p_port->rfc.p_mcb, p_port->dlci, NULL);
534 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
552 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
556 if (!p_port)
559 p_port = port_find_dlci_port (dlci);
560 if (!p_port)
565 p_mcb->port_inx[dlci] = p_port->inx;
569 p_port->peer_port_pars = *p_pars;
584 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
589 if (!p_port)
597 p_port->error = PORT_PORT_NEG_FAILED;
599 RFCOMM_DlcReleaseReq (p_mcb, p_port->dlci);
601 port_rfc_closed (p_port, PORT_PORT_NEG_FAILED);
605 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT))
607 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
626 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
632 if (!p_port)
635 old_signals = p_port->peer_ctrl.modem_signal;
637 event = port_get_signal_changes (p_port, old_signals, p_pars->modem_signal);
639 p_port->peer_ctrl = *p_pars;
641 if (!(p_port->port_ctrl & PORT_CTRL_REQ_SENT))
642 RFCOMM_ControlReq (p_port->rfc.p_mcb, p_port->dlci, &p_port->local_ctrl);
646 if (!(p_port->port_ctrl & PORT_CTRL_IND_RECEIVED))
648 event |= (PORT_EV_CONNECTED & p_port->ev_mask);
651 if (p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED)
653 event |= port_rfc_send_tx_data(p_port);
657 p_port->port_ctrl |= (PORT_CTRL_IND_RECEIVED | PORT_CTRL_IND_RESPONDED);
660 event |= (PORT_EV_BREAK & p_port->ev_mask);
663 if (event && p_port->p_callback)
664 (p_port->p_callback)(event, p_port->inx);
667 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DTRDSR) ? 1 : 0),
668 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RTSCTS) ? 1 : 0),
669 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_RI) ? 1 : 0),
670 ((p_port->peer_ctrl.modem_signal & MODEM_SIGNAL_DCD) ? 1 : 0));
685 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
691 if (!p_port)
694 if (!(p_port->port_ctrl & PORT_CTRL_REQ_CONFIRMED))
696 p_port->port_ctrl |= PORT_CTRL_REQ_CONFIRMED;
698 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)
699 event = (p_port->ev_mask & PORT_EV_CONNECTED);
702 if (p_port->port_ctrl & PORT_CTRL_IND_RECEIVED)
704 event |= port_rfc_send_tx_data(p_port);
708 if (event && p_port->p_callback)
709 (p_port->p_callback)(event, p_port->inx);
723 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
728 if (!p_port)
731 p_port->line_status |= line_status;
742 if ((p_port->p_callback != NULL) && (p_port->ev_mask & event))
743 p_port->p_callback ((p_port->ev_mask & event), p_port->inx);
757 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
761 if (!p_port)
764 port_rfc_closed (p_port, PORT_CLOSED);
778 tPORT *p_port;
783 p_port = &rfc_cb.port.port[0];
784 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
786 if (p_port->rfc.p_mcb == p_mcb)
788 port_rfc_closed (p_port, PORT_PEER_CONNECTION_FAILED);
804 tPORT *p_port;
809 p_port = &rfc_cb.port.port[0];
810 for (i = 0; i < MAX_RFC_PORTS; i++, p_port++)
812 if (p_port->rfc.p_mcb == p_mcb)
814 port_rfc_closed (p_port, PORT_PEER_TIMEOUT);
830 tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
836 RFCOMM_TRACE_EVENT("PORT_DataInd with data length %d, p_mcb:%p,p_port:%p,dlci:%d",
837 p_buf->len, p_mcb, p_port, dlci);
838 if (!p_port)
844 if (p_port->p_data_co_callback)
848 if(p_port->p_data_co_callback(p_port->inx, (UINT8*)p_buf, -1, DATA_CO_CALLBACK_TYPE_INCOMING))
849 port_flow_control_peer(p_port, TRUE, 1);
850 else port_flow_control_peer(p_port, FALSE, 0);
854 else RFCOMM_TRACE_ERROR("PORT_DataInd, p_port:%p, p_data_co_callback is null", p_port);
856 if (p_port->p_data_callback)
859 port_flow_control_peer(p_port, TRUE, 1);
861 p_port->p_data_callback (p_port->inx, (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len);
867 if ((p_port->rx.queue_size + p_buf->len > PORT_RX_CRITICAL_WM)
868 || (p_port->rx.queue.count + 1 > p_port->rx_buf_critical))
879 if (((rx_char1 = p_port->user_port_pars.rx_char1) != 0)
880 && (p_port->ev_mask & PORT_EV_RXFLAG))
894 GKI_enqueue (&p_port->rx.queue, p_buf);
895 p_port->rx.queue_size += p_buf->len;
900 port_flow_control_peer(p_port, FALSE, 0);
903 if (p_port->rx.user_fc)
906 p_port->rx_flag_ev_pending = TRUE;
914 events &= p_port->ev_mask;
916 if (p_port->p_callback && events)
917 p_port->p_callback (events, p_port->inx);
931 tPORT *p_port = (tPORT *)NULL;
943 if ((p_port = port_find_mcb_dlci_port (p_mcb, dlci)) == NULL)
946 p_port->tx.peer_fc = !enable_data;
954 p_port = &rfc_cb.port.port[i];
955 if (!p_port->in_use
956 || (p_port->rfc.p_mcb != p_mcb)
957 || (p_port->rfc.state != RFC_STATE_OPENED))
963 events |= port_flow_control_user (p_port);
966 events |= port_rfc_send_tx_data (p_port);
969 events &= p_port->ev_mask;
972 if (p_port->p_callback && events)
973 (p_port->p_callback)(events, p_port->inx);
989 UINT32 port_rfc_send_tx_data (tPORT *p_port)
995 if (p_port->tx.queue_size > 0)
998 while (!p_port->tx.peer_fc && p_portp_port->rfc.p_mcb->peer_ready)
1003 if ((p_buf = (BT_HDR *)GKI_dequeue (&p_port->tx.queue)) != NULL)
1005 p_port->tx.queue_size -= p_buf->len;
1009 RFCOMM_TRACE_DEBUG ("Sending RFCOMM_DataReq tx.queue_size=%d", p_port->tx.queue_size);
1011 RFCOMM_DataReq (p_port->rfc.p_mcb, p_port->dlci, p_buf);
1015 if (p_port->tx.queue_size == 0)
1031 events |= port_flow_control_user (p_port);
1033 return (events & p_port->ev_mask);
1044 void port_rfc_closed (tPORT *p_port, UINT8 res)
1048 tRFC_MCB *p_mcb = p_port->rfc.p_mcb;
1050 if ((p_port->state == PORT_STATE_OPENING) && (p_port->is_server))
1055 rfc_port_timer_stop (p_port);
1056 p_port->rfc.state = RFC_STATE_CLOSED;
1060 p_mcb->port_inx[p_port->dlci] = 0;
1064 p_port->rfc.p_mcb = NULL;
1070 p_port->dlci &= 0xfe;
1075 if ((p_port->state != PORT_STATE_CLOSING) && (p_port->state != PORT_STATE_CLOSED))
1077 p_port->line_status |= LINE_STATUS_FAILED;
1079 old_signals = p_port->peer_ctrl.modem_signal;
1081 p_port->peer_ctrl.modem_signal &= ~(PORT_DTRDSR_ON | PORT_CTSRTS_ON | PORT_DCD_ON);
1083 events |= port_get_signal_changes (p_port, old_signals, p_port->peer_ctrl.modem_signal);
1085 if(p_port->ev_mask & PORT_EV_CONNECT_ERR)
1088 RFCOMM_TRACE_EVENT ("port_rfc_closed state:%d sending events:%x", p_port->state, events);
1090 if ((p_port->p_callback != NULL) && events)
1091 p_port->p_callback (events, p_port->inx);
1093 if (p_port->p_mgmt_callback)
1094 p_port->p_mgmt_callback (res, p_port->inx);
1096 p_port->rfc.state = RFC_STATE_CLOSED;
1098 port_release_port (p_port);
1112 void port_get_credits (tPORT *p_port, UINT8 k)
1114 p_port->credit_tx = k;
1115 if (p_port->credit_tx == 0)
1116 p_port->tx.peer_fc = TRUE;