Radio Control Layer (RCL)
|
These functions are useful as part of the API to RCL
Macros | |
#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... | |
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... | |
#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.
numPad | Number of padding bytes in front of the packet |
hdrLen | Number of header bytes to hold |
dataLen | Number of payload bytes to hold |
Referenced by RCL_Handler_BLE5_adv(), and RCL_Handler_BLE5_aux_adv().
#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.
numPad | Number of padding bytes in front of the packet |
hdrLen | Number of header bytes to hold |
dataLen | Number of payload bytes to hold |
#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.
numPad | Number of padding bytes in front of the packet |
hdrLen | Number of header bytes to hold |
dataLen | Number of payload bytes to hold |
#define RCL_MultiBuffer_len | ( | dataLen | ) | (offsetof(RCL_MultiBuffer, data) + (dataLen)) |
Total length of a multi buffer in bytes, including all fields.
dataLen | Number of bytes available to store data entries |
#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.
dataLen | Number of bytes available to store data entries |
|
inlinestatic |
Function to atomically get the first elem in a Tx Buffer list.
list | A pointer to a linked list of Tx Buffers |
Referenced by RCL_Handler_BLE5_adv(), RCL_Handler_BLE5_aux_adv(), RCL_Handler_BLE5_conn(), RCL_Handler_BLE5_genericTx(), RCL_Handler_Generic_Tx(), and RCL_Handler_Nesb_Ptx().
|
inlinestatic |
Function to return the head of a TxBuffer list.
This function does not remove the head, it simply returns a pointer to it. This function is typically used when traversing a linked list.
list | A pointer to the linked list of Tx Buffers |
Referenced by RCL_Handler_BLE5_adv(), RCL_Handler_BLE5_aux_adv(), RCL_Handler_BLE5_scan_init(), RCL_Handler_BLE5_updateTxBuffers(), RCL_Handler_Generic_updateTxBuffers(), and RCL_Handler_Nesb_updateHeader().
|
inlinestatic |
Function to return the next elem in a linked list of Tx Buffers.
This function does not remove the elem, it simply returns a pointer to next one. This function is typically used when traversing a linked list.
elem | Elem in the TxBuffer list |
References RCL_Buffer_TxBuffer::numPad, RCL_TxBuffer_init(), and RCL_TxBuffer_put().
Referenced by RCL_Handler_BLE5_adv(), RCL_Handler_BLE5_aux_adv(), RCL_Handler_BLE5_updateTxBuffers(), and RCL_Handler_Generic_updateTxBuffers().
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.
Initialize a new TX buffer entry with the correct length and padding
buffer | Tx buffer to initialize |
numPad | Number of padding bytes in front of the packet |
hdrLen | Number of header bytes to hold |
dataLen | Number of payload bytes to hold |
References RCL_BufferStatePending.
Referenced by RCL_TxBuffer_next().
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.
Add an entry to the TX buffer list and notify the running command if there is any
list | A pointer to the Tx buffer list |
elem | Element to place onto the end of the linked list |
References RCL_SchedulerState::currCmd, RCL_EventTxBufferUpdate, RCL_Scheduler_postEvent(), and rclSchedulerState.
Referenced by RCL_TxBuffer_next().
|
inlinestatic |
Function to return the head of a MultiBuffer list.
This function does not remove the head, it simply returns a pointer to it. This function is typically used when traversing a linked list.
list | A pointer to the linked list of Multi Buffers |
Referenced by RCL_MultiBuffer_RxEntry_consume(), and RCL_MultiBuffer_RxEntry_next().
|
inlinestatic |
Function to return the next elem in a linked list of MultiBuffers.
This function does not remove the elem, it simply returns a pointer to next one. This function is typically used when traversing a linked list.
elem | Elem in the MultiBuffer list |
|
inlinestatic |
Function to get the first elem in a MultiBuffer list.
Returns the first whole MultiBuffer from a list. Note that this will be done even if the buffer wasn't finished and that the buffer may contain several entries.
list | A pointer to a linked list of Tx Buffers |
References RCL_MultiBuffer_clear(), RCL_MultiBuffer_commitBytes(), RCL_MultiBuffer_findAvailableRxSpace(), RCL_MultiBuffer_findFirstWritableBuffer(), RCL_MultiBuffer_getBuffer(), RCL_MultiBuffer_getNextWritableByte(), RCL_MultiBuffer_init(), RCL_MultiBuffer_ListInfo_init(), RCL_MultiBuffer_put(), RCL_MultiBuffer_RxEntry_get(), RCL_MultiBuffer_RxEntry_isEmpty(), RCL_MultiBuffer_RxEntry_isLast(), and RCL_MultiBuffer_RxEntry_next().
void RCL_MultiBuffer_clear | ( | RCL_MultiBuffer * | buffer | ) |
Function to clear a multi buffer entry for re-use by RCL.
Clear a new multi buffer entry so that it can be re-used by RCL for storing received packets
buffer | Multi buffer to clear |
References RCL_BufferStatePending.
Referenced by RCL_MultiBuffer_get(), and RCL_MultiBuffer_init().
void RCL_MultiBuffer_init | ( | RCL_MultiBuffer * | buffer, |
size_t | size | ||
) |
Function to initialize a multi buffer entry for use by RCL.
Initialize a new multi buffer entry so that it can be provided to RCL for storing received packets
buffer | Multi buffer to initialize |
size | Size of the buffer in bytes including all fields |
References RCL_Debug_assert, and RCL_MultiBuffer_clear().
Referenced by RCL_MultiBuffer_get().
RCL_Buffer_DataEntry* RCL_MultiBuffer_RxEntry_get | ( | List_List * | list, |
List_List * | consumedBuffers | ||
) |
Function to get the first entry in a MultiBuffer list.
This function gets the first entry in a MultiBuffer list and consumes it. If one or two whole RCL_MultiBuffer are consumed as a result of this, they are added to the consumedBuffers list.
list | A pointer to a linked list of MultiBuffers |
consumedBuffers | A pointer to a linked list which will hold the buffers that were consumed and can now be re-used. The list is not initialized, so that it is possible to get consumed entries appended. If this is not desired, the list should be cleared first. If NULL, consumed buffers are not reported |
References List_consumeAndStore(), RCL_Buffer_DataEntry_paddedLen, RCL_BufferStateFinished, and RCL_Debug_assert.
Referenced by RCL_MultiBuffer_get().
bool RCL_MultiBuffer_RxEntry_isEmpty | ( | List_List * | list | ) |
Function to check if the MultiBuffer List is out of entries.
This function returns true if there are no more entries to read from a list of MultiBuffers
list | Pointer to list of multi buffers |
References RxEntry_isAtEnd().
Referenced by RCL_MultiBuffer_get().
void RCL_MultiBuffer_ListInfo_init | ( | RCL_MultiBuffer_ListInfo * | listInfo, |
List_List * | list | ||
) |
Function to initialize information for traversing a multi buffer list.
This function prepares a struct for holding information about entries being read from a list of multi buffers. It will set up the struct to start by traversing the head of the list.
listInfo | Pointer to list information which will be set up to start traversing the head of the list |
list | Pointer to list of multi buffers |
References RCL_Debug_assert.
Referenced by RCL_MultiBuffer_get().
RCL_Buffer_DataEntry* RCL_MultiBuffer_RxEntry_next | ( | RCL_MultiBuffer_ListInfo * | listInfo | ) |
Function to return the next entry in a list of multi buffers.
This function does not remove the entry, it simply returns a pointer to next one. This function is typically used when traversing a linked list of multi buffers.
listInfo | Struct with information of the next entry to access. Set up using RCL_MultiBuffer_ListInfo_init before starting. |
References RCL_Buffer_DataEntry_paddedLen, RCL_BufferStateFinished, RCL_Debug_assert, and RCL_MultiBuffer_head().
Referenced by RCL_MultiBuffer_get().
bool RCL_MultiBuffer_RxEntry_isLast | ( | RCL_MultiBuffer_ListInfo * | listInfo | ) |
Function to check a traversed entry was the last one.
This function returns true if the latest entry returned by RCL_MultiBuffer_RxEntry_next was the last one
listInfo | Struct with information of the next entry to access |
References RCL_Debug_assert, and RxEntry_isAtEnd().
Referenced by RCL_MultiBuffer_get().
void RCL_MultiBuffer_put | ( | List_List * | list, |
RCL_MultiBuffer * | elem | ||
) |
Function to atomically put an elem onto the end of a multi buffer list.
Add an entry to the multi buffer list and notify the running command if there is any
list | A pointer to the multi buffer list |
elem | Multi buffer to place onto the end of the linked list |
References RCL_SchedulerState::currCmd, RCL_EventRxBufferUpdate, RCL_Scheduler_postEvent(), and rclSchedulerState.
Referenced by RCL_MultiBuffer_get().