Pointer-Array-FIFO Buffer Manager

In many cases, there will be a need to submit pointers in an order and consume them. For example, a originator module can push transmit data pointers to a buffer and sender module can get it and transmit it. In such cases, Pointer-Array-backed-FIFO can be used.

The rs_pointer_fifo_buf_mgr_init function can be used to initialize the manger with the starting address of the pre-allocated array with the number of elements that can be stored. When a pointer has to be pushed in, rs_pointer_fifo_buf_mgr_push can be called. The other module can use rs_pointer_fifo_buf_mgr_pop to pop-out the same.

Pointer-FIFO Buffer Manager Header

Documentation from the relevant header as follows:

Definitions for RAPIDSEA Buffer Manager to manage array/linked list based buffers.

Functions

rs_ret_val_t rs_pointer_fifo_buf_mgr_init(rs_buffer_mgr_t *ptr_mgr, void *ptr_array, uint32_t u32_num_pointers)

Initializes the Pointer-Array-backed-FIFO buffer manager.

This function initializes the manager with the given configuration

Parameters:
  • ptr_mgr[in] - Pointer to the Pointer-Array-backed-FIFO buffer manager memory

  • ptr_array[in] - Starting address of the pointer array to be used

  • u32_num_pointers[in] - Number of pointers that can be held in the array

Returns:

Zero for success or negative error code

rs_ret_val_t rs_pointer_fifo_buf_mgr_push(rs_buffer_mgr_t *ptr_mgr, void *ptr)

Pushes a pointer to the Pointer-Array-backed-FIFO buffer manager.

This function is used to push a pointer to the manager

Parameters:
  • ptr_mgr[in] - Pointer to the Pointer-Array-backed-FIFO buffer manager memory

  • ptr[in] - Pointer to be pushed in

Returns:

Zero for success or negative error code

void *rs_pointer_fifo_buf_mgr_pop(rs_buffer_mgr_t *ptr_mgr)

Pops out a pointer from the Pointer-Array-backed-FIFO buffer manager.

This function is used to pop a pointer from the manager, if available

Parameters:

ptr_mgr[in] - Pointer to the Pointer-Array-backed-FIFO buffer manager memory

Returns:

Pointer is available or NULL if not