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_t * | bmm_buffer_alloc (uint16_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 cleanup_tal(), complete_rx_transaction(), process_incoming_frame(), tal_init(), tal_trx_wakeup(), and upload_frame().
buffer_t* bmm_buffer_alloc | ( | uint16_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.
size | size of buffer to be allocated. |
References LARGE_BUFFER_SIZE, qmm_queue_remove(), and SMALL_BUFFER_SIZE.
Referenced by cleanup_tal(), complete_rx_transaction(), init_after_disconnect(), tal_init(), tal_task(), and tal_trx_wakeup().
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.
pbuffer | Pointer to buffer that has to be freed. |
References qmm_queue_append().
Referenced by cleanup_tal(), qmm_queue_flush(), tal_rx_frame_cb(), and tal_trx_sleep().
__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(), 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().