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 
36 #include <ti/drivers/rcl/RCL_Command.h>
37 #include <ti/drivers/rcl/RCL_Buffer.h>
38 #include <ti/drivers/rcl/handlers/generic.h>
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 
71 /**
72  *  @brief RF frequency programming type object
73  *
74  *  Type to specify how frequency programming is done for FS command
75  */
76 typedef enum RCL_FsType_e {
77     RCL_FsType_Rx,               /*!< Program synth as for RX operation */
78     RCL_FsType_Tx,               /*!< Program synth as for TX operation */
79 } RCL_FsType;
80 
81 /**
82  *  @brief Frequency programming command
83  *
84  *  Command to program a synth frequency without directly starting RX or TX
85  */
86 struct RCL_CMD_GENERIC_FS_t {
87     RCL_Command     common;
88     uint32_t        rfFrequency; /*!< RF frequency in Hz to program */
89     RCL_FsType      fsType;      /*!< Rules for synth setup */
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 
101 /**
102  *  @brief Stop frequency synthesizer command
103  *
104  *  Command to stop the frequency synthesizer if it is running after a command
105  */
106 struct RCL_CMD_GENERIC_FS_OFF_t {
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 
118 /**
119  *  @brief Generic transmit command
120  *
121  *  Command to transmit a packet
122  */
123 struct RCL_CMD_GENERIC_TX_t {
124     RCL_Command     common;
125     uint32_t        rfFrequency; /*!< RF frequency in Hz to program. 0: Do not program frequency */
126     List_List       txBuffers;   /*!< Linked list of packets to transmit. RCL will pop the first packet when transmitted. */
127     uint32_t        syncWord;    /*!< Sync word to transmit */
128     RCL_Command_TxPower txPower; /*!< Transmit power */
129     struct {
130         uint8_t     fsOff: 1;    /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
131         uint8_t     reserved: 7; /*!< Reserved, set to 0 */
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 
149 /**
150  *  @brief Generic repeated packet transmit command
151  *
152  *  Command to transmit a packet repeatedly
153  */
154 struct RCL_CMD_GENERIC_TX_REPEAT_t {
155     RCL_Command          common;
156     uint32_t             rfFrequency; /*!< RF frequency in Hz to program. 0: Do not program frequency */
157     RCL_Buffer_DataEntry *txEntry;    /*!< Packet to transmit */
158     uint32_t             syncWord;    /*!< Sync word to transmit */
159     uint32_t             timePeriod;  /*!< Time period (0.25 us units) of repeated transmissions. 0: Back-to-back */
160     uint16_t             numPackets;  /*!< Number of times to send the packet: 0: Unlimited */
161     RCL_Command_TxPower  txPower;     /*!< Transmit power */
162     struct {
163         uint8_t          fsOff: 1;    /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
164         uint8_t          fsRecal: 1;  /*!< 0: Keep synth running between each packet. 1. Turn off synth after each packet and recalibrate for the next. Requires %rfFrequency != 0 */
165         uint8_t          reserved: 6; /*!< Reserved, set to 0 */
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 
185 /**
186  *  @brief Generic transmitter test command
187  *
188  *  Command to transmit continuously, either a modulated signal or continuous wave
189  */
190 struct RCL_CMD_GENERIC_TX_TEST_t {
191     RCL_Command     common;
192     uint32_t        rfFrequency;   /*!< RF frequency in Hz to program. 0: Do not program frequency */
193     RCL_Command_TxPower txPower;   /*!< Transmit power */
194     struct {
195         uint32_t     txWord: 16;   /*!< Repeated word to transmit */
196         uint32_t     whitenMode: 2;/*!< 0. No whitening. 1: Default whitening. 2: PRBS-15. 3: PRBS-32 */
197         uint32_t     sendCw: 1;    /*!< 0: Send modulated signal. 1: Send CW */
198         uint32_t     fsOff: 1;     /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
199         uint32_t     reserved: 12; /*!< Reserved, set to 0 */
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 /*!< config.whitenMode: No whitening */
219 #define RCL_CMD_GENERIC_WH_MODE_DEFAULT  1 /*!< config.whitenMode: Default whitening */
220 #define RCL_CMD_GENERIC_WH_MODE_PRBS15   2 /*!< config.whitenMode: PRBS-15 */
221 #define RCL_CMD_GENERIC_WH_MODE_PRBS32   3 /*!< config.whitenMode: PRBS-32 */
222 
223 /**
224  *  @brief Generic receive command
225  *
226  *  Command to receive a packet
227  */
228 struct RCL_CMD_GENERIC_RX_t {
229     RCL_Command     common;
230     uint32_t        rfFrequency;         /*!< RF frequency in Hz to program. 0: Do not program frequency */
231     List_List       rxBuffers;           /*!< Linked list of buffers where packets are stored */
232     RCL_StatsGeneric *stats;             /*!< Pointer to statistics structure. NULL: Do not store statistics */
233     uint32_t        syncWordA;           /*!< Sync word to listen for */
234     uint32_t        syncWordB;           /*!< Alternate  Sync word to listen for */
235     uint16_t        maxPktLen;           /*!< Maximum packet length, or packet length for fixed length */
236     struct {
237         uint8_t     repeated: 1;         /*!< 0: End after receiving one packet. 1: Go back to sync search after receiving. */
238         uint8_t     disableSyncA: 1;     /*!< 0: Listen for syncWordA. 1: Do not listen for syncWordA */
239         uint8_t     disableSyncB: 1;     /*!< 0: Listen for syncWordB. 1: Do not listen for syncWordB */
240         uint8_t     discardRxPackets: 1; /*!< 0: Store received packets in rxBuffers. 1: Do not store packets, useful for link tests where checksum result is enough */
241         uint8_t     fsOff: 1;            /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
242         uint8_t     reserved: 3;         /*!< Reserved, set to 0 */
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 
266 struct RCL_STATS_GENERIC_t {
267     struct
268     {
269         uint8_t accumulate : 1;      /*!< 0: Reset counters to 0 at start of command. 1: Add to incoming value of counters. */
270         uint8_t activeUpdate : 1;    /*!< 0: Update only at end of command. 1: Update after receiving or transmitting packets. */
271         uint8_t reserved : 6;        /*!< Reserved, set to 0 */
272     } config;                        /*!< Configuration provided to RCL */
273     uint8_t   timestampValid;        /*!< Returns 1 if %lastTimestamp is updated; 0 otherwise */
274     int8_t    lastRssi;              /*!< RSSI of last received packet. */
275     uint32_t  lastTimestamp;         /*!< Timestamp of last successfully received packet */
276     uint32_t  nRxNok;                /*!< Number of packets received with CRC error */
277     uint32_t  nRxOk;                 /*!< Number of correctly received packets */
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 
288 /**
289  *  @brief Send PBE operation
290  *
291  *  Send an opcode to the PBE and wait for it to report done
292  */
293 struct RCL_CMD_GENERIC_PBE_OPERATION_t {
294     RCL_Command     common;
295     uint16_t        pbeOperation;     /*!<  Operation code to send to the PBE */
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 
306 /**
307  *  @brief NESB transmit command
308  *
309  *  Command to transmit a packet
310  */
311 struct RCL_CMD_NESB_PTX_t {
312     RCL_Command     common;
313     uint32_t        rfFrequency;            /*!< RF frequency in Hz to program. 0: Do not program frequency. */
314     List_List       txBuffers;              /*!< Linked list of packets to transmit. RCL will pop the first packet when transmitted. */
315     List_List       rxBuffers;              /*!< Linked list of buffers for storing received packets. In this case, the ACK. */
316     RCL_StatsNesb   *stats;                /*!< Pointer to statistics structure. NULL: Do not store statistics */
317     uint32_t        syncWord;               /*!< Sync word to transmit */
318     RCL_Command_TxPower txPower;            /*!< Transmit power */
319     uint8_t         seqNo;                  /*!< Sequence number to use for next packet */
320     uint8_t         maxRetrans;             /*!< Maximum number of retransmissions */
321     uint32_t        retransDelay;           /*!< Number of Systim ticks (250 [ns] resolution) from start of transmission of a packet to retransmission.
322                                                  If an unattainable retransmission delay is set, the retransmission will start as soon as possible. */
323     struct {
324         uint8_t     fsOff: 1;               /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
325         uint8_t     autoRetransmitMode: 2;  /*!< 0: Do not listen for ACK.
326                                                  1: Listen for ACK if transmitted NO_ACK = 0 and retransmit if missing.
327                                                  2: Listen for ACK if transmitted NO_ACK = 1 and retransmit if missing.
328                                                  3: Always listen for ACK and retransmit if missing. */
329         uint8_t     hdrConf: 1;             /*!< 0: Insert NO_ACK field from TX buffer.
330                                                  1: Insert SEQ and NO_ACK field from TX buffer. */
331         uint8_t     reserved: 4;            /*!< Reserved, set to 0 */
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 
356 struct RCL_CONFIG_ADDRESS_t {
357     uint32_t    address;                /*!< Address after header */
358     uint16_t    crcVal;                 /*!< CRC value (last two bytes if more than 2 CRC bytes) of last successfully received
359                                              packet. */
360     uint8_t     maxPktLen;              /*!< Packet length for fixed length, maximum packet length for variable
361                                              length */
362     uint8_t     autoAckMode: 2;         /*!< 0: Disable auto-acknowledgement.
363                                              1: Enable auto-acknowledgement if received NO_ACK = 0.
364                                              2: Enable auto-acknowledgement if received NO_ACK = 1.
365                                              3: Enable auto-acknowledgement regardless of received NO_ACK. */
366     uint8_t     varLen: 1;              /*!< 0: Use fixed length given by maxPktLenA in receiver when receiving packets
367                                              1: Use variable length in receiver when receiving packets */
368     uint8_t     seqValid: 1;            /*!< 0: The status is not valid. Any packet is viewed as new.
369                                              1: The status is valid. Only packets with sequence number and CRC different from
370                                                 the previous one are accepted. */
371     uint8_t     seq: 2;                 /*!< Sequence number of last successfully received packet */
372     uint8_t     reserved: 2;            /*!< Reserved, set to 0  */
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 
389 /**
390  *  @brief NESB receive command
391  *
392  *  Command to receive a packet
393  */
394 struct RCL_CMD_NESB_PRX_t {
395     RCL_Command     common;
396     uint32_t        rfFrequency;            /*!< RF frequency in Hz to program. 0: Do not program frequency */
397     List_List       rxBuffers;              /*!< Linked list of buffers where packets are stored */
398     RCL_StatsNesb   *stats;                /*!< Pointer to statistics structure. NULL: Do not store statistics */
399     uint32_t        syncWordA;              /*!< Sync word to listen for */
400     uint32_t        syncWordB;              /*!< Alternate Sync word to listen for */
401     RCL_Command_TxPower txPower;            /*!< Transmit power for ACKs */
402     uint8_t         addrLen;                /*!< Length of address after header (0-4 bytes) */
403     struct {
404         uint8_t     disableSyncA: 1;        /*!< 0: Listen for syncWordA. 1: Do not listen for syncWordA */
405         uint8_t     disableSyncB: 1;        /*!< 0: Listen for syncWordB. 1: Do not listen for syncWordB */
406         uint8_t     discardRxPackets: 1;    /*!< 0: Store received packets in rxBuffers.
407                                                  1: Do not store packets, useful for link tests where checksum result is enough */
408         uint8_t     fsOff: 1;               /*!< 0: Keep PLL enabled after command. 1: Turn off FS after command. */
409         uint8_t     repeatOk: 1;            /*!< 0: End operation after receiving a packet correctly.
410                                                  1: Go back to sync search after receiving a packet correctly */
411         uint8_t     repeatNok: 1;           /*!< 0: End operation after receiving a packet with CRC error or address mismatch.
412                                                  1: Go back to sync search after receiving a packet with CRC error or address
413                                                     mismatch */
414         uint8_t     reserved: 2;            /*!< Reserved, set to 0 */
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 
449 struct RCL_STATS_NESB_t {
450     struct
451     {
452         uint8_t accumulate : 1;      /*!< 0: Reset counters to 0 at start of command. 1: Add to incoming value of counters. */
453         uint8_t activeUpdate : 1;    /*!< 0: Update only at end of command. 1: Update after receiving or transmitting packets. */
454         uint8_t reserved : 6;        /*!< Reserved, set to 0 */
455     } config;                        /*!< Configuration provided to RCL */
456     uint8_t   timestampValid;        /*!< Returns 1 if %lastTimestamp is updated; 0 otherwise */
457     int8_t    lastRssi;              /*!< RSSI of last received packet. */
458     uint32_t  lastTimestamp;         /*!< Timestamp of last successfully received packet */
459     uint32_t  nTx;                   /*!< Number of packets or acknowledgements transmitted */
460     uint32_t  nRxNok;                /*!< Number of packets that have been received with CRC error */
461     uint32_t  nRxOk;                 /*!< Number of packets that have been received with CRC OK and not ignored */
462     uint32_t  nRxIgnored;            /*!< Number of packets ignored as retransmissions */
463     uint32_t  nRxAddrMismatch;       /*!< Number of packets ignored due to address mismatch */
464     uint32_t  nRxBufFull;            /*!< Number of packets that have been received and discarded due to lack of buffer space */
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
477