Radio Control Layer (RCL)
ieee.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2026, 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_commands_ieee__include
34 #define ti_drivers_rcl_commands_ieee__include
35 
38 
39 #include <ti/drivers/utils/List.h>
40 
41 typedef struct RCL_CMD_IEEE_RX_TX_t RCL_CmdIeeeRxTx;
42 typedef struct RCL_CMD_IEEE_TX_TEST_t RCL_CmdIeeeTxTest;
43 typedef struct RCL_STATS_IEEE_t RCL_StatsIeee;
44 typedef struct RCL_CmdIeee_RxAction_t RCL_CmdIeee_RxAction;
45 typedef struct RCL_CmdIeee_RxActionSinglePan_t RCL_CmdIeee_RxActionSinglePan;
46 typedef struct RCL_CmdIeee_TxAction_t RCL_CmdIeee_TxAction;
47 
48 /* Command IDs for generic commands */
49 #define RCL_CMDID_IEEE_RX_TX 0x2001U
50 #define RCL_CMDID_IEEE_TX_TEST 0x2002U
51 
53 #define RCL_CMD_IEEE_CHANNEL_FREQUENCY(channel) ((((channel) - 11UL) * 5000000UL) + 2405000000UL)
54 
59 typedef union {
60  struct {
61  uint8_t crcError :1;
62  uint8_t ignored :1;
63  uint8_t reserved :6;
64  };
65  uint8_t value;
67 
74  RCL_Command common;
75  uint32_t rfFrequency;
78  RCL_CmdIeee_RxAction *rxAction;
79  RCL_CmdIeee_TxAction *txAction;
80  RCL_StatsIeee *stats;
82 };
83 #define RCL_CmdIeeeRxTx_Default() \
84 { \
85  .common = RCL_Command_Default(RCL_CMDID_IEEE_RX_TX, \
86  RCL_Handler_Ieee_RxTx), \
87  .rfFrequency = 2440000000U, \
88  .txPower = {.dBm = 0, .fraction = 0}, \
89  .coexControl = {.value = 0}, \
90  .rxAction = NULL, \
91  .txAction = NULL, \
92  .stats = NULL, \
93 }
94 #define RCL_CmdIeeeRxTx_DefaultRuntime() (RCL_CmdIeeeRxTx) RCL_CmdIeeeRxTx_Default()
95 
96 typedef enum RCL_CmdIeee_AutoAckMode_e
97 {
104 
105 typedef union
106 {
107  struct {
108  uint16_t panId;
109  uint16_t shortAddr;
110  };
111  uint32_t combined;
113 
115 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN 64U
116 
118 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_WITH_EXT_MAX_LEN 32U
119 
120 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS \
121 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN) + ((8U * sizeof(uint16_t)) - 1U)) / (8U * sizeof(uint16_t)))
122 
123 typedef struct
124 {
125  uint32_t numEntries;
128  RCL_CmdIeee_PanIdAddr shortEntry[];
130 
132 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN 16U
133 
134 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS \
135 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN) + ((8U * sizeof(uint16_t)) - 1U)) / (8U * sizeof(uint16_t)))
136 
137 typedef struct
138 {
139  uint32_t numEntries;
142  uint64_t extEntry[];
144 
148 typedef struct
149 {
150  uint8_t entryEnable: 1;
151  uint8_t framePending: 1;
152  uint8_t reserved: 6;
154 
155 typedef struct RCL_CmdIeee_PanConfig_t
156 {
157  uint64_t localExtAddr;
158  uint16_t localPanId;
159  uint16_t localShortAddr;
160  RCL_CmdIeee_AutoAckMode autoAckMode : 3;
161  uint8_t defaultPend : 1;
162  uint8_t panCoord : 1;
163  uint8_t maxFrameVersion : 2;
167 
168 #define RCL_CmdIeee_PanConfig_Default() \
169 { \
170  .localExtAddr = 0, \
171  .localPanId = 0, \
172  .localShortAddr = 0, \
173  .autoAckMode = RCL_CmdIeee_AutoAck_Off, \
174  .defaultPend = 0, \
175  .panCoord = 0, \
176  .maxFrameVersion = 1, \
177  .sourceMatchingTableShort = NULL, \
178  .sourceMatchingTableExt = NULL, \
179 }
180 #define RCL_CmdIeee_PanConfig_DefaultRuntime() (RCL_CmdIeee_PanConfig) RCL_CmdIeee_PanConfig_Default()
181 
182 /* Do include after typedefs, as the types are needed in ti/drivers/rcl/handlers/ieee.h */
184 
186 #define RCL_CMD_IEEE_MAX_NUM_PAN 2U /* Maximum number of PANs */
187 
189 {
190  List_List rxBuffers;
191  uint8_t numPan;
193  bool disableSync;
196 };
197 
198 #define RCL_CmdIeee_RxAction_Default() \
199 { \
200  .rxBuffers = { 0 }, \
201  .numPan = 0, \
202  .frameFiltStop = false, \
203  .disableSync = false, \
204  .alwaysStoreAck = false, \
205  .panConfig = { \
206  RCL_CmdIeee_PanConfig_Default(), \
207  RCL_CmdIeee_PanConfig_Default(), \
208  } \
209 }
210 #define RCL_CmdIeee_RxAction_DefaultRuntime() (RCL_CmdIeee_RxAction) RCL_CmdIeee_RxAction_Default()
211 
213 {
214  List_List rxBuffers;
215  uint8_t numPan;
217  bool disableSync;
219  RCL_CmdIeee_PanConfig panConfig[1];
220 };
221 
222 #define RCL_CmdIeee_RxActionSinglePan_Default() \
223 { \
224  .rxBuffers = { 0 }, \
225  .numPan = 0, \
226  .frameFiltStop = false, \
227  .disableSync = false, \
228  .alwaysStoreAck = false, \
229  .panConfig = { \
230  RCL_CmdIeee_PanConfig_Default(), \
231  } \
232 }
233 #define RCL_CmdIeee_RxActionSinglePan_DefaultRuntime() (RCL_CmdIeee_RxActionSinglePan) RCL_CmdIeee_RxActionSinglePan_Default()
234 
235 typedef enum RCL_CmdIeee_CcaMode_e
236 {
244 
246 {
248  int8_t rssiLimit;
250  uint16_t allowDelay : 1;
252  uint16_t ccaCorrThresh : 3;
253  uint16_t ccaContentionWindow : 2;
254  uint16_t expectImmAck : 1;
255  uint16_t expectEnhAck : 1;
256  uint16_t allowTxDelay : 1;
257  uint16_t endCmdWhenDone : 1;
259  uint32_t absCcaStartTime;
261  uint16_t ackTimeout;
262  RCL_Buffer_DataEntry *txEntry;
263  uint32_t txTimeStamp;
264 };
265 #define RCL_CmdIeee_TxAction_Default() \
266 { \
267  .txStatus = RCL_CommandStatus_Idle, \
268  .rssiLimit = -70, \
269  .ccaScheduling = RCL_Schedule_Now, \
270  .allowDelay = 1, \
271  .ccaMode = RCL_CmdIeee_NoCca, \
272  .ccaCorrThresh = 3, \
273  .ccaContentionWindow = 1, \
274  .expectImmAck = 0, \
275  .expectEnhAck = 0, \
276  .allowTxDelay = 1, \
277  .endCmdWhenDone = 0, \
278  .absCcaStartTime = 0, \
279  .relativeTxStartTime = 0, \
280  .ackTimeout = RCL_SCHEDULER_SYSTIM_US(300), \
281  .txEntry = NULL, \
282  .txTimeStamp = 0, \
283 }
284 #define RCL_CmdIeee_TxAction_DefaultRuntime() (RCL_CmdIeee_TxAction) RCL_CmdIeee_TxAction_Default()
285 
286 
293  RCL_Command common;
294  uint32_t rfFrequency;
296  uint16_t txWord;
297  struct {
298  uint8_t whitenMode: 2;
299  uint8_t sendCw: 1;
300  uint8_t reserved: 5;
301  } config;
302 };
303 #define RCL_CmdIeeeTxTest_Default() \
304 { \
305  .common = RCL_Command_Default(RCL_CMDID_IEEE_TX_TEST, \
306  RCL_Handler_Ieee_TxTest), \
307  .rfFrequency = 2440000000U, \
308  .txPower = {.dBm = 0, .fraction = 0}, \
309  .txWord = 0, \
310  .config = { \
311  .whitenMode = 2, \
312  .sendCw = 0, \
313  .reserved = 0, \
314  }, \
315 }
316 #define RCL_CmdIeeeTxTest_DefaultRuntime() (RCL_CmdIeeeTxTest) RCL_CmdIeeeTxTest_Default()
317 
318 #define RCL_CMD_IEEE_WH_MODE_OFF 0U
319 #define RCL_CMD_IEEE_WH_MODE_PRBS9 1U
320 #define RCL_CMD_IEEE_WH_MODE_PRBS15 2U
321 #define RCL_CMD_IEEE_WH_MODE_PRBS32 3U
323 struct RCL_STATS_IEEE_t {
324  struct
325  {
326  uint8_t accumulate : 1;
327  uint8_t activeUpdate : 1;
328  uint8_t reserved : 6;
329  } config;
330  uint8_t timestampValid;
331  int8_t lastRssi;
332  int8_t maxRssi;
333  uint32_t lastTimestamp;
334  uint16_t nRxNok;
335  uint16_t nRxFifoFull;
336  uint16_t nRxOk;
337  uint16_t nRxIgnored;
338  uint16_t nTxImmAck;
339  uint16_t nTxEnhAck;
340  uint16_t nTx;
341 };
342 
343 #define RCL_StatsIeee_Default() \
344 { \
345  .config = { 0 }, \
346  .timestampValid = 0, \
347  .lastRssi = LRF_RSSI_INVALID, \
348  .maxRssi = LRF_RSSI_INVALID, \
349 }
350 #define RCL_StatsIeee_DefaultRuntime() (RCL_StatsIeee) RCL_StatsIeee_Default()
351 
352 
353 
354 #endif /* ti_drivers_rcl_commands_ieee__include */
uint32_t txTimeStamp
Definition: ieee.h:263
RCL_CmdIeee_TxAction * txAction
Definition: ieee.h:79
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS
Definition: ieee.h:120
bool alwaysStoreAck
Definition: ieee.h:218
uint16_t allowTxDelay
Definition: ieee.h:256
uint32_t combined
Definition: ieee.h:111
Type for Coex control.
Definition: RCL_Command.h:231
uint32_t rfFrequency
Definition: ieee.h:294
Definition: ieee.h:98
Appended packet status field from RX buffer.
Definition: ieee.h:59
uint16_t nTx
Definition: ieee.h:340
uint16_t nRxIgnored
Definition: ieee.h:337
Definition: ieee.h:155
Definition: ieee.h:241
Definition: ieee.h:105
RCL_ScheduleType ccaScheduling
Definition: ieee.h:249
RCL_Command common
Definition: ieee.h:74
uint16_t txWord
Definition: ieee.h:296
uint8_t numPan
Definition: ieee.h:215
RCL_Command_TxPower txPower
Definition: ieee.h:295
uint16_t localShortAddr
Definition: ieee.h:159
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS
Definition: ieee.h:134
int8_t lastRssi
Definition: ieee.h:331
Index of the tx power table.
Definition: LRFLPF3.h:170
RCL_StatsIeee * stats
Definition: ieee.h:80
#define RCL_CMD_IEEE_MAX_NUM_PAN
Definition: ieee.h:186
uint16_t nRxFifoFull
Definition: ieee.h:335
RCL_Command_CoexPriority coexPriority
Definition: ieee.h:258
RCL_ScheduleType
Schedule type.
Definition: RCL_Command.h:157
RCL_Command_TxPower txPower
Definition: ieee.h:76
uint16_t nRxNok
Definition: ieee.h:334
IEEE 802.15.4 Receive and transmit command.
Definition: ieee.h:73
int8_t maxRssi
Definition: ieee.h:332
Definition: ieee.h:238
uint8_t value
Definition: ieee.h:65
uint16_t relativeTxStartTime
Definition: ieee.h:260
uint16_t nTxEnhAck
Definition: ieee.h:339
RCL_Command common
Definition: ieee.h:293
uint16_t expectEnhAck
Definition: ieee.h:255
uint32_t numEntries
Definition: ieee.h:139
Definition: ieee.h:245
uint32_t rfFrequency
Definition: ieee.h:75
Definition: ieee.h:237
IEEE 802.15.4 transmitter test command.
Definition: ieee.h:292
uint32_t lastTimestamp
Definition: ieee.h:333
uint16_t localPanId
Definition: ieee.h:158
RCL_CommandStatus txStatus
Definition: ieee.h:247
RCL_CmdIeee_RxAction * rxAction
Definition: ieee.h:78
int8_t rssiLimit
Definition: ieee.h:248
uint16_t nRxOk
Definition: ieee.h:336
uint16_t ccaCorrThresh
Definition: ieee.h:252
Definition: ieee.h:239
uint16_t ackTimeout
Definition: ieee.h:261
RCL_CmdIeee_SourceMatchingTableExt * sourceMatchingTableExt
Definition: ieee.h:165
Definition: ieee.h:212
uint8_t numPan
Definition: ieee.h:191
bool disableSync
Definition: ieee.h:193
bool disableSync
Definition: ieee.h:217
bool frameFiltStop
Definition: ieee.h:192
uint64_t localExtAddr
Definition: ieee.h:157
Enable and frame pending bits of updated source matching entry.
Definition: ieee.h:148
List_List rxBuffers
Definition: ieee.h:190
Definition: ieee.h:323
uint16_t expectImmAck
Definition: ieee.h:254
RCL_CmdIeee_AutoAckMode
Definition: ieee.h:96
uint32_t numEntries
Definition: ieee.h:125
List_List rxBuffers
Definition: ieee.h:214
bool alwaysStoreAck
Definition: ieee.h:194
RCL_CmdIeee_CcaMode ccaMode
Definition: ieee.h:251
RCL_CmdIeee_CcaMode
Definition: ieee.h:235
bool frameFiltStop
Definition: ieee.h:216
RCL_Command_CoexPriority
Type for Coex priority.
Definition: RCL_Command.h:212
uint32_t absCcaStartTime
Definition: ieee.h:259
uint16_t ccaContentionWindow
Definition: ieee.h:253
RCL_CmdIeee_SourceMatchingTableShort * sourceMatchingTableShort
Definition: ieee.h:164
Definition: ieee.h:188
RCL_CommandStatus
Command status.
Definition: RCL_Command.h:86
uint16_t endCmdWhenDone
Definition: ieee.h:257
RCL_Command_CoexControl coexControl
Definition: ieee.h:77
RCL_Buffer_DataEntry * txEntry
Definition: ieee.h:262
uint8_t timestampValid
Definition: ieee.h:330
uint16_t nTxImmAck
Definition: ieee.h:338
uint16_t allowDelay
Definition: ieee.h:250