Skip to content

Commit 0583a04

Browse files
Bluedroid stack dynamic allocation changes to optimise DRAM usage
Structures allocated dynamically: tACL_CONN, tBTM_PM_MCB, tBTM_SEC_DEV_REC, tGATT_TCB, tGATT_CLCB, tL2C_LCB, tL2C_CCB, tSDP_RECORD Total dynamic allocation size ~19KB. Peak dram usage reduced by ~12KB when in BT classic + BLE scenario(1 a2dp sink + 1 BLE gatt server)
1 parent ec661be commit 0583a04

30 files changed

+1034
-814
lines changed

components/bt/common/osi/include/osi/list.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ bool list_is_empty(const list_t *list);
3434
// |list| may not be NULL.
3535
bool list_contains(const list_t *list, const void *data);
3636

37+
// Returns list_node which contains |data|, NULL otherwise.
38+
// |list| may not be NULL.
39+
list_node_t *list_get_node(const list_t *list, const void *data);
40+
3741
// Returns the length of the |list|. |list| may not be NULL.
3842
size_t list_length(const list_t *list);
3943

components/bt/common/osi/list.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ bool list_contains(const list_t *list, const void *data)
6868
return false;
6969
}
7070

71+
list_node_t *list_get_node(const list_t *list, const void *data)
72+
{
73+
assert(list != NULL);
74+
assert(data != NULL);
75+
list_node_t *p_node_ret = NULL;
76+
for (list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) {
77+
if (list_node(node) == data) {
78+
p_node_ret = node;
79+
break;
80+
}
81+
}
82+
83+
return p_node_ret;
84+
}
85+
7186
size_t list_length(const list_t *list)
7287
{
7388
assert(list != NULL);

0 commit comments

Comments
 (0)