TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
RF.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
71 #ifndef ti_drivers_rf__include
72 #define ti_drivers_rf__include
73 
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 #include <stdint.h>
79 #include <stdbool.h>
80 #include <ti/sysbios/BIOS.h>
81 #include <ti/sysbios/knl/Clock.h>
82 #include <ti/sysbios/knl/Semaphore.h>
83 #include <driverlib/rf_common_cmd.h>
84 #include <driverlib/rf_prop_cmd.h>
85 
86 
88 #define RF_MODE_PROPRIETARY 0x00
89 
90 
92 typedef rfc_radioOp_t RF_Op;
93 
94 
96 typedef struct {
97  uint8_t rfMode;
98  void (*cpePatchFxn)(void);
99  void (*mcePatchFxn)(void);
100  void (*rfePatchFxn)(void);
101 } RF_Mode;
102 
103 
105 typedef enum {
110 } RF_Priority;
111 
112 
114 typedef enum {
115  RF_EventCmdDone = (1<<1),
118  RF_EventCmdAborted = (1<<29),
119  RF_EventCmdError = (1<<30),
120  RF_EventRxOk = (1<<16),
121  RF_EventRxNok = (1<<17),
125  RF_EventRxBufFull = (1<<22),
126  RF_EventRxAborted = (1<<26),
128 } RF_Event;
129 
130 
132 typedef uint64_t RF_EventMask;
133 
134 
136 typedef union {
137  rfc_command_t naked; // Can be used simply to get RF operation ID
138  rfc_CMD_RADIO_SETUP_t common;
139  rfc_CMD_PROP_RADIO_SETUP_t prop;
140 } RF_RadioSetup;
141 
142 
145 typedef int16_t RF_CmdHandle;
146 
147 
150 typedef struct {
152 } RF_Params;
153 
154 
162 typedef struct {
164  struct {
168  } config;
170  struct {
171  struct {
172  rfc_CMD_FS_t cmdFs;
173  union {
174  struct {
175  uint8_t foo;
176  } prop;
177  struct {
178  uint8_t foo;
179  } ble;
180  struct {
181  uint8_t foo;
182  } ieee;
183  };
184  } mode_state;
185  Semaphore_Struct semSync;
186  RF_Event volatile eventSync;
187  void* pCbSync;
189  Clock_Struct clkInactivity;
190  RF_CmdHandle volatile chLastPosted;
191  bool bYielded;
192  } state;
193 } RF_Object;
194 
195 
199 
200 
207 typedef void (*RF_Callback)(RF_Handle h, RF_CmdHandle ch, RF_Event e);
208 
209 
227 extern RF_Handle RF_open(RF_Object *pObj, RF_Mode *pRfMode, RF_RadioSetup *pOpSetup, RF_Params *params);
228 
229 
239 extern void RF_close(RF_Handle h);
240 
241 
251 extern uint32_t RF_getCurrentTime(void);
252 
253 
281 extern RF_CmdHandle RF_postCmd(RF_Handle h, RF_Op* pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent);
282 
283 
305 extern RF_Event RF_waitCmd(RF_Handle h, RF_CmdHandle ch, RF_EventMask bmEvent);
306 
307 
325 extern RF_Event RF_runCmd(RF_Handle h, RF_Op* pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent);
326 
327 
341 extern void RF_abortCmd(RF_Handle h, RF_CmdHandle ch, bool bGraceful);
342 
343 
353 extern void RF_yield(RF_Handle h);
354 
355 
365 extern void RF_Params_init(RF_Params *params);
366 
367 
368 // Do not interfere with the app if they include the family Hwi module
369 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
370 
371 #ifdef __cplusplus
372 }
373 #endif
374 
375 #endif /* ti_drivers_rf__include */
RF_Event volatile eventSync
Event mask/value used by runCmd() and waitCmd()
Definition: RF.h:186
See Radio HAL documentation.
Definition: RF.h:120
See Radio HAL documentation.
Definition: RF.h:123
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 (ch...
Definition: RF.h:207
RF parameter struct RF parameters are used with the RF_open() and RF_Params_init() call...
Definition: RF.h:150
Last RX operation data received.
Definition: RF.h:122
uint8_t rfMode
Variable for tracking operation mode.
Definition: RF.h:97
RF_Mode * pRfMode
Mode of operation.
Definition: RF.h:166
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...
Highest, use sparingly.
Definition: RF.h:106
uint64_t RF_EventMask
Event mask type (construct mask with combinations of RF_Event)
Definition: RF.h:132
bool bYielded
Client has indicated that there are no more commands.
Definition: RF.h:191
void RF_close(RF_Handle h)
Close client connection to RF driver.
rfc_command_t naked
Definition: RF.h:137
RF_Handle RF_open(RF_Object *pObj, RF_Mode *pRfMode, RF_RadioSetup *pOpSetup, RF_Params *params)
Open client connection to RF driver.
uint32_t RF_getCurrentTime(void)
Return current radio timer value.
RF_Object * RF_Handle
A handle that is returned from a RF_open() call Used for further RF client interaction with the RF dr...
Definition: RF.h:198
See Radio HAL documentation.
Definition: RF.h:127
Radio command (chain) stopped while in progress.
Definition: RF.h:117
void * pCbSync
Internal storage for user callback.
Definition: RF.h:187
rfc_radioOp_t RF_Op
Alias for the data type of the header common to all radio operations.
Definition: RF.h:92
Normal, usually best choice.
Definition: RF.h:108
Low, use for infinite or background commands.
Definition: RF.h:109
RF_RadioSetup * pOpSetup
Radio setup radio operation, only ram right now.
Definition: RF.h:167
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...
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...
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 ...
uint32_t nInactivityTimeout
Inactivity timeout in us.
Definition: RF.h:165
See Radio HAL documentation.
Definition: RF.h:126
Radio command (chain) aborted while in progress.
Definition: RF.h:118
Some error reported during command/operation queueing/parsing.
Definition: RF.h:119
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.
Definition: RF.h:145
RF_CmdHandle volatile chLastPosted
Command handle of most recently posted command.
Definition: RF.h:190
RF_Event unpendCause
Return value for RF_waitCmd()
Definition: RF.h:188
Radio command (chain) cancelled before dispatch.
Definition: RF.h:116
rfc_CMD_RADIO_SETUP_t common
Definition: RF.h:138
RF_Priority
Priority of RF commands.
Definition: RF.h:105
See Radio HAL documentation.
Definition: RF.h:121
High, time-critical commands in synchronous protocols.
Definition: RF.h:107
Last radio operation in command chain finished (non-maskeable)
Definition: RF.h:115
Union of the different flavors of RADIO_SETUP commands.
Definition: RF.h:136
Clock_Struct clkInactivity
Clock used for inactivity timeouts.
Definition: RF.h:189
uint32_t nInactivityTimeout
Inactivity timeout in us, default is infinite.
Definition: RF.h:151
RF_Event
RF Events reported to callback functions or from RF_runCmd()
Definition: RF.h:114
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 c...
rfc_CMD_FS_t cmdFs
FS command encapsulating FS state.
Definition: RF.h:172
Struct defining operating mode of RF driver.
Definition: RF.h:96
See Radio HAL documentation.
Definition: RF.h:124
See Radio HAL documentation.
Definition: RF.h:125
rfc_CMD_PROP_RADIO_SETUP_t prop
Definition: RF.h:139
void RF_Params_init(RF_Params *params)
Function to initialize the RF_Params struct to its defaults.
Struct used to store RF client state and configuration Pointer to an RF_Object is used as handles (RF...
Definition: RF.h:162
Semaphore_Struct semSync
Semaphore used by runCmd(), waitCmd() and powerdown sequence.
Definition: RF.h:185
uint8_t foo
Definition: RF.h:175
Copyright 2015, Texas Instruments Incorporated