Radio Control Layer (RCL)
ieee.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-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_commands_ieee_h__include
34 #define ti_drivers_RCL_commands_ieee_h__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_TxAction_t RCL_CmdIeee_TxAction;
46 
47 /* Command IDs for generic commands */
48 #define RCL_CMDID_IEEE_RX_TX 0x2001U
49 #define RCL_CMDID_IEEE_TX_TEST 0x2002U
50 
52 #define RCL_CMD_IEEE_CHANNEL_FREQUENCY(channel) ((((channel) - 11UL) * 5000000UL) + 2405000000UL)
53 
58 typedef union {
59  struct {
60  uint8_t crcError :1;
61  uint8_t ignored :1;
62  uint8_t reserved :6;
63  };
64  uint8_t value;
66 
73  RCL_Command common;
74  uint32_t rfFrequency;
77  RCL_CmdIeee_RxAction *rxAction;
78  RCL_CmdIeee_TxAction *txAction;
79  RCL_StatsIeee *stats;
81 };
82 #define RCL_CmdIeeeRxTx_Default() \
83 { \
84  .common = RCL_Command_Default(RCL_CMDID_IEEE_RX_TX, \
85  RCL_Handler_Ieee_RxTx), \
86  .rfFrequency = 2440000000U, \
87  .txPower = {.dBm = 0, .fraction = 0}, \
88  .coexControl = {.value = 0}, \
89  .rxAction = NULL, \
90  .txAction = NULL, \
91  .stats = NULL, \
92 }
93 #define RCL_CmdIeeeRxTx_DefaultRuntime() (RCL_CmdIeeeRxTx) RCL_CmdIeeeRxTx_Default()
94 
95 typedef enum
96 {
103 
104 typedef union
105 {
106  struct {
107  uint16_t panId;
108  uint16_t shortAddr;
109  };
110  uint32_t combined;
112 
114 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN 64
115 
117 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_WITH_EXT_MAX_LEN 32
118 
119 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS \
120 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN) + ((8 * sizeof(uint16_t)) - 1)) / (8 * sizeof(uint16_t)))
121 
122 typedef struct
123 {
124  uint32_t numEntries;
127  RCL_CmdIeee_PanIdAddr shortEntry[];
129 
131 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN 16
132 
133 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS \
134 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN) + ((8 * sizeof(uint16_t)) - 1)) / (8 * sizeof(uint16_t)))
135 
136 typedef struct
137 {
138  uint32_t numEntries;
141  uint64_t extEntry[];
143 
147 typedef struct
148 {
149  uint8_t entryEnable: 1;
150  uint8_t framePending: 1;
151  uint8_t reserved: 6;
153 
154 typedef struct RCL_CmdIeee_PanConfig_t
155 {
156  uint64_t localExtAddr;
157  uint16_t localPanId;
158  uint16_t localShortAddr;
159  RCL_CmdIeee_AutoAckMode autoAckMode : 3;
160  uint8_t defaultPend : 1;
161  uint8_t panCoord : 1;
162  uint8_t maxFrameVersion : 2;
166 
167 #define RCL_CmdIeee_PanConfig_Default() \
168 { \
169  .localExtAddr = 0, \
170  .localPanId = 0, \
171  .localShortAddr = 0, \
172  .autoAckMode = RCL_CmdIeee_AutoAck_Off, \
173  .defaultPend = 0, \
174  .panCoord = 0, \
175  .maxFrameVersion = 1, \
176  .sourceMatchingTableShort = NULL, \
177  .sourceMatchingTableExt = NULL, \
178 }
179 #define RCL_CmdIeee_PanConfig_DefaultRuntime() (RCL_CmdIeee_PanConfig) RCL_CmdIeee_PanConfig_Default()
180 
181 /* Do include after typedefs, as the types are needed in ti/drivers/rcl/handlers/ieee.h */
183 
185 #define RCL_CMD_IEEE_MAX_NUM_PAN 1 /* Maximum number of PANs; will be updated to 2 when dual PAN support is added */
186 
188 {
189  List_List rxBuffers;
190  uint8_t numPan;
192  bool disableSync;
195 };
196 
197 #define RCL_CmdIeee_RxAction_Default() \
198 { \
199  .rxBuffers = { 0 }, \
200  .numPan = 0, \
201  .frameFiltStop = false, \
202  .disableSync = false, \
203  .alwaysStoreAck = false, \
204  .panConfig = {RCL_CmdIeee_PanConfig_Default()} \
205 }
206 #define RCL_CmdIeee_RxAction_DefaultRuntime() (RCL_CmdIeee_RxAction) RCL_CmdIeee_RxAction_Default()
207 
208 typedef enum
209 {
217 
219 {
221  int8_t rssiLimit;
223  uint16_t allowDelay : 1;
225  uint16_t ccaCorrThresh : 3;
226  uint16_t ccaContentionWindow : 2;
227  uint16_t expectImmAck : 1;
228  uint16_t expectEnhAck : 1;
229  uint16_t allowTxDelay : 1;
230  uint16_t endCmdWhenDone : 1;
232  uint32_t absCcaStartTime;
234  uint16_t ackTimeout;
235  RCL_Buffer_DataEntry *txEntry;
236  uint32_t txTimeStamp;
237 };
238 #define RCL_CmdIeee_TxAction_Default() \
239 { \
240  .txStatus = RCL_CommandStatus_Idle, \
241  .rssiLimit = -70, \
242  .ccaScheduling = RCL_Schedule_Now, \
243  .allowDelay = 1, \
244  .ccaMode = RCL_CmdIeee_NoCca, \
245  .ccaCorrThresh = 3, \
246  .ccaContentionWindow = 1, \
247  .expectImmAck = 0, \
248  .expectEnhAck = 0, \
249  .allowTxDelay = 1, \
250  .endCmdWhenDone = 0, \
251  .absCcaStartTime = 0, \
252  .relativeTxStartTime = 0, \
253  .ackTimeout = RCL_SCHEDULER_SYSTIM_US(300), \
254  .txEntry = NULL, \
255  .txTimeStamp = 0, \
256 }
257 #define RCL_CmdIeee_TxAction_DefaultRuntime() (RCL_CmdIeee_TxAction) RCL_CmdIeee_TxAction_Default()
258 
259 
266  RCL_Command common;
267  uint32_t rfFrequency;
269  uint16_t txWord;
270  struct {
271  uint8_t whitenMode: 2;
272  uint8_t sendCw: 1;
273  uint8_t reserved: 5;
274  } config;
275 };
276 #define RCL_CmdIeeeTxTest_Default() \
277 { \
278  .common = RCL_Command_Default(RCL_CMDID_IEEE_TX_TEST, \
279  RCL_Handler_Ieee_TxTest), \
280  .rfFrequency = 2440000000U, \
281  .txPower = {.dBm = 0, .fraction = 0}, \
282  .txWord = 0, \
283  .config = { \
284  .whitenMode = 2, \
285  .sendCw = 0, \
286  .reserved = 0, \
287  }, \
288 }
289 #define RCL_CmdIeeeTxTest_DefaultRuntime() (RCL_CmdIeeeTxTest) RCL_CmdIeeeTxTest_Default()
290 
291 #define RCL_CMD_IEEE_WH_MODE_OFF 0
292 #define RCL_CMD_IEEE_WH_MODE_PRBS9 1
293 #define RCL_CMD_IEEE_WH_MODE_PRBS15 2
294 #define RCL_CMD_IEEE_WH_MODE_PRBS32 3
296 struct RCL_STATS_IEEE_t {
297  struct
298  {
299  uint8_t accumulate : 1;
300  uint8_t activeUpdate : 1;
301  uint8_t reserved : 6;
302  } config;
303  uint8_t timestampValid;
304  int8_t lastRssi;
305  int8_t maxRssi;
306  uint32_t lastTimestamp;
307  uint16_t nRxNok;
308  uint16_t nRxFifoFull;
309  uint16_t nRxOk;
310  uint16_t nRxIgnored;
311  uint16_t nTxImmAck;
312  uint16_t nTxEnhAck;
313  uint16_t nTx;
314 };
315 
316 #define RCL_StatsIeee_Default() \
317 { \
318  .config = { 0 }, \
319  .timestampValid = 0, \
320  .lastRssi = LRF_RSSI_INVALID, \
321  .maxRssi = LRF_RSSI_INVALID, \
322 }
323 #define RCL_StatsIeee_DefaultRuntime() (RCL_StatsIeee) RCL_StatsIeee_Default()
324 
325 
326 
327 #endif
uint32_t txTimeStamp
Definition: ieee.h:236
RCL_CmdIeee_TxAction * txAction
Definition: ieee.h:78
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS
Definition: ieee.h:119
uint16_t allowTxDelay
Definition: ieee.h:229
uint32_t combined
Definition: ieee.h:110
Type for Coex control.
Definition: RCL_Command.h:231
uint32_t rfFrequency
Definition: ieee.h:267
Definition: ieee.h:97
Appended packet status field from RX buffer.
Definition: ieee.h:58
uint16_t nTx
Definition: ieee.h:313
uint16_t nRxIgnored
Definition: ieee.h:310
Definition: ieee.h:154
Definition: ieee.h:214
Definition: ieee.h:104
RCL_ScheduleType ccaScheduling
Definition: ieee.h:222
RCL_Command common
Definition: ieee.h:73
uint16_t txWord
Definition: ieee.h:269
RCL_Command_TxPower txPower
Definition: ieee.h:268
uint16_t localShortAddr
Definition: ieee.h:158
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS
Definition: ieee.h:133
int8_t lastRssi
Definition: ieee.h:304
RCL_StatsIeee * stats
Definition: ieee.h:79
#define RCL_CMD_IEEE_MAX_NUM_PAN
Definition: ieee.h:185
uint16_t nRxFifoFull
Definition: ieee.h:308
RCL_Command_CoexPriority coexPriority
Definition: ieee.h:231
RCL_ScheduleType
Schedule type.
Definition: RCL_Command.h:157
RCL_Command_TxPower txPower
Definition: ieee.h:75
uint16_t nRxNok
Definition: ieee.h:307
IEEE 802.15.4 Receive and transmit command.
Definition: ieee.h:72
Index of the tx power table.
Definition: LRFCC23X0.h:169
int8_t maxRssi
Definition: ieee.h:305
Definition: ieee.h:211
uint8_t value
Definition: ieee.h:64
uint16_t relativeTxStartTime
Definition: ieee.h:233
uint16_t nTxEnhAck
Definition: ieee.h:312
RCL_Command common
Definition: ieee.h:266
uint16_t expectEnhAck
Definition: ieee.h:228
uint32_t numEntries
Definition: ieee.h:138
Definition: ieee.h:218
uint32_t rfFrequency
Definition: ieee.h:74
Definition: ieee.h:210
IEEE 802.15.4 transmitter test command.
Definition: ieee.h:265
uint32_t lastTimestamp
Definition: ieee.h:306
uint16_t localPanId
Definition: ieee.h:157
RCL_CommandStatus txStatus
Definition: ieee.h:220
RCL_CmdIeee_RxAction * rxAction
Definition: ieee.h:77
int8_t rssiLimit
Definition: ieee.h:221
uint16_t nRxOk
Definition: ieee.h:309
uint16_t ccaCorrThresh
Definition: ieee.h:225
Definition: ieee.h:212
uint16_t ackTimeout
Definition: ieee.h:234
RCL_CmdIeee_SourceMatchingTableExt * sourceMatchingTableExt
Definition: ieee.h:164
uint8_t numPan
Definition: ieee.h:190
bool disableSync
Definition: ieee.h:192
bool frameFiltStop
Definition: ieee.h:191
uint64_t localExtAddr
Definition: ieee.h:156
Enable and frame pending bits of updated source matching entry.
Definition: ieee.h:147
List_List rxBuffers
Definition: ieee.h:189
Definition: ieee.h:296
uint16_t expectImmAck
Definition: ieee.h:227
RCL_CmdIeee_AutoAckMode
Definition: ieee.h:95
uint32_t numEntries
Definition: ieee.h:124
bool alwaysStoreAck
Definition: ieee.h:193
RCL_CmdIeee_CcaMode ccaMode
Definition: ieee.h:224
RCL_CmdIeee_CcaMode
Definition: ieee.h:208
RCL_Command_CoexPriority
Type for Coex priority.
Definition: RCL_Command.h:212
uint32_t absCcaStartTime
Definition: ieee.h:232
uint16_t ccaContentionWindow
Definition: ieee.h:226
RCL_CmdIeee_SourceMatchingTableShort * sourceMatchingTableShort
Definition: ieee.h:163
Definition: ieee.h:187
RCL_CommandStatus
Command status.
Definition: RCL_Command.h:86
uint16_t endCmdWhenDone
Definition: ieee.h:230
RCL_Command_CoexControl coexControl
Definition: ieee.h:76
RCL_Buffer_DataEntry * txEntry
Definition: ieee.h:235
uint8_t timestampValid
Definition: ieee.h:303
uint16_t nTxImmAck
Definition: ieee.h:311
uint16_t allowDelay
Definition: ieee.h:223