Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Buffer Management

Buffer Management (large and small buffers): provides services for dynamically allocating and freeing memory buffers.

Data Structures

struct  buffer_t
 Buffer structure holding information of each buffer. More...
 

Macros

#define BMM_BUFFER_POINTER(buf)   ((buf)->body)
 This macro provides the pointer to the corresponding body of the supplied buffer header. More...
 

Functions

buffer_tbmm_buffer_alloc (uint8_t size)
 Allocates a buffer. More...
 
void bmm_buffer_free (buffer_t *pbuffer)
 Frees up a buffer. More...
 
__PACK__RST_DATA__ void bmm_buffer_init (void)
 Initializes the buffer module. More...
 

Variables

uint8_t * buffer_t::body
 Pointer to the buffer body. More...
 
struct buffer_tag * buffer_t::next
 Pointer to next free buffer. More...
 

buffer_t* bmm_buffer_alloc ( uint8_t  size)

Allocates a buffer.

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.

Parameters
sizesize of buffer to be allocated.
Returns
pointer to the buffer allocated, NULL if buffer not available.

References qmm_queue_remove().

Referenced by handle_received_frame_irq(), mac_awake_scan(), parse_mpdu(), tal_init(), and tal_task().

void bmm_buffer_free ( buffer_t pbuffer)

Frees up a buffer.

This function frees up a buffer. The pointer passed to this function should be the pointer returned during buffer allocation. The result is unpredictable if an incorrect pointer is passed.

Parameters
pbufferPointer to buffer that has to be freed.

References qmm_queue_append().

Referenced by dispatch_event(), mac_awake_scan(), mac_process_beacon_frame(), mac_process_beacon_request(), mac_process_data_frame(), mac_process_tal_data_ind(), mac_process_tal_tx_status(), process_data_ind_not_transient(), qmm_queue_flush(), scan_proceed(), and tal_reset().

__PACK__RST_DATA__ void bmm_buffer_init ( void  )

Initializes the buffer module.

This function initializes the buffer module. This function should be called before using any other functionality of buffer module.

References buffer_t::body, buf_pool, qmm_queue_append(), qmm_queue_init(), TOTAL_NUMBER_OF_LARGE_BUFS, and TOTAL_NUMBER_OF_SMALL_BUFS.

Referenced by tal_init().

uint8_t* buffer_t::body

Pointer to the buffer body.

Referenced by bmm_buffer_init(), and queue_read_or_remove().

struct buffer_tag* buffer_t::next

Pointer to next free buffer.

Referenced by qmm_queue_append(), and queue_read_or_remove().