TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
Data Structures | Macros | Typedefs | Enumerations | Functions
RF.h File Reference

Detailed Description

RF driver for the CC26/13xx family.

============================================================================

Driver include

The RF header file should be included in an application as follows:

Overview

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.

Power Management

The RF driver sets power constraints during operation to keep the device out of standby. When the operation has finished, power constraints are released.

Supported Functions

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, clear queue
RF_yield() Signal that the radio will not be used for a while
Note
All calls should go through the generic API
#include <stdint.h>
#include <stdbool.h>
#include <ti/sysbios/BIOS.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>
Include dependency graph for RF.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 uint64_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_ObjectRF_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 = (1<<1),
  RF_EventCmdCancelled = (1<<2),
  RF_EventCmdStopped = (1<<3),
  RF_EventCmdAborted = (1<<29),
  RF_EventCmdError = (1<<30),
  RF_EventRxOk = (1<<16),
  RF_EventRxNok = (1<<17),
  RF_EventRxEntryDone = (1<<23),
  RF_EventDataWritten = (1<<24),
  RF_EventNDataWritten = (1<<25),
  RF_EventRxBufFull = (1<<22),
  RF_EventRxAborted = (1<<26),
  RF_EventTxEntryDone = (1<<10)
}
 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, RF_EventMask bmEvent)
 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, RF_Callback pCb, RF_EventMask bmEvent)
 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, bool bGraceful)
 Abort/stop/cancel command and any subsequent commands in command queue If command is running, aborts/stops 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/stopped/cancelled, has no effect. The callbacks for the aborted/stopped/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...
 

Macro Definition Documentation

#define RF_MODE_PROPRIETARY   0x00

Define for RF mode.

Typedef Documentation

typedef rfc_radioOp_t RF_Op

Alias for the data type of the header common to all radio operations.

typedef uint64_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.

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.

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.

Enumeration Type Documentation

Priority of RF commands.

Enumerator
RF_PriorityHighest 

Highest, use sparingly.

RF_PriorityHigh 

High, time-critical commands in synchronous protocols.

RF_PriorityNormal 

Normal, usually best choice.

RF_PriorityLow 

Low, use for infinite or background commands.

enum RF_Event

RF Events reported to callback functions or from RF_runCmd()

Enumerator
RF_EventCmdDone 

Last radio operation in command chain finished (non-maskeable)

RF_EventCmdCancelled 

Radio command (chain) cancelled before dispatch.

RF_EventCmdStopped 

Radio command (chain) stopped while in progress.

RF_EventCmdAborted 

Radio command (chain) aborted while in progress.

RF_EventCmdError 

Some error reported during command/operation queueing/parsing.

RF_EventRxOk 

See Radio HAL documentation.

RF_EventRxNok 

See Radio HAL documentation.

RF_EventRxEntryDone 

Last RX operation data received.

RF_EventDataWritten 

See Radio HAL documentation.

RF_EventNDataWritten 

See Radio HAL documentation.

RF_EventRxBufFull 

See Radio HAL documentation.

RF_EventRxAborted 

See Radio HAL documentation.

RF_EventTxEntryDone 

See Radio HAL documentation.

Function Documentation

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.

Note
Can only be called from task context
Parameters
pObjPointer to a RF_Object that will hold the state for this RF client. The object must be in persistent and writeable memory
pRfModePointer to a RF_Mode struct holding patch information
pOpSetupPointer to the setup command used in this RF configuration
paramsPointer to an RF_Params object that is initialized with desired RF parameters. Can be set to NULL for defaults
Returns
A handle for further RF driver calls or NULL if a client connection was not possible or the supplied parameters invalid
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.

Note
Can only be called from task context
Parameters
hHandle 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

Note
Can be called from any context
Returns
Current radio timer value
RF_CmdHandle RF_postCmd ( RF_Handle  h,
RF_Op pOp,
RF_Priority  ePri,
RF_Callback  pCb,
RF_EventMask  bmEvent 
)

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:

  • The operation must be in the set supported in the chosen radio mode when RF_open() was called
  • Only a subset of radio operations are supported
  • Only some of the trigger modes are supported
    • TRIG_NOW, TRIG_ABSTIME
  • Only some of the conditional execution modes are supported
    • COND_ALWAYS, COND_NEVER
Note
Can be called from task or SWI context
Parameters
hHandle previously returned by RF_open()
pOpPointer to the RF_Op. Must normally be in persistent and writeable memory
ePriPriority of this RF command (used for arbitration in multi-client systems)
pCbCallback function called upon command completion (and some other events). If RF_postCmd() fails no callback is made
bmEventBitmask of events that will trigger the callback.
Returns
A handle to the RF command. Negative value indicates an error
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.

Note
Can only be called from task context
Only one call to RF_waitCmd() or RF_runCmd() can be made at a time for each client
Returns immediately if command has already run or has been aborted/cancelled
Parameters
hHandle previously returned by RF_open()
chCommand handle previously returned by RF_postCmd().
bmEventBitmask of events that make RF_waitCmd() return. The command done event can not be masked away.
Returns
The relevant RF_Event (including RF_EventCmdDone) for the command or last command in a chain
RF_Event RF_runCmd ( RF_Handle  h,
RF_Op pOp,
RF_Priority  ePri,
RF_Callback  pCb,
RF_EventMask  bmEvent 
)

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.

Note
Can only be called from task context
Only one call to RF_waitCmd() or RF_runCmd() can be made at a time for each client
Parameters
hHandle previously returned by RF_open()
pOpPointer to the RF_Op. Must normally be in persistent and writeable memory
ePriPriority of this RF command (used for arbitration in multi-client systems)
pCbCallback function called upon command completion (and some other events). If RF_runCmd() fails no callback is made
bmEventBitmask of events that will trigger the callback.
Returns
The relevant RF_Event (including RF_EventCmdDone) for the command or last command in a chain
void RF_abortCmd ( RF_Handle  h,
RF_CmdHandle  ch,
bool  bGraceful 
)

Abort/stop/cancel command and any subsequent commands in command queue If command is running, aborts/stops 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/stopped/cancelled, has no effect. The callbacks for the aborted/stopped/cancelled commands are called in chronological order.

Note
Can be called from task context or SWI context
Parameters
hHandle previously returned by RF_open()
chCommand handle previously returned by RF_postCmd().
bGracefulTrue: Stop gracefully or False: abort abruptly
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.

Note
Can be called from task context or SWI context
Parameters
hHandle previously returned by RF_open()
void RF_Params_init ( RF_Params params)

Function to initialize the RF_Params struct to its defaults.

Parameters
paramsAn pointer to RF_Params structure for initialization

Defaults values are: nInactivityTimeout = RF_NO_TIMEOUT;

Copyright 2015, Texas Instruments Incorporated