Radio Control Layer (RCL)
RCL_Buffer.h File Reference
#include <stdint.h>
#include <ti/drivers/utils/List.h>
+ Include dependency graph for RCL_Buffer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RCL_Buffer_TxBuffer
 Definition of an RCL Tx Buffer. More...
 
struct  RCL_Buffer_DataEntry
 Definition of an RCL Rx Buffer Entry. More...
 
struct  RCL_MultiBuffer
 Definition of an RCL Rx MultiBuffer. More...
 
struct  RCL_MultiBuffer_ListInfo
 Information about an RCL_MultiBuffer list being traversed. More...
 

Macros

#define RCL_Buffer_bytesToWords(byteLen)   (((byteLen) + sizeof(uint32_t) - 1) / sizeof(uint32_t))
 Number of 32-bit words needed to hold a given number of bytes (rounded up) More...
 
#define RCL_Buffer_DataEntry_paddedLen(len)   (RCL_Buffer_bytesToWords((len) + sizeof(uint16_t)) * sizeof(uint32_t))
 Total length of a data entry in bytes based on length field of the entry. More...
 
#define RCL_Buffer_entryLen(numPad, hdrLen, dataLen)   (RCL_Buffer_DataEntry_paddedLen(sizeof(uint8_t) + (numPad) + (hdrLen) + (dataLen)))
 Total length of a data entry in bytes, including entry length field and padding. More...
 
#define RCL_TxBuffer_len(numPad, hdrLen, dataLen)   (offsetof(RCL_Buffer_TxBuffer, length) + RCL_Buffer_entryLen(numPad, hdrLen, dataLen))
 Total length of a TX buffer in bytes, including all fields and padding. More...
 
#define RCL_TxBuffer_len_u32(numPad, hdrLen, dataLen)   (RCL_Buffer_bytesToWords(RCL_TxBuffer_len(numPad, hdrLen, dataLen)))
 Total length of a TX buffer in 32-bit words, including all fields and padding. More...
 
#define RCL_MultiBuffer_len(dataLen)   (offsetof(RCL_MultiBuffer, data) + (dataLen))
 Total length of a multi buffer in bytes, including all fields. More...
 
#define RCL_MultiBuffer_len_u32(dataLen)   (RCL_Buffer_bytesToWords(RCL_MultiBuffer_len(dataLen)))
 Total length of a multi buffer in 32-bit words, including all fields. More...
 

Enumerations

enum  RCL_BufferState { RCL_BufferStatePending = 0U, RCL_BufferStateInUse = 1U, RCL_BufferStateFinished = 2U }
 Buffer state. More...
 

Functions

static RCL_Buffer_TxBuffer * RCL_TxBuffer_get (List_List *list)
 Function to atomically get the first elem in a Tx Buffer list. More...
 
static RCL_Buffer_TxBuffer * RCL_TxBuffer_head (List_List *list)
 Function to return the head of a TxBuffer list. More...
 
static RCL_Buffer_TxBuffer * RCL_TxBuffer_next (RCL_Buffer_TxBuffer *elem)
 Function to return the next elem in a linked list of Tx Buffers. More...
 
uint8_t * RCL_TxBuffer_init (RCL_Buffer_TxBuffer *buffer, uint32_t numPad, uint32_t hdrLen, uint32_t dataLen)
 Function to initialize a TX buffer entry for use by RCL. More...
 
void RCL_TxBuffer_put (List_List *list, RCL_Buffer_TxBuffer *elem)
 Function to atomically put an elem onto the end of a Tx Buffer list. More...
 
static RCL_MultiBuffer * RCL_MultiBuffer_head (List_List *list)
 Function to return the head of a MultiBuffer list. More...
 
static RCL_MultiBuffer * RCL_MultiBuffer_next (RCL_MultiBuffer *elem)
 Function to return the next elem in a linked list of MultiBuffers. More...
 
static RCL_MultiBuffer * RCL_MultiBuffer_get (List_List *list)
 Function to get the first elem in a MultiBuffer list. More...
 
void RCL_MultiBuffer_clear (RCL_MultiBuffer *buffer)
 Function to clear a multi buffer entry for re-use by RCL. More...
 
void RCL_MultiBuffer_init (RCL_MultiBuffer *buffer, size_t size)
 Function to initialize a multi buffer entry for use by RCL. More...
 
RCL_Buffer_DataEntry * RCL_MultiBuffer_RxEntry_get (List_List *list, List_List *consumedBuffers)
 Function to get the first entry in a MultiBuffer list. More...
 
bool RCL_MultiBuffer_RxEntry_isEmpty (List_List *list)
 Function to check if the MultiBuffer List is out of entries. More...
 
void RCL_MultiBuffer_ListInfo_init (RCL_MultiBuffer_ListInfo *listInfo, List_List *list)
 Function to initialize information for traversing a multi buffer list. More...
 
RCL_Buffer_DataEntry * RCL_MultiBuffer_RxEntry_next (RCL_MultiBuffer_ListInfo *listInfo)
 Function to return the next entry in a list of multi buffers. More...
 
bool RCL_MultiBuffer_RxEntry_isLast (RCL_MultiBuffer_ListInfo *listInfo)
 Function to check a traversed entry was the last one. More...
 
void RCL_MultiBuffer_put (List_List *list, RCL_MultiBuffer *elem)
 Function to atomically put an elem onto the end of a multi buffer list. More...
 
RCL_MultiBuffer * RCL_MultiBuffer_findFirstWritableBuffer (RCL_MultiBuffer *head)
 Find the first writable buffer in a list of MultiBuffers. More...
 
RCL_MultiBuffer * RCL_MultiBuffer_getBuffer (RCL_MultiBuffer *curBuffer, uint32_t minLength)
 Returns a buffer with at least minLength bytes remaining capacity. More...
 
uint32_t RCL_MultiBuffer_findAvailableRxSpace (const RCL_MultiBuffer *curBuffer)
 Find the minumum number of bytes that can be stored in available MultiBuffers. More...
 
static uint8_t * RCL_MultiBuffer_getNextWritableByte (RCL_MultiBuffer *curBuffer)
 Find the first byte to write in an RCL_MultiBuffer. More...
 
static void RCL_MultiBuffer_commitBytes (RCL_MultiBuffer *curBuffer, uint32_t numBytes)
 Update number of bytes written to RCL_MultiBuffer. More...
 

Data Structure Documentation

◆ RCL_MultiBuffer_s

struct RCL_MultiBuffer_s

Definition of an RCL Rx MultiBuffer.

Instances of RCL_MultiBuffer are allocated by the protocol stacks, and provided to RCL

Data Fields
List_Elem __elem__
RCL_BufferState state

Buffer state

uint16_t length

Number of bytes in the data field

uint16_t headIndex

Number of bytes consumed

uint16_t tailIndex

Number of bytes written

uint8_t data[]

Data buffer consisting of RCL_Buffer_DataEntry elements

◆ RCL_MultiBuffer_ListInfo_s

struct RCL_MultiBuffer_ListInfo_s

Information about an RCL_MultiBuffer list being traversed.

An instance of RCL_MultiBuffer_ListInfo is used to hold information of an RX queue which is read without consuming directly.

Data Fields
List_List * multiBuffers

Pointer to list of MultiBuffers

RCL_MultiBuffer * nextBuffer

Pointer to next MultiBuffer to traverse

uint16_t nextIndex

Index of nextBuffer->data for next entry

Macro Definition Documentation

◆ RCL_Buffer_bytesToWords

#define RCL_Buffer_bytesToWords (   byteLen)    (((byteLen) + sizeof(uint32_t) - 1) / sizeof(uint32_t))

Number of 32-bit words needed to hold a given number of bytes (rounded up)

◆ RCL_Buffer_DataEntry_paddedLen

#define RCL_Buffer_DataEntry_paddedLen (   len)    (RCL_Buffer_bytesToWords((len) + sizeof(uint16_t)) * sizeof(uint32_t))

Total length of a data entry in bytes based on length field of the entry.

Enumeration Type Documentation

◆ RCL_BufferState

Buffer state.

Enumerator
RCL_BufferStatePending 

Buffer is not yet accessed by RCL

RCL_BufferStateInUse 

Buffer has been accessed by RCL, and may be accessed again

RCL_BufferStateFinished 

RCL is finished with the buffer. It may be reused or freed.