xref: /btstack/src/btstack_memory.h (revision 3edc84c5b6b1e23a3d103fe8ce1f6b5ad1df3498)
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] 
392e97c149S[email protected] 
40a3b02b71Smatthias.ringwald /*
41cf49570bSMatthias Ringwald  *  btstack_memory.h
42a3b02b71Smatthias.ringwald  *
43a3b02b71Smatthias.ringwald  *  @brief BTstack memory management via configurable memory pools
44a3b02b71Smatthias.ringwald  *
45a3b02b71Smatthias.ringwald  */
46a3b02b71Smatthias.ringwald 
47f471afd8S[email protected] #ifndef __BTSTACK_MEMORY_H
48f471afd8S[email protected] #define __BTSTACK_MEMORY_H
49a3b02b71Smatthias.ringwald 
50bc64ca62S[email protected] #if defined __cplusplus
51bc64ca62S[email protected] extern "C" {
52bc64ca62S[email protected] #endif
53bc64ca62S[email protected] 
54d0fdae3cS[email protected] #include "btstack-config.h"
55d0fdae3cS[email protected] 
56*3edc84c5SMatthias Ringwald // Core
576527a633S[email protected] #include "hci.h"
586527a633S[email protected] #include "l2cap.h"
596527a633S[email protected] 
60*3edc84c5SMatthias Ringwald // Classic
61*3edc84c5SMatthias Ringwald #include "classic/rfcomm.h"
62*3edc84c5SMatthias Ringwald #include "classic/bnep.h"
63*3edc84c5SMatthias Ringwald #include "classic/hfp.h"
64*3edc84c5SMatthias Ringwald #include "classic/remote_device_db.h"
65*3edc84c5SMatthias Ringwald 
66*3edc84c5SMatthias Ringwald // BLE
67d0fdae3cS[email protected] #ifdef HAVE_BLE
68*3edc84c5SMatthias Ringwald #include "ble/gatt_client.h"
69*3edc84c5SMatthias Ringwald #include "ble/sm.h"
70d0fdae3cS[email protected] #endif
71d0fdae3cS[email protected] 
72f8088037SMilanka Ringwald /* API_START */
73f8088037SMilanka Ringwald 
74f8088037SMilanka Ringwald /**
75f8088037SMilanka Ringwald  * @brief Initializes BTstack memory pools.
76f8088037SMilanka Ringwald  */
77a3b02b71Smatthias.ringwald void btstack_memory_init(void);
78a3b02b71Smatthias.ringwald 
79f8088037SMilanka Ringwald /* API_END */
80f8088037SMilanka Ringwald 
812e97c149S[email protected] // hci_connection
826527a633S[email protected] hci_connection_t * btstack_memory_hci_connection_get(void);
836527a633S[email protected] void   btstack_memory_hci_connection_free(hci_connection_t *hci_connection);
84fdb398c2S[email protected] 
852e97c149S[email protected] // l2cap_service, l2cap_channel
866527a633S[email protected] l2cap_service_t * btstack_memory_l2cap_service_get(void);
876527a633S[email protected] void   btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service);
886527a633S[email protected] l2cap_channel_t * btstack_memory_l2cap_channel_get(void);
896527a633S[email protected] void   btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel);
90fdb398c2S[email protected] 
912e97c149S[email protected] // rfcomm_multiplexer, rfcomm_service, rfcomm_channel
926527a633S[email protected] rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void);
936527a633S[email protected] void   btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer);
946527a633S[email protected] rfcomm_service_t * btstack_memory_rfcomm_service_get(void);
956527a633S[email protected] void   btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service);
966527a633S[email protected] rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void);
976527a633S[email protected] void   btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel);
98fdb398c2S[email protected] 
992e97c149S[email protected] // db_mem_device_name, db_mem_device_link_key, db_mem_service
1006527a633S[email protected] db_mem_device_name_t * btstack_memory_db_mem_device_name_get(void);
1016527a633S[email protected] void   btstack_memory_db_mem_device_name_free(db_mem_device_name_t *db_mem_device_name);
1026527a633S[email protected] db_mem_device_link_key_t * btstack_memory_db_mem_device_link_key_get(void);
1036527a633S[email protected] void   btstack_memory_db_mem_device_link_key_free(db_mem_device_link_key_t *db_mem_device_link_key);
1046527a633S[email protected] db_mem_service_t * btstack_memory_db_mem_service_get(void);
1056527a633S[email protected] void   btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service);
106bc64ca62S[email protected] 
1072e97c149S[email protected] // bnep_service, bnep_channel
1082e97c149S[email protected] bnep_service_t * btstack_memory_bnep_service_get(void);
1092e97c149S[email protected] void   btstack_memory_bnep_service_free(bnep_service_t *bnep_service);
1102e97c149S[email protected] bnep_channel_t * btstack_memory_bnep_channel_get(void);
1112e97c149S[email protected] void   btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel);
1122e97c149S[email protected] 
113ea5029c9SMilanka Ringwald // hfp_connection
114ea5029c9SMilanka Ringwald hfp_connection_t * btstack_memory_hfp_connection_get(void);
115ea5029c9SMilanka Ringwald void   btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection);
116ea5029c9SMilanka Ringwald 
117d0fdae3cS[email protected] #ifdef HAVE_BLE
118cf49570bSMatthias Ringwald // gatt_client, gatt_subclient, whitelist_entry, sm_lookup_entry
119d0fdae3cS[email protected] gatt_client_t * btstack_memory_gatt_client_get(void);
120d0fdae3cS[email protected] void   btstack_memory_gatt_client_free(gatt_client_t *gatt_client);
1212e97c149S[email protected] gatt_subclient_t * btstack_memory_gatt_subclient_get(void);
1222e97c149S[email protected] void   btstack_memory_gatt_subclient_free(gatt_subclient_t *gatt_subclient);
123656bec4fSMatthias Ringwald whitelist_entry_t * btstack_memory_whitelist_entry_get(void);
124656bec4fSMatthias Ringwald void   btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry);
125cf49570bSMatthias Ringwald sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void);
126cf49570bSMatthias Ringwald void   btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry);
127d0fdae3cS[email protected] #endif
128d0fdae3cS[email protected] 
129bc64ca62S[email protected] #if defined __cplusplus
130bc64ca62S[email protected] }
131bc64ca62S[email protected] #endif
132f471afd8S[email protected] 
133f471afd8S[email protected] #endif // __BTSTACK_MEMORY_H
1342e97c149S[email protected] 
135