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)

This macro provides the pointer to the corresponding body of the supplied buffer header.

Referenced by build_null_data_frame(), dispatch_event(), find_buffer_cb(), gen_mlme_poll_conf(), gen_mlme_start_conf(), gen_rx_enable_conf(), handle_exp_persistence_timer(), handle_received_frame_irq(), mac_awake_disassociate(), mac_awake_scan(), mac_build_and_tx_beacon(), mac_build_and_tx_data_req(), mac_gen_mcps_data_conf(), mac_gen_mlme_associate_conf(), mac_gen_mlme_disassociate_conf(), mac_handle_tx_null_data_frame(), mac_mlme_comm_status(), mac_prep_disassoc_conf(), mac_process_associate_request(), mac_process_beacon_frame(), mac_process_data_frame(), mac_process_data_request(), mac_process_disassociate_notification(), mac_process_orphan_notification(), mac_process_orphan_realign(), mac_process_tal_data_ind(), mac_process_tal_tx_status(), mac_t_scan_duration_cb(), mac_tx_coord_realignment_command(), mcps_data_conf(), mcps_data_ind(), mcps_data_request(), mcps_purge_conf(), mcps_purge_request(), mlme_associate_conf(), mlme_associate_ind(), mlme_associate_request(), mlme_associate_response(), mlme_beacon_notify_ind(), mlme_comm_status_ind(), mlme_disassociate_conf(), mlme_disassociate_ind(), mlme_disassociate_request(), mlme_get_conf(), mlme_get_request(), mlme_orphan_ind(), mlme_poll_conf(), mlme_poll_request(), mlme_reset_conf(), mlme_reset_request(), mlme_rx_enable_conf(), mlme_rx_enable_request(), mlme_scan_conf(), mlme_scan_request(), mlme_set_conf(), mlme_set_request(), mlme_start_conf(), mlme_start_request(), mlme_sync_loss_ind(), parse_mpdu(), process_incoming_frame(), scan_proceed(), send_reset_conf(), send_scan_cmd(), tal_ed_end_cb(), tx_pan_id_conf_notif(), wpan_mcps_data_req(), wpan_mcps_purge_req(), wpan_mlme_associate_req(), wpan_mlme_associate_resp(), wpan_mlme_disassociate_req(), wpan_mlme_get_req(), wpan_mlme_orphan_resp(), wpan_mlme_poll_req(), wpan_mlme_reset_req(), wpan_mlme_rx_enable_req(), wpan_mlme_scan_req(), wpan_mlme_set_req(), and wpan_mlme_start_req().

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 build_null_data_frame(), 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_mcps_purge_req(), wpan_mlme_associate_req(), wpan_mlme_associate_resp(), wpan_mlme_disassociate_req(), wpan_mlme_get_req(), wpan_mlme_orphan_resp(), wpan_mlme_poll_req(), wpan_mlme_reset_req(), wpan_mlme_rx_enable_req(), wpan_mlme_scan_req(), wpan_mlme_set_req(), and wpan_mlme_start_req().

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_buffer_purge(), mac_build_and_tx_data_req(), mac_handle_tx_null_data_frame(), mac_process_associate_request(), mac_process_associate_response(), mac_process_beacon_frame(), mac_process_beacon_request(), mac_process_coord_realign(), mac_process_data_frame(), mac_process_data_request(), mac_process_orphan_realign(), mac_process_tal_data_ind(), mac_process_tal_tx_status(), mcps_data_conf(), mcps_data_ind(), mcps_purge_conf(), mlme_associate_conf(), mlme_associate_ind(), mlme_associate_response(), mlme_beacon_notify_ind(), mlme_comm_status_ind(), mlme_disassociate_conf(), mlme_disassociate_ind(), mlme_get_conf(), mlme_orphan_ind(), mlme_poll_conf(), mlme_reset_conf(), mlme_rx_enable_conf(), mlme_scan_conf(), mlme_set_conf(), mlme_start_conf(), process_data_ind_not_transient(), qmm_queue_flush(), scan_proceed(), tal_reset(), tx_pan_id_conf_notif(), wpan_mcps_data_req(), wpan_mcps_purge_req(), wpan_mlme_associate_req(), wpan_mlme_associate_resp(), wpan_mlme_disassociate_req(), wpan_mlme_get_req(), wpan_mlme_orphan_resp(), wpan_mlme_poll_req(), wpan_mlme_reset_req(), wpan_mlme_rx_enable_req(), wpan_mlme_scan_req(), wpan_mlme_set_req(), and wpan_mlme_start_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().