Radio Control Layer (RCL)
ieee.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024, 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 
51 /* Macro for finding RF frequency from channel */
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;
76  RCL_CmdIeee_RxAction *rxAction;
77  RCL_CmdIeee_TxAction *txAction;
78  RCL_StatsIeee *stats;
80 };
81 #define RCL_CmdIeeeRxTx_Default() \
82 { \
83  .common = RCL_Command_Default(RCL_CMDID_IEEE_RX_TX, \
84  RCL_Handler_Ieee_RxTx), \
85  .rfFrequency = 2440000000U, \
86  .rxAction = NULL, \
87  .txAction = NULL, \
88  .stats = NULL, \
89 }
90 #define RCL_CmdIeeeRxTx_DefaultRuntime() (RCL_CmdIeeeRxTx) RCL_CmdIeeeRxTx_Default()
91 
92 typedef enum
93 {
100 
101 typedef struct
102 {
103  uint16_t panId;
104  uint16_t shortAddr;
106 
108 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN 64
109 
111 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_WITH_EXT_MAX_LEN 32
112 
113 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS \
114 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_MAX_LEN) + ((8 * sizeof(uint16_t)) - 1)) / (8 * sizeof(uint16_t)))
115 
116 typedef struct
117 {
118  uint32_t numEntries;
121  RCL_CmdIeee_PanIdAddr shortEntry[];
123 
125 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN 16
126 
127 #define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS \
128 (((RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_MAX_LEN) + ((8 * sizeof(uint16_t)) - 1)) / (8 * sizeof(uint16_t)))
129 
130 typedef struct
131 {
132  uint32_t numEntries;
135  uint64_t extEntry[];
137 
138 typedef struct RCL_CmdIeee_PanConfig_t
139 {
140  uint64_t localExtAddr;
141  uint16_t localPanId;
142  uint16_t localShortAddr;
143  RCL_CmdIeee_AutoAckMode autoAckMode : 3;
144  uint8_t defaultPend : 1;
145  uint8_t panCoord : 1;
146  uint8_t maxFrameVersion : 2;
150 
151 #define RCL_CmdIeee_PanConfig_Default() \
152 { \
153  .localExtAddr = 0, \
154  .localPanId = 0, \
155  .localShortAddr = 0, \
156  .autoAckMode = RCL_CmdIeee_AutoAck_Off, \
157  .defaultPend = 0, \
158  .panCoord = 0, \
159  .maxFrameVersion = 1, \
160  .sourceMatchingTableShort = NULL, \
161  .sourceMatchingTableExt = NULL, \
162 }
163 #define RCL_CmdIeee_PanConfig_DefaultRuntime() (RCL_CmdIeee_PanConfig) RCL_CmdIeee_PanConfig_Default()
164 
165 /* Do include after typedefs, as the types are needed in ti/drivers/rcl/handlers/ieee.h */
167 
169 #define RCL_CMD_IEEE_MAX_NUM_PAN 1 /* Dual PAN not supported in this version */
170 
172 {
173  List_List rxBuffers;
174  uint8_t numPan;
176  bool disableSync;
178  RCL_CmdIeee_PanConfig panConfig[];
179 };
180 
181 #define RCL_CmdIeee_RxAction_Default() \
182 { \
183  .rxBuffers = { 0 }, \
184  .numPan = 0, \
185  .frameFiltStop = false, \
186  .disableSync = false, \
187  .alwaysStoreAck = false, \
188 }
189 #define RCL_CmdIeee_RxAction_DefaultRuntime() (RCL_CmdIeee_RxAction) RCL_CmdIeee_RxAction_Default()
190 
191 typedef enum
192 {
200 
202 {
204  int8_t rssiLimit;
206  uint16_t allowDelay : 1;
208  uint16_t ccaCorrThresh : 2;
209  uint16_t ccaContentionWindow : 2;
210  uint16_t expectImmAck : 1;
211  uint16_t expectEnhAck : 1;
212  uint16_t allowTxDelay : 1;
213  uint16_t endCmdWhenDone : 1;
214  uint32_t absCcaStartTime;
216  uint16_t ackTimeout;
217  RCL_Buffer_DataEntry *txEntry;
218  uint32_t txTimeStamp;
219 };
220 #define RCL_CmdIeee_TxAction_Default() \
221 { \
222  .txStatus = RCL_CommandStatus_Idle, \
223  .rssiLimit = -70, \
224  .ccaScheduling = RCL_Schedule_Now, \
225  .allowDelay = 1, \
226  .ccaMode = RCL_CmdIeee_NoCca, \
227  .ccaCorrThresh = 2, \
228  .ccaContentionWindow = 1, \
229  .expectImmAck = 0, \
230  .expectEnhAck = 0, \
231  .allowTxDelay = 1, \
232  .endCmdWhenDone = 0, \
233  .absCcaStartTime = 0, \
234  .relativeTxStartTime = 0, \
235  .ackTimeout = RCL_SCHEDULER_SYSTIM_US(300), \
236  .txEntry = NULL, \
237  .txTimeStamp = 0, \
238 }
239 #define RCL_CmdIeee_TxAction_DefaultRuntime() (RCL_CmdIeee_TxAction) RCL_CmdIeee_TxAction_Default()
240 
241 
248  RCL_Command common;
249  uint32_t rfFrequency;
251  uint16_t txWord;
252  struct {
253  uint8_t whitenMode: 2;
254  uint8_t sendCw: 1;
255  uint8_t reserved: 5;
256  } config;
257 };
258 #define RCL_CmdIeeeTxTest_Default() \
259 { \
260  .common = RCL_Command_Default(RCL_CMDID_IEEE_TX_TEST, \
261  RCL_Handler_Ieee_TxTest), \
262  .rfFrequency = 2440000000U, \
263  .txPower = {.dBm = 0, .fraction = 0}, \
264  .txWord = 0, \
265  .config = { \
266  .whitenMode = 2, \
267  .sendCw = 0, \
268  .reserved = 0, \
269  }, \
270 }
271 #define RCL_CmdIeeeTxTest_DefaultRuntime() (RCL_CmdIeeeTxTest) RCL_CmdIeeeTxTest_Default()
272 
273 #define RCL_CMD_IEEE_WH_MODE_DEFAULT 0
274 #define RCL_CMD_IEEE_WH_MODE_PRBS9 1
275 #define RCL_CMD_IEEE_WH_MODE_PRBS15 2
276 #define RCL_CMD_IEEE_WH_MODE_PRBS32 3
277 struct RCL_STATS_IEEE_t {
278  struct
279  {
280  uint8_t accumulate : 1;
281  uint8_t activeUpdate : 1;
282  uint8_t reserved : 6;
283  } config;
284  uint8_t timestampValid;
285  int8_t lastRssi;
286  int8_t maxRssi;
287  uint32_t lastTimestamp;
288  uint16_t nRxNok;
289  uint16_t nRxFifoFull;
290  uint16_t nRxOk;
291  uint16_t nRxIgnored;
292  uint16_t nTxAck;
293  uint16_t nTx;
294 };
295 
296 #define RCL_StatsIeee_Default() \
297 { \
298  .config = { 0 }, \
299  .timestampValid = 0, \
300  .lastRssi = LRF_RSSI_INVALID, \
301  .maxRssi = LRF_RSSI_INVALID, \
302 }
303 #define RCL_StatsIeee_DefaultRuntime() (RCL_StatsIeee) RCL_StatsIeee_Default()
304 
305 
306 
307 #endif
uint32_t txTimeStamp
Definition: ieee.h:218
RCL_CmdIeee_TxAction * txAction
Definition: ieee.h:77
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_SHORT_NUM_WORDS
Definition: ieee.h:113
uint16_t allowTxDelay
Definition: ieee.h:212
uint32_t rfFrequency
Definition: ieee.h:249
Definition: ieee.h:94
Appended packet status field from RX buffer.
Definition: ieee.h:58
uint16_t nTx
Definition: ieee.h:293
uint16_t nRxIgnored
Definition: ieee.h:291
Definition: ieee.h:138
Definition: ieee.h:197
uint16_t shortAddr
Definition: ieee.h:104
RCL_ScheduleType ccaScheduling
Definition: ieee.h:205
RCL_Command common
Definition: ieee.h:73
uint16_t txWord
Definition: ieee.h:251
RCL_Command_TxPower txPower
Definition: ieee.h:250
uint16_t localShortAddr
Definition: ieee.h:142
#define RCL_CMD_IEEE_SOURCE_MATCH_TABLE_EXT_NUM_WORDS
Definition: ieee.h:127
int8_t lastRssi
Definition: ieee.h:285
RCL_StatsIeee * stats
Definition: ieee.h:78
uint16_t panId
Definition: ieee.h:103
uint16_t nRxFifoFull
Definition: ieee.h:289
RCL_ScheduleType
Schedule type.
Definition: RCL_Command.h:151
RCL_Command_TxPower txPower
Definition: ieee.h:75
uint16_t nRxNok
Definition: ieee.h:288
IEEE 802.15.4 Receive and transmit command.
Definition: ieee.h:72
Index of the tx power table.
Definition: LRFCC23X0.h:173
int8_t maxRssi
Definition: ieee.h:286
Definition: ieee.h:194
uint8_t value
Definition: ieee.h:64
uint16_t relativeTxStartTime
Definition: ieee.h:215
RCL_Command common
Definition: ieee.h:248
uint16_t expectEnhAck
Definition: ieee.h:211
uint32_t numEntries
Definition: ieee.h:132
Definition: ieee.h:201
uint32_t rfFrequency
Definition: ieee.h:74
Definition: ieee.h:193
IEEE 802.15.4 transmitter test command.
Definition: ieee.h:247
uint32_t lastTimestamp
Definition: ieee.h:287
uint16_t localPanId
Definition: ieee.h:141
RCL_CommandStatus txStatus
Definition: ieee.h:203
RCL_CmdIeee_RxAction * rxAction
Definition: ieee.h:76
int8_t rssiLimit
Definition: ieee.h:204
uint16_t nTxAck
Definition: ieee.h:292
uint16_t nRxOk
Definition: ieee.h:290
uint16_t ccaCorrThresh
Definition: ieee.h:208
Definition: ieee.h:195
uint16_t ackTimeout
Definition: ieee.h:216
RCL_CmdIeee_SourceMatchingTableExt * sourceMatchingTableExt
Definition: ieee.h:148
uint8_t numPan
Definition: ieee.h:174
bool disableSync
Definition: ieee.h:176
bool frameFiltStop
Definition: ieee.h:175
uint64_t localExtAddr
Definition: ieee.h:140
List_List rxBuffers
Definition: ieee.h:173
Definition: ieee.h:277
uint16_t expectImmAck
Definition: ieee.h:210
RCL_CmdIeee_AutoAckMode
Definition: ieee.h:92
uint32_t numEntries
Definition: ieee.h:118
bool alwaysStoreAck
Definition: ieee.h:177
RCL_CmdIeee_CcaMode ccaMode
Definition: ieee.h:207
RCL_CmdIeee_CcaMode
Definition: ieee.h:191
Definition: ieee.h:101
uint32_t absCcaStartTime
Definition: ieee.h:214
uint16_t ccaContentionWindow
Definition: ieee.h:209
RCL_CmdIeee_SourceMatchingTableShort * sourceMatchingTableShort
Definition: ieee.h:147
Definition: ieee.h:171
RCL_CommandStatus
Command status.
Definition: RCL_Command.h:83
uint16_t endCmdWhenDone
Definition: ieee.h:213
RCL_Buffer_DataEntry * txEntry
Definition: ieee.h:217
uint8_t timestampValid
Definition: ieee.h:284
uint16_t allowDelay
Definition: ieee.h:206