mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
component/bt : remove all GKI reference
1. remove GKI(not use osi_free_and_reset) 2. modify mutex/semaphore to individual directory 3. set osi_malloc as malloc(previously use calloc) 4. change osi allocator debug osi_free 5. fix rebase of remove GKI
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "port_api.h"
|
||||
#include "port_int.h"
|
||||
@@ -125,6 +124,9 @@ void port_set_defaults (tPORT *p_port)
|
||||
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(SIZE_MAX);
|
||||
p_port->rx.queue = fixed_queue_new(SIZE_MAX);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -203,21 +205,21 @@ void port_release_port (tPORT *p_port)
|
||||
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;
|
||||
|
||||
@@ -230,6 +232,11 @@ void port_release_port (tPORT *p_port)
|
||||
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);
|
||||
@@ -402,7 +409,7 @@ UINT32 port_flow_control_user (tPORT *p_port)
|
||||
|| !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);
|
||||
@@ -514,7 +521,7 @@ void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -527,7 +534,7 @@ void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count)
|
||||
/* 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 */
|
||||
@@ -546,7 +553,7 @@ void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count)
|
||||
/* 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.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user