4.1 Buffer Management Module

The Buffer management module provides services for dynamically allocating and freeing the memory buffers.

The following are two types of buffers which can be allocated by an application or any stack layers:

  1. LARGE BUFFER
  2. SMALL BUFFER

The size of buffers can be configured by the layer which are using the service. For Example, PHY Layer uses the Large buffer for holding the received packet. So, the size of LARGE BUFFER is calculated as follows:

#define LARGE_BUFFER_SIZE (((sizeof(PHY_FrameInfo_t) + aMaxPHYPacketSize +

LENGTH_FIELD_LEN + LQI_LEN + ED_VAL_LEN) / 4 + 1) * 4)

Number of buffers used by the application or stack layer is also configurable.

#define NUMBER_OF_LARGE_BUFFERS 10

Both buffer size and number of buffers decides the buffer pool area where the allocation and freeing will happen.

Following are the list of interface functions of Buffer Management Module

Table 4-1. BMM APIs
S. No.Function Description
1bmm_buffer_initInitializes the buffer module
2bmm_buffer_allocAllocates a buffer
3bmm_buffer_freeFrees up a buffer