Assertions

Callbacks called by assertions.

Macros

#define RAIL_ASSERT_ERROR_MESSAGES
Use this define to create an array of error messages that map to the codes in RAIL_AssertErrorCodes_t .

Enumerations

enum RAIL_AssertErrorCodes_t {
RAIL_ASSERT_FAILED_APPENDED_INFO_MISSING = 0,
RAIL_ASSERT_FAILED_RX_FIFO_BYTES = 1,
RAIL_ASSERT_FAILED_RX_FIFO_ZERO_BYTES_READ = 2,
RAIL_ASSERT_FAILED_ILLEGAL_RXLEN_ENTRY_STATUS = 3,
RAIL_ASSERT_FAILED_BAD_PACKET_LENGTH = 4,
RAIL_ASSERT_FAILED_SYNTH_DIVCTRL_ENUM_CONVERSION_ERROR = 5,
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RX_FIFO = 6,
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_RXLEN_FIFO = 7,
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TX_FIFO = 8,
RAIL_ASSERT_FAILED_UNEXPECTED_STATE_TXACK_FIFO = 9,
RAIL_ASSERT_FAILED_PBUFFER_NOT_DEFINED = 10,
RAIL_ASSERT_FAILED_INSUFFICIENT_BYTES_IN_RX_PACKET = 11,
RAIL_ASSERT_FAILED_CLOCK_PRESCALER = 12,
RAIL_ASSERT_FAILED_RTCC_POST_WAKEUP = 13,
RAIL_ASSERT_FAILED_SYNTH_VCO_FREQUENCY = 14,
RAIL_ASSERT_FAILED_RAC_STATE = 15,
RAIL_ASSERT_FAILED_RETIME_LIMIT = 16,
RAIL_ASSERT_FAILED_NESTED_SEQUENCER_LOCK = 17,
RAIL_ASSERT_FAILED_RSSI_AVERAGE_DONE = 18,
RAIL_ASSERT_FAILED_DFL_BITS_SIZE = 19,
RAIL_ASSERT_FAILED_PROTIMER_RANDOM_SEED = 20,
RAIL_ASSERT_FAILED_EFR32XG1_REGISTER_SIZE = 21,
RAIL_ASSERT_FAILED_PROTIMER_CHANNEL = 22,
RAIL_ASSERT_FAILED_TIMER_REQUIRES_WRAP = 23,
RAIL_ASSERT_FAILED_BASECNTTOP = 24,
RAIL_ASSERT_FAILED_DEPRECATED_LBTRETRY = 25,
RAIL_ASSERT_FAILED_RTCC_SYNC_MISSED = 26,
RAIL_ASSERT_FAILED_CLOCK_SOURCE_NOT_READY = 27,
RAIL_ASSERT_FAILED_TIMINGS_INVALID = 28,
RAIL_ASSERT_NULL_HANDLE = 29,
RAIL_ASSERT_FAILED_SCHED_TIMER_NOT_RUNNING = 30,
RAIL_ASSERT_FAILED_NO_ACTIVE_CONFIG = 31,
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SWITCH = 32,
RAIL_ASSERT_FAILED_RFINIT = 33,
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SCHEDRX = 34,
RAIL_ASSERT_FAILED_INVALID_HANDLE_SCHEDTX = 35,
RAIL_ASSERT_FAILED_INACTIVE_HANDLE_SCHEDTX = 36,
RAIL_ASSERT_FAILED_CONFIG_INDEX_INVALID = 37,
RAIL_ASSERT_FAILED_NO_ACTIVE_HANDLE_SINGLEPROTOCOL = 38,
RAIL_ASSERT_DEPRECATED_FUNCTION = 39,
RAIL_ASSERT_MULTIPROTOCOL_NO_EVENT = 40,
RAIL_ASSERT_FAILED_INVALID_INTERRUPT_ENABLED = 41,
RAIL_ASSERT_CONVERSION_CURVES_NOT_INITIALIZED = 42,
RAIL_ASSERT_DIVISION_BY_ZERO = 43,
RAIL_ASSERT_CANT_USE_HARDWARE = 44,
RAIL_ASSERT_NULL_PARAMETER = 45,
RAIL_ASSERT_INVALID_TASK_TYPE = 46
}
Enumeration of all possible error codes from RAIL_ASSERT.

Functions

void RAILCb_AssertFailed ( RAIL_Handle_t railHandle, RAIL_AssertErrorCodes_t errorCode)
Callback called upon failed assertion.

Detailed Description

Callbacks called by assertions.

This assertion framework was implemented for the purpose of not only being able to assert that certain conditions be true in a block of code, but also to be able to handle them more appropriately. In previous implementations, the behavior upon a failed assert would be to hang in a while(1) loop. However, with the callback, each assert is given a unique error code so that they can be handled on a more case-by-case basis. For documentation on each of the errors, see the rail_assert_error_codes.h file. RAIL_ASSERT_ERROR_MESSAGES[errorCode] gives the explanation of the error. With asserts built into the library, customers can choose how to handle each error inside the callback.

Macro Definition Documentation

#define RAIL_ASSERT_ERROR_MESSAGES

Use this define to create an array of error messages that map to the codes in RAIL_AssertErrorCodes_t .

You can use these to print slightly more detailed error strings related to a particular assert error code if desired. For example, you could implement your assert failed callback as follows to make use of this.

void RAILCb_AssertFailed ( RAIL_Handle_t railHandle, uint32_t errorCode)
{
static const char * railErrorMessages[] = RAIL_ASSERT_ERROR_MESSAGES ;
const char *errorMessage = "Unknown" ;
// If this error code is within the range of known error messages then use
// the appropriate error message.
if (errorCode < ( sizeof (railErrorMessages) / sizeof ( char *))) {
errorMessage = railErrorMessages[errorCode];
}
printf(errorMessage);
// Reset the chip since an assert is a fatal error
NVIC_SystemReset();
}

Definition at line 96 of file rail_assert_error_codes.h .

Function Documentation

void RAILCb_AssertFailed ( RAIL_Handle_t railHandle,
RAIL_AssertErrorCodes_t errorCode
)

Callback called upon failed assertion.

Parameters
[in] railHandle A RAIL instance handle.
[in] errorCode Value passed in by the calling assertion API indicating the RAIL error that is indicated by the failing assertion.
Returns
void.

Referenced by RAIL_CopyRxPacket() .