TI-RTOS for SimpleLink Wireless MCUs
2.14.02.22
|
RF driver for the CC26/13xx family.
============================================================================
The RF header file should be included in an application as follows:
The RF driver allows clients (applications or other drivers) to control the radio of the device. The radio interface can either be blocking or non-blocking. Furthermore, the RF driver manages the rf powerdomain and tries to power down when the radio is no longer needed. It also allows clients to setup callbacks for when radio operations are completed and as such allows for fully interrupt based radio software.
The RF driver sets power constraints during operation to keep the device out of standby. When the operation has finished, power constraints are released.
Generic API function | Description |
---|---|
RF_open() | Open client connection to RF driver |
RF_close() | Close client connection to RF driver |
RF_getCurrentTime() | Return current radio timer value |
RF_postCmd() | Post an RF operation (chain) to the command queue |
RF_waitCmd() | Wait for posted command to complete |
RF_runCmd() | Runs synchronously a (chain of) RF operation(s) |
RF_abortCmd() | Abort previously submitted command |
RF_yield() | Signal that the radio will not be used for a while |
#include <stdint.h>
#include <stdbool.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <driverlib/rf_common_cmd.h>
#include <driverlib/rf_prop_cmd.h>
Go to the source code of this file.
Data Structures | |
struct | RF_Mode |
Struct defining operating mode of RF driver. More... | |
union | RF_RadioSetup |
Union of the different flavors of RADIO_SETUP commands. More... | |
struct | RF_Params |
RF parameter struct RF parameters are used with the RF_open() and RF_Params_init() call. More... | |
struct | RF_Object |
Struct used to store RF client state and configuration Pointer to an RF_Object is used as handles (RF_Handle) in interactions with the RF driver. More... | |
Macros | |
#define | RF_MODE_PROPRIETARY 0x00 |
Define for RF mode. More... | |
Typedefs | |
typedef rfc_radioOp_t | RF_Op |
Alias for the data type of the header common to all radio operations. More... | |
typedef uint8_t | RF_EventMask |
Event mask type (construct mask with combinations of RF_Event) More... | |
typedef int16_t | RF_CmdHandle |
A command handle that is returned from RF_postCmd() Used by RF_waitCmd() and RF_abortCmd(). A negative value indicates an error. More... | |
typedef RF_Object * | RF_Handle |
A handle that is returned from a RF_open() call Used for further RF client interaction with the RF driver. More... | |
typedef void(* | RF_Callback) (RF_Handle h, RF_CmdHandle ch, RF_Event e) |
RF callback function pointer type RF callbacks can occur at the completion of posted RF operation (chain). The callback is called from SWI context and provides the relevant RF_Handle, pointer to the relevant radio operation as well as an RF_Event that indicates what has occurred. More... | |
Enumerations | |
enum | RF_Priority { RF_PriorityHighest = 0, RF_PriorityHigh = 1, RF_PriorityNormal = 2, RF_PriorityLow = 3 } |
Priority of RF commands. More... | |
enum | RF_Event { RF_EventCmdDone = 0, RF_EventRxEntryDone = (1<<0), RF_EventCmdError = (1<<5), RF_EventCmdAborted = (1<<6), RF_EventCmdCancelled = (1<<7) } |
RF Events reported to callback functions or from RF_runCmd() More... | |
Functions | |
RF_Handle | RF_open (RF_Object *pObj, RF_Mode *pRfMode, RF_RadioSetup *pOpSetup, RF_Params *params) |
Open client connection to RF driver. More... | |
void | RF_close (RF_Handle h) |
Close client connection to RF driver. More... | |
uint32_t | RF_getCurrentTime (void) |
Return current radio timer value. More... | |
RF_CmdHandle | RF_postCmd (RF_Handle h, RF_Op *pOp, RF_Priority ePri, RF_Callback pCb) |
Post an RF operation (chain) to the command queue Post an RF_Op to the RF command queue of the client with handle h. The command can be the first in a chain of RF operations or a standalone RF operation. If a chain of operations are posted they are treated atomically, i.e. either all or none of the chained operations are run. All operations must be posted in strictly increasing chronological order. Function returns immediately. More... | |
RF_Event | RF_waitCmd (RF_Handle h, RF_CmdHandle ch, RF_EventMask bmEvent) |
Wait for posted command to complete Wait until completion of RF command identified by handle ch for client identified by handle h to complete. Some RF operations (or chains of operations) post additional events during execution which, if enabled in event mask bmEvent, will make RF_waitCmd() return early. In this case, multiple calls to RF_waitCmd() for a single command can be made. If RF_waitCmd() is called for a command that registered a callback function it will take precedence and the callback function will never be called. More... | |
RF_Event | RF_runCmd (RF_Handle h, RF_Op *pOp, RF_Priority ePri) |
Runs synchronously a (chain of) RF operation(s) Allows a (chain of) operation(s) to be posted to the command queue and then waits for it to complete. More... | |
void | RF_abortCmd (RF_Handle h, RF_CmdHandle ch) |
Abort/cancel command and any subsequent commands in command queue If command is running, aborts it and then cancels all later commands in queue. If command has not yet run, cancels it and all later commands in queue. If command has already run or been aborted/cancelled, has no effect. The callbacks for the aborted/cancelled commands are called in chronological order. More... | |
void | RF_yield (RF_Handle h) |
Signal that radio client is not going to issue more commands in a while Hint to RF driver that, irrespective of inactivity timeout, no new further commands will be issued for a while and thus the radio can be powered down at the earliest convenience. More... | |
void | RF_Params_init (RF_Params *params) |
Function to initialize the RF_Params struct to its defaults. More... | |
#define RF_MODE_PROPRIETARY 0x00 |
Define for RF mode.
typedef rfc_radioOp_t RF_Op |
Alias for the data type of the header common to all radio operations.
typedef uint8_t RF_EventMask |
Event mask type (construct mask with combinations of RF_Event)
typedef int16_t RF_CmdHandle |
A command handle that is returned from RF_postCmd() Used by RF_waitCmd() and RF_abortCmd(). A negative value indicates an error.
A handle that is returned from a RF_open() call Used for further RF client interaction with the RF driver.
typedef void(* RF_Callback) (RF_Handle h, RF_CmdHandle ch, RF_Event e) |
enum RF_Priority |
enum RF_Event |
RF Events reported to callback functions or from RF_runCmd()
RF_Handle RF_open | ( | RF_Object * | pObj, |
RF_Mode * | pRfMode, | ||
RF_RadioSetup * | pOpSetup, | ||
RF_Params * | params | ||
) |
Open client connection to RF driver.
Allows a RF client (high-level driver or application) to request access to RF hardware.
pObj | Pointer to a RF_Object that will hold the state for this RF client. The object must be in persistent and writeable memory |
pRfMode | Pointer to a RF_Mode struct holding patch information |
pOpSetup | Pointer to the setup command used in this RF configuration |
params | Pointer to an RF_Params object that is initialized with desired RF parameters. Can be set to NULL for defaults |
void RF_close | ( | RF_Handle | h | ) |
Close client connection to RF driver.
Allows a RF client (high-level driver or application) to close its connection to the RF driver.
h | Handle previously returned by RF_open() |
uint32_t RF_getCurrentTime | ( | void | ) |
Return current radio timer value.
If the radio is powered returns the current radio timer value, if not returns a conservative estimate of the current radio timer value
RF_CmdHandle RF_postCmd | ( | RF_Handle | h, |
RF_Op * | pOp, | ||
RF_Priority | ePri, | ||
RF_Callback | pCb | ||
) |
Post an RF operation (chain) to the command queue Post an RF_Op to the RF command queue of the client with handle h. The command can be the first in a chain of RF operations or a standalone RF operation. If a chain of operations are posted they are treated atomically, i.e. either all or none of the chained operations are run. All operations must be posted in strictly increasing chronological order. Function returns immediately.
Limitations apply to the operations posted:
h | Handle previously returned by RF_open() |
pOp | Pointer to the RF_Op. Must normally be in persistent and writeable memory |
ePri | Priority of this RF command (used for arbitration in multi-client systems) |
pCb | Callback function called upon command completion (and some other events). If RF_postCmd() fails no callback is made |
RF_Event RF_waitCmd | ( | RF_Handle | h, |
RF_CmdHandle | ch, | ||
RF_EventMask | bmEvent | ||
) |
Wait for posted command to complete Wait until completion of RF command identified by handle ch for client identified by handle h to complete. Some RF operations (or chains of operations) post additional events during execution which, if enabled in event mask bmEvent, will make RF_waitCmd() return early. In this case, multiple calls to RF_waitCmd() for a single command can be made. If RF_waitCmd() is called for a command that registered a callback function it will take precedence and the callback function will never be called.
h | Handle previously returned by RF_open() |
ch | Command handle previously returned by RF_postCmd(). |
bmEvent | Bitmask of events that make RF_waitCmd() return. The command done event can not be masked away. |
RF_Event RF_runCmd | ( | RF_Handle | h, |
RF_Op * | pOp, | ||
RF_Priority | ePri | ||
) |
Runs synchronously a (chain of) RF operation(s) Allows a (chain of) operation(s) to be posted to the command queue and then waits for it to complete.
h | Handle previously returned by RF_open() |
pOp | Pointer to the RF_Op. Must normally be in persistent and writeable memory |
ePri | Priority of this RF command (used for arbitration in multi-client systems) |
void RF_abortCmd | ( | RF_Handle | h, |
RF_CmdHandle | ch | ||
) |
Abort/cancel command and any subsequent commands in command queue If command is running, aborts it and then cancels all later commands in queue. If command has not yet run, cancels it and all later commands in queue. If command has already run or been aborted/cancelled, has no effect. The callbacks for the aborted/cancelled commands are called in chronological order.
h | Handle previously returned by RF_open() |
ch | Command handle previously returned by RF_postCmd(). |
void RF_yield | ( | RF_Handle | h | ) |
Signal that radio client is not going to issue more commands in a while Hint to RF driver that, irrespective of inactivity timeout, no new further commands will be issued for a while and thus the radio can be powered down at the earliest convenience.
h | Handle previously returned by RF_open() |