GKI cleanup - Replaced usage of GKI queue with OSI fixed_queue
* Added new functions to OSI:
- fixed_queue_init()
- fixed_queue_length()
- fixed_queue_try_remove_from_queue()
- fixed_queue_try_peek_last()
* Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first()
* Replaced usage of GKI queue functions with OSI fixed_queue functions:
- GKI_init_q() -> fixed_queue_new(SIZE_MAX)
NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory /
state that needs to be released by calling fixed_queue_free()
- GKI_enqueue() -> fixed_queue_enqueue()
- GKI_dequeue() -> fixed_queue_try_dequeue()
NOTE: fixed_queue_try_dequeue() is non-blocking
- GKI_queue_length() -> fixed_queue_length()
- GKI_queue_is_empty() -> fixed_queue_is_empty()
- GKI_getfirst() -> fixed_queue_try_peek_first()
- GKI_getlast() -> fixed_queue_try_peek_last()
- GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue()
- Queue elements iteration.
In the fixed_queue implementation we have to use the underlying
list_t mechanism to iterate over the elements.
OLD:
p = GKI_getfirst(queue);
...
while ((p = GKI_getnext(p) != NULL) {
...
}
NEW:
list_t *list = fixed_queue_get_list(queue);
for (const list_node_t *node = list_begin(list);
node != list_end(list); node = list_next(node)) {
p = list_node(node);
}
* Remove initialization of the GKI module, because it is not needed
anymore
* Removed unused files in GKI:
gki/common/gki_common.h
gki/ulinux/gki_int.h
gki/ulinux/gki_ulinux.c
Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
diff --git a/stack/avdt/avdt_int.h b/stack/avdt/avdt_int.h
index fb1b313..b696dd8 100644
--- a/stack/avdt/avdt_int.h
+++ b/stack/avdt/avdt_int.h
@@ -24,6 +24,7 @@
#ifndef AVDT_INT_H
#define AVDT_INT_H
+#include "osi/include/fixed_queue.h"
#include "gki.h"
#include "avdt_api.h"
#include "avdtc_api.h"
@@ -423,8 +424,8 @@
typedef struct {
BD_ADDR peer_addr; /* BD address of peer */
TIMER_LIST_ENT timer_entry; /* CCB timer list entry */
- BUFFER_Q cmd_q; /* Queue for outgoing command messages */
- BUFFER_Q rsp_q; /* Queue for outgoing response and reject messages */
+ fixed_queue_t *cmd_q; /* Queue for outgoing command messages */
+ fixed_queue_t *rsp_q; /* Queue for outgoing response and reject messages */
tAVDT_CTRL_CBACK *proc_cback; /* Procedure callback function */
tAVDT_CTRL_CBACK *p_conn_cback; /* Connection/disconnection callback function */
void *p_proc_data; /* Pointer to data storage for procedure */
@@ -450,7 +451,7 @@
BT_HDR *p_buf;
UINT32 time_stamp;
#if AVDT_MULTIPLEXING == TRUE
- BUFFER_Q frag_q; /* Queue for outgoing media fragments. p_buf should be 0 */
+ fixed_queue_t *frag_q; /* Queue for outgoing media fragments. p_buf should be 0 */
UINT8 *p_data;
UINT32 data_len;
#endif
@@ -496,7 +497,7 @@
BOOLEAN cong; /* Whether media transport channel is congested */
UINT8 close_code; /* Error code received in close response */
#if AVDT_MULTIPLEXING == TRUE
- BUFFER_Q frag_q; /* Queue for outgoing media fragments */
+ fixed_queue_t *frag_q; /* Queue for outgoing media fragments */
UINT32 frag_off; /* length of already received media fragments */
UINT32 frag_org_len; /* original length before fragmentation of receiving media packet */
UINT8 *p_next_frag; /* next fragment to send */
@@ -669,7 +670,8 @@
extern void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_tc_timer(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
extern void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data);
-extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len, BUFFER_Q *pq);
+extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data,
+ UINT32 *p_data_len, fixed_queue_t *pq);
/* msg function declarations */
extern BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg);