2222 */
2323#define SYNC_EVT_SIZE (BT_BUF_RESERVE + BT_HCI_EVT_HDR_SIZE + 255)
2424
25- static bt_buf_rx_freed_cb_t buf_rx_freed_cb ;
26-
27- static void buf_rx_freed_notify (enum bt_buf_type mask )
28- {
29- k_sched_lock ();
30-
31- if (buf_rx_freed_cb ) {
32- buf_rx_freed_cb (mask );
33- }
34-
35- k_sched_unlock ();
36- }
37-
38- #if defined(CONFIG_BT_ISO_RX )
39- static void iso_rx_freed_cb (void )
40- {
41- buf_rx_freed_notify (BT_BUF_ISO_IN );
42- }
43- #endif
44-
4525/* Pool for RX HCI buffers that are always freed by `bt_recv`
4626 * before it returns.
4727 *
@@ -57,37 +37,17 @@ NET_BUF_POOL_FIXED_DEFINE(discardable_pool, CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT,
5737 sizeof (struct bt_buf_data ), NULL );
5838
5939#if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL )
60- static void acl_in_pool_destroy (struct net_buf * buf )
61- {
62- bt_hci_host_num_completed_packets (buf );
63- buf_rx_freed_notify (BT_BUF_ACL_IN );
64- }
65-
66- static void evt_pool_destroy (struct net_buf * buf )
67- {
68- net_buf_destroy (buf );
69- buf_rx_freed_notify (BT_BUF_EVT );
70- }
40+ NET_BUF_POOL_DEFINE (acl_in_pool , BT_BUF_ACL_RX_COUNT ,
41+ BT_BUF_ACL_SIZE (CONFIG_BT_BUF_ACL_RX_SIZE ),
42+ sizeof (struct acl_data ), bt_hci_host_num_completed_packets );
7143
72- NET_BUF_POOL_DEFINE (acl_in_pool , BT_BUF_ACL_RX_COUNT , BT_BUF_ACL_SIZE (CONFIG_BT_BUF_ACL_RX_SIZE ),
73- sizeof (struct acl_data ), acl_in_pool_destroy );
74-
75- NET_BUF_POOL_FIXED_DEFINE (evt_pool , CONFIG_BT_BUF_EVT_RX_COUNT , BT_BUF_EVT_RX_SIZE ,
76- sizeof (struct bt_buf_data ), evt_pool_destroy );
44+ NET_BUF_POOL_FIXED_DEFINE (evt_pool , CONFIG_BT_BUF_EVT_RX_COUNT ,
45+ BT_BUF_EVT_RX_SIZE , sizeof (struct bt_buf_data ),
46+ NULL );
7747#else
78- static void hci_rx_pool_destroy (struct net_buf * buf )
79- {
80- net_buf_destroy (buf );
81-
82- /* When ACL Flow Control is disabled, a single pool is used for events and acl data.
83- * Therefore the callback will always notify about both types of buffers, BT_BUF_EVT and
84- * BT_BUF_ACL_IN.
85- */
86- buf_rx_freed_notify (BT_BUF_EVT | BT_BUF_ACL_IN );
87- }
88-
89- NET_BUF_POOL_FIXED_DEFINE (hci_rx_pool , BT_BUF_RX_COUNT , BT_BUF_RX_SIZE , sizeof (struct acl_data ),
90- hci_rx_pool_destroy );
48+ NET_BUF_POOL_FIXED_DEFINE (hci_rx_pool , BT_BUF_RX_COUNT ,
49+ BT_BUF_RX_SIZE , sizeof (struct acl_data ),
50+ NULL );
9151#endif /* CONFIG_BT_HCI_ACL_FLOW_CONTROL */
9252
9353struct net_buf * bt_buf_get_rx (enum bt_buf_type type , k_timeout_t timeout )
@@ -119,19 +79,6 @@ struct net_buf *bt_buf_get_rx(enum bt_buf_type type, k_timeout_t timeout)
11979 return buf ;
12080}
12181
122- void bt_buf_rx_freed_cb_set (bt_buf_rx_freed_cb_t cb )
123- {
124- k_sched_lock ();
125-
126- buf_rx_freed_cb = cb ;
127-
128- #if defined(CONFIG_BT_ISO_RX )
129- bt_iso_buf_rx_freed_cb_set (cb != NULL ? iso_rx_freed_cb : NULL );
130- #endif
131-
132- k_sched_unlock ();
133- }
134-
13582struct net_buf * bt_buf_get_evt (uint8_t evt , bool discardable ,
13683 k_timeout_t timeout )
13784{
0 commit comments