Data Management
Data management functions.
Data Structures |
|
struct | RAIL_DataConfig_t |
RAIL data configuration structure.
|
Macros |
|
#define | RAIL_FIFO_THRESHOLD_DISABLED 0xFFFFU |
A FIFO threshold value that disables the threshold.
|
Enumerations |
|
enum | RAIL_TxDataSource_t { TX_PACKET_DATA } |
Transmit data sources supported by RAIL.
|
|
enum |
RAIL_RxDataSource_t
{
RX_PACKET_DATA , RX_DEMOD_DATA , RX_IQDATA_FILTLSB , RX_IQDATA_FILTMSB } |
Receive data sources supported by RAIL.
|
|
enum |
RAIL_DataMethod_t
{
PACKET_MODE , FIFO_MODE } |
Methods for the application to provide and retrieve data from RAIL.
|
Functions |
|
RAIL_Status_t | RAIL_ConfigData ( RAIL_Handle_t railHandle, const RAIL_DataConfig_t *dataConfig) |
RAIL data management configuration.
|
|
uint16_t | RAIL_WriteTxFifo ( RAIL_Handle_t railHandle, const uint8_t *dataPtr, uint16_t writeLength, bool reset) |
Writes data to the transmit FIFO.
|
|
uint16_t | RAIL_SetTxFifo ( RAIL_Handle_t railHandle, uint8_t *addr, uint16_t initLength, uint16_t size) |
Sets the address of the transmit FIFO, a circular buffer used for TX data.
|
|
RAIL_Status_t | RAIL_SetRxFifo ( RAIL_Handle_t railHandle, uint8_t *addr, uint16_t *size) |
Sets the address of the receive FIFO, a circular buffer used for RX data.
|
|
RAIL_Status_t | RAILCb_SetupRxFifo ( RAIL_Handle_t railHandle) |
Sets up the receive FIFO to use.
|
|
uint16_t | RAIL_ReadRxFifo ( RAIL_Handle_t railHandle, uint8_t *dataPtr, uint16_t readLength) |
Reads packet data from RAIL's internal receive FIFO.
|
|
uint16_t | RAIL_SetTxFifoThreshold ( RAIL_Handle_t railHandle, uint16_t txThreshold) |
Configures the RAIL transmit FIFO almost empty threshold.
|
|
uint16_t | RAIL_SetRxFifoThreshold ( RAIL_Handle_t railHandle, uint16_t rxThreshold) |
Configures the RAIL receive FIFO almost full threshold.
|
|
uint16_t | RAIL_GetTxFifoThreshold ( RAIL_Handle_t railHandle) |
Gets the RAIL transmit FIFO almost empty threshold value.
|
|
uint16_t | RAIL_GetRxFifoThreshold ( RAIL_Handle_t railHandle) |
Gets the RAIL receive FIFO almost full threshold value.
|
|
void | RAIL_ResetFifo ( RAIL_Handle_t railHandle, bool txFifo, bool rxFifo) |
Resets the RAIL transmit and/or receive FIFOs.
|
|
uint16_t | RAIL_GetRxFifoBytesAvailable ( RAIL_Handle_t railHandle) |
Gets the number of bytes used in the receive FIFO.
|
|
uint16_t | RAIL_GetTxFifoSpaceAvailable ( RAIL_Handle_t railHandle) |
Gets the number of bytes unused in the transmit FIFO.
|
Detailed Description
Data management functions.
These functions allow the application to choose how data is presented to the application. RAIL provides data in a packet-based method or in a FIFO-based method. As originally conceived, RAIL_DataMethod_t::PACKET_MODE was designed for handling packets that fit within RAIL's FIFOs while RAIL_DataMethod_t::FIFO_MODE was designed for handling packets larger than RAIL's FIFOs could hold. Conceptually it is still useful to think of these modes this way, but functionally their disinction has become blurred by improvements in RAIL's flexibility – applications now have much more control over both receive and transmit FIFO sizes, and the FIFO-management and threshold APIs and related events are no longer restricted to RAIL_DataMethod_t::FIFO_MODE operation but can be used in RAIL_DataMethod_t::PACKET_MODE too.
The application can configure RAIL data management through RAIL_ConfigData() . This function allows the application to specify the type of radio data ( RAIL_TxDataSource_t and RAIL_RxDataSource_t ) and the method of interacting with data ( RAIL_DataMethod_t ). By default, RAIL configures TX and RX both with packet data source and RAIL_DataMethod_t::PACKET_MODE .
For transmit, RAIL_DataMethod_t::PACKET_MODE and RAIL_DataMethod_t::FIFO_MODE are functionally the same:
- When not actively transmitting, load a packet's initial transmit data using RAIL_WriteTxFifo() with reset set to true. Alternatively this data copying can be avoided by changing the transmit FIFO to an already-loaded section of memory with RAIL_SetTxFifo() .
- When actively transmitting, load remaining transmit data with RAIL_WriteTxFifo() with reset set to false.
- If transmit packets exceed the FIFO size, set the transmit FIFO threshold through RAIL_SetTxFifoThreshold() . The RAIL_Config_t::eventsCallback with RAIL_EVENT_TX_FIFO_ALMOST_EMPTY will occur telling the application to load more TX packet data, if needed, to prevent a RAIL_EVENT_TX_UNDERFLOW event from occurring. One can get how much space is available in the transmit FIFO for more transmit data through RAIL_GetTxFifoSpaceAvailable() .
- After transmit completes, the transmit FIFO can be manually reset with RAIL_ResetFifo() , but this should rarely be necessary.
The transmit FIFO is specified by the application and its size is the value returned from the most recent call to RAIL_SetTxFifo() . The transmit FIFO is edge-based in that it only provides the RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event once when the threshold is crossed in the emptying direction.
For receive, the distinction between RAIL_DataMethod_t::PACKET_MODE and RAIL_DataMethod_t::FIFO_MODE basically boils down to how unsuccessfully-received packets are handled. In RAIL_DataMethod_t::PACKET_MODE , data from such packets is automatically rolled back as if the packet was never received, while in RAIL_DataMethod_t::FIFO_MODE , rollback does not occur putting more onus on the application to deal with that data.
In receive RAIL_DataMethod_t::PACKET_MODE data management:
- Packet lengths are determined from the Radio Configurator configuration and can be read out at the end using RAIL_GetRxPacketInfo() .
- Received packet data is made available on successful packet completion via RAIL_Config_t::eventsCallback with RAIL_EVENT_RX_PACKET_RECEIVED which can then use RAIL_GetRxPacketInfo() and RAIL_GetRxPacketDetailsAlt() to access packet information and RAIL_PeekRxPacket() to access packet data.
- Filtered, Aborted, or FrameError received packet data is automatically rolled back (dropped) without the application needing to worry about consuming it. The application can choose to not even be bothered with the events related to such packets: RAIL_EVENT_RX_ADDRESS_FILTERED , RAIL_EVENT_RX_PACKET_ABORTED , or RAIL_EVENT_RX_FRAME_ERROR .
In receive RAIL_DataMethod_t::FIFO_MODE data management:
- Packet Lengths are determined from the Radio Configurator configuration or by application knowledge of packet payload structure.
- Received data can be retrieved prior to packet completion through RAIL_ReadRxFifo() and is never rolled back on Filtered, Aborted, or FrameError packets. The application should enable and handle these events so it can flush any packet data it's already retrieved.
- After packet completion, remaining packet data for Filtered, Aborted, or FrameError packets remains in the FIFO and the appropriate event is triggered to the user. This data may be consumed in the callback unlike in packet mode where it is automatically rolled back. At the end of the callback all remaining data in the FIFO will be cleaned up as usual. Keep in mind that RAIL_GetRxPacketDetailsAlt() provides packet detailed information only for successfully received packets.
Common receive data management features:
- Set the receive FIFO threshold through RAIL_SetRxFifoThreshold() . The RAIL_Config_t::eventsCallback with RAIL_EVENT_RX_FIFO_ALMOST_FULL will occur telling the application to consume some RX packet data to prevent a RAIL_EVENT_RX_FIFO_OVERFLOW event from occurring.
- Get receive FIFO count information through RAIL_GetRxPacketInfo( RAIL_RX_PACKET_HANDLE_NEWEST ) (or RAIL_GetRxFifoBytesAvailable() ).
- After receive completes and all its data has been consumed, the receive FIFO can be manually reset with RAIL_ResetFifo() , though this should rarely be necessary and should only be done with the radio idle.
When trying to determine an appropriate threshold, the application needs to know the size of each FIFO. The default receive FIFO is internal to RAIL with a size of 512 bytes. This can be changed, however, using the RAIL_SetRxFifo API and the default may be removed entirely by doing this in the RAILCb_SetupRxFifo() callback. The receive FIFO event is level-based in that the RAIL_EVENT_RX_FIFO_ALMOST_FULL event will constantly pend if the threshold is exceeded. This normally means that inside this event's callback, the application should empty enough of the FIFO to go under the threshold. To defer reading the FIFO to main context, the application can disable or re-enable the receive FIFO threshold event using RAIL_ConfigEvents() with the mask RAIL_EVENT_RX_FIFO_ALMOST_FULL .
The receive FIFO can store multiple packets and processing of a packet can be held off deferred from the RAIL event callback to main loop processing. Before a packet is done being received you can always use RAIL_PeekRxPacket() to peek at the contents. In FIFO mode, you may also consume the data with RAIL_ReadRxPacket(). Remember that none of these APIs will read across a packet boundary (even in FIFO mode) so you will need to handle each received packet individually. To defer this processing until the main loop you must use RAIL_HoldRxPacket() when the completion event occurs to prevent us from automatically clearing the data from the FIFO.
While RAIL defaults to RAIL_DataMethod_t::PACKET_MODE , the application can explicitly initialize RAIL for RAIL_DataMethod_t::PACKET_MODE in the following manner:
Initializing RAIL for RAIL_DataMethod_t::FIFO_MODE requires a few more function calls:
On receive, an application can use multiple data sources that are only compatible with RAIL_DataMethod_t::FIFO_MODE . All that differs from the FIFO mode example above is the RAIL_DataConfig_t::rxSource setting. IQ data samples are taken at the hardware's oversample rate and the amount of data can easily overwhelm the CPU processing time. The sample rate depends on the chosen PHY, as determined by the data rate and the decimation chain. It is not recommended to use the IQ data source with sample rates above 300 k samples/second as the CPU might not be able to keep up with the data. Depending on the application and needed CPU bandwidth, slower data rates may be required.
Enumeration Type Documentation
enum RAIL_DataMethod_t |
Methods for the application to provide and retrieve data from RAIL.
For Transmit the distinction between RAIL_DataMethod_t::PACKET_MODE and RAIL_DataMethod_t::FIFO_MODE has become more cosmetic than functional, as the RAIL_WriteTxFifo() and RAIL_SetTxFifoThreshold() APIs and related RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event can be used in either mode. For Receive the distinction is functionally important because in RAIL_DataMethod_t::PACKET_MODE rollback occurs automtically for unsuccessfully-received packets ( RAIL_RxPacketStatus_t ABORT statuses), flushing their data. In RAIL_DataMethod_t::FIFO_MODE rollback is prevented, leaving the data from unsuccessfully-received packets in the receive FIFO for the application to deal with. This allows for packets larger than the receive FIFO size where automatic rollback would corrupt the receive FIFO.
Enumerator | |
---|---|
PACKET_MODE |
Packet-based data method. |
FIFO_MODE |
FIFO-based data method. |
Definition at line
1296
of file
rail_types.h
.
enum RAIL_RxDataSource_t |
Receive data sources supported by RAIL.
Definition at line
1270
of file
rail_types.h
.
enum RAIL_TxDataSource_t |
Function Documentation
RAIL_Status_t RAIL_ConfigData | ( | RAIL_Handle_t |
railHandle,
|
const RAIL_DataConfig_t * |
dataConfig
|
||
) |
RAIL data management configuration.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in] dataConfig
RAIL data configuration structure.
- Returns
- Status code indicating success of the function call.
This function configures how RAIL manages data. The application can configure RAIL to receive data in a packet-based or FIFO-based manner. RAIL_DataMethod_t::FIFO_MODE is necessary to receive packets larger than the radio's receive FIFO.
Generally with RAIL_DataMethod_t::FIFO_MODE , the application sets appropriate FIFO thresholds via RAIL_SetTxFifoThreshold() and RAIL_SetRxFifoThreshold() and then enables and handles the RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event callback (to feed more packet data via RAIL_WriteTxFifo() before the FIFO underflows) and the RAIL_EVENT_RX_FIFO_ALMOST_FULL event callback (to consume packet data via RAIL_ReadRxFifo() before the RX FIFO overflows).
When configuring TX for RAIL_DataMethod_t::FIFO_MODE , this function resets the transmit FIFO. When configuring TX or RX for RAIL_DataMethod_t::PACKET_MODE , this function will reset the corresponding FIFO thresholds such that they won't trigger the RAIL_EVENT_RX_FIFO_ALMOST_FULL or RAIL_EVENT_TX_FIFO_ALMOST_EMPTY events.
When RAIL_DataConfig_t::rxMethod is set to RAIL_DataMethod_t::FIFO_MODE , the radio won't drop packet data of aborted or CRC error packets, but will present it to the application to deal with accordingly. On completion of erroneous packets, the RAIL_Config_t::eventsCallback with RAIL_EVENT_RX_PACKET_ABORTED , RAIL_EVENT_RX_FRAME_ERROR , or RAIL_EVENT_RX_ADDRESS_FILTERED will tell the application it can drop any data it read via RAIL_ReadRxFifo() during reception. For CRC error packets when the RAIL_RX_OPTION_IGNORE_CRC_ERRORS RX option is in effect, the application should check for that from the RAIL_RxPacketStatus_t obtained by calling RAIL_GetRxPacketInfo() . RAIL will automatically flush any remaining packet data after reporting one of these packet completion events or the application can explicitly flush it by calling RAIL_ReleaseRxPacket() .
When RAIL_DataConfig_t::rxMethod is set to RAIL_DataMethod_t::PACKET_MODE , the radio will roll back (drop) all packet data associated with aborted packets including those with CRC errors (unless configured to ignore CRC errors via the RAIL_RX_OPTION_IGNORE_CRC_ERRORS RX option). The application will never have to deal with packet data from these packets.
In either mode, the application can set RX options as needed.
uint16_t RAIL_GetRxFifoBytesAvailable | ( | RAIL_Handle_t |
railHandle
|
) |
Gets the number of bytes used in the receive FIFO.
This function should only be used in RX RAIL_DataMethod_t::FIFO_MODE . Apps should use RAIL_GetRxPacketInfo() instead.
- Parameters
-
[in] railHandle
A RAIL instance handle.
- Returns
- Number of bytes used in the receive FIFO.
This tells how much packet-related data exists in the receive FIFO that could be read.
- Note
- The number of bytes returned may not just reflect the current packet's data but could also include raw appended info bytes added after successful packet reception and bytes from subsequently received packets. It is up to the app to never try to consume more than the packet's actual data when using the value returned here in a subsequent call to RAIL_ReadRxFifo() , otherwise the RX FIFO will be corrupted.
uint16_t RAIL_GetRxFifoThreshold | ( | RAIL_Handle_t |
railHandle
|
) |
Gets the RAIL receive FIFO almost full threshold value.
- Parameters
-
[in] railHandle
A RAIL instance handle.
- Returns
- Configured RX Threshold value.
Retrieves the configured RX threshold value.
uint16_t RAIL_GetTxFifoSpaceAvailable | ( | RAIL_Handle_t |
railHandle
|
) |
Gets the number of bytes unused in the transmit FIFO.
- Parameters
-
[in] railHandle
A RAIL instance handle.
- Returns
- Number of bytes unused in the transmit FIFO.
This tells how much space is available in the transmit FIFO for writing additional packet data.
uint16_t RAIL_GetTxFifoThreshold | ( | RAIL_Handle_t |
railHandle
|
) |
Gets the RAIL transmit FIFO almost empty threshold value.
- Parameters
-
[in] railHandle
A RAIL instance handle.
- Returns
- Configured TX Threshold value.
Retrieves the configured TX threshold value.
uint16_t RAIL_ReadRxFifo | ( | RAIL_Handle_t |
railHandle,
|
uint8_t * |
dataPtr,
|
||
uint16_t |
readLength
|
||
) |
Reads packet data from RAIL's internal receive FIFO.
- Parameters
-
[in] railHandle
A RAIL instance handle. [out] dataPtr
An application-provided pointer to store data. If NULL, the data is thrown away rather than copied out. [in] readLength
A number of packet bytes to read from the FIFO.
- Returns
- The number of packet bytes read from the receive FIFO.
This function reads packet data from the head of receive FIFO and writes it to the provided dataPtr. It does not permit reading more data than is available in the FIFO, nor does it permit reading more data than remains in the oldest unreleased packet.
Because this function does not have a critical section, use it only in one context or make sure function calls are protected to prevent buffer corruption.
- Warning
- This function is intended for use only with RAIL_DataMethod_t::FIFO_MODE and should never be called in RAIL_DataMethod_t::PACKET_MODE where it could lead to receive FIFO corruption.
- Note
- When reading data from an arriving packet that is not yet complete, keep in mind its data is highly suspect because it has not yet passed any CRC integrity checking. Also note that the packet could be aborted, canceled, or fail momentarily, invalidating its data in Packet mode. Furthermore, there is a small chance towards the end of packet reception that the receive FIFO could include not only packet data received so far, but also some raw radio-appended info detail bytes that RAIL's packet-completion processing will subsequently deal with. It's up to the application to know its packet format well enough to avoid reading this info as it will corrupt the packet's details and possibly corrupt the receive FIFO.
void RAIL_ResetFifo | ( | RAIL_Handle_t |
railHandle,
|
bool |
txFifo,
|
||
bool |
rxFifo
|
||
) |
Resets the RAIL transmit and/or receive FIFOs.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in] txFifo
If true, reset the transmit FIFO. [in] rxFifo
If true, reset the receive FIFO.
- Returns
- void.
This function can reset each FIFO independently. The application should not reset the receive FIFO while receiving a frame, nor should it reset the transmit FIFO while transmitting a frame.
RAIL_Status_t RAIL_SetRxFifo | ( | RAIL_Handle_t |
railHandle,
|
uint8_t * |
addr,
|
||
uint16_t * |
size
|
||
) |
Sets the address of the receive FIFO, a circular buffer used for RX data.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in,out] addr
A pointer to a read-write memory location in RAM used as the receive FIFO. This memory must persist until the next call to this function. [in,out] size
A desired size of the receive FIFO in bytes. This will be populated with the actual size during the function call.
- Returns
- Status code indicating success of the function call.
This function sets the memory location for the receive FIFO. It must be called at least once before any receive operations occur.
The FIFO size can be determined by the value of size after this function. The chosen size is determined based on the available FIFO sizes supported by the hardware. For more on supported FIFO sizes and required alignments, see chip-specific documentation, such as EFR32 . The returned FIFO size will be the closest allowed size less than or equal to the passed in size parameter, unless the size parameter is smaller than the minimum FIFO size.
This function reserves the block of RAM starting at addr with a length of size, which is used internally as a circular buffer for the receive FIFO. It must be able to hold the entire FIFO size. The caller must guarantee that the custom FIFO remains intact and unchanged (except via incoming packet data being written) until the next call to this function.
In multiprotocol, RAIL currently shares one receive FIFO across all protocols. This function will return RAIL_STATUS_INVALID_STATE if the requested RAIL_Handle_t is not active.
uint16_t RAIL_SetRxFifoThreshold | ( | RAIL_Handle_t |
railHandle,
|
uint16_t |
rxThreshold
|
||
) |
Configures the RAIL receive FIFO almost full threshold.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in] rxThreshold
The threshold above which the RAIL_EVENT_RX_FIFO_ALMOST_FULL event will fire.
- Returns
- Configured receive FIFO threshold value.
This function configures the threshold for the receive FIFO. When the number of bytes of packet data in the receive FIFO exceeds the configured threshold, RAIL_Config_t::eventsCallback will fire with RAIL_EVENT_RX_FIFO_ALMOST_FULL set. The rxThreshold value should be smaller than the receive FIFO size; if it is set higher, it will be configured so that the event fires when the receive FIFO is one byte away from being full. A value of RAIL_FIFO_THRESHOLD_DISABLED will disable the threshold, returning RAIL_FIFO_THRESHOLD_DISABLED .
uint16_t RAIL_SetTxFifo | ( | RAIL_Handle_t |
railHandle,
|
uint8_t * |
addr,
|
||
uint16_t |
initLength,
|
||
uint16_t |
size
|
||
) |
Sets the address of the transmit FIFO, a circular buffer used for TX data.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in,out] addr
A pointer to a read-write memory location in RAM used as the transmit FIFO. This memory must persist until the next call to this function. [in] initLength
A number of initial bytes already in the transmit FIFO. [in] size
A desired size of the transmit FIFO in bytes.
- Returns
- Returns the FIFO size in bytes.
This function sets the memory location for the transmit FIFO. It must be called at least once before any transmit operations occur.
The FIFO size can be determined by the return value of this function. The chosen size is determined based on the available FIFO sizes supported by the hardware. For more on supported FIFO sizes and alignments, see chip-specific documentation, such as EFR32 . The returned FIFO size will be the closest allowed size less than or equal to the passed in size parameter, unless the size parameter is smaller than the minimum FIFO size. If the initLength parameter is larger than the returned size, the FIFO will be filled up to its size.
A user may write to the custom memory location directly before calling this function, or use RAIL_WriteTxFifo to write to the memory location after calling this function. Users must specify the initLength for previously-written memory to be set in the transmit FIFO.
This function reserves the block of RAM starting at addr with a length of the returned FIFO size, which is used internally as a circular buffer for the transmit FIFO. It must be able to hold the entire FIFO size. The caller must guarantee that the custom FIFO remains intact and unchanged (except via calls to RAIL_WriteTxFifo ) until the next call to this function.
- Note
- The protocol's packet configuration, as set up by the radio configurator or via RAIL_SetFixedLength() , determines how many bytes of data are consumed from the transmit FIFO for a successful transmit operation, not the initLength value passed in. If not enough data has been put into the transmit FIFO, a RAIL_EVENT_TX_UNDERFLOW event will occur. If too much data is put into the transmit FIFO, the extra data will either become the first bytes sent in a subsequent packet, or will be thrown away if the FIFO gets reset prior to the next transmit. In general, the proper number of packet bytes to put into the transmit FIFO are all payload bytes except for any CRC bytes which the packet configuration causes to be sent automatically.
uint16_t RAIL_SetTxFifoThreshold | ( | RAIL_Handle_t |
railHandle,
|
uint16_t |
txThreshold
|
||
) |
Configures the RAIL transmit FIFO almost empty threshold.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in] txThreshold
The threshold below which the RAIL_EVENT_TX_FIFO_ALMOST_EMPTY event will fire.
- Returns
- Configured transmit FIFO threshold value.
This function configures the threshold for the transmit FIFO. When the number of bytes in the transmit FIFO falls below the configured threshold, RAIL_Config_t::eventsCallback will fire with RAIL_EVENT_TX_FIFO_ALMOST_EMPTY set. The txThreshold value should be smaller than or equal to the transmit FIFO size, otherwise the event will never fire. A value of 0 or RAIL_FIFO_THRESHOLD_DISABLED will disable the threshold, returning RAIL_FIFO_THRESHOLD_DISABLED .
uint16_t RAIL_WriteTxFifo | ( | RAIL_Handle_t |
railHandle,
|
const uint8_t * |
dataPtr,
|
||
uint16_t |
writeLength,
|
||
bool |
reset
|
||
) |
Writes data to the transmit FIFO.
- Parameters
-
[in] railHandle
A RAIL instance handle. [in] dataPtr
An application-provided pointer to transmit data. [in] writeLength
A number of bytes to write to the transmit FIFO. [in] reset
If true, resets transmit FIFO before writing the data.
- Returns
- The number of bytes written to the transmit FIFO.
This function reads data from the provided dataPtr and writes it to the transmit FIFO. If the requested writeLength exceeds the current number of bytes open in the transmit FIFO, the function only writes until the transmit FIFO is full. The function returns the number of bytes written to the transmit FIFO or returns zero if railHandle is NULL or if the transmit FIFO is full.
- Note
- The protocol's packet configuration, as set up by the radio configurator or via RAIL_SetFixedLength() , determines how many bytes of data are consumed from the transmit FIFO for a successful transmit operation, not the writeLength value passed in. If not enough data has been put into the transmit FIFO, a RAIL_EVENT_TX_UNDERFLOW event will occur. If too much data is put into the transmit FIFO, the extra data will either become the first bytes sent in a subsequent packet, or will be thrown away if the FIFO gets reset prior to the next transmit. In general, the proper number of packet bytes to put into the transmit FIFO are all payload bytes except for any CRC bytes, which the packet configuration causes to be sent automatically.
- This function does not create a critical section but, depending on the application, a critical section could be appropriate.
RAIL_Status_t RAILCb_SetupRxFifo | ( | RAIL_Handle_t |
railHandle
|
) |
Sets up the receive FIFO to use.
This function is optional to implement.
- Parameters
-
[in] railHandle
A RAIL instance handle.
- Returns
- Status code indicating success of the function call.
This function is called during the RAIL_Init process to set up the FIFO to use for received packets. If not implemented by the application, a default implementation from within the RAIL library will be used to initialize a 512-byte receive FIFO.
If this function returns an error, then the RAIL_Init process will fail.
During this function, the application should generally call RAIL_SetRxFifo . If that does not happen, then the application needs to set up the receive FIFO via a call to RAIL_SetRxFifo before attempting to receive any packets. An example implementation may look like the following: