Radio Control Layer (RCL)
generic.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2023, 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_generic_h__include
34 #define ti_drivers_RCL_commands_generic_h__include
35 
39 
40 #include <ti/drivers/utils/List.h>
41 
42 #include <ti/devices/DeviceFamily.h>
43 #include DeviceFamily_constructPath(inc/pbe_generic_ram_regs.h)
44 #include DeviceFamily_constructPath(inc/pbe_generic_regdef_regs.h)
45 
46 typedef struct RCL_CMD_GENERIC_FS_t RCL_CmdGenericFs;
47 typedef struct RCL_CMD_GENERIC_FS_OFF_t RCL_CmdGenericFsOff;
48 typedef struct RCL_CMD_GENERIC_TX_t RCL_CmdGenericTx;
49 typedef struct RCL_CMD_GENERIC_TX_REPEAT_t RCL_CmdGenericTxRepeat;
50 typedef struct RCL_CMD_GENERIC_TX_TEST_t RCL_CmdGenericTxTest;
51 typedef struct RCL_CMD_GENERIC_RX_t RCL_CmdGenericRx;
52 typedef struct RCL_CMD_GENERIC_PBE_OPERATION_t RCL_CmdGenericPbeOperation;
53 typedef struct RCL_STATS_GENERIC_t RCL_StatsGeneric;
54 typedef struct RCL_CMD_NESB_PTX_t RCL_CmdNesbPtx;
55 typedef struct RCL_CMD_NESB_PRX_t RCL_CmdNesbPrx;
56 typedef struct RCL_STATS_NESB_t RCL_StatsNesb;
57 typedef struct RCL_CONFIG_ADDRESS_t RCL_ConfigAddress;
58 
59 /* Command IDs for generic commands */
60 #define RCL_CMDID_GENERIC_FS 0x0001U
61 #define RCL_CMDID_GENERIC_FS_OFF 0x0002U
62 #define RCL_CMDID_GENERIC_TX 0x0003U
63 #define RCL_CMDID_GENERIC_TX_REPEAT 0x0004U
64 #define RCL_CMDID_GENERIC_TX_TEST 0x0005U
65 #define RCL_CMDID_GENERIC_RX 0x0006U
66 #define RCL_CMDID_GENERIC_PBE_OPERATION 0x0007U
67 #define RCL_CMDID_NESB_PTX 0x0008U
68 #define RCL_CMDID_NESB_PRX 0x0009U
69 
70 
76 typedef enum RCL_FsType_e {
79 } RCL_FsType;
80 
87  RCL_Command common;
88  uint32_t rfFrequency;
90 };
91 
92 #define RCL_CmdGenericFs_Default() \
93 { \
94  .common = RCL_Command_Default(RCL_CMDID_GENERIC_FS, \
95  RCL_Handler_Generic_Fs), \
96  .rfFrequency = 2440000000U, \
97  .fsType = RCL_FsType_Rx, \
98 }
99 #define RCL_CmdGenericFs_DefaultRuntime() (RCL_CmdGenericFs) RCL_CmdGenericFs_Default()
100 
107  RCL_Command common;
108 };
109 
110 #define RCL_CmdGenericFsOff_Default() \
111 { \
112  .common = RCL_Command_Default(RCL_CMDID_GENERIC_FS_OFF, \
113  RCL_Handler_Generic_FsOff), \
114 }
115 #define RCL_CmdGenericFsOff_DefaultRuntime() (RCL_CmdGenericFsOff) RCL_CmdGenericFsOff_Default()
116 
117 
124  RCL_Command common;
125  uint32_t rfFrequency;
126  List_List txBuffers;
127  uint32_t syncWord;
129  struct {
130  uint8_t fsOff: 1;
131  uint8_t reserved: 7;
132  } config;
133 };
134 #define RCL_CmdGenericTx_Default() \
135 { \
136  .common = RCL_Command_Default(RCL_CMDID_GENERIC_TX, \
137  RCL_Handler_Generic_Tx), \
138  .rfFrequency = 2440000000U, \
139  .txBuffers = { 0 }, \
140  .syncWord = 0x930B51DE, \
141  .txPower = {.dBm = 0, .fraction = 0}, \
142  .config = { \
143  .fsOff = 1, \
144  .reserved = 0, \
145  }, \
146 }
147 #define RCL_CmdGenericTx_DefaultRuntime() (RCL_CmdGenericTx) RCL_CmdGenericTx_Default()
148 
155  RCL_Command common;
156  uint32_t rfFrequency;
157  RCL_Buffer_DataEntry *txEntry;
158  uint32_t syncWord;
159  uint32_t timePeriod;
160  uint16_t numPackets;
162  struct {
163  uint8_t fsOff: 1;
164  uint8_t fsRecal: 1;
165  uint8_t reserved: 6;
166  } config;
167 };
168 #define RCL_CmdGenericTxRepeat_Default() \
169 { \
170  .common = RCL_Command_Default(RCL_CMDID_GENERIC_TX_REPEAT, \
171  RCL_Handler_Generic_TxRepeat),\
172  .rfFrequency = 2440000000U, \
173  .txEntry = NULL, \
174  .syncWord = 0x930B51DE, \
175  .timePeriod = 0, \
176  .numPackets = 0, \
177  .config = { \
178  .fsOff = 1, \
179  .fsRecal = 0, \
180  .reserved = 0, \
181  }, \
182 }
183 #define RCL_CmdGenericTxRepeat_DefaultRuntime() (RCL_CmdGenericTxRepeat) RCL_CmdGenericTxRepeat_Default()
184 
191  RCL_Command common;
192  uint32_t rfFrequency;
194  struct {
195  uint32_t txWord: 16;
196  uint32_t whitenMode: 2;
197  uint32_t sendCw: 1;
198  uint32_t fsOff: 1;
199  uint32_t reserved: 12;
200  } config;
201 };
202 #define RCL_CmdGenericTxTest_Default() \
203 { \
204  .common = RCL_Command_Default(RCL_CMDID_GENERIC_TX_TEST, \
205  RCL_Handler_Generic_TxTest), \
206  .rfFrequency = 2440000000U, \
207  .txPower = {.dBm = 0, .fraction = 0}, \
208  .config = { \
209  .txWord = 0, \
210  .whitenMode = 2, \
211  .sendCw = 0, \
212  .fsOff = 1, \
213  .reserved = 0, \
214  }, \
215 }
216 #define RCL_CmdGenericTxTest_DefaultRuntime() (RCL_CmdGenericTxTest) RCL_CmdGenericTxTest_Default()
217 
218 #define RCL_CMD_GENERIC_WH_MODE_NONE 0
219 #define RCL_CMD_GENERIC_WH_MODE_DEFAULT 1
220 #define RCL_CMD_GENERIC_WH_MODE_PRBS15 2
221 #define RCL_CMD_GENERIC_WH_MODE_PRBS32 3
228 struct RCL_CMD_GENERIC_RX_t {
229  RCL_Command common;
230  uint32_t rfFrequency;
231  List_List rxBuffers;
232  RCL_StatsGeneric *stats;
233  uint32_t syncWordA;
234  uint32_t syncWordB;
235  uint16_t maxPktLen;
236  struct {
237  uint8_t repeated: 1;
238  uint8_t disableSyncA: 1;
239  uint8_t disableSyncB: 1;
240  uint8_t discardRxPackets: 1;
241  uint8_t fsOff: 1;
242  uint8_t reserved: 3;
243  } config;
244 };
245 #define RCL_CmdGenericRx_Default() \
246 { \
247  .common = RCL_Command_Default(RCL_CMDID_GENERIC_RX, \
248  RCL_Handler_Generic_Rx), \
249  .rfFrequency = 2440000000U, \
250  .rxBuffers = {0}, \
251  .stats = NULL, \
252  .syncWordA = 0x930B51DE, \
253  .syncWordB = 0x12345678, \
254  .maxPktLen = 255, \
255  .config = { \
256  .repeated = 1, \
257  .disableSyncA = 0, \
258  .disableSyncB = 1, \
259  .discardRxPackets = 0, \
260  .fsOff = 1, \
261  .reserved = 0, \
262  }, \
263 }
264 #define RCL_CmdGenericRx_DefaultRuntime() (RCL_CmdGenericRx) RCL_CmdGenericRx_Default()
265 
267  struct
268  {
269  uint8_t accumulate : 1;
270  uint8_t activeUpdate : 1;
271  uint8_t reserved : 6;
272  } config;
273  uint8_t timestampValid;
274  int8_t lastRssi;
275  uint32_t lastTimestamp;
276  uint32_t nRxNok;
277  uint32_t nRxOk;
278 };
279 
280 #define RCL_StatsGeneric_Default() \
281 { \
282  .config = { 0 }, \
283  .timestampValid = 0, \
284  .lastRssi = LRF_RSSI_INVALID, \
285 }
286 #define RCL_StatsGeneric_DefaultRuntime() (RCL_StatsGeneric) RCL_StatsGeneric_Default()
287 
294  RCL_Command common;
295  uint16_t pbeOperation;
296 };
297 
298 #define RCL_CmdGenericPbeOperation_Default() \
299 { \
300  .common = RCL_Command_Default(RCL_CMDID_GENERIC_PBE_OPERATION, \
301  RCL_Handler_Generic_PbeOperation),\
302  .pbeOperation = PBE_GENERIC_REGDEF_API_OP_PING, \
303 }
304 #define RCL_CmdGenericPbeOperation_DefaultRuntime() (RCL_CmdGenericPbeOperation) RCL_CmdGenericPbeOperation_Default()
305 
312  RCL_Command common;
313  uint32_t rfFrequency;
314  List_List txBuffers;
315  List_List rxBuffers;
316  RCL_StatsNesb *stats;
317  uint32_t syncWord;
319  uint8_t seqNo;
320  uint8_t maxRetrans;
321  uint32_t retransDelay;
323  struct {
324  uint8_t fsOff: 1;
325  uint8_t autoRetransmitMode: 2;
329  uint8_t hdrConf: 1;
331  uint8_t reserved: 4;
332  } config;
333 };
334 #define RCL_CmdNesbPtx_Default() \
335 { \
336  .common = RCL_Command_Default(RCL_CMDID_NESB_PTX, \
337  RCL_Handler_Nesb_Ptx), \
338  .rfFrequency = 2440000000U, \
339  .txBuffers = { 0 }, \
340  .rxBuffers = { 0 }, \
341  .stats = NULL, \
342  .syncWord = 0x930B51DE, \
343  .txPower = {.dBm = 0, .fraction = 0}, \
344  .seqNo = 0, \
345  .maxRetrans = 5, \
346  .retransDelay = 100000, \
347  .config = { \
348  .fsOff = 1, \
349  .autoRetransmitMode = 3, \
350  .hdrConf = 1, \
351  .reserved = 0, \
352  } \
353 }
354 #define RCL_CmdNesbPtx_DefaultRuntime() (RCL_CmdNesbPtx) RCL_CmdNesbPtx_Default()
355 
357  uint32_t address;
358  uint16_t crcVal;
360  uint8_t maxPktLen;
362  uint8_t autoAckMode: 2;
366  uint8_t varLen: 1;
368  uint8_t seqValid: 1;
371  uint8_t seq: 2;
372  uint8_t reserved: 2;
373 };
374 
375 #define RCL_ConfigAddress_Default(_addr) \
376 { \
377  .address = _addr, \
378  .crcVal = 0, \
379  .maxPktLen = 255, \
380  .autoAckMode = 3, \
381  .varLen = 1, \
382  .seqValid = 0, \
383  .seq = 1, \
384  .reserved = 0, \
385 }
386 #define RCL_ConfigAddress_DefaultRuntime(_addr) (RCL_ConfigAddress) RCL_ConfigAddress_Default(_addr)
387 
388 
395  RCL_Command common;
396  uint32_t rfFrequency;
397  List_List rxBuffers;
398  RCL_StatsNesb *stats;
399  uint32_t syncWordA;
400  uint32_t syncWordB;
402  uint8_t addrLen;
403  struct {
404  uint8_t disableSyncA: 1;
405  uint8_t disableSyncB: 1;
406  uint8_t discardRxPackets: 1;
408  uint8_t fsOff: 1;
409  uint8_t repeatOk: 1;
411  uint8_t repeatNok: 1;
414  uint8_t reserved: 2;
415  } config;
416  union {
417  RCL_ConfigAddress syncWord[2];
418  struct {
419  RCL_ConfigAddress syncWordACfg;
420  RCL_ConfigAddress syncWordBCfg;
421  };
422  };
423 };
424 #define RCL_CmdNesbPrx_Default() \
425 { \
426  .common = RCL_Command_Default(RCL_CMDID_NESB_PRX, \
427  RCL_Handler_Nesb_Prx), \
428  .rfFrequency = 2440000000U, \
429  .rxBuffers = {0}, \
430  .stats = NULL, \
431  .syncWordA = 0x930B51DE, \
432  .syncWordB = 0x570451AE, \
433  .txPower = {.dBm = 0, .fraction = 0}, \
434  .addrLen = 4, \
435  .config = { \
436  .disableSyncA = 0, \
437  .disableSyncB = 1, \
438  .discardRxPackets = 0, \
439  .fsOff = 1, \
440  .repeatOk = 1, \
441  .repeatNok = 0, \
442  .reserved = 0, \
443  }, \
444  .syncWord[0] = RCL_ConfigAddress_Default(0xEFFEABBA), \
445  .syncWord[1] = RCL_ConfigAddress_Default(0xEFFEABBC) \
446 }
447 #define RCL_CmdNesbPrx_DefaultRuntime() (RCL_CmdNesbPrx) RCL_CmdNesbPrx_Default()
448 
450  struct
451  {
452  uint8_t accumulate : 1;
453  uint8_t activeUpdate : 1;
454  uint8_t reserved : 6;
455  } config;
456  uint8_t timestampValid;
457  int8_t lastRssi;
458  uint32_t lastTimestamp;
459  uint32_t nTx;
460  uint32_t nRxNok;
461  uint32_t nRxOk;
462  uint32_t nRxIgnored;
463  uint32_t nRxAddrMismatch;
464  uint32_t nRxBufFull;
465 };
466 
467 #define RCL_StatsNesb_Default() \
468 { \
469  .config = { 0 }, \
470  .timestampValid = 0, \
471  .lastRssi = -128, \
472 }
473 #define RCL_StatsNesb_DefaultRuntime() (RCL_StatsNesb) RCL_StatsNesb_Default()
474 
475 
476 #endif
Frequency programming command.
Definition: generic.h:86
RCL_Command common
Definition: generic.h:395
uint16_t maxPktLen
Definition: generic.h:235
uint16_t numPackets
Definition: generic.h:160
Generic transmitter test command.
Definition: generic.h:190
RCL_FsType
RF frequency programming type object.
Definition: generic.h:76
RCL_StatsNesb * stats
Definition: generic.h:316
uint32_t lastTimestamp
Definition: generic.h:275
uint32_t syncWordB
Definition: generic.h:400
NESB receive command.
Definition: generic.h:394
RCL_Command_TxPower txPower
Definition: generic.h:128
int8_t lastRssi
Definition: generic.h:274
Generic receive command.
Definition: generic.h:228
RCL_FsType fsType
Definition: generic.h:89
Definition: generic.h:449
uint32_t nRxOk
Definition: generic.h:461
Definition: generic.h:266
List_List rxBuffers
Definition: generic.h:315
uint8_t maxRetrans
Definition: generic.h:320
uint32_t retransDelay
Definition: generic.h:321
uint32_t syncWordA
Definition: generic.h:399
Index of the tx power table.
Definition: LRFCC23X0.h:173
RCL_Command common
Definition: generic.h:124
uint32_t syncWord
Definition: generic.h:317
RCL_Command common
Definition: generic.h:155
uint32_t rfFrequency
Definition: generic.h:88
uint32_t syncWord
Definition: generic.h:158
uint32_t rfFrequency
Definition: generic.h:156
RCL_Command_TxPower txPower
Definition: generic.h:401
uint8_t timestampValid
Definition: generic.h:273
uint8_t addrLen
Definition: generic.h:402
uint16_t crcVal
Definition: generic.h:358
RCL_Command common
Definition: generic.h:294
uint16_t pbeOperation
Definition: generic.h:295
uint32_t rfFrequency
Definition: generic.h:192
uint32_t nRxNok
Definition: generic.h:460
uint32_t nRxOk
Definition: generic.h:277
RCL_Command common
Definition: generic.h:229
List_List txBuffers
Definition: generic.h:126
uint32_t rfFrequency
Definition: generic.h:396
uint32_t syncWordB
Definition: generic.h:234
uint8_t maxPktLen
Definition: generic.h:360
uint32_t rfFrequency
Definition: generic.h:230
uint32_t lastTimestamp
Definition: generic.h:458
uint32_t nTx
Definition: generic.h:459
uint32_t syncWord
Definition: generic.h:127
uint32_t address
Definition: generic.h:357
Definition: generic.h:77
List_List rxBuffers
Definition: generic.h:397
List_List rxBuffers
Definition: generic.h:231
RCL_Command_TxPower txPower
Definition: generic.h:193
uint8_t timestampValid
Definition: generic.h:456
Generic repeated packet transmit command.
Definition: generic.h:154
RCL_Command common
Definition: generic.h:87
Definition: generic.h:78
RCL_StatsGeneric * stats
Definition: generic.h:232
uint32_t rfFrequency
Definition: generic.h:125
RCL_Command common
Definition: generic.h:107
uint32_t nRxAddrMismatch
Definition: generic.h:463
uint32_t nRxNok
Definition: generic.h:276
Send PBE operation.
Definition: generic.h:293
Stop frequency synthesizer command.
Definition: generic.h:106
NESB transmit command.
Definition: generic.h:311
RCL_Buffer_DataEntry * txEntry
Definition: generic.h:157
Definition: generic.h:356
uint32_t nRxBufFull
Definition: generic.h:464
uint32_t nRxIgnored
Definition: generic.h:462
Generic transmit command.
Definition: generic.h:123
uint8_t seqNo
Definition: generic.h:319
RCL_Command common
Definition: generic.h:312
RCL_Command_TxPower txPower
Definition: generic.h:318
RCL_StatsNesb * stats
Definition: generic.h:398
List_List txBuffers
Definition: generic.h:314
RCL_Command_TxPower txPower
Definition: generic.h:161
uint32_t rfFrequency
Definition: generic.h:313
int8_t lastRssi
Definition: generic.h:457
uint32_t syncWordA
Definition: generic.h:233
uint32_t timePeriod
Definition: generic.h:159
RCL_Command common
Definition: generic.h:191