Memory pool library

nRF5 SDK v15.3.0

This information applies to the following SoftDevices: S132, S140

Memory pool implementation, based on circular buffer data structure, which supports asynchronous processing of RX data. The current default implementation supports 1 TX buffer and 4 RX buffers. The memory managed by the pool is allocated from static storage instead of heap. The internal design of the circular buffer implementing the RX memory layout is illustrated in the picture below.

Page-1 Flowline1 free(consume) free(consume) Flowline1.266 read(extract) read(extract) Flowline1.267 write(produce) write(produce) Flowline1.268 Older data Older data Flowline1.269 Newer data Newer data Process.277 Sheet.278 unused space unused space Sheet.281 unused space unused space Sheet.282 Data being used by transport Data being used by transport Sheet.285 Data being used by application Data being used by application Sheet.286 Sheet.287 Sheet.288
Circular buffer design

The expected call order for the RX APIs is as follows:

  • hci_mem_pool_rx_produce
  • hci_mem_pool_rx_data_size_set
  • hci_mem_pool_rx_extract
  • hci_mem_pool_rx_consume
Warning
If the above mentioned expected call order is violated the end result can be undefined.
Component specific configuration options

The following compile time configuration options are available to suit various implementations:

  • TX_BUF_SIZE TX buffer size in bytes.
  • RX_BUF_SIZE RX buffer size in bytes.
  • RX_BUF_QUEUE_SIZE RX buffer element size.