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...
 

#define BMM_BUFFER_POINTER (   buf)    ((buf)->body)

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 LARGE_BUFFER_SIZE, qmm_queue_remove(), and SMALL_BUFFER_SIZE.

Referenced by handle_received_frame_irq(), mac_awake_scan(), mac_build_and_tx_data_req(), parse_mpdu(), tal_init(), tal_task(), tx_pan_id_conf_notif(), wpan_mcps_data_req(), wpan_mlme_associate_req(), wpan_mlme_disassociate_req(), wpan_mlme_get_req(), wpan_mlme_poll_req(), wpan_mlme_reset_req(), wpan_mlme_rx_enable_req(), wpan_mlme_scan_req(), and wpan_mlme_set_req().

__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, LARGE_BUFFER_SIZE, qmm_queue_append(), qmm_queue_init(), SMALL_BUFFER_SIZE, 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(), mac_sync_loss(), 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().