mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 19:20:51 +00:00
btstack_memory: add goep_server_service and goep_server_connection
# Conflicts: # tool/btstack_memory_generator.py
This commit is contained in:
parent
b3911ea7cc
commit
b8c00949e5
@ -635,6 +635,121 @@ void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel){
|
||||
|
||||
|
||||
|
||||
// MARK: goep_server_service_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_GOEP_SERVER_SERVICES)
|
||||
#if defined(MAX_NO_GOEP_SERVER_SERVICES)
|
||||
#error "Deprecated MAX_NO_GOEP_SERVER_SERVICES defined instead of MAX_NR_GOEP_SERVER_SERVICES. Please update your btstack_config.h to use MAX_NR_GOEP_SERVER_SERVICES."
|
||||
#else
|
||||
#define MAX_NR_GOEP_SERVER_SERVICES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAX_NR_GOEP_SERVER_SERVICES
|
||||
#if MAX_NR_GOEP_SERVER_SERVICES > 0
|
||||
static goep_server_service_t goep_server_service_storage[MAX_NR_GOEP_SERVER_SERVICES];
|
||||
static btstack_memory_pool_t goep_server_service_pool;
|
||||
goep_server_service_t * btstack_memory_goep_server_service_get(void){
|
||||
void * buffer = btstack_memory_pool_get(&goep_server_service_pool);
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(goep_server_service_t));
|
||||
}
|
||||
return (goep_server_service_t *) buffer;
|
||||
}
|
||||
void btstack_memory_goep_server_service_free(goep_server_service_t *goep_server_service){
|
||||
btstack_memory_pool_free(&goep_server_service_pool, goep_server_service);
|
||||
}
|
||||
#else
|
||||
goep_server_service_t * btstack_memory_goep_server_service_get(void){
|
||||
return NULL;
|
||||
}
|
||||
void btstack_memory_goep_server_service_free(goep_server_service_t *goep_server_service){
|
||||
UNUSED(goep_server_service);
|
||||
};
|
||||
#endif
|
||||
#elif defined(HAVE_MALLOC)
|
||||
|
||||
typedef struct {
|
||||
btstack_memory_buffer_t tracking;
|
||||
goep_server_service_t data;
|
||||
} btstack_memory_goep_server_service_t;
|
||||
|
||||
goep_server_service_t * btstack_memory_goep_server_service_get(void){
|
||||
btstack_memory_goep_server_service_t * buffer = (btstack_memory_goep_server_service_t *) malloc(sizeof(btstack_memory_goep_server_service_t));
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(btstack_memory_goep_server_service_t));
|
||||
btstack_memory_tracking_add(&buffer->tracking);
|
||||
return &buffer->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
void btstack_memory_goep_server_service_free(goep_server_service_t *goep_server_service){
|
||||
// reconstruct buffer start
|
||||
btstack_memory_buffer_t * buffer = &((btstack_memory_buffer_t *) goep_server_service)[-1];
|
||||
btstack_memory_tracking_remove(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// MARK: goep_server_connection_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_GOEP_SERVER_CONNECTIONS)
|
||||
#if defined(MAX_NO_GOEP_SERVER_CONNECTIONS)
|
||||
#error "Deprecated MAX_NO_GOEP_SERVER_CONNECTIONS defined instead of MAX_NR_GOEP_SERVER_CONNECTIONS. Please update your btstack_config.h to use MAX_NR_GOEP_SERVER_CONNECTIONS."
|
||||
#else
|
||||
#define MAX_NR_GOEP_SERVER_CONNECTIONS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAX_NR_GOEP_SERVER_CONNECTIONS
|
||||
#if MAX_NR_GOEP_SERVER_CONNECTIONS > 0
|
||||
static goep_server_connection_t goep_server_connection_storage[MAX_NR_GOEP_SERVER_CONNECTIONS];
|
||||
static btstack_memory_pool_t goep_server_connection_pool;
|
||||
goep_server_connection_t * btstack_memory_goep_server_connection_get(void){
|
||||
void * buffer = btstack_memory_pool_get(&goep_server_connection_pool);
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(goep_server_connection_t));
|
||||
}
|
||||
return (goep_server_connection_t *) buffer;
|
||||
}
|
||||
void btstack_memory_goep_server_connection_free(goep_server_connection_t *goep_server_connection){
|
||||
btstack_memory_pool_free(&goep_server_connection_pool, goep_server_connection);
|
||||
}
|
||||
#else
|
||||
goep_server_connection_t * btstack_memory_goep_server_connection_get(void){
|
||||
return NULL;
|
||||
}
|
||||
void btstack_memory_goep_server_connection_free(goep_server_connection_t *goep_server_connection){
|
||||
UNUSED(goep_server_connection);
|
||||
};
|
||||
#endif
|
||||
#elif defined(HAVE_MALLOC)
|
||||
|
||||
typedef struct {
|
||||
btstack_memory_buffer_t tracking;
|
||||
goep_server_connection_t data;
|
||||
} btstack_memory_goep_server_connection_t;
|
||||
|
||||
goep_server_connection_t * btstack_memory_goep_server_connection_get(void){
|
||||
btstack_memory_goep_server_connection_t * buffer = (btstack_memory_goep_server_connection_t *) malloc(sizeof(btstack_memory_goep_server_connection_t));
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(btstack_memory_goep_server_connection_t));
|
||||
btstack_memory_tracking_add(&buffer->tracking);
|
||||
return &buffer->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
void btstack_memory_goep_server_connection_free(goep_server_connection_t *goep_server_connection){
|
||||
// reconstruct buffer start
|
||||
btstack_memory_buffer_t * buffer = &((btstack_memory_buffer_t *) goep_server_connection)[-1];
|
||||
btstack_memory_tracking_remove(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// MARK: hfp_connection_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_HFP_CONNECTIONS)
|
||||
#if defined(MAX_NO_HFP_CONNECTIONS)
|
||||
@ -751,64 +866,6 @@ void btstack_memory_hid_host_connection_free(hid_host_connection_t *hid_host_con
|
||||
|
||||
|
||||
|
||||
// MARK: service_record_item_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_SERVICE_RECORD_ITEMS)
|
||||
#if defined(MAX_NO_SERVICE_RECORD_ITEMS)
|
||||
#error "Deprecated MAX_NO_SERVICE_RECORD_ITEMS defined instead of MAX_NR_SERVICE_RECORD_ITEMS. Please update your btstack_config.h to use MAX_NR_SERVICE_RECORD_ITEMS."
|
||||
#else
|
||||
#define MAX_NR_SERVICE_RECORD_ITEMS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAX_NR_SERVICE_RECORD_ITEMS
|
||||
#if MAX_NR_SERVICE_RECORD_ITEMS > 0
|
||||
static service_record_item_t service_record_item_storage[MAX_NR_SERVICE_RECORD_ITEMS];
|
||||
static btstack_memory_pool_t service_record_item_pool;
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
void * buffer = btstack_memory_pool_get(&service_record_item_pool);
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(service_record_item_t));
|
||||
}
|
||||
return (service_record_item_t *) buffer;
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
btstack_memory_pool_free(&service_record_item_pool, service_record_item);
|
||||
}
|
||||
#else
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
return NULL;
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
UNUSED(service_record_item);
|
||||
};
|
||||
#endif
|
||||
#elif defined(HAVE_MALLOC)
|
||||
|
||||
typedef struct {
|
||||
btstack_memory_buffer_t tracking;
|
||||
service_record_item_t data;
|
||||
} btstack_memory_service_record_item_t;
|
||||
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
btstack_memory_service_record_item_t * buffer = (btstack_memory_service_record_item_t *) malloc(sizeof(btstack_memory_service_record_item_t));
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(btstack_memory_service_record_item_t));
|
||||
btstack_memory_tracking_add(&buffer->tracking);
|
||||
return &buffer->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
// reconstruct buffer start
|
||||
btstack_memory_buffer_t * buffer = &((btstack_memory_buffer_t *) service_record_item)[-1];
|
||||
btstack_memory_tracking_remove(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// MARK: avdtp_stream_endpoint_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_AVDTP_STREAM_ENDPOINTS)
|
||||
#if defined(MAX_NO_AVDTP_STREAM_ENDPOINTS)
|
||||
@ -1040,6 +1097,64 @@ void btstack_memory_avrcp_browsing_connection_free(avrcp_browsing_connection_t *
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// MARK: service_record_item_t
|
||||
#if !defined(HAVE_MALLOC) && !defined(MAX_NR_SERVICE_RECORD_ITEMS)
|
||||
#if defined(MAX_NO_SERVICE_RECORD_ITEMS)
|
||||
#error "Deprecated MAX_NO_SERVICE_RECORD_ITEMS defined instead of MAX_NR_SERVICE_RECORD_ITEMS. Please update your btstack_config.h to use MAX_NR_SERVICE_RECORD_ITEMS."
|
||||
#else
|
||||
#define MAX_NR_SERVICE_RECORD_ITEMS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MAX_NR_SERVICE_RECORD_ITEMS
|
||||
#if MAX_NR_SERVICE_RECORD_ITEMS > 0
|
||||
static service_record_item_t service_record_item_storage[MAX_NR_SERVICE_RECORD_ITEMS];
|
||||
static btstack_memory_pool_t service_record_item_pool;
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
void * buffer = btstack_memory_pool_get(&service_record_item_pool);
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(service_record_item_t));
|
||||
}
|
||||
return (service_record_item_t *) buffer;
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
btstack_memory_pool_free(&service_record_item_pool, service_record_item);
|
||||
}
|
||||
#else
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
return NULL;
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
UNUSED(service_record_item);
|
||||
};
|
||||
#endif
|
||||
#elif defined(HAVE_MALLOC)
|
||||
|
||||
typedef struct {
|
||||
btstack_memory_buffer_t tracking;
|
||||
service_record_item_t data;
|
||||
} btstack_memory_service_record_item_t;
|
||||
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void){
|
||||
btstack_memory_service_record_item_t * buffer = (btstack_memory_service_record_item_t *) malloc(sizeof(btstack_memory_service_record_item_t));
|
||||
if (buffer){
|
||||
memset(buffer, 0, sizeof(btstack_memory_service_record_item_t));
|
||||
btstack_memory_tracking_add(&buffer->tracking);
|
||||
return &buffer->data;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item){
|
||||
// reconstruct buffer start
|
||||
btstack_memory_buffer_t * buffer = &((btstack_memory_buffer_t *) service_record_item)[-1];
|
||||
btstack_memory_tracking_remove(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_BLE
|
||||
|
||||
@ -1881,15 +1996,18 @@ void btstack_memory_init(void){
|
||||
#if MAX_NR_BNEP_CHANNELS > 0
|
||||
btstack_memory_pool_create(&bnep_channel_pool, bnep_channel_storage, MAX_NR_BNEP_CHANNELS, sizeof(bnep_channel_t));
|
||||
#endif
|
||||
#if MAX_NR_GOEP_SERVER_SERVICES > 0
|
||||
btstack_memory_pool_create(&goep_server_service_pool, goep_server_service_storage, MAX_NR_GOEP_SERVER_SERVICES, sizeof(goep_server_service_t));
|
||||
#endif
|
||||
#if MAX_NR_GOEP_SERVER_CONNECTIONS > 0
|
||||
btstack_memory_pool_create(&goep_server_connection_pool, goep_server_connection_storage, MAX_NR_GOEP_SERVER_CONNECTIONS, sizeof(goep_server_connection_t));
|
||||
#endif
|
||||
#if MAX_NR_HFP_CONNECTIONS > 0
|
||||
btstack_memory_pool_create(&hfp_connection_pool, hfp_connection_storage, MAX_NR_HFP_CONNECTIONS, sizeof(hfp_connection_t));
|
||||
#endif
|
||||
#if MAX_NR_HID_HOST_CONNECTIONS > 0
|
||||
btstack_memory_pool_create(&hid_host_connection_pool, hid_host_connection_storage, MAX_NR_HID_HOST_CONNECTIONS, sizeof(hid_host_connection_t));
|
||||
#endif
|
||||
#if MAX_NR_SERVICE_RECORD_ITEMS > 0
|
||||
btstack_memory_pool_create(&service_record_item_pool, service_record_item_storage, MAX_NR_SERVICE_RECORD_ITEMS, sizeof(service_record_item_t));
|
||||
#endif
|
||||
#if MAX_NR_AVDTP_STREAM_ENDPOINTS > 0
|
||||
btstack_memory_pool_create(&avdtp_stream_endpoint_pool, avdtp_stream_endpoint_storage, MAX_NR_AVDTP_STREAM_ENDPOINTS, sizeof(avdtp_stream_endpoint_t));
|
||||
#endif
|
||||
@ -1902,6 +2020,9 @@ void btstack_memory_init(void){
|
||||
#if MAX_NR_AVRCP_BROWSING_CONNECTIONS > 0
|
||||
btstack_memory_pool_create(&avrcp_browsing_connection_pool, avrcp_browsing_connection_storage, MAX_NR_AVRCP_BROWSING_CONNECTIONS, sizeof(avrcp_browsing_connection_t));
|
||||
#endif
|
||||
#if MAX_NR_SERVICE_RECORD_ITEMS > 0
|
||||
btstack_memory_pool_create(&service_record_item_pool, service_record_item_storage, MAX_NR_SERVICE_RECORD_ITEMS, sizeof(service_record_item_t));
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ENABLE_BLE
|
||||
#if MAX_NR_BATTERY_SERVICE_CLIENTS > 0
|
||||
|
@ -65,6 +65,7 @@ extern "C" {
|
||||
#include "classic/bnep.h"
|
||||
#include "classic/btstack_link_key_db.h"
|
||||
#include "classic/btstack_link_key_db_memory.h"
|
||||
#include "classic/goep_server.h"
|
||||
#include "classic/hfp.h"
|
||||
#include "classic/hid_host.h"
|
||||
#include "classic/rfcomm.h"
|
||||
@ -130,6 +131,12 @@ void btstack_memory_bnep_service_free(bnep_service_t *bnep_service);
|
||||
bnep_channel_t * btstack_memory_bnep_channel_get(void);
|
||||
void btstack_memory_bnep_channel_free(bnep_channel_t *bnep_channel);
|
||||
|
||||
// goep_server_service, goep_server_connection
|
||||
goep_server_service_t * btstack_memory_goep_server_service_get(void);
|
||||
void btstack_memory_goep_server_service_free(goep_server_service_t *goep_server_service);
|
||||
goep_server_connection_t * btstack_memory_goep_server_connection_get(void);
|
||||
void btstack_memory_goep_server_connection_free(goep_server_connection_t *goep_server_connection);
|
||||
|
||||
// hfp_connection
|
||||
hfp_connection_t * btstack_memory_hfp_connection_get(void);
|
||||
void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection);
|
||||
@ -138,10 +145,6 @@ void btstack_memory_hfp_connection_free(hfp_connection_t *hfp_connection);
|
||||
hid_host_connection_t * btstack_memory_hid_host_connection_get(void);
|
||||
void btstack_memory_hid_host_connection_free(hid_host_connection_t *hid_host_connection);
|
||||
|
||||
// service_record_item
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void);
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item);
|
||||
|
||||
// avdtp_stream_endpoint
|
||||
avdtp_stream_endpoint_t * btstack_memory_avdtp_stream_endpoint_get(void);
|
||||
void btstack_memory_avdtp_stream_endpoint_free(avdtp_stream_endpoint_t *avdtp_stream_endpoint);
|
||||
@ -158,6 +161,10 @@ void btstack_memory_avrcp_connection_free(avrcp_connection_t *avrcp_connection
|
||||
avrcp_browsing_connection_t * btstack_memory_avrcp_browsing_connection_get(void);
|
||||
void btstack_memory_avrcp_browsing_connection_free(avrcp_browsing_connection_t *avrcp_browsing_connection);
|
||||
|
||||
// service_record_item
|
||||
service_record_item_t * btstack_memory_service_record_item_get(void);
|
||||
void btstack_memory_service_record_item_free(service_record_item_t *service_record_item);
|
||||
|
||||
#endif
|
||||
#ifdef ENABLE_BLE
|
||||
// battery_service_client, gatt_client, hids_client, scan_parameters_service_client, sm_lookup_entry, whitelist_entry, periodic_advertiser_list_entry
|
||||
|
@ -73,6 +73,7 @@ extern "C" {
|
||||
#include "classic/bnep.h"
|
||||
#include "classic/btstack_link_key_db.h"
|
||||
#include "classic/btstack_link_key_db_memory.h"
|
||||
#include "classic/goep_server.h"
|
||||
#include "classic/hfp.h"
|
||||
#include "classic/hid_host.h"
|
||||
#include "classic/rfcomm.h"
|
||||
@ -294,6 +295,7 @@ list_of_classic_structs = [
|
||||
["rfcomm_multiplexer", "rfcomm_service", "rfcomm_channel"],
|
||||
["btstack_link_key_db_memory_entry"],
|
||||
["bnep_service", "bnep_channel"],
|
||||
["goep_server_service", "goep_server_connection"],
|
||||
["hfp_connection"],
|
||||
["hid_host_connection"],
|
||||
["service_record_item"],
|
||||
@ -515,4 +517,4 @@ for struct_names in list_of_mesh_structs:
|
||||
for struct_name in struct_names:
|
||||
writeln(f, replacePlaceholder(test_template, struct_name))
|
||||
writeln(f, "#endif")
|
||||
writeln(f, test_footer)
|
||||
writeln(f, test_footer)
|
||||
|
Loading…
x
Reference in New Issue
Block a user