4.1.2 bmm_buffer_alloc Function

C

buffer_t* bmm_buffer_alloc(uint16_t size)

Summary

Allocates a buffer

Description

This function allocates a buffer and returns a pointer to the buffer. The same pointer should be used while freeing the buffer.User should call BMM_BUFFER_POINTER(buf) to get the pointer to buffer user area

Precondition

bmm_buffer_init should have been called before using this function

Parameters

ParamDescription
sizesize of buffer to be allocated

Returns

return- pointer to the buffer allocated, NULL if buffer not available

Example

buffer_t *buffer;
buffer = bmm_buffer_alloc(LARGE_BUFFER_SIZE);

if (buffer == NULL)
{
    //Buffer is unavailable
}

Remarks

This routine is used by the PHY Layer for allocating the buffer for reception. Number of Buffers should be defined as per application needs before the buffer allocation function. If application allocates the buffer and not freeing them, Trx may not able to continuously receive the packet. So care should be taken when defining the Number of Buffers.