TI-RTOS for SimpleLink Wireless MCUs  2.14.02.22
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/knl/Clock.h>
81 #include <ti/sysbios/knl/Semaphore.h>
82 #include <driverlib/rf_common_cmd.h>
83 #include <driverlib/rf_prop_cmd.h>
84 
85 
87 #define RF_MODE_PROPRIETARY 0x00
88 
89 
91 typedef rfc_radioOp_t RF_Op;
92 
93 
95 typedef struct {
96  uint8_t rfMode;
97  void (*cpePatchFxn)(void);
98  void (*mcePatchFxn)(void);
99  void (*rfePatchFxn)(void);
100 } RF_Mode;
101 
102 
104 typedef enum {
109 } RF_Priority;
110 
111 
113 typedef enum {
116 
117  RF_EventCmdError = (1<<5),
120 } RF_Event;
121 
122 
124 typedef uint8_t RF_EventMask;
125 
126 
128 typedef union {
129  rfc_command_t naked; // Can be used simply to get RF operation ID
130  rfc_CMD_RADIO_SETUP_t common;
131  rfc_CMD_PROP_RADIO_SETUP_t prop;
132 } RF_RadioSetup;
133 
134 
137 typedef int16_t RF_CmdHandle;
138 
139 
142 typedef struct {
144 } RF_Params;
145 
146 
154 typedef struct {
156  struct {
160  } config;
162  struct {
163  struct {
164  rfc_CMD_FS_t cmdFs;
165  union {
166  struct {
167  uint8_t foo;
168  } prop;
169  struct {
170  uint8_t foo;
171  } ble;
172  struct {
173  uint8_t foo;
174  } ieee;
175  };
176  } mode_state;
177  Semaphore_Struct semSync;
178  RF_Event volatile eventSync;
179  Clock_Struct clkInactivity;
180  RF_CmdHandle volatile chLastPosted;
181  bool bYielded;
182  } state;
183 } RF_Object;
184 
185 
189 
190 
197 typedef void (*RF_Callback)(RF_Handle h, RF_CmdHandle ch, RF_Event e);
198 
199 
217 extern RF_Handle RF_open(RF_Object *pObj, RF_Mode *pRfMode, RF_RadioSetup *pOpSetup, RF_Params *params);
218 
219 
229 extern void RF_close(RF_Handle h);
230 
231 
241 extern uint32_t RF_getCurrentTime(void);
242 
243 
271 extern RF_CmdHandle RF_postCmd(RF_Handle h, RF_Op* pOp, RF_Priority ePri, RF_Callback pCb);
272 
273 
295 extern RF_Event RF_waitCmd(RF_Handle h, RF_CmdHandle ch, RF_EventMask bmEvent);
296 
297 
312 extern RF_Event RF_runCmd(RF_Handle h, RF_Op* pOp, RF_Priority ePri);
313 
314 
327 extern void RF_abortCmd(RF_Handle h, RF_CmdHandle ch);
328 
329 
339 extern void RF_yield(RF_Handle h);
340 
341 
351 extern void RF_Params_init(RF_Params *params);
352 
353 
354 // Do not interfere with the app if they include the family Hwi module
355 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
356 
357 #ifdef __cplusplus
358 }
359 #endif
360 
361 #endif /* ti_drivers_rf__include */
RF_Event volatile eventSync
Event mask/value used by runCmd() and waitCmd()
Definition: RF.h:178
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:197
RF parameter struct RF parameters are used with the RF_open() and RF_Params_init() call...
Definition: RF.h:142
Last RX operation data received.
Definition: RF.h:115
uint8_t rfMode
Variable for tracking operation mode.
Definition: RF.h:96
RF_Mode * pRfMode
Mode of operation.
Definition: RF.h:158
Highest, use sparingly.
Definition: RF.h:105
bool bYielded
Client has indicated that there are no more commands.
Definition: RF.h:181
void RF_close(RF_Handle h)
Close client connection to RF driver.
rfc_command_t naked
Definition: RF.h:129
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:188
rfc_radioOp_t RF_Op
Alias for the data type of the header common to all radio operations.
Definition: RF.h:91
Normal, usually best choice.
Definition: RF.h:107
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...
Low, use for infinite or background commands.
Definition: RF.h:108
RF_RadioSetup * pOpSetup
Radio setup radio operation, only ram right now.
Definition: RF.h:159
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...
uint32_t nInactivityTimeout
Inactivity timeout in us.
Definition: RF.h:157
Radio command (chain) aborted while in progress.
Definition: RF.h:118
Some error reported during command/operation queueing/parsing.
Definition: RF.h:117
uint8_t RF_EventMask
Event mask type (construct mask with combinations of RF_Event)
Definition: RF.h:124
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:137
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 ...
RF_CmdHandle volatile chLastPosted
Command handle of most recently posted command.
Definition: RF.h:180
Radio command (chain) cancelled before dispatch.
Definition: RF.h:119
rfc_CMD_RADIO_SETUP_t common
Definition: RF.h:130
RF_Priority
Priority of RF commands.
Definition: RF.h:104
High, time-critical commands in synchronous protocols.
Definition: RF.h:106
Last radio operation in command chain finished (non-maskeable)
Definition: RF.h:114
Union of the different flavors of RADIO_SETUP commands.
Definition: RF.h:128
Clock_Struct clkInactivity
Clock used for inactivity timeouts.
Definition: RF.h:179
uint32_t nInactivityTimeout
Inactivity timeout in us.
Definition: RF.h:143
RF_Event
RF Events reported to callback functions or from RF_runCmd()
Definition: RF.h:113
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:164
Struct defining operating mode of RF driver.
Definition: RF.h:95
rfc_CMD_PROP_RADIO_SETUP_t prop
Definition: RF.h:131
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:154
Semaphore_Struct semSync
Semaphore used by runCmd(), waitCmd() and powerdown sequence.
Definition: RF.h:177
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.
uint8_t foo
Definition: RF.h:167
Copyright 2015, Texas Instruments Incorporated