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 4780e33422SMatthias Ringwald #ifndef BTSTACK_MEMORY_H 4880e33422SMatthias Ringwald #define BTSTACK_MEMORY_H 49a3b02b71Smatthias.ringwald 50bc64ca62S[email protected] #if defined __cplusplus 51bc64ca62S[email protected] extern "C" { 52bc64ca62S[email protected] #endif 53bc64ca62S[email protected] 547907f069SMatthias Ringwald #include "btstack_config.h" 55d0fdae3cS[email protected] 563edc84c5SMatthias Ringwald // Core 576527a633S[email protected] #include "hci.h" 586527a633S[email protected] #include "l2cap.h" 596527a633S[email protected] 603edc84c5SMatthias Ringwald // Classic 618ef7100fSMilanka Ringwald #include "classic/avdtp_sink.h" 628ef7100fSMilanka Ringwald #include "classic/avdtp_source.h" 63be32e7f1SMilanka Ringwald #include "classic/avrcp.h" 64*f399f7fbSMilanka Ringwald #include "classic/bnep.h" 65*f399f7fbSMilanka Ringwald #include "classic/btstack_link_key_db.h" 66*f399f7fbSMilanka Ringwald #include "classic/btstack_link_key_db_memory.h" 67*f399f7fbSMilanka Ringwald #include "classic/hfp.h" 68*f399f7fbSMilanka Ringwald #include "classic/hid_host.h" 69*f399f7fbSMilanka Ringwald #include "classic/rfcomm.h" 70*f399f7fbSMilanka Ringwald #include "classic/sdp_server.h" 713edc84c5SMatthias Ringwald 723edc84c5SMatthias Ringwald // BLE 73a9a4c409SMatthias Ringwald #ifdef ENABLE_BLE 743edc84c5SMatthias Ringwald #include "ble/gatt_client.h" 753edc84c5SMatthias Ringwald #include "ble/sm.h" 7644c5d856SMatthias Ringwald #endif 7744c5d856SMatthias Ringwald 7844c5d856SMatthias Ringwald #ifdef ENABLE_MESH 7977ba3d3fSMatthias Ringwald #include "mesh/mesh_network.h" 80a5a7b6daSMatthias Ringwald #include "mesh/mesh_keys.h" 81a5a7b6daSMatthias Ringwald #include "mesh/mesh_virtual_addresses.h" 82d0fdae3cS[email protected] #endif 83d0fdae3cS[email protected] 84f8088037SMilanka Ringwald /* API_START */ 85f8088037SMilanka Ringwald 86f8088037SMilanka Ringwald /** 87f8088037SMilanka Ringwald * @brief Initializes BTstack memory pools. 88f8088037SMilanka Ringwald */ 89a3b02b71Smatthias.ringwald void btstack_memory_init(void); 90a3b02b71Smatthias.ringwald 91b6269742SMatthias Ringwald /** 92b6269742SMatthias Ringwald * @brief Deinitialize BTstack memory pools 93b6269742SMatthias Ringwald * @note if HAVE_MALLOC is defined, all previously allocated buffers are free'd 94b6269742SMatthias Ringwald */ 95b6269742SMatthias Ringwald void btstack_memory_deinit(void); 96b6269742SMatthias Ringwald 97f8088037SMilanka Ringwald /* API_END */ 98f8088037SMilanka Ringwald 992e97c149S[email protected] // hci_connection 1006527a633S[email protected] hci_connection_t * btstack_memory_hci_connection_get(void); 1016527a633S[email protected] void btstack_memory_hci_connection_free(hci_connection_t *hci_connection); 102fdb398c2S[email protected] 1032e97c149S[email protected] // l2cap_service, l2cap_channel 1046527a633S[email protected] l2cap_service_t * btstack_memory_l2cap_service_get(void); 1056527a633S[email protected] void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service); 1066527a633S[email protected] l2cap_channel_t * btstack_memory_l2cap_channel_get(void); 1076527a633S[email protected] void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel); 108fdb398c2S[email protected] 10944c5d856SMatthias Ringwald #ifdef ENABLE_CLASSIC 1102e97c149S[email protected] // rfcomm_multiplexer, rfcomm_service, rfcomm_channel 1116527a633S[email protected] rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void); 1126527a633S[email protected] void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer); 1136527a633S[email protected] rfcomm_service_t * btstack_memory_rfcomm_service_get(void); 1146527a633S[email protected] void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service); 1156527a633S[email protected] rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void); 1166527a633S[email protected] void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel); 117fdb398c2S[email protected] 1182c455dadSMatthias Ringwald // btstack_link_key_db_memory_entry 1192c455dadSMatthias Ringwald btstack_link_key_db_memory_entry_t * btstack_memory_btstack_link_key_db_memory_entry_get(void); 1202c455dadSMatthias Ringwald void btstack_memory_btstack_link_key_db_memory_entry_free(btstack_link_key_db_memory_entry_t *btstack_link_key_db_memory_entry); 121bc64ca62S[email protected] 1222e97c149S[email protected] // bnep_service, bnep_channel 1232e97c149S[email protected] bnep_service_t * btstack_memory_bnep_service_get(void); 1242e97c149S[email protected] void btstack_memory_bnep_service_free(bnep_service_t *bnep_service); 1252e97c149S[email protected] bnep_channel_t * btstack_memory_bnep_channel_get(void); 1262e97c149S[email protected] void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel); 1272e97c149S[email protected] 128ea5029c9SMilanka Ringwald // hfp_connection 129ea5029c9SMilanka Ringwald hfp_connection_t * btstack_memory_hfp_connection_get(void); 130ea5029c9SMilanka Ringwald void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection); 131ea5029c9SMilanka Ringwald 132*f399f7fbSMilanka Ringwald // hid_host_connection 133*f399f7fbSMilanka Ringwald hid_host_connection_t * btstack_memory_hid_host_connection_get(void); 134*f399f7fbSMilanka Ringwald void btstack_memory_hid_host_connection_free(hid_host_connection_t *hid_host_connection); 135*f399f7fbSMilanka Ringwald 136cd9ee144SMatthias Ringwald // service_record_item 137cd9ee144SMatthias Ringwald service_record_item_t * btstack_memory_service_record_item_get(void); 138cd9ee144SMatthias Ringwald void btstack_memory_service_record_item_free(service_record_item_t *service_record_item); 139cd9ee144SMatthias Ringwald 1400e826a17SMilanka Ringwald // avdtp_stream_endpoint 1410e826a17SMilanka Ringwald avdtp_stream_endpoint_t * btstack_memory_avdtp_stream_endpoint_get(void); 1420e826a17SMilanka Ringwald void btstack_memory_avdtp_stream_endpoint_free(avdtp_stream_endpoint_t *avdtp_stream_endpoint); 14327faf85aSMilanka Ringwald 14412e7f38cSMilanka Ringwald // avdtp_connection 14512e7f38cSMilanka Ringwald avdtp_connection_t * btstack_memory_avdtp_connection_get(void); 14612e7f38cSMilanka Ringwald void btstack_memory_avdtp_connection_free(avdtp_connection_t *avdtp_connection); 14712e7f38cSMilanka Ringwald 14891451a2bSMilanka Ringwald // avrcp_connection 14991451a2bSMilanka Ringwald avrcp_connection_t * btstack_memory_avrcp_connection_get(void); 15091451a2bSMilanka Ringwald void btstack_memory_avrcp_connection_free(avrcp_connection_t *avrcp_connection); 15191451a2bSMilanka Ringwald 152f12a3722SMilanka Ringwald // avrcp_browsing_connection 153f12a3722SMilanka Ringwald avrcp_browsing_connection_t * btstack_memory_avrcp_browsing_connection_get(void); 154f12a3722SMilanka Ringwald void btstack_memory_avrcp_browsing_connection_free(avrcp_browsing_connection_t *avrcp_browsing_connection); 155f12a3722SMilanka Ringwald 15644c5d856SMatthias Ringwald #endif 157a9a4c409SMatthias Ringwald #ifdef ENABLE_BLE 1589c662c9bSMatthias Ringwald // gatt_client, whitelist_entry, sm_lookup_entry 159d0fdae3cS[email protected] gatt_client_t * btstack_memory_gatt_client_get(void); 160d0fdae3cS[email protected] void btstack_memory_gatt_client_free(gatt_client_t *gatt_client); 161656bec4fSMatthias Ringwald whitelist_entry_t * btstack_memory_whitelist_entry_get(void); 162656bec4fSMatthias Ringwald void btstack_memory_whitelist_entry_free(whitelist_entry_t *whitelist_entry); 163cf49570bSMatthias Ringwald sm_lookup_entry_t * btstack_memory_sm_lookup_entry_get(void); 164cf49570bSMatthias Ringwald void btstack_memory_sm_lookup_entry_free(sm_lookup_entry_t *sm_lookup_entry); 16544c5d856SMatthias Ringwald #endif 16644c5d856SMatthias Ringwald #ifdef ENABLE_MESH 167039cbf1dSMatthias Ringwald // mesh_network_pdu, mesh_segmented_pdu, mesh_upper_transport_pdu, mesh_network_key, mesh_transport_key, mesh_virtual_address, mesh_subnet 168ebb73e1fSMatthias Ringwald mesh_network_pdu_t * btstack_memory_mesh_network_pdu_get(void); 169ebb73e1fSMatthias Ringwald void btstack_memory_mesh_network_pdu_free(mesh_network_pdu_t *mesh_network_pdu); 170a4bbc09dSMatthias Ringwald mesh_segmented_pdu_t * btstack_memory_mesh_segmented_pdu_get(void); 171a4bbc09dSMatthias Ringwald void btstack_memory_mesh_segmented_pdu_free(mesh_segmented_pdu_t *mesh_segmented_pdu); 172491f99b3SMatthias Ringwald mesh_upper_transport_pdu_t * btstack_memory_mesh_upper_transport_pdu_get(void); 173491f99b3SMatthias Ringwald void btstack_memory_mesh_upper_transport_pdu_free(mesh_upper_transport_pdu_t *mesh_upper_transport_pdu); 174c0a711d9SMatthias Ringwald mesh_network_key_t * btstack_memory_mesh_network_key_get(void); 175c0a711d9SMatthias Ringwald void btstack_memory_mesh_network_key_free(mesh_network_key_t *mesh_network_key); 17601e2bf94SMatthias Ringwald mesh_transport_key_t * btstack_memory_mesh_transport_key_get(void); 17701e2bf94SMatthias Ringwald void btstack_memory_mesh_transport_key_free(mesh_transport_key_t *mesh_transport_key); 1781f45d603SMatthias Ringwald mesh_virtual_address_t * btstack_memory_mesh_virtual_address_get(void); 1791f45d603SMatthias Ringwald void btstack_memory_mesh_virtual_address_free(mesh_virtual_address_t *mesh_virtual_address); 18001122b73SMatthias Ringwald mesh_subnet_t * btstack_memory_mesh_subnet_get(void); 18101122b73SMatthias Ringwald void btstack_memory_mesh_subnet_free(mesh_subnet_t *mesh_subnet); 182d0fdae3cS[email protected] #endif 183d0fdae3cS[email protected] 184bc64ca62S[email protected] #if defined __cplusplus 185bc64ca62S[email protected] } 186bc64ca62S[email protected] #endif 187f471afd8S[email protected] 18880e33422SMatthias Ringwald #endif // BTSTACK_MEMORY_H 1892e97c149S[email protected] 190