|
Radio Control Layer (RCL)
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>#include <string.h>#include <ti/drivers/RCL.h>#include <ti/drivers/rcl/RCL_Scheduler.h>#include <ti/drivers/rcl/RCL_Profiling.h>#include <ti/drivers/rcl/RCL_Gpio.h>#include <ti/drivers/rcl/RCL_Debug.h>#include <ti/drivers/rcl/RCL_Version.h>#include <ti/drivers/rcl/LRF.h>#include <ti/drivers/rcl/hal/RCL_Hal.h>#include <ti/drivers/dpl/SemaphoreP.h>#include <ti/drivers/dpl/HwiP.h>#include <ti/log/Log.h>
Include dependency graph for RCL.c:Functions | |
| static void | rclCommandHwi (void) |
| static void | rclDispatchHwi (void) |
| static void | rclSchedulerHwi (void) |
| static void | rclPowerNotify (RCL_PowerEvent eventType) |
| static RCL_CommandStatus | rclStop (RCL_Command_Handle c, RCL_StopType stopType, RCL_SchedulerStopReason stopReason) |
| void | RCL_clearNextCommandHook () |
| Hook function to clear nextCmd pointer. More... | |
| RCL_Command * | RCL_getNextCommandHook () |
| Hook function to get the nextCmd from the command queue. More... | |
| RCL_StopType | RCL_policyHook (RCL_Command *currentCmd, RCL_Command *newCmd) |
| Hook function to determine what stop type the ongoing command should get. More... | |
| void | RCL_phyHook (RCL *rclState, RCL_Handle client, RCL_Command *cmd) |
| Hook function to allow dynamic PHY change. More... | |
| void | RCL_scheduleHook (RCL_SchedulerState *rclSchedulerState, RCL_Handle client, RCL_Command *cmd) |
| Hook function to schedule new command. More... | |
| RCL_CommandStatus | RCL_stopNextCmdHook (RCL_Command *cmd, RCL_StopType stopType, RCL_SchedulerStopReason stopReason) |
| Hook function to stop a queued command. More... | |
| RCL_CommandStatus | RCL_submitHook (RCL_Handle h, RCL_Command *cmd) |
| Hook function to submit a command to the RCL. More... | |
| RCL_CommandStatus | RCL_ScheduleStop (RCL_Command_Handle c, RCL_StopType stopType) |
| Function to schedule a stop for a running command. More... | |
| static void | rclCheckNextCommandPendCallback (void) |
| __attribute__ ((weak)) | |
| void | RCL_init (void) |
| void | RCL_openPowerNotifications (void) |
| void | RCL_closePowerNotifications (void) |
| RCL_Handle | RCL_open (RCL_Client *c, const LRF_Config *lrfConfig) |
| void | RCL_close (RCL_Handle h) |
| RCL_CommandStatus | RCL_Command_submit (RCL_Handle h, RCL_Command_Handle c) |
| RCL_CommandStatus | RCL_Command_pend (RCL_Command_Handle c) |
| RCL_CommandStatus | RCL_Command_stop (RCL_Command_Handle c, RCL_StopType stopType) |
| int8_t | RCL_readRssi (void) |
| void | RCL_triggerScheduler (void) |
| uint32_t | RCL_getPhySwitchingTime (void) |
| RCL_Command_TxPower | RCL_txPowerLookup (const LRF_TxPowerTable *table, RCL_Command_TxPower powerLevel, bool roundUp, bool returnBoundaryOnOutOfRange) |
Variables | |
| static bool | isInitialized = false |
| static RCL_Command * | rclNextCmd = NULL |
| RCL | rclState |
|
static |
References RCL_SchedulerState::currCmd, RCL_SchedulerState::descheduleReason, RCL_SchedulerState::gracefulStopInfo, HAL_TIMER_EVT_GRACEFUL_STOP, HAL_TIMER_EVT_HARD_STOP, HAL_TIMER_EVT_PACKET_TIMEOUT, HAL_TIMER_EVT_SETUP, HAL_TIMER_EVT_START, RCL_SchedulerState::hardStopInfo, LRF_hardStop(), LRF_setupRadio(), RCL_SchedulerState::postedRclEvents, RadioState_Configured, RadioState_Down, RadioState_ImagesLoaded, RCL_CommandStatus_Error_Setup, RCL_CommandStatus_Finished, RCL_CommandStatus_Scheduled, RCL_Debug_assert, RCL_EventHandlerCmdUpdate, RCL_EventNone, RCL_Hal_cancelGracefulStopTime(), RCL_Hal_cancelHardStopTime(), RCL_Hal_cancelStartTime(), RCL_Hal_checkClearTimerCompare(), RCL_Hal_disableAllCommandRadioInterrupts(), RCL_Hal_getCommandIfgReg(), RCL_Hal_powerReleaseStandbyConstraint(), RCL_Hal_powerSetStandbyConstraint(), RCL_Hal_triggerDispatchFsm(), RCL_Scheduler_findStopStatus(), RCL_Scheduler_postEvent(), RCL_Scheduler_setStopTimes(), RCL_SchedulerStopReason_Timeout, RCL_StopType_DescheduleOnly, RCL_StopType_None, rclSchedulerState, rclState, rclStop(), RCL_SchedulerState::requestedPhyFeatures, SetupResult_Ok, and RCL_SchedulerStopInfo::stopReason.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, LRF_EventNone, RCL_SchedulerState::nextWantsStop, RCL_clearNextCommandHook(), RCL_CommandStatus_Finished, RCL_CommandStatus_RejectedStart, RCL_Debug_assert, RCL_EventNone, RCL_getNextCommandHook(), RCL_Hal_disableAllDispatchRadioInterrupts(), RCL_Hal_getDispatchIfgReg(), RCL_Hal_triggerSchedulerFsm(), rclCheckNextCommandPendCallback(), and rclSchedulerState.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, LRF_imagesNeedUpdate(), RadioState_Configured, RadioState_ImagesLoaded, RCL_clearNextCommandHook(), RCL_CommandStatus_Finished, RCL_CommandStatus_Scheduled, RCL_Debug_assert, RCL_EventCmdScheduleDone, RCL_EventSetup, RCL_getNextCommandHook(), RCL_Hal_initDispatchRadioInterrupts(), RCL_Hal_setupSetupTime(), RCL_phyHook(), RCL_ProfilingEvent_PostprocStop, RCL_Schedule_Now, RCL_scheduleHook(), RCL_Scheduler_delta(), RCL_Scheduler_getCurrentTime(), RCL_SCHEDULER_MARGIN_ARM, RCL_SCHEDULER_MARGIN_CONFIGURE, RCL_SCHEDULER_MARGIN_LOAD, RCL_Scheduler_postEvent(), RCL_SCHEDULER_SLEEP_CUTOFF, RCL_SCHEDULER_TRIG_NOW_DELAY, RCL_SCHEDULER_WAKEUP_MARGIN, and rclSchedulerState.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, RadioState_ImagesLoaded, RCL_GPIO_disable(), RCL_GPIO_enable(), RCL_Hal_enableSetupTimeIrq(), RCL_Hal_initDispatchRadioInterrupts(), RCL_POWER_STANDBY_AWAKE, RCL_POWER_STANDBY_ENTER, RCL_ProfilingEvent_PreprocStart, and rclSchedulerState.
Referenced by RCL_Hal_powerPostNotifyFxn(), and RCL_openPowerNotifications().
|
static |
References RCL_SchedulerStopInfo::apiStopEnabled, RCL_SchedulerState::currCmd, RCL_SchedulerState::descheduleReason, RCL_SchedulerState::gracefulStopInfo, RCL_SchedulerState::hardStopInfo, LRF_sendGracefulStop(), LRF_sendHardStop(), RCL_CommandStatus_Finished, RCL_CommandStatus_Queued, RCL_Debug_assert, RCL_EventNone, RCL_Scheduler_postEvent(), RCL_stopNextCmdHook(), RCL_StopType_DescheduleOnly, RCL_StopType_Graceful, RCL_StopType_Hard, RCL_StopType_None, rclSchedulerState, and RCL_SchedulerStopInfo::stopReason.
Referenced by __attribute__(), RCL_Command_stop(), RCL_ScheduleStop(), and rclCommandHwi().
| void RCL_clearNextCommandHook | ( | ) |
Hook function to clear nextCmd pointer.
Referenced by __attribute__(), rclDispatchHwi(), and rclSchedulerHwi().
| RCL_Command* RCL_getNextCommandHook | ( | ) |
Hook function to get the nextCmd from the command queue.
Referenced by __attribute__(), rclDispatchHwi(), and rclSchedulerHwi().
| RCL_StopType RCL_policyHook | ( | RCL_Command * | currentCmd, |
| RCL_Command * | newCmd | ||
| ) |
Hook function to determine what stop type the ongoing command should get.
| [in] | currentCmd | Currently running command |
| [in] | newCmd | New command to potentially take its place |
Referenced by __attribute__().
| void RCL_phyHook | ( | RCL * | rclState, |
| RCL_Handle | client, | ||
| RCL_Command * | cmd | ||
| ) |
Hook function to allow dynamic PHY change.
| [in] | rclState | RCL state |
| [in] | client | Current RCL client |
| [in] | cmd | Currently running command |
Referenced by __attribute__(), and rclSchedulerHwi().
| void RCL_scheduleHook | ( | RCL_SchedulerState * | rclSchedulerState, |
| RCL_Handle | client, | ||
| RCL_Command * | cmd | ||
| ) |
Hook function to schedule new command.
| [in] | rclSchedulerState | Scheduler state |
| [in] | client | Current RCL client |
| [in] | cmd | Command to be scheduled |
Referenced by __attribute__(), and rclSchedulerHwi().
| RCL_CommandStatus RCL_stopNextCmdHook | ( | RCL_Command * | cmd, |
| RCL_StopType | stopType, | ||
| RCL_SchedulerStopReason | stopReason | ||
| ) |
Hook function to stop a queued command.
This hook is invoked when a command that is still in the queue (i.e. not yet scheduled or active) needs to be stopped.
| [in] | cmd | Pointer to the command to be stopped |
| [in] | stopType | Type of stop that should be applied |
| [in] | stopReason | Reason for stopping the command |
Referenced by __attribute__(), and rclStop().
| RCL_CommandStatus RCL_submitHook | ( | RCL_Handle | h, |
| RCL_Command * | cmd | ||
| ) |
Hook function to submit a command to the RCL.
| [in] | h | Handle of the RCL client submitting the command |
| [in] | cmd | Pointer to the command being submitted |
Referenced by RCL_close(), and RCL_Command_submit().
| RCL_CommandStatus RCL_ScheduleStop | ( | RCL_Command_Handle | c, |
| RCL_StopType | stopType | ||
| ) |
Function to schedule a stop for a running command.
| [in] | c | Handle of the RCL command to be stopped |
| [in] | stopType | Type of stop to apply (hard, graceful, etc.) |
References RCL_SchedulerStopReason_Scheduling, and rclStop().
|
static |
References LRF_EventNone, RCL_EventDescheduleStop, RCL_EventLastCmdDone, rclSchedulerState, and RCL_SchedulerState::stopCmd.
Referenced by rclDispatchHwi().
| __attribute__ | ( | (weak) | ) |
References RCL_SchedulerStopInfo::apiStopEnabled, RCL_SchedulerState::currCmd, RCL_SchedulerState::descheduleReason, RCL_SchedulerState::gracefulStopInfo, RCL_SchedulerState::hardStopInfo, LRF_EventNone, LRF_sendGracefulStop(), LRF_sendHardStop(), RCL_SchedulerState::nextWantsStop, RCL_clearNextCommandHook(), RCL_CommandStatus_Error, RCL_CommandStatus_Error_StartTooLate, RCL_ConflictPolicy_AlwaysInterrupt, RCL_ConflictPolicy_NeverInterrupt, RCL_ConflictPolicy_Polite, RCL_EventGracefulStop, RCL_EventHardStop, RCL_getNextCommandHook(), RCL_Hal_triggerDispatchFsm(), RCL_phyHook(), RCL_policyHook(), RCL_Schedule_Now, RCL_scheduleHook(), RCL_Scheduler_cancelSchedStopTime(), RCL_Scheduler_delta(), RCL_Scheduler_getCurrentTime(), RCL_Scheduler_isLater(), RCL_SCHEDULER_MARGIN_LOAD, RCL_Scheduler_postEvent(), RCL_Scheduler_setSchedStopTime(), RCL_SCHEDULER_TRIG_NOW_DELAY, RCL_Scheduler_updateStopStatus(), RCL_SchedulerStopReason_Scheduling, RCL_stopNextCmdHook(), RCL_StopType_DescheduleOnly, RCL_StopType_Graceful, RCL_StopType_Hard, RCL_StopType_None, rclNextCmd, rclSchedulerState, rclState, rclStop(), and RCL_SchedulerState::stopCmd.
Referenced by RCL_close().
| void RCL_init | ( | void | ) |
References isInitialized, RadioState_Down, RCL_Hal_initFsm(), RCL_Hal_temperatureInit(), rclCommandHwi(), rclDispatchHwi(), and rclSchedulerHwi().
Referenced by __attribute__().
| void RCL_openPowerNotifications | ( | void | ) |
References RCL_Debug_assert, RCL_Hal_powerOpen(), and rclPowerNotify().
Referenced by RCL_open().
| void RCL_closePowerNotifications | ( | void | ) |
References RCL_Debug_assert, and RCL_Hal_powerClose().
Referenced by RCL_close().
| RCL_Handle RCL_open | ( | RCL_Client * | c, |
| const LRF_Config * | lrfConfig | ||
| ) |
References LRF_rclEnableRadioClocks(), RCL_GPIO_enable(), RCL_Hal_enableClkBuffer(), RCL_openPowerNotifications(), RCL_VERSION, RCL_VERSION_CHANNEL_NUMBER, and RCL_VERSION_SHA.
Referenced by __attribute__().
| void RCL_close | ( | RCL_Handle | h | ) |
References __attribute__(), RCL_SchedulerState::currCmd, LRF_rclDisableRadioClocks(), RCL_closePowerNotifications(), RCL_CommandStatus_Error_AlreadySubmitted, RCL_CommandStatus_Error_CommandQueueFull, RCL_CommandStatus_Finished, RCL_CommandStatus_Idle, RCL_CommandStatus_Queued, RCL_GPIO_disable(), RCL_submitHook(), rclNextCmd, and rclSchedulerState.
Referenced by __attribute__(), and adcNoiseCallback().
| RCL_CommandStatus RCL_Command_submit | ( | RCL_Handle | h, |
| RCL_Command_Handle | c | ||
| ) |
References RCL_CommandStatus_Queued, RCL_Hal_triggerSchedulerFsm(), and RCL_submitHook().
Referenced by __attribute__().
| RCL_CommandStatus RCL_Command_pend | ( | RCL_Command_Handle | c | ) |
References RCL_CommandStatus_Active, RCL_CommandStatus_Error, and RCL_Debug_assert.
Referenced by __attribute__().
| RCL_CommandStatus RCL_Command_stop | ( | RCL_Command_Handle | c, |
| RCL_StopType | stopType | ||
| ) |
References RCL_SchedulerStopReason_Api, and rclStop().
| int8_t RCL_readRssi | ( | void | ) |
References LRF_readRssi(), LRF_RSSI_INVALID, and RadioState_Configured.
| void RCL_triggerScheduler | ( | void | ) |
References RCL_Hal_triggerSchedulerFsm().
| uint32_t RCL_getPhySwitchingTime | ( | void | ) |
| RCL_Command_TxPower RCL_txPowerLookup | ( | const LRF_TxPowerTable * | table, |
| RCL_Command_TxPower | powerLevel, | ||
| bool | roundUp, | ||
| bool | returnBoundaryOnOutOfRange | ||
| ) |
References LRF_TxPowerTable_findValueExtended(), and LRF_TxPowerTable_Entry::power.
|
static |
Referenced by RCL_init().
|
static |
Referenced by __attribute__(), and RCL_close().
| RCL rclState |
Referenced by __attribute__(), and rclCommandHwi().