Radio Control Layer (RCL)
RCL.c File Reference
#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_Tracer.h>
#include <ti/drivers/rcl/RCL_Debug.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)
 
RCL_StopType policyHook (RCL_Command *currentCmd, RCL_Command *newCmd)
 Hook function to determine what stop type the ongoing command should get. More...
 
void phyHook (RCL *rclState, RCL_Handle client, RCL_Command *cmd)
 Hook function to allow dynamic PHY change. More...
 
void 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...
 

Variables

static bool isInitialized = 0
 
RCL rclState
 

Function Documentation

§ rclCommandHwi()

§ rclDispatchHwi()

§ rclSchedulerHwi()

§ rclPowerNotify()

§ rclStop()

§ policyHook()

RCL_StopType policyHook ( RCL_Command *  currentCmd,
RCL_Command *  newCmd 
)

Hook function to determine what stop type the ongoing command should get.

Parameters
[in]currentCmdCurrently running command
[in]newCmdNew command to potentially take its place
Returns
RCL_StopType How the ongoing command will be terminated if not already terminated when needed

Referenced by __attribute__().

§ phyHook()

void phyHook ( RCL rclState,
RCL_Handle  client,
RCL_Command *  cmd 
)

Hook function to allow dynamic PHY change.

Parameters
[in]rclStateRCL state
[in]clientCurrent RCL client
[in]cmdCurrently running command

Referenced by __attribute__(), and rclSchedulerHwi().

§ scheduleHook()

void scheduleHook ( RCL_SchedulerState rclSchedulerState,
RCL_Handle  client,
RCL_Command *  cmd 
)

Hook function to schedule new command.

Parameters
[in]rclSchedulerStateScheduler state
[in]clientCurrent RCL client
[in]cmdCommand to be scheduled

Referenced by __attribute__(), and rclSchedulerHwi().

§ __attribute__()

§ RCL_init()

void RCL_init ( void  )

Initializes the RCL driver state.

Resets global state and initialize hardware.

Note
Must be called before using any other RCL API

References hal_init_fsm(), hal_temperature_init(), isInitialized, RCL::numClients, RadioState_Down, RCL_Tracer_enable(), rclCommandHwi(), rclDispatchHwi(), and rclSchedulerHwi().

Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().

§ RCL_openPowerNotifications()

void RCL_openPowerNotifications ( void  )

Request RCL power notifications.

References hal_power_open(), RCL::powerNotifyEnableCount, RCL_Debug_assert, and rclPowerNotify().

Referenced by RCL_open().

§ RCL_closePowerNotifications()

void RCL_closePowerNotifications ( void  )

Remove RCL power notification request.

References hal_power_close(), RCL::powerNotifyEnableCount, and RCL_Debug_assert.

Referenced by RCL_close().

§ RCL_open()

RCL_Handle RCL_open ( RCL_Client *  c,
const LRF_Config lrfConfig 
)

Initializes an RCL client instance.

Parameters
[in]c- Client object struct to be initialized
[in]lrfConfig- Radio configuration to be used by client
Returns
Instance RCL_Handle handle or NULL

References hal_enable_clk_buffer(), LRF_rclEnableRadioClocks(), RCL::numClients, RCL_GPIO_enable(), and RCL_openPowerNotifications().

Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().

§ RCL_close()

void RCL_close ( RCL_Handle  h)

§ RCL_Command_submit()

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.

Parameters
[in]h- Client handle
[in]c- Command handle
Returns
RCL_CommandStatus result of the submission

References RCL_SchedulerState::currCmd, hal_trigger_scheduler_fsm(), RCL::nextCmd, RCL_CommandStatus_Error, RCL_CommandStatus_Error_AlreadySubmitted, RCL_CommandStatus_Finished, and RCL_CommandStatus_Idle.

Referenced by RCL_AdcNoise_get_samples_blocking(), and RCL_AdcNoise_get_samples_callback().

§ RCL_Command_pend()

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.

Precondition
This function must be called from a task context, with interrupts enabled.
Parameters
[in]c- Client handle

References RCL_CommandStatus_Active, and RCL_Debug_assert.

Referenced by RCL_AdcNoise_get_samples_blocking().

§ RCL_Command_stop()

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.

Parameters
c[in] - Command handle
stopType[in] - Stop type; telling which situations the command will stop
Returns
Status of the command; if the command is not finished, a wait is needed.

References RCL_SchedulerStopReason_Api, and rclStop().

§ RCL_readRssi()

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.

Returns
Returns RSSI value, or LRF_RSSI_INVALID if the last obtained RSSI value is no longer valid or if the radio is unavailable (e.g. in the middle of a Tx operation).

References LRF_readRssi(), LRF_RSSI_INVALID, RCL::lrfState, and RadioState_Configured.

Variable Documentation

§ isInitialized

bool isInitialized = 0
static

Referenced by RCL_init().

§ rclState

RCL rclState