******************************************************************************/
#include <string.h>
-#include "bt_target.h"
-#include "gki.h"
-#include "rfcdefs.h"
-#include "port_api.h"
+#include "common/bt_target.h"
+#include "stack/rfcdefs.h"
+#include "stack/port_api.h"
#include "port_int.h"
#include "rfc_int.h"
-#include "l2cdefs.h"
+#include "stack/l2cdefs.h"
#include "btm_int.h"
-#include "btu.h"
+#include "stack/btu.h"
+#include "osi/mutex.h"
+#include "osi/allocator.h"
+#if (defined RFCOMM_INCLUDED && RFCOMM_INCLUDED == TRUE)
static const tPORT_STATE default_port_pars = {
PORT_BAUD_RATE_9600,
memset (&p_port->peer_ctrl, 0, sizeof (p_port->peer_ctrl));
memset (&p_port->rx, 0, sizeof (p_port->rx));
memset (&p_port->tx, 0, sizeof (p_port->tx));
+
+ p_port->tx.queue = fixed_queue_new(QUEUE_SIZE_MAX);
+ p_port->rx.queue = fixed_queue_new(QUEUE_SIZE_MAX);
}
/*******************************************************************************
tPORT_CALLBACK *p_port_cb;
tPORT_STATE user_port_pars;
- PORT_SCHEDULE_LOCK;
+ osi_mutex_global_lock();
RFCOMM_TRACE_DEBUG("port_release_port, p_port:%p", p_port);
- while ((p_buf = (BT_HDR *)GKI_dequeue (&p_port->rx.queue)) != NULL) {
- GKI_freebuf (p_buf);
+ while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->rx.queue)) != NULL) {
+ osi_free (p_buf);
}
p_port->rx.queue_size = 0;
- while ((p_buf = (BT_HDR *)GKI_dequeue (&p_port->tx.queue)) != NULL) {
- GKI_freebuf (p_buf);
+ while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_port->tx.queue)) != NULL) {
+ osi_free (p_buf);
}
p_port->tx.queue_size = 0;
- PORT_SCHEDULE_UNLOCK;
+ osi_mutex_global_unlock();
p_port->state = PORT_STATE_CLOSED;
rfc_check_mcb_active (p_port->rfc.p_mcb);
}
rfc_port_timer_stop (p_port);
+ fixed_queue_free(p_port->tx.queue, NULL);
+ p_port->tx.queue = NULL;
+ fixed_queue_free(p_port->rx.queue, NULL);
+ p_port->rx.queue = NULL;
+
RFCOMM_TRACE_DEBUG ("port_release_port:p_port->keep_port_handle:%d", p_port->keep_port_handle);
if ( p_port->keep_port_handle ) {
RFCOMM_TRACE_DEBUG ("port_release_port:Initialize handle:%d", p_port->inx);
memcpy (p_port->bd_addr, BT_BD_ANY, BD_ADDR_LEN);
} else {
RFCOMM_TRACE_DEBUG ("port_release_port:Clean-up handle:%d", p_port->inx);
+ rfc_port_timer_free (p_port);
memset (p_port, 0, sizeof (tPORT));
}
}
|| !p_port->rfc.p_mcb
|| !p_port->rfc.p_mcb->peer_ready
|| (p_port->tx.queue_size > PORT_TX_HIGH_WM)
- || (GKI_queue_length(&p_port->tx.queue) > PORT_TX_BUF_HIGH_WM);
+ || (fixed_queue_length(p_port->tx.queue) > PORT_TX_BUF_HIGH_WM);
if (p_port->tx.user_fc == fc) {
return (0);
p_port->rx.peer_fc = TRUE;
}
/* if queue count reached credit rx max, set peer fc */
- else if (GKI_queue_length(&p_port->rx.queue) >= p_port->credit_rx_max) {
+ else if (fixed_queue_length(p_port->rx.queue) >= p_port->credit_rx_max) {
p_port->rx.peer_fc = TRUE;
}
}
/* check if it can be resumed now */
if (p_port->rx.peer_fc
&& (p_port->rx.queue_size < PORT_RX_LOW_WM)
- && (GKI_queue_length(&p_port->rx.queue) < PORT_RX_BUF_LOW_WM)) {
+ && (fixed_queue_length(p_port->rx.queue) < PORT_RX_BUF_LOW_WM)) {
p_port->rx.peer_fc = FALSE;
/* If user did not force flow control allow traffic now */
/* Check the size of the rx queue. If it exceeds certain */
/* level and flow control has not been sent to the peer do it now */
else if ( ((p_port->rx.queue_size > PORT_RX_HIGH_WM)
- || (GKI_queue_length(&p_port->rx.queue) > PORT_RX_BUF_HIGH_WM))
+ || (fixed_queue_length(p_port->rx.queue) > PORT_RX_BUF_HIGH_WM))
&& !p_port->rx.peer_fc) {
RFCOMM_TRACE_EVENT ("PORT_DataInd Data reached HW. Sending FC set.");
}
}
+
+#endif ///(defined RFCOMM_INCLUDED && RFCOMM_INCLUDED == TRUE)