Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Memory Management

The following APIs provides the memory buffer management used by the application and the upper layer stack of the AIROC Bluetooth Stack. More...

Modules

 Data Structures
 
 Functions
 
 GKI
 Defines the interfaces for Buffer , Timer and Event Management Services.
 

Functions

uint16_t wiced_bt_buffer_poolutilization (uint8_t pool_id)
 Get specific buffer pool utilization. More...
 
void * wiced_memory_permanent_allocate (uint32_t size)
 Allocates memory for permanent usage. More...
 
uint32_t wiced_memory_get_free_bytes (void)
 Returns the number of free bytes of RAM left. More...
 
wiced_bool_t wiced_memory_set_application_thread_stack_size (uint16_t new_stack_size)
 Update the stack size of the application thread (MPAF) NOTE : This API will work only when invoked from SPAR_CRT_SETUP() More...
 
wiced_bt_buffer_pool_twiced_bt_create_pool (uint32_t buffer_size, uint32_t buffer_cnt)
 Creates a private buffer pool dedicated for the application usage. More...
 
void * wiced_bt_get_buffer_from_pool (wiced_bt_buffer_pool_t *p_pool)
 Allocates a buffer from the private pool. More...
 
uint32_t wiced_bt_get_buffer_count (wiced_bt_buffer_pool_t *p_pool)
 To get the number of buffers available in the pool. More...
 
void * wiced_bt_get_buffer (uint16_t buffer_size)
 Allocates a buffer from the public pools. More...
 
void wiced_bt_free_buffer (void *p_buf)
 Frees an existing buffer in a pool. More...
 
uint32_t wiced_bt_get_buffer_size (void *p_buf)
 Gets the buffer size. More...
 
wiced_result_t wiced_bt_get_buffer_usage (wiced_bt_buffer_statistics_t *p_buffer_stat, uint16_t size)
 Dumps dynamic buffer usage (see wiced_bt_buffer_statistics_t),from the last start of the system. More...
 

Detailed Description

The following APIs provides the memory buffer management used by the application and the upper layer stack of the AIROC Bluetooth Stack.

Note
For more information on application buffer pool allocation, please refer to the app note /doc/WICED-Application-Buffer-Pools.pdf

Function Documentation

uint16_t wiced_bt_buffer_poolutilization ( uint8_t  pool_id)

Get specific buffer pool utilization.

Parameters
sizeParameters pool_id - (input) pool ID
Returns
Return % of buffers used from 0 to 100
wiced_bt_buffer_pool_t* wiced_bt_create_pool ( uint32_t  buffer_size,
uint32_t  buffer_cnt 
)

Creates a private buffer pool dedicated for the application usage.

Parameters
buffer_sizeThe size of the buffers in the pool
buffer_cntThe number of buffers in the pool
Returns
The pointer to the created pool on success NULL on failure

Note: The max number of buffer pools configured in wiced_bt_cfg_settings_t.max_number_of_buffer_pools must be increased for each buffer pool the application creates.

void wiced_bt_free_buffer ( void *  p_buf)

Frees an existing buffer in a pool.

Parameters
p_bufThe pointer to the start of the buffer to be freed
Returns
void
void* wiced_bt_get_buffer ( uint16_t  buffer_size)

Allocates a buffer from the public pools.

Public pools shall be specified using wiced_bt_cfg_buf_pool_t from the application.

Parameters
buffer_sizeThe size of the buffer
Returns
The pointer to the buffer on success NULL on failure
uint32_t wiced_bt_get_buffer_count ( wiced_bt_buffer_pool_t p_pool)

To get the number of buffers available in the pool.

Parameters
p_poolThe pointer to the created pool
Returns
The number of buffers available in the pool
void* wiced_bt_get_buffer_from_pool ( wiced_bt_buffer_pool_t p_pool)

Allocates a buffer from the private pool.

Pass the pool pointer to get the buffer from the desired pool.

Parameters
p_poolThe pointer to the created pool
Returns
The pointer to the buffer on success NULL on failure
uint32_t wiced_bt_get_buffer_size ( void *  p_buf)

Gets the buffer size.

Parameters
p_bufThe pointer to the start of the buffer
Returns
The size of the buffer on success 0 if unsuccessful
wiced_result_t wiced_bt_get_buffer_usage ( wiced_bt_buffer_statistics_t p_buffer_stat,
uint16_t  size 
)

Dumps dynamic buffer usage (see wiced_bt_buffer_statistics_t),from the last start of the system.

Parameters
p_buffer_statThe pointer buffer to fill statistics
sizeThe size of the memory to get the statistics
Returns
WICED_BT_SUCCESS on success else error
uint32_t wiced_memory_get_free_bytes ( void  )

Returns the number of free bytes of RAM left.

Returns
The number of free bytes of RAM left
void* wiced_memory_permanent_allocate ( uint32_t  size)

Allocates memory for permanent usage.

Parameters
sizeThe size of the memory to be allocated
Returns
The pointer to the allocated memory on success NULL on failure
wiced_bool_t wiced_memory_set_application_thread_stack_size ( uint16_t  new_stack_size)

Update the stack size of the application thread (MPAF) NOTE : This API will work only when invoked from SPAR_CRT_SETUP()

Parameters
new_stack_sizeRequired size of the stack
Returns
TRUE on success else FALSE