|
Radio Control Layer (RCL)
|
#include <stdint.h>#include <stddef.h>#include <stdbool.h>#include <string.h>#include <ti/drivers/rcl/hal/hal.h>#include <ti/drivers/rcl/RCL.h>#include <ti/drivers/rcl/LRF.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/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... | |
| __attribute__ ((weak)) | |
| void | RCL_init (void) |
| Initializes the RCL driver state. More... | |
| void | RCL_openPowerNotifications (void) |
| Request RCL power notifications. More... | |
| void | RCL_closePowerNotifications (void) |
| Remove RCL power notification request. More... | |
| RCL_Handle | RCL_open (RCL_Client *c, const LRF_Config *lrfConfig) |
| Initializes an RCL client instance. More... | |
| void | RCL_close (RCL_Handle h) |
| Closes client instance and deallocates open resources. More... | |
| RCL_CommandStatus | RCL_Command_submit (RCL_Handle h, RCL_Command_Handle c) |
| Submit RCL command object to be scheduled for execution. More... | |
| RCL_CommandStatus | RCL_Command_pend (RCL_Command_Handle c) |
| Wait for a submitted command to complete. More... | |
| RCL_CommandStatus | RCL_Command_stop (RCL_Command_Handle c, RCL_StopType stopType) |
| Stop a command. More... | |
| int8_t | RCL_readRssi (void) |
| Get the last valid RSSI value. More... | |
| void | RCL_triggerScheduler (void) |
| Trigger the RCL Scheduler. More... | |
| uint32_t | RCL_getPhySwitchingTime (void) |
| Get Phy RCL Switching time. More... | |
Variables | |
| static bool | isInitialized = 0 |
| static RCL_Command * | rclNextCmd = NULL |
| RCL | rclState |
|
static |
References RCL_SchedulerState::currCmd, RCL_SchedulerState::descheduleReason, RCL_SchedulerState::gracefulStopInfo, hal_cancel_graceful_stop_time(), hal_cancel_hard_stop_time(), hal_cancel_start_time(), hal_check_clear_timer_compare(), hal_disable_all_command_radio_interrupts(), hal_get_command_ifg_reg(), hal_power_release_standby_constraint(), hal_power_set_standby_constraint(), HAL_TIMER_EVT_GRACEFUL_STOP, HAL_TIMER_EVT_HARD_STOP, HAL_TIMER_EVT_PACKET_TIMEOUT, HAL_TIMER_EVT_SETUP, HAL_TIMER_EVT_START, hal_trigger_dispatch_fsm(), RCL_SchedulerState::hardStopInfo, LRF_hardStop(), LRF_setupRadio(), RCL::lrfConfig, RCL::lrfState, RCL_SchedulerState::postedRclEvents, RCL::powerState, RadioState_Configured, RadioState_Down, RadioState_ImagesLoaded, RCL_CommandStatus_Error_Setup, RCL_CommandStatus_Finished, RCL_CommandStatus_Scheduled, RCL_Debug_assert, RCL_EventHandlerCmdUpdate, RCL_EventNone, RCL_Scheduler_findStopStatus(), RCL_Scheduler_postEvent(), RCL_Scheduler_setStopTimes(), RCL_SchedulerStopReason_Timeout, RCL_standbyAllow, RCL_standbyDisallow, RCL_StopType_DescheduleOnly, RCL_StopType_None, rclSchedulerState, rclStop(), RCL_SchedulerState::requestedPhyFeatures, result, SetupResult_Ok, and RCL_SchedulerStopInfo::stopReason.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, hal_disable_all_dispatch_radio_interrupts(), hal_get_dispatch_ifg_reg(), hal_trigger_scheduler_fsm(), LRF_EventNone, RCL_SchedulerState::nextWantsStop, RCL_clearNextCommandHook(), RCL_CommandStatus_Finished, RCL_CommandStatus_RejectedStart, RCL_Debug_assert, RCL_EventNone, RCL_getNextCommandHook(), and rclSchedulerState.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, hal_init_dispatch_radio_interrupts(), hal_setup_setup_time(), LRF_imagesNeedUpdate(), RCL::lrfConfig, RCL::lrfState, RadioState_Configured, RadioState_ImagesLoaded, RCL_clearNextCommandHook(), RCL_CommandStatus_Finished, RCL_Debug_assert, RCL_EventSetup, RCL_getNextCommandHook(), 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, and RCL_SCHEDULER_WAKEUP_MARGIN.
Referenced by RCL_init().
|
static |
References RCL_SchedulerState::currCmd, hal_enable_setup_time_irq(), hal_init_dispatch_radio_interrupts(), RCL::lrfState, RCL::numClients, RadioState_ImagesLoaded, RCL_GPIO_disable(), RCL_GPIO_enable(), RCL_POWER_STANDBY_AWAKE, RCL_POWER_STANDBY_ENTER, and RCL_ProfilingEvent_PreprocStart.
Referenced by hal_power_post_notify_fxn(), 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_clearNextCommandHook(), RCL_CommandStatus_Finished, RCL_CommandStatus_Queued, RCL_Debug_assert, RCL_EventGracefulStop, RCL_EventHardStop, RCL_EventNone, RCL_Scheduler_cancelSchedStopTime(), RCL_Scheduler_findStopStatus(), RCL_Scheduler_postEvent(), RCL_StopType_DescheduleOnly, RCL_StopType_Graceful, RCL_StopType_Hard, RCL_StopType_None, and RCL_SchedulerStopInfo::stopReason.
Referenced by __attribute__(), RCL_Command_stop(), and rclCommandHwi().
| void RCL_clearNextCommandHook | ( | ) |
Hook function to clear nextCmd pointer.
Referenced by __attribute__(), rclDispatchHwi(), rclSchedulerHwi(), and rclStop().
| RCL_Command* RCL_getNextCommandHook | ( | ) |
Hook function to get the nextCmd from the command queue.
Referenced by __attribute__(), RCL_close(), RCL_Command_submit(), 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.
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().
| __attribute__ | ( | (weak) | ) |
References RCL_SchedulerState::currCmd, RCL_SchedulerState::gracefulStopInfo, RCL_SchedulerState::hardStopInfo, LRF_EventNone, RCL_SchedulerState::nextWantsStop, RCL_clearNextCommandHook(), RCL_CommandStatus_Error_StartTooLate, RCL_ConflictPolicy_AlwaysInterrupt, RCL_ConflictPolicy_NeverInterrupt, RCL_ConflictPolicy_Polite, RCL_getNextCommandHook(), RCL_phyHook(), RCL_policyHook(), RCL_Schedule_Now, RCL_scheduleHook(), RCL_Scheduler_delta(), RCL_Scheduler_getCurrentTime(), RCL_Scheduler_isLater(), RCL_SCHEDULER_MARGIN_LOAD, RCL_Scheduler_setSchedStopTime(), RCL_SCHEDULER_TRIG_NOW_DELAY, RCL_SchedulerStopReason_Scheduling, RCL_StopType_DescheduleOnly, RCL_StopType_Graceful, RCL_StopType_Hard, RCL_StopType_None, rclNextCmd, rclSchedulerState, and rclStop().
Referenced by RCL_close().
| void RCL_init | ( | void | ) |
Initializes the RCL driver state.
Resets global state and initialize hardware.
References hal_init_fsm(), hal_temperature_init(), isInitialized, RCL::numClients, RadioState_Down, rclCommandHwi(), rclDispatchHwi(), and rclSchedulerHwi().
Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().
| void RCL_openPowerNotifications | ( | void | ) |
Request RCL power notifications.
References hal_power_open(), RCL::powerNotifyEnableCount, RCL_Debug_assert, and rclPowerNotify().
Referenced by RCL_open().
| void RCL_closePowerNotifications | ( | void | ) |
Remove RCL power notification request.
References hal_power_close(), RCL::powerNotifyEnableCount, and RCL_Debug_assert.
Referenced by RCL_close().
| RCL_Handle RCL_open | ( | RCL_Client * | c, |
| const LRF_Config * | lrfConfig | ||
| ) |
Initializes an RCL client instance.
| [in] | c | - Client object struct to be initialized |
| [in] | lrfConfig | - Radio configuration to be used by client |
References hal_enable_clk_buffer(), LRF_rclEnableRadioClocks(), RCL::numClients, RCL_GPIO_enable(), RCL_openPowerNotifications(), RCL_VERSION, RCL_VERSION_CHANNEL_NUMBER, and RCL_VERSION_SHA.
Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().
| void RCL_close | ( | RCL_Handle | h | ) |
Closes client instance and deallocates open resources.
| [in] | h | - Client handle |
References __attribute__(), LRF_rclDisableRadioClocks(), RCL::lrfConfig, RCL::numClients, RCL_closePowerNotifications(), RCL_CommandStatus_Error_CommandQueueFull, RCL_CommandStatus_Scheduled, RCL_getNextCommandHook(), RCL_GPIO_disable(), and rclNextCmd.
Referenced by adcNoiseCallback(), and RCL_AdcNoise_get_samples_blocking().
| RCL_CommandStatus RCL_Command_submit | ( | RCL_Handle | h, |
| RCL_Command_Handle | c | ||
| ) |
Submit RCL command object to be scheduled for execution.
This API returns immediately with either RCL_CommandStatus_Error or the asynchronous current state of the command.
| [in] | h | - Client handle |
| [in] | c | - Command handle |
References RCL_SchedulerState::currCmd, hal_trigger_scheduler_fsm(), RCL_CommandStatus_Error_AlreadySubmitted, RCL_CommandStatus_Finished, RCL_CommandStatus_Idle, RCL_CommandStatus_Scheduled, and RCL_getNextCommandHook().
Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().
| RCL_CommandStatus RCL_Command_pend | ( | RCL_Command_Handle | c | ) |
Wait for a submitted command to complete.
Uses SemaphoreP_pend to block in the callers context.
| [in] | c | - Client handle |
References RCL_CommandStatus_Active, and RCL_Debug_assert.
Referenced by RCL_AdcNoise_get_samples_blocking().
| RCL_CommandStatus RCL_Command_stop | ( | RCL_Command_Handle | c, |
| RCL_StopType | stopType | ||
| ) |
Stop a command.
Sends the message to try to stop a command. When the function returns, the command may still be running. Depending on the stop type, the command may stop after some time. RCL_Command_pend may be used to wait for the command to finish.
| c | [in] - Command handle |
| stopType | [in] - Stop type; telling which situations the command will stop |
References RCL_SchedulerStopReason_Api, and rclStop().
| int8_t RCL_readRssi | ( | void | ) |
Get the last valid RSSI value.
This API returns the last valid RSSI value or a specific error status if the last obtained RSSI value is no longer valid.
References LRF_readRssi(), LRF_RSSI_INVALID, RCL::lrfState, and RadioState_Configured.
| void RCL_triggerScheduler | ( | void | ) |
Trigger the RCL Scheduler.
This API is meant to be used when there is an update in the command queue by DMM due to change in order of priority. RCL will update nextCmd based on this.
References hal_trigger_scheduler_fsm().
| uint32_t RCL_getPhySwitchingTime | ( | void | ) |
Get Phy RCL Switching time.
This API will return the phy switching time for the radio including the wakeup margin, configuration time, buffer preparation time and phy load time.
References RCL_SCHEDULER_MARGIN_ARM, RCL_SCHEDULER_MARGIN_CONFIGURE, RCL_SCHEDULER_MARGIN_LOAD, and RCL_SCHEDULER_WAKEUP_MARGIN.
|
static |
Referenced by RCL_init().
|
static |
Referenced by __attribute__(), and RCL_close().
| RCL rclState |