xref: /btstack/src/btstack_memory.c (revision cf49570bee47d681485b34f681e32667c8b7019f)
1a3b02b71Smatthias.ringwald /*
2a0c35809S[email protected]  * Copyright (C) 2014 BlueKitchen GmbH
3a3b02b71Smatthias.ringwald  *
4a3b02b71Smatthias.ringwald  * Redistribution and use in source and binary forms, with or without
5a3b02b71Smatthias.ringwald  * modification, are permitted provided that the following conditions
6a3b02b71Smatthias.ringwald  * are met:
7a3b02b71Smatthias.ringwald  *
8a3b02b71Smatthias.ringwald  * 1. Redistributions of source code must retain the above copyright
9a3b02b71Smatthias.ringwald  *    notice, this list of conditions and the following disclaimer.
10a3b02b71Smatthias.ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11a3b02b71Smatthias.ringwald  *    notice, this list of conditions and the following disclaimer in the
12a3b02b71Smatthias.ringwald  *    documentation and/or other materials provided with the distribution.
13a3b02b71Smatthias.ringwald  * 3. Neither the name of the copyright holders nor the names of
14a3b02b71Smatthias.ringwald  *    contributors may be used to endorse or promote products derived
15a3b02b71Smatthias.ringwald  *    from this software without specific prior written permission.
166b64433eSmatthias.ringwald  * 4. Any redistribution, use, or modification is done solely for
176b64433eSmatthias.ringwald  *    personal benefit and not for any commercial purpose or for
186b64433eSmatthias.ringwald  *    monetary gain.
19a3b02b71Smatthias.ringwald  *
202e97c149S[email protected]  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21a3b02b71Smatthias.ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22a3b02b71Smatthias.ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23a3b02b71Smatthias.ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24a3b02b71Smatthias.ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25a3b02b71Smatthias.ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26a3b02b71Smatthias.ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27a3b02b71Smatthias.ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28a3b02b71Smatthias.ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29a3b02b71Smatthias.ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30a3b02b71Smatthias.ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31a3b02b71Smatthias.ringwald  * SUCH DAMAGE.
32a3b02b71Smatthias.ringwald  *
332e97c149S[email protected]  * Please inquire about commercial licensing options at
342e97c149S[email protected]  * [email protected]
356b64433eSmatthias.ringwald  *
36a3b02b71Smatthias.ringwald  */
37a3b02b71Smatthias.ringwald 
382e97c149S[email protected] 
39a3b02b71Smatthias.ringwald /*
40a3b02b71Smatthias.ringwald  *  btstsack_memory.h
41a3b02b71Smatthias.ringwald  *
42a3b02b71Smatthias.ringwald  *  @brief BTstack memory management via configurable memory pools
43a3b02b71Smatthias.ringwald  *
446f7ecb09S[email protected]  *  @note code semi-atuomatically generated by tools/btstack_memory_generator.py
45a3b02b71Smatthias.ringwald  *
46a3b02b71Smatthias.ringwald  */
47a3b02b71Smatthias.ringwald 
48a3b02b71Smatthias.ringwald #include "btstack_memory.h"
49a3b02b71Smatthias.ringwald #include <btstack/memory_pool.h>
50a3b02b71Smatthias.ringwald 
51a3b02b71Smatthias.ringwald #include <stdlib.h>
52a3b02b71Smatthias.ringwald 
53a3b02b71Smatthias.ringwald 
542e97c149S[email protected] 
55a3b02b71Smatthias.ringwald // MARK: hci_connection_t
56a3b02b71Smatthias.ringwald #ifdef MAX_NO_HCI_CONNECTIONS
57c4d3f927Smatthias.ringwald #if MAX_NO_HCI_CONNECTIONS > 0
58a3b02b71Smatthias.ringwald static hci_connection_t hci_connection_storage[MAX_NO_HCI_CONNECTIONS];
59a3b02b71Smatthias.ringwald static memory_pool_t hci_connection_pool;
606527a633S[email protected] hci_connection_t * btstack_memory_hci_connection_get(void){
6121b856f3S[email protected]     return (hci_connection_t *) memory_pool_get(&hci_connection_pool);
62a3b02b71Smatthias.ringwald }
636527a633S[email protected] void btstack_memory_hci_connection_free(hci_connection_t *hci_connection){
64a3b02b71Smatthias.ringwald     memory_pool_free(&hci_connection_pool, hci_connection);
65a3b02b71Smatthias.ringwald }
66c4d3f927Smatthias.ringwald #else
676527a633S[email protected] hci_connection_t * btstack_memory_hci_connection_get(void){
68c4d3f927Smatthias.ringwald     return NULL;
69c4d3f927Smatthias.ringwald }
706527a633S[email protected] void btstack_memory_hci_connection_free(hci_connection_t *hci_connection){
716f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
722e97c149S[email protected]     (void) hci_connection;
73c4d3f927Smatthias.ringwald };
74c4d3f927Smatthias.ringwald #endif
75a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
766527a633S[email protected] hci_connection_t * btstack_memory_hci_connection_get(void){
776527a633S[email protected]     return (hci_connection_t*) malloc(sizeof(hci_connection_t));
78a3b02b71Smatthias.ringwald }
796527a633S[email protected] void btstack_memory_hci_connection_free(hci_connection_t *hci_connection){
80a3b02b71Smatthias.ringwald     free(hci_connection);
81a3b02b71Smatthias.ringwald }
82e045abdeSmatthias.ringwald #else
836527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_HCI_CONNECTIONS for struct hci_connection is defined. Please, edit the config file."
84a3b02b71Smatthias.ringwald #endif
85a3b02b71Smatthias.ringwald 
86a3b02b71Smatthias.ringwald 
872e97c149S[email protected] 
88a3b02b71Smatthias.ringwald // MARK: l2cap_service_t
89a3b02b71Smatthias.ringwald #ifdef MAX_NO_L2CAP_SERVICES
90c4d3f927Smatthias.ringwald #if MAX_NO_L2CAP_SERVICES > 0
91a3b02b71Smatthias.ringwald static l2cap_service_t l2cap_service_storage[MAX_NO_L2CAP_SERVICES];
92a3b02b71Smatthias.ringwald static memory_pool_t l2cap_service_pool;
936527a633S[email protected] l2cap_service_t * btstack_memory_l2cap_service_get(void){
9421b856f3S[email protected]     return (l2cap_service_t *) memory_pool_get(&l2cap_service_pool);
95a3b02b71Smatthias.ringwald }
966527a633S[email protected] void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service){
97a3b02b71Smatthias.ringwald     memory_pool_free(&l2cap_service_pool, l2cap_service);
98a3b02b71Smatthias.ringwald }
99c4d3f927Smatthias.ringwald #else
1006527a633S[email protected] l2cap_service_t * btstack_memory_l2cap_service_get(void){
101c4d3f927Smatthias.ringwald     return NULL;
102c4d3f927Smatthias.ringwald }
1036527a633S[email protected] void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service){
1046f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
1056f7ecb09S[email protected]     (void) l2cap_service;
106c4d3f927Smatthias.ringwald };
107c4d3f927Smatthias.ringwald #endif
108a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
1096527a633S[email protected] l2cap_service_t * btstack_memory_l2cap_service_get(void){
1106527a633S[email protected]     return (l2cap_service_t*) malloc(sizeof(l2cap_service_t));
111a3b02b71Smatthias.ringwald }
1126527a633S[email protected] void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service){
113a3b02b71Smatthias.ringwald     free(l2cap_service);
114a3b02b71Smatthias.ringwald }
115e045abdeSmatthias.ringwald #else
1166527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_L2CAP_SERVICES for struct l2cap_service is defined. Please, edit the config file."
117a3b02b71Smatthias.ringwald #endif
118a3b02b71Smatthias.ringwald 
119a3b02b71Smatthias.ringwald 
120a3b02b71Smatthias.ringwald // MARK: l2cap_channel_t
121a3b02b71Smatthias.ringwald #ifdef MAX_NO_L2CAP_CHANNELS
122c4d3f927Smatthias.ringwald #if MAX_NO_L2CAP_CHANNELS > 0
123a3b02b71Smatthias.ringwald static l2cap_channel_t l2cap_channel_storage[MAX_NO_L2CAP_CHANNELS];
124a3b02b71Smatthias.ringwald static memory_pool_t l2cap_channel_pool;
1256527a633S[email protected] l2cap_channel_t * btstack_memory_l2cap_channel_get(void){
12621b856f3S[email protected]     return (l2cap_channel_t *) memory_pool_get(&l2cap_channel_pool);
127a3b02b71Smatthias.ringwald }
1286527a633S[email protected] void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel){
129a3b02b71Smatthias.ringwald     memory_pool_free(&l2cap_channel_pool, l2cap_channel);
130a3b02b71Smatthias.ringwald }
131c4d3f927Smatthias.ringwald #else
1326527a633S[email protected] l2cap_channel_t * btstack_memory_l2cap_channel_get(void){
133c4d3f927Smatthias.ringwald     return NULL;
134c4d3f927Smatthias.ringwald }
1356527a633S[email protected] void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel){
1366f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
1376f7ecb09S[email protected]     (void) l2cap_channel;
138c4d3f927Smatthias.ringwald };
139c4d3f927Smatthias.ringwald #endif
140a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
1416527a633S[email protected] l2cap_channel_t * btstack_memory_l2cap_channel_get(void){
1426527a633S[email protected]     return (l2cap_channel_t*) malloc(sizeof(l2cap_channel_t));
143a3b02b71Smatthias.ringwald }
1446527a633S[email protected] void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel){
145a3b02b71Smatthias.ringwald     free(l2cap_channel);
146a3b02b71Smatthias.ringwald }
147e045abdeSmatthias.ringwald #else
1486527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_L2CAP_CHANNELS for struct l2cap_channel is defined. Please, edit the config file."
149a3b02b71Smatthias.ringwald #endif
150a3b02b71Smatthias.ringwald 
151a3b02b71Smatthias.ringwald 
1522e97c149S[email protected] 
153a3b02b71Smatthias.ringwald // MARK: rfcomm_multiplexer_t
154a3b02b71Smatthias.ringwald #ifdef MAX_NO_RFCOMM_MULTIPLEXERS
155c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_MULTIPLEXERS > 0
156a3b02b71Smatthias.ringwald static rfcomm_multiplexer_t rfcomm_multiplexer_storage[MAX_NO_RFCOMM_MULTIPLEXERS];
157a3b02b71Smatthias.ringwald static memory_pool_t rfcomm_multiplexer_pool;
1586527a633S[email protected] rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void){
15921b856f3S[email protected]     return (rfcomm_multiplexer_t *) memory_pool_get(&rfcomm_multiplexer_pool);
160a3b02b71Smatthias.ringwald }
1616527a633S[email protected] void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer){
162a3b02b71Smatthias.ringwald     memory_pool_free(&rfcomm_multiplexer_pool, rfcomm_multiplexer);
163a3b02b71Smatthias.ringwald }
164c4d3f927Smatthias.ringwald #else
1656527a633S[email protected] rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void){
166c4d3f927Smatthias.ringwald     return NULL;
167c4d3f927Smatthias.ringwald }
1686527a633S[email protected] void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer){
1696f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
1706f7ecb09S[email protected]     (void) rfcomm_multiplexer;
171c4d3f927Smatthias.ringwald };
172c4d3f927Smatthias.ringwald #endif
173a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
1746527a633S[email protected] rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void){
1756527a633S[email protected]     return (rfcomm_multiplexer_t*) malloc(sizeof(rfcomm_multiplexer_t));
176a3b02b71Smatthias.ringwald }
1776527a633S[email protected] void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer){
178a3b02b71Smatthias.ringwald     free(rfcomm_multiplexer);
179a3b02b71Smatthias.ringwald }
180e045abdeSmatthias.ringwald #else
1816527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_RFCOMM_MULTIPLEXERS for struct rfcomm_multiplexer is defined. Please, edit the config file."
182a3b02b71Smatthias.ringwald #endif
183a3b02b71Smatthias.ringwald 
184a3b02b71Smatthias.ringwald 
185a3b02b71Smatthias.ringwald // MARK: rfcomm_service_t
186a3b02b71Smatthias.ringwald #ifdef MAX_NO_RFCOMM_SERVICES
187c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_SERVICES > 0
188a3b02b71Smatthias.ringwald static rfcomm_service_t rfcomm_service_storage[MAX_NO_RFCOMM_SERVICES];
189a3b02b71Smatthias.ringwald static memory_pool_t rfcomm_service_pool;
1906527a633S[email protected] rfcomm_service_t * btstack_memory_rfcomm_service_get(void){
19121b856f3S[email protected]     return (rfcomm_service_t *) memory_pool_get(&rfcomm_service_pool);
192a3b02b71Smatthias.ringwald }
1936527a633S[email protected] void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service){
194a3b02b71Smatthias.ringwald     memory_pool_free(&rfcomm_service_pool, rfcomm_service);
195a3b02b71Smatthias.ringwald }
196c4d3f927Smatthias.ringwald #else
1976527a633S[email protected] rfcomm_service_t * btstack_memory_rfcomm_service_get(void){
198c4d3f927Smatthias.ringwald     return NULL;
199c4d3f927Smatthias.ringwald }
2006527a633S[email protected] void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service){
2016f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
2026f7ecb09S[email protected]     (void) rfcomm_service;
203c4d3f927Smatthias.ringwald };
204c4d3f927Smatthias.ringwald #endif
205a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
2066527a633S[email protected] rfcomm_service_t * btstack_memory_rfcomm_service_get(void){
2076527a633S[email protected]     return (rfcomm_service_t*) malloc(sizeof(rfcomm_service_t));
208a3b02b71Smatthias.ringwald }
2096527a633S[email protected] void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service){
210a3b02b71Smatthias.ringwald     free(rfcomm_service);
211a3b02b71Smatthias.ringwald }
212e045abdeSmatthias.ringwald #else
2136527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_RFCOMM_SERVICES for struct rfcomm_service is defined. Please, edit the config file."
214a3b02b71Smatthias.ringwald #endif
215a3b02b71Smatthias.ringwald 
216a3b02b71Smatthias.ringwald 
217a3b02b71Smatthias.ringwald // MARK: rfcomm_channel_t
218a3b02b71Smatthias.ringwald #ifdef MAX_NO_RFCOMM_CHANNELS
219c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_CHANNELS > 0
220a3b02b71Smatthias.ringwald static rfcomm_channel_t rfcomm_channel_storage[MAX_NO_RFCOMM_CHANNELS];
221a3b02b71Smatthias.ringwald static memory_pool_t rfcomm_channel_pool;
2226527a633S[email protected] rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void){
22321b856f3S[email protected]     return (rfcomm_channel_t *) memory_pool_get(&rfcomm_channel_pool);
224a3b02b71Smatthias.ringwald }
2256527a633S[email protected] void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel){
226a3b02b71Smatthias.ringwald     memory_pool_free(&rfcomm_channel_pool, rfcomm_channel);
227a3b02b71Smatthias.ringwald }
228c4d3f927Smatthias.ringwald #else
2296527a633S[email protected] rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void){
230c4d3f927Smatthias.ringwald     return NULL;
231c4d3f927Smatthias.ringwald }
2326527a633S[email protected] void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel){
2336f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
2346f7ecb09S[email protected]     (void) rfcomm_channel;
235c4d3f927Smatthias.ringwald };
236c4d3f927Smatthias.ringwald #endif
237a3b02b71Smatthias.ringwald #elif defined(HAVE_MALLOC)
2386527a633S[email protected] rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void){
2396527a633S[email protected]     return (rfcomm_channel_t*) malloc(sizeof(rfcomm_channel_t));
240a3b02b71Smatthias.ringwald }
2416527a633S[email protected] void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel){
242a3b02b71Smatthias.ringwald     free(rfcomm_channel);
243a3b02b71Smatthias.ringwald }
244e045abdeSmatthias.ringwald #else
2456527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_RFCOMM_CHANNELS for struct rfcomm_channel is defined. Please, edit the config file."
246a3b02b71Smatthias.ringwald #endif
247a3b02b71Smatthias.ringwald 
248fdb398c2S[email protected] 
249e0e5e285Smatthias.ringwald 
250e0e5e285Smatthias.ringwald // MARK: db_mem_device_name_t
251e0e5e285Smatthias.ringwald #ifdef MAX_NO_DB_MEM_DEVICE_NAMES
252c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_DEVICE_NAMES > 0
253e0e5e285Smatthias.ringwald static db_mem_device_name_t db_mem_device_name_storage[MAX_NO_DB_MEM_DEVICE_NAMES];
254e0e5e285Smatthias.ringwald static memory_pool_t db_mem_device_name_pool;
2556527a633S[email protected] db_mem_device_name_t * btstack_memory_db_mem_device_name_get(void){
25621b856f3S[email protected]     return (db_mem_device_name_t *) memory_pool_get(&db_mem_device_name_pool);
2571801b596Smatthias.ringwald }
2586527a633S[email protected] void btstack_memory_db_mem_device_name_free(db_mem_device_name_t *db_mem_device_name){
259e0e5e285Smatthias.ringwald     memory_pool_free(&db_mem_device_name_pool, db_mem_device_name);
2601801b596Smatthias.ringwald }
261c4d3f927Smatthias.ringwald #else
2626527a633S[email protected] db_mem_device_name_t * btstack_memory_db_mem_device_name_get(void){
263c4d3f927Smatthias.ringwald     return NULL;
264c4d3f927Smatthias.ringwald }
2656527a633S[email protected] void btstack_memory_db_mem_device_name_free(db_mem_device_name_t *db_mem_device_name){
2666f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
2676f7ecb09S[email protected]     (void) db_mem_device_name;
268c4d3f927Smatthias.ringwald };
269c4d3f927Smatthias.ringwald #endif
2701801b596Smatthias.ringwald #elif defined(HAVE_MALLOC)
2716527a633S[email protected] db_mem_device_name_t * btstack_memory_db_mem_device_name_get(void){
2726527a633S[email protected]     return (db_mem_device_name_t*) malloc(sizeof(db_mem_device_name_t));
2731801b596Smatthias.ringwald }
2746527a633S[email protected] void btstack_memory_db_mem_device_name_free(db_mem_device_name_t *db_mem_device_name){
275e0e5e285Smatthias.ringwald     free(db_mem_device_name);
276e0e5e285Smatthias.ringwald }
277e045abdeSmatthias.ringwald #else
2786527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_DB_MEM_DEVICE_NAMES for struct db_mem_device_name is defined. Please, edit the config file."
279e0e5e285Smatthias.ringwald #endif
280e0e5e285Smatthias.ringwald 
281e0e5e285Smatthias.ringwald 
282e0e5e285Smatthias.ringwald // MARK: db_mem_device_link_key_t
283e0e5e285Smatthias.ringwald #ifdef MAX_NO_DB_MEM_DEVICE_LINK_KEYS
284c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_DEVICE_LINK_KEYS > 0
285e0e5e285Smatthias.ringwald static db_mem_device_link_key_t db_mem_device_link_key_storage[MAX_NO_DB_MEM_DEVICE_LINK_KEYS];
286e0e5e285Smatthias.ringwald static memory_pool_t db_mem_device_link_key_pool;
2876527a633S[email protected] db_mem_device_link_key_t * btstack_memory_db_mem_device_link_key_get(void){
28821b856f3S[email protected]     return (db_mem_device_link_key_t *) memory_pool_get(&db_mem_device_link_key_pool);
289e0e5e285Smatthias.ringwald }
2906527a633S[email protected] void btstack_memory_db_mem_device_link_key_free(db_mem_device_link_key_t *db_mem_device_link_key){
291e0e5e285Smatthias.ringwald     memory_pool_free(&db_mem_device_link_key_pool, db_mem_device_link_key);
292e0e5e285Smatthias.ringwald }
293c4d3f927Smatthias.ringwald #else
2946527a633S[email protected] db_mem_device_link_key_t * btstack_memory_db_mem_device_link_key_get(void){
295c4d3f927Smatthias.ringwald     return NULL;
296c4d3f927Smatthias.ringwald }
2976527a633S[email protected] void btstack_memory_db_mem_device_link_key_free(db_mem_device_link_key_t *db_mem_device_link_key){
2986f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
2996f7ecb09S[email protected]     (void) db_mem_device_link_key;
300c4d3f927Smatthias.ringwald };
301c4d3f927Smatthias.ringwald #endif
302e0e5e285Smatthias.ringwald #elif defined(HAVE_MALLOC)
3036527a633S[email protected] db_mem_device_link_key_t * btstack_memory_db_mem_device_link_key_get(void){
3046527a633S[email protected]     return (db_mem_device_link_key_t*) malloc(sizeof(db_mem_device_link_key_t));
305e0e5e285Smatthias.ringwald }
3066527a633S[email protected] void btstack_memory_db_mem_device_link_key_free(db_mem_device_link_key_t *db_mem_device_link_key){
307e0e5e285Smatthias.ringwald     free(db_mem_device_link_key);
3081801b596Smatthias.ringwald }
309e045abdeSmatthias.ringwald #else
3106527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_DB_MEM_DEVICE_LINK_KEYS for struct db_mem_device_link_key is defined. Please, edit the config file."
3111801b596Smatthias.ringwald #endif
3121801b596Smatthias.ringwald 
3131801b596Smatthias.ringwald 
3141801b596Smatthias.ringwald // MARK: db_mem_service_t
3151801b596Smatthias.ringwald #ifdef MAX_NO_DB_MEM_SERVICES
316c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_SERVICES > 0
3171801b596Smatthias.ringwald static db_mem_service_t db_mem_service_storage[MAX_NO_DB_MEM_SERVICES];
3181801b596Smatthias.ringwald static memory_pool_t db_mem_service_pool;
3196527a633S[email protected] db_mem_service_t * btstack_memory_db_mem_service_get(void){
32021b856f3S[email protected]     return (db_mem_service_t *) memory_pool_get(&db_mem_service_pool);
3211801b596Smatthias.ringwald }
3226527a633S[email protected] void btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service){
3231801b596Smatthias.ringwald     memory_pool_free(&db_mem_service_pool, db_mem_service);
3241801b596Smatthias.ringwald }
325c4d3f927Smatthias.ringwald #else
3266527a633S[email protected] db_mem_service_t * btstack_memory_db_mem_service_get(void){
327c4d3f927Smatthias.ringwald     return NULL;
328c4d3f927Smatthias.ringwald }
3296527a633S[email protected] void btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service){
3306f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
3316f7ecb09S[email protected]     (void) db_mem_service;
332c4d3f927Smatthias.ringwald };
333c4d3f927Smatthias.ringwald #endif
3341801b596Smatthias.ringwald #elif defined(HAVE_MALLOC)
3356527a633S[email protected] db_mem_service_t * btstack_memory_db_mem_service_get(void){
3366527a633S[email protected]     return (db_mem_service_t*) malloc(sizeof(db_mem_service_t));
3371801b596Smatthias.ringwald }
3386527a633S[email protected] void btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service){
3391801b596Smatthias.ringwald     free(db_mem_service);
3401801b596Smatthias.ringwald }
341e045abdeSmatthias.ringwald #else
3426527a633S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_DB_MEM_SERVICES for struct db_mem_service is defined. Please, edit the config file."
3431801b596Smatthias.ringwald #endif
3441801b596Smatthias.ringwald 
3452e97c149S[email protected] 
3462e97c149S[email protected] 
3472e97c149S[email protected] // MARK: bnep_service_t
3482e97c149S[email protected] #ifdef MAX_NO_BNEP_SERVICES
3492e97c149S[email protected] #if MAX_NO_BNEP_SERVICES > 0
3502e97c149S[email protected] static bnep_service_t bnep_service_storage[MAX_NO_BNEP_SERVICES];
3512e97c149S[email protected] static memory_pool_t bnep_service_pool;
3522e97c149S[email protected] bnep_service_t * btstack_memory_bnep_service_get(void){
35321b856f3S[email protected]     return (bnep_service_t *) memory_pool_get(&bnep_service_pool);
3542e97c149S[email protected] }
3552e97c149S[email protected] void btstack_memory_bnep_service_free(bnep_service_t *bnep_service){
3562e97c149S[email protected]     memory_pool_free(&bnep_service_pool, bnep_service);
3572e97c149S[email protected] }
3582e97c149S[email protected] #else
3592e97c149S[email protected] bnep_service_t * btstack_memory_bnep_service_get(void){
3602e97c149S[email protected]     return NULL;
3612e97c149S[email protected] }
3622e97c149S[email protected] void btstack_memory_bnep_service_free(bnep_service_t *bnep_service){
3632e97c149S[email protected]     // silence compiler warning about unused parameter in a portable way
3642e97c149S[email protected]     (void) bnep_service;
3652e97c149S[email protected] };
3662e97c149S[email protected] #endif
3672e97c149S[email protected] #elif defined(HAVE_MALLOC)
3682e97c149S[email protected] bnep_service_t * btstack_memory_bnep_service_get(void){
3692e97c149S[email protected]     return (bnep_service_t*) malloc(sizeof(bnep_service_t));
3702e97c149S[email protected] }
3712e97c149S[email protected] void btstack_memory_bnep_service_free(bnep_service_t *bnep_service){
3722e97c149S[email protected]     free(bnep_service);
3732e97c149S[email protected] }
3742e97c149S[email protected] #else
3752e97c149S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_BNEP_SERVICES for struct bnep_service is defined. Please, edit the config file."
3762e97c149S[email protected] #endif
3772e97c149S[email protected] 
3782e97c149S[email protected] 
3792e97c149S[email protected] // MARK: bnep_channel_t
3802e97c149S[email protected] #ifdef MAX_NO_BNEP_CHANNELS
3812e97c149S[email protected] #if MAX_NO_BNEP_CHANNELS > 0
3822e97c149S[email protected] static bnep_channel_t bnep_channel_storage[MAX_NO_BNEP_CHANNELS];
3832e97c149S[email protected] static memory_pool_t bnep_channel_pool;
3842e97c149S[email protected] bnep_channel_t * btstack_memory_bnep_channel_get(void){
38521b856f3S[email protected]     return (bnep_channel_t *) memory_pool_get(&bnep_channel_pool);
3862e97c149S[email protected] }
3872e97c149S[email protected] void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel){
3882e97c149S[email protected]     memory_pool_free(&bnep_channel_pool, bnep_channel);
3892e97c149S[email protected] }
3902e97c149S[email protected] #else
3912e97c149S[email protected] bnep_channel_t * btstack_memory_bnep_channel_get(void){
3922e97c149S[email protected]     return NULL;
3932e97c149S[email protected] }
3942e97c149S[email protected] void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel){
3952e97c149S[email protected]     // silence compiler warning about unused parameter in a portable way
3962e97c149S[email protected]     (void) bnep_channel;
3972e97c149S[email protected] };
3982e97c149S[email protected] #endif
3992e97c149S[email protected] #elif defined(HAVE_MALLOC)
4002e97c149S[email protected] bnep_channel_t * btstack_memory_bnep_channel_get(void){
4012e97c149S[email protected]     return (bnep_channel_t*) malloc(sizeof(bnep_channel_t));
4022e97c149S[email protected] }
4032e97c149S[email protected] void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel){
4042e97c149S[email protected]     free(bnep_channel);
4052e97c149S[email protected] }
4062e97c149S[email protected] #else
4072e97c149S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_BNEP_CHANNELS for struct bnep_channel is defined. Please, edit the config file."
4082e97c149S[email protected] #endif
4092e97c149S[email protected] 
4102e97c149S[email protected] 
411ea5029c9SMilanka Ringwald 
412ea5029c9SMilanka Ringwald // MARK: hfp_connection_t
413ea5029c9SMilanka Ringwald #ifdef MAX_NO_HFP_CONNECTIONS
414ea5029c9SMilanka Ringwald #if MAX_NO_HFP_CONNECTIONS > 0
415ea5029c9SMilanka Ringwald static hfp_connection_t hfp_connection_storage[MAX_NO_HFP_CONNECTIONS];
416ea5029c9SMilanka Ringwald static memory_pool_t hfp_connection_pool;
417ea5029c9SMilanka Ringwald hfp_connection_t * btstack_memory_hfp_connection_get(void){
418ea5029c9SMilanka Ringwald     return (hfp_connection_t *) memory_pool_get(&hfp_connection_pool);
419ea5029c9SMilanka Ringwald }
420ea5029c9SMilanka Ringwald void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection){
421ea5029c9SMilanka Ringwald     memory_pool_free(&hfp_connection_pool, hfp_connection);
422ea5029c9SMilanka Ringwald }
423ea5029c9SMilanka Ringwald #else
424ea5029c9SMilanka Ringwald hfp_connection_t * btstack_memory_hfp_connection_get(void){
425ea5029c9SMilanka Ringwald     return NULL;
426ea5029c9SMilanka Ringwald }
427ea5029c9SMilanka Ringwald void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection){
428ea5029c9SMilanka Ringwald     // silence compiler warning about unused parameter in a portable way
429ea5029c9SMilanka Ringwald     (void) hfp_connection;
430ea5029c9SMilanka Ringwald };
431ea5029c9SMilanka Ringwald #endif
432ea5029c9SMilanka Ringwald #elif defined(HAVE_MALLOC)
433ea5029c9SMilanka Ringwald hfp_connection_t * btstack_memory_hfp_connection_get(void){
434ea5029c9SMilanka Ringwald     return (hfp_connection_t*) malloc(sizeof(hfp_connection_t));
435ea5029c9SMilanka Ringwald }
436ea5029c9SMilanka Ringwald void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection){
437ea5029c9SMilanka Ringwald     free(hfp_connection);
438ea5029c9SMilanka Ringwald }
439ea5029c9SMilanka Ringwald #else
440ea5029c9SMilanka Ringwald #error "Neither HAVE_MALLOC nor MAX_NO_HFP_CONNECTIONS for struct hfp_connection is defined. Please, edit the config file."
441ea5029c9SMilanka Ringwald #endif
442ea5029c9SMilanka Ringwald 
443ea5029c9SMilanka Ringwald 
444d0fdae3cS[email protected] #ifdef HAVE_BLE
4452e97c149S[email protected] 
4462e97c149S[email protected] // MARK: gatt_client_t
447d0fdae3cS[email protected] #ifdef MAX_NO_GATT_CLIENTS
448d0fdae3cS[email protected] #if MAX_NO_GATT_CLIENTS > 0
449d0fdae3cS[email protected] static gatt_client_t gatt_client_storage[MAX_NO_GATT_CLIENTS];
450d0fdae3cS[email protected] static memory_pool_t gatt_client_pool;
451d0fdae3cS[email protected] gatt_client_t * btstack_memory_gatt_client_get(void){
45221b856f3S[email protected]     return (gatt_client_t *) memory_pool_get(&gatt_client_pool);
453d0fdae3cS[email protected] }
454d0fdae3cS[email protected] void btstack_memory_gatt_client_free(gatt_client_t *gatt_client){
455d0fdae3cS[email protected]     memory_pool_free(&gatt_client_pool, gatt_client);
456d0fdae3cS[email protected] }
457d0fdae3cS[email protected] #else
458d0fdae3cS[email protected] gatt_client_t * btstack_memory_gatt_client_get(void){
459d0fdae3cS[email protected]     return NULL;
460d0fdae3cS[email protected] }
461d0fdae3cS[email protected] void btstack_memory_gatt_client_free(gatt_client_t *gatt_client){
4626f7ecb09S[email protected]     // silence compiler warning about unused parameter in a portable way
4636f7ecb09S[email protected]     (void) gatt_client;
464d0fdae3cS[email protected] };
465d0fdae3cS[email protected] #endif
466d0fdae3cS[email protected] #elif defined(HAVE_MALLOC)
467d0fdae3cS[email protected] gatt_client_t * btstack_memory_gatt_client_get(void){
468d0fdae3cS[email protected]     return (gatt_client_t*) malloc(sizeof(gatt_client_t));
469d0fdae3cS[email protected] }
470d0fdae3cS[email protected] void btstack_memory_gatt_client_free(gatt_client_t *gatt_client){
471d0fdae3cS[email protected]     free(gatt_client);
472d0fdae3cS[email protected] }
473d0fdae3cS[email protected] #else
474d0fdae3cS[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_GATT_CLIENTS for struct gatt_client is defined. Please, edit the config file."
475d0fdae3cS[email protected] #endif
4762e97c149S[email protected] 
4772e97c149S[email protected] 
4782e97c149S[email protected] // MARK: gatt_subclient_t
4792e97c149S[email protected] #ifdef MAX_NO_GATT_SUBCLIENTS
4802e97c149S[email protected] #if MAX_NO_GATT_SUBCLIENTS > 0
4812e97c149S[email protected] static gatt_subclient_t gatt_subclient_storage[MAX_NO_GATT_SUBCLIENTS];
4822e97c149S[email protected] static memory_pool_t gatt_subclient_pool;
4832e97c149S[email protected] gatt_subclient_t * btstack_memory_gatt_subclient_get(void){
48421b856f3S[email protected]     return (gatt_subclient_t *) memory_pool_get(&gatt_subclient_pool);
4852e97c149S[email protected] }
4862e97c149S[email protected] void btstack_memory_gatt_subclient_free(gatt_subclient_t *gatt_subclient){
4872e97c149S[email protected]     memory_pool_free(&gatt_subclient_pool, gatt_subclient);
4882e97c149S[email protected] }
4892e97c149S[email protected] #else
4902e97c149S[email protected] gatt_subclient_t * btstack_memory_gatt_subclient_get(void){
4912e97c149S[email protected]     return NULL;
4922e97c149S[email protected] }
4932e97c149S[email protected] void btstack_memory_gatt_subclient_free(gatt_subclient_t *gatt_subclient){
4942e97c149S[email protected]     // silence compiler warning about unused parameter in a portable way
4952e97c149S[email protected]     (void) gatt_subclient;
4962e97c149S[email protected] };
4972e97c149S[email protected] #endif
4982e97c149S[email protected] #elif defined(HAVE_MALLOC)
4992e97c149S[email protected] gatt_subclient_t * btstack_memory_gatt_subclient_get(void){
5002e97c149S[email protected]     return (gatt_subclient_t*) malloc(sizeof(gatt_subclient_t));
5012e97c149S[email protected] }
5022e97c149S[email protected] void btstack_memory_gatt_subclient_free(gatt_subclient_t *gatt_subclient){
5032e97c149S[email protected]     free(gatt_subclient);
5042e97c149S[email protected] }
5052e97c149S[email protected] #else
5062e97c149S[email protected] #error "Neither HAVE_MALLOC nor MAX_NO_GATT_SUBCLIENTS for struct gatt_subclient is defined. Please, edit the config file."
507d0fdae3cS[email protected] #endif
508fdb398c2S[email protected] 
5092e97c149S[email protected] 
510656bec4fSMatthias Ringwald // MARK: whitelist_entry_t
511656bec4fSMatthias Ringwald #ifdef MAX_NO_WHITELIST_ENTRIES
512656bec4fSMatthias Ringwald #if MAX_NO_WHITELIST_ENTRIES > 0
513656bec4fSMatthias Ringwald static whitelist_entry_t whitelist_entry_storage[MAX_NO_WHITELIST_ENTRIES];
514656bec4fSMatthias Ringwald static memory_pool_t whitelist_entry_pool;
515656bec4fSMatthias Ringwald whitelist_entry_t * btstack_memory_whitelist_entry_get(void){
516656bec4fSMatthias Ringwald     return (whitelist_entry_t *) memory_pool_get(&whitelist_entry_pool);
517656bec4fSMatthias Ringwald }
518656bec4fSMatthias Ringwald void btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry){
519656bec4fSMatthias Ringwald     memory_pool_free(&whitelist_entry_pool, whitelist_entry);
520656bec4fSMatthias Ringwald }
521656bec4fSMatthias Ringwald #else
522656bec4fSMatthias Ringwald whitelist_entry_t * btstack_memory_whitelist_entry_get(void){
523656bec4fSMatthias Ringwald     return NULL;
524656bec4fSMatthias Ringwald }
525656bec4fSMatthias Ringwald void btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry){
526656bec4fSMatthias Ringwald     // silence compiler warning about unused parameter in a portable way
527656bec4fSMatthias Ringwald     (void) whitelist_entry;
528656bec4fSMatthias Ringwald };
529656bec4fSMatthias Ringwald #endif
530656bec4fSMatthias Ringwald #elif defined(HAVE_MALLOC)
531656bec4fSMatthias Ringwald whitelist_entry_t * btstack_memory_whitelist_entry_get(void){
532656bec4fSMatthias Ringwald     return (whitelist_entry_t*) malloc(sizeof(whitelist_entry_t));
533656bec4fSMatthias Ringwald }
534656bec4fSMatthias Ringwald void btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry){
535656bec4fSMatthias Ringwald     free(whitelist_entry);
536656bec4fSMatthias Ringwald }
537656bec4fSMatthias Ringwald #else
538656bec4fSMatthias Ringwald #error "Neither HAVE_MALLOC nor MAX_NO_WHITELIST_ENTRIES for struct whitelist_entry is defined. Please, edit the config file."
539656bec4fSMatthias Ringwald #endif
540656bec4fSMatthias Ringwald 
541656bec4fSMatthias Ringwald 
542*cf49570bSMatthias Ringwald // MARK: sm_lookup_entry_t
543*cf49570bSMatthias Ringwald #ifdef MAX_NO_SM_LOOKUP_ENTRIES
544*cf49570bSMatthias Ringwald #if MAX_NO_SM_LOOKUP_ENTRIES > 0
545*cf49570bSMatthias Ringwald static sm_lookup_entry_t sm_lookup_entry_storage[MAX_NO_SM_LOOKUP_ENTRIES];
546*cf49570bSMatthias Ringwald static memory_pool_t sm_lookup_entry_pool;
547*cf49570bSMatthias Ringwald sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void){
548*cf49570bSMatthias Ringwald     return (sm_lookup_entry_t *) memory_pool_get(&sm_lookup_entry_pool);
549*cf49570bSMatthias Ringwald }
550*cf49570bSMatthias Ringwald void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry){
551*cf49570bSMatthias Ringwald     memory_pool_free(&sm_lookup_entry_pool, sm_lookup_entry);
552*cf49570bSMatthias Ringwald }
553*cf49570bSMatthias Ringwald #else
554*cf49570bSMatthias Ringwald sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void){
555*cf49570bSMatthias Ringwald     return NULL;
556*cf49570bSMatthias Ringwald }
557*cf49570bSMatthias Ringwald void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry){
558*cf49570bSMatthias Ringwald     // silence compiler warning about unused parameter in a portable way
559*cf49570bSMatthias Ringwald     (void) sm_lookup_entry;
560*cf49570bSMatthias Ringwald };
561*cf49570bSMatthias Ringwald #endif
562*cf49570bSMatthias Ringwald #elif defined(HAVE_MALLOC)
563*cf49570bSMatthias Ringwald sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void){
564*cf49570bSMatthias Ringwald     return (sm_lookup_entry_t*) malloc(sizeof(sm_lookup_entry_t));
565*cf49570bSMatthias Ringwald }
566*cf49570bSMatthias Ringwald void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry){
567*cf49570bSMatthias Ringwald     free(sm_lookup_entry);
568*cf49570bSMatthias Ringwald }
569*cf49570bSMatthias Ringwald #else
570*cf49570bSMatthias Ringwald #error "Neither HAVE_MALLOC nor MAX_NO_SM_LOOKUP_ENTRIES for struct sm_lookup_entry is defined. Please, edit the config file."
571*cf49570bSMatthias Ringwald #endif
572*cf49570bSMatthias Ringwald 
573*cf49570bSMatthias Ringwald 
5742e97c149S[email protected] #endif
575a3b02b71Smatthias.ringwald // init
576a3b02b71Smatthias.ringwald void btstack_memory_init(void){
577c4d3f927Smatthias.ringwald #if MAX_NO_HCI_CONNECTIONS > 0
578a3b02b71Smatthias.ringwald     memory_pool_create(&hci_connection_pool, hci_connection_storage, MAX_NO_HCI_CONNECTIONS, sizeof(hci_connection_t));
579a3b02b71Smatthias.ringwald #endif
580c4d3f927Smatthias.ringwald #if MAX_NO_L2CAP_SERVICES > 0
581a3b02b71Smatthias.ringwald     memory_pool_create(&l2cap_service_pool, l2cap_service_storage, MAX_NO_L2CAP_SERVICES, sizeof(l2cap_service_t));
582a3b02b71Smatthias.ringwald #endif
583c4d3f927Smatthias.ringwald #if MAX_NO_L2CAP_CHANNELS > 0
584a3b02b71Smatthias.ringwald     memory_pool_create(&l2cap_channel_pool, l2cap_channel_storage, MAX_NO_L2CAP_CHANNELS, sizeof(l2cap_channel_t));
585a3b02b71Smatthias.ringwald #endif
586c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_MULTIPLEXERS > 0
587a3b02b71Smatthias.ringwald     memory_pool_create(&rfcomm_multiplexer_pool, rfcomm_multiplexer_storage, MAX_NO_RFCOMM_MULTIPLEXERS, sizeof(rfcomm_multiplexer_t));
588a3b02b71Smatthias.ringwald #endif
589c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_SERVICES > 0
590a3b02b71Smatthias.ringwald     memory_pool_create(&rfcomm_service_pool, rfcomm_service_storage, MAX_NO_RFCOMM_SERVICES, sizeof(rfcomm_service_t));
591a3b02b71Smatthias.ringwald #endif
592c4d3f927Smatthias.ringwald #if MAX_NO_RFCOMM_CHANNELS > 0
593a3b02b71Smatthias.ringwald     memory_pool_create(&rfcomm_channel_pool, rfcomm_channel_storage, MAX_NO_RFCOMM_CHANNELS, sizeof(rfcomm_channel_t));
594a3b02b71Smatthias.ringwald #endif
595c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_DEVICE_NAMES > 0
596e0e5e285Smatthias.ringwald     memory_pool_create(&db_mem_device_name_pool, db_mem_device_name_storage, MAX_NO_DB_MEM_DEVICE_NAMES, sizeof(db_mem_device_name_t));
597e0e5e285Smatthias.ringwald #endif
598c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_DEVICE_LINK_KEYS > 0
599e0e5e285Smatthias.ringwald     memory_pool_create(&db_mem_device_link_key_pool, db_mem_device_link_key_storage, MAX_NO_DB_MEM_DEVICE_LINK_KEYS, sizeof(db_mem_device_link_key_t));
6001801b596Smatthias.ringwald #endif
601c4d3f927Smatthias.ringwald #if MAX_NO_DB_MEM_SERVICES > 0
6021801b596Smatthias.ringwald     memory_pool_create(&db_mem_service_pool, db_mem_service_storage, MAX_NO_DB_MEM_SERVICES, sizeof(db_mem_service_t));
6031801b596Smatthias.ringwald #endif
6042e97c149S[email protected] #if MAX_NO_BNEP_SERVICES > 0
6052e97c149S[email protected]     memory_pool_create(&bnep_service_pool, bnep_service_storage, MAX_NO_BNEP_SERVICES, sizeof(bnep_service_t));
6062e97c149S[email protected] #endif
6072e97c149S[email protected] #if MAX_NO_BNEP_CHANNELS > 0
6082e97c149S[email protected]     memory_pool_create(&bnep_channel_pool, bnep_channel_storage, MAX_NO_BNEP_CHANNELS, sizeof(bnep_channel_t));
6092e97c149S[email protected] #endif
610ea5029c9SMilanka Ringwald #if MAX_NO_HFP_CONNECTIONS > 0
611ea5029c9SMilanka Ringwald     memory_pool_create(&hfp_connection_pool, hfp_connection_storage, MAX_NO_HFP_CONNECTIONS, sizeof(hfp_connection_t));
612ea5029c9SMilanka Ringwald #endif
613a7d12effS[email protected] #ifdef HAVE_BLE
614d0fdae3cS[email protected] #if MAX_NO_GATT_CLIENTS > 0
615d0fdae3cS[email protected]     memory_pool_create(&gatt_client_pool, gatt_client_storage, MAX_NO_GATT_CLIENTS, sizeof(gatt_client_t));
616d0fdae3cS[email protected] #endif
6172e97c149S[email protected] #if MAX_NO_GATT_SUBCLIENTS > 0
6182e97c149S[email protected]     memory_pool_create(&gatt_subclient_pool, gatt_subclient_storage, MAX_NO_GATT_SUBCLIENTS, sizeof(gatt_subclient_t));
6192e97c149S[email protected] #endif
620656bec4fSMatthias Ringwald #if MAX_NO_WHITELIST_ENTRIES > 0
621656bec4fSMatthias Ringwald     memory_pool_create(&whitelist_entry_pool, whitelist_entry_storage, MAX_NO_WHITELIST_ENTRIES, sizeof(whitelist_entry_t));
622656bec4fSMatthias Ringwald #endif
623*cf49570bSMatthias Ringwald #if MAX_NO_SM_LOOKUP_ENTRIES > 0
624*cf49570bSMatthias Ringwald     memory_pool_create(&sm_lookup_entry_pool, sm_lookup_entry_storage, MAX_NO_SM_LOOKUP_ENTRIES, sizeof(sm_lookup_entry_t));
625*cf49570bSMatthias Ringwald #endif
626a7d12effS[email protected] #endif
627a3b02b71Smatthias.ringwald }
628