Radio Control Layer (RCL)
RCL_Command.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2025, 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  */
32 
33 #ifndef ti_drivers_RCL_Command_h__include
34 #define ti_drivers_RCL_Command_h__include
35 
36 #include <stdint.h>
37 #include <stdbool.h>
38 
41 #include <ti/drivers/rcl/LRF.h>
42 
46 typedef RCL_Events (*RCL_CommandHandler)(RCL_Command *cmd, LRF_Events lrfEvents, RCL_Events rclEvents);
47 
51 typedef void (*RCL_Callback)(RCL_Command *cmd, LRF_Events lrfEvents, RCL_Events rclEvents);
52 
60  RCL_Client *client;
61  LRF_Events lrfCallbackMask;
62  RCL_Events rclCallbackMask;
64 #if defined(DeviceFamily_PARENT) && ((DeviceFamily_PARENT == DeviceFamily_PARENT_CC27XX) || (DeviceFamily_PARENT == DeviceFamily_PARENT_CC23X0))
65  uint32_t activityInfo;
66 #endif
67 };
68 
75  uint32_t absStartTime;
76  uint32_t relMinTime;
78  uint32_t relHardStopTime;
79 };
80 
86 typedef enum RCL_CommandStatus_e {
128 
132 #define RCL_CommandStatus_isAnyStop(x) (((x) >= RCL_CommandStatus_DescheduledApi) && ((x) <= RCL_CommandStatus_HardStopScheduling))
133 #define RCL_CommandStatus_isAnyDescheduled(x) (((x) >= RCL_CommandStatus_DescheduledApi) && ((x) <= RCL_CommandStatus_DescheduledScheduling))
134 #define RCL_CommandStatus_isAnyGracefulStop(x) (((x) >= RCL_CommandStatus_GracefulStopTimeout) && ((x) <= RCL_CommandStatus_GracefulStopScheduling))
135 #define RCL_CommandStatus_isAnyHardStop(x) (((x) >= RCL_CommandStatus_HardStopTimeout) && ((x) <= RCL_CommandStatus_HardStopScheduling))
136 #define RCL_CommandStatus_isAnyTimeoutStop(x) (((x) == RCL_CommandStatus_GracefulStopTimeout) || ((x) == RCL_CommandStatus_HardStopTimeout))
137 #define RCL_CommandStatus_isAnyApiStop(x) (((x) == RCL_CommandStatus_DescheduledApi) || ((x) == RCL_CommandStatus_GracefulStopApi) || ((x) == RCL_CommandStatus_HardStopApi))
138 #define RCL_CommandStatus_isAnySchedulingStop(x) (((x) == RCL_CommandStatus_DescheduledScheduling) || ((x) == RCL_CommandStatus_GracefulStopScheduling) || ((x) == RCL_CommandStatus_HardStopScheduling))
139 
145 typedef enum {
150 } RCL_StopType;
151 
157 typedef enum {
161 
167 typedef enum {
172 
179  uint16_t cmdId;
180  uint16_t phyFeatures;
181  RCL_ScheduleType scheduling : 8;
182  RCL_CommandStatus status : 8;
183  RCL_ConflictPolicy conflictPolicy : 8;
184  bool allowDelay;
185  RCL_CommandRuntime runtime;
186  RCL_CommandTiming timing;
187 };
188 
189 #define RCL_Command_Default(_id, _handler) \
190 { \
191  .cmdId = _id, \
192  .phyFeatures = 0, \
193  .scheduling = RCL_Schedule_Now, \
194  .status = RCL_CommandStatus_Idle, \
195  .conflictPolicy = RCL_ConflictPolicy_AlwaysInterrupt, \
196  .allowDelay = false, \
197  .runtime = { \
198  .handler = _handler, \
199  }, \
200  .timing = { \
201  .absStartTime = 0, \
202  .relGracefulStopTime = 0, \
203  .relHardStopTime = 0, \
204  }, \
205 }
206 #define RCL_Command_DefaultRuntime(_id, _handler) (RCL_Command) RCL_Command_Default(_id, _handler)
207 
212 typedef enum {
216 
221 typedef enum {
225 
231 typedef union {
232  struct {
233  uint8_t grantEnable : 1;
234  uint8_t requestPriorityEnable : 1;
235  RCL_Command_CoexPriority priority : 1;
236  RCL_Command_CoexRxMode rxMode : 1;
237  uint8_t reserved : 4;
238  };
239  uint8_t value;
241 
255 
262 static inline void RCL_Command_setRawTxPower(uint32_t registerSetting, uint32_t temperatureCoefficient)
263 {
264  LRF_setRawTxPower(registerSetting, temperatureCoefficient);
265 }
266 
267 #endif /* ti_drivers_RCL_Command_h__include */
Definition: RCL_Command.h:98
static void RCL_Command_setRawTxPower(uint32_t registerSetting, uint32_t temperatureCoefficient)
Set raw TX power.
Definition: RCL_Command.h:262
LRF_TxPowerTable_Index RCL_Command_TxPower
Type for TX power.
Definition: RCL_Command.h:254
Definition: RCL_Command.h:103
void(* RCL_Callback)(RCL_Command *cmd, LRF_Events lrfEvents, RCL_Events rclEvents)
Callback function type.
Definition: RCL_Command.h:51
Definition: RCL_Command.h:102
RCL_Client * client
Definition: RCL_Command.h:60
Type for Coex control.
Definition: RCL_Command.h:231
Definition: RCL_Command.h:222
Definition: RCL_Command.h:223
Definition: RCL_Command.h:117
Definition: RCL_Command.h:95
Definition: RCL_Command.h:91
Definition: RCL_Command.h:106
Definition: RCL_Command.h:109
RCL_Events(* RCL_CommandHandler)(RCL_Command *cmd, LRF_Events lrfEvents, RCL_Events rclEvents)
Command handler function type.
Definition: RCL_Command.h:46
Definition: RCL_Command.h:118
uint16_t cmdId
Definition: RCL_Command.h:179
RCL_CommandHandler handler
Definition: RCL_Command.h:59
Definition: RCL_Command.h:93
RCL_StopType
Stop types.
Definition: RCL_Command.h:145
RCL_ConflictPolicy
Conflict resolution policy.
Definition: RCL_Command.h:167
Definition: RCL_Command.h:113
Definition: RCL_Command.h:112
Definition: RCL_Command.h:99
uint32_t relHardStopTime
Definition: RCL_Command.h:78
RCL_ScheduleType
Schedule type.
Definition: RCL_Command.h:157
Definition: RCL_Command.h:158
Index of the tx power table.
Definition: LRFCC23X0.h:169
RCL_Events rclCallbackMask
Definition: RCL_Command.h:62
Command timing structure.
Definition: RCL_Command.h:74
RCL_Callback callback
Definition: RCL_Command.h:63
Definition: RCL_Command.h:94
Definition: RCL_Command.h:214
Definition: RCL_Command.h:88
Definition: RCL_Command.h:168
Definition: RCL_Command.h:213
Definition: RCL_Command.h:170
Definition: RCL_Command.h:125
Definition: RCL_Command.h:92
Definition: RCL_Command.h:148
uint8_t value
Definition: RCL_Command.h:239
Definition: RCL_Command.h:104
Definition: RCL_Command.h:146
uint32_t absStartTime
Definition: RCL_Command.h:75
Definition: RCL_Command.h:96
Definition: RCL_Command.h:119
Definition: RCL_Command.h:147
Definition: RCL_Command.h:87
Definition: RCL_Command.h:111
Definition: RCL_Command.h:114
LRF_Events lrfCallbackMask
Definition: RCL_Command.h:61
RCL_CommandTiming timing
Definition: RCL_Command.h:186
int32_t relGracefulStopTime
Definition: RCL_Command.h:77
Definition: RCL_Command.h:120
Definition: RCL_Command.h:159
Definition: RCL_Command.h:121
RCL_Command_CoexRxMode
Type for Coex receive mode.
Definition: RCL_Command.h:221
Definition: RCL_Command.h:90
Definition: RCL_Command.h:169
Definition: RCL_Command.h:116
void LRF_setRawTxPower(uint32_t value, uint32_t temperatureCoefficient)
Definition: LRFCC23X0.c:1659
Definition: RCL_Command.h:105
bool allowDelay
Definition: RCL_Command.h:184
Command runtime structure.
Definition: RCL_Command.h:58
Definition: RCL_Command.h:101
uint16_t phyFeatures
Definition: RCL_Command.h:180
RCL_CommandRuntime runtime
Definition: RCL_Command.h:185
General command.
Definition: RCL_Command.h:178
RCL_Command_CoexPriority
Type for Coex priority.
Definition: RCL_Command.h:212
Definition: RCL_Command.h:100
Definition: RCL_Command.h:124
uint32_t relMinTime
Definition: RCL_Command.h:76
Definition: RCL_Command.h:107
Definition: RCL_Command.h:126
Definition: RCL_Command.h:115
Definition: RCL_Command.h:97
RCL_CommandStatus
Command status.
Definition: RCL_Command.h:86
Definition: RCL_Command.h:123
Definition: RCL_Command.h:108
Definition: RCL_Command.h:149
Definition: RCL_Command.h:110
Definition: RCL_Command.h:89
Definition: RCL_Command.h:122