1 /*
2  * Copyright (c) 2018 - 2023, Nordic Semiconductor ASA
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  *    list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  *    contributors may be used to endorse or promote products derived from this
19  *    software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #ifndef NRF_802154_TYPES_H__
36 #define NRF_802154_TYPES_H__
37 
38 #include <stdint.h>
39 
40 /**
41  * Avoid including nrfx dependencies in a unit test build.
42  */
43 #if !defined(UNIT_TEST)
44     #include "hal/nrf_radio.h"
45 #else
46 typedef uint8_t nrf_radio_cca_mode_t;
47 
48 #endif
49 
50 /**
51  * @defgroup nrf_802154_types Type definitions used in the 802.15.4 driver
52  * @{
53  * @ingroup nrf_802154
54  * @brief Definitions of types used in the 802.15.4 driver.
55  */
56 
57 /**
58  * @brief States of the driver.
59  */
60 typedef uint8_t nrf_802154_state_t;
61 
62 #define NRF_802154_STATE_INVALID            0x01 // !< Radio in an invalid state.
63 #define NRF_802154_STATE_SLEEP              0x02 // !< Radio in the sleep state.
64 #define NRF_802154_STATE_RECEIVE            0x03 // !< Radio in the receive state.
65 #define NRF_802154_STATE_TRANSMIT           0x04 // !< Radio in the transmit state.
66 #define NRF_802154_STATE_ENERGY_DETECTION   0x05 // !< Radio in the energy detection state.
67 #define NRF_802154_STATE_CCA                0x06 // !< Radio in the CCA state.
68 #define NRF_802154_STATE_CONTINUOUS_CARRIER 0x07 // !< Radio in the continuous carrier state.
69 #define NRF_802154_STATE_MODULATED_CARRIER  0x08 // !< Radio in the modulated carrier state.
70 
71 /**
72  * @brief Errors reported during the frame transmission.
73  */
74 typedef uint8_t nrf_802154_tx_error_t;
75 
76 #define NRF_802154_TX_ERROR_NONE                0x00 // !< There is no transmit error.
77 #define NRF_802154_TX_ERROR_BUSY_CHANNEL        0x01 // !< CCA reported busy channel before the transmission.
78 #define NRF_802154_TX_ERROR_INVALID_ACK         0x02 // !< Received ACK frame is other than expected.
79 #define NRF_802154_TX_ERROR_NO_MEM              0x03 // !< No receive buffer is available to receive an ACK.
80 #define NRF_802154_TX_ERROR_TIMESLOT_ENDED      0x04 // !< Radio timeslot ended during the transmission procedure.
81 #define NRF_802154_TX_ERROR_NO_ACK              0x05 // !< ACK frame was not received during the timeout period.
82 #define NRF_802154_TX_ERROR_ABORTED             0x06 // !< Procedure was aborted by another operation.
83 #define NRF_802154_TX_ERROR_TIMESLOT_DENIED     0x07 // !< Transmission did not start due to a denied timeslot request.
84 #define NRF_802154_TX_ERROR_KEY_ID_INVALID      0x08 // !< Transmission did not start due to invalid key ID in frame's security header.
85 #define NRF_802154_TX_ERROR_FRAME_COUNTER_ERROR 0x09 // !< Transmission did not start due a frame counter error.
86 
87 /**
88  * @brief Possible errors during the frame reception.
89  */
90 typedef uint8_t nrf_802154_rx_error_t;
91 
92 #define NRF_802154_RX_ERROR_NONE                    0x00 // !< There is no receive error.
93 #define NRF_802154_RX_ERROR_INVALID_FRAME           0x01 // !< Received a malformed frame.
94 #define NRF_802154_RX_ERROR_INVALID_FCS             0x02 // !< Received a frame with an invalid checksum.
95 #define NRF_802154_RX_ERROR_INVALID_DEST_ADDR       0x03 // !< Received a frame with a mismatched destination address.
96 #define NRF_802154_RX_ERROR_RUNTIME                 0x04 // !< Runtime error occurred (for example, CPU was held for too long).
97 #define NRF_802154_RX_ERROR_TIMESLOT_ENDED          0x05 // !< Radio timeslot ended during the frame reception.
98 #define NRF_802154_RX_ERROR_ABORTED                 0x06 // !< Procedure was aborted by another operation.
99 #define NRF_802154_RX_ERROR_DELAYED_TIMESLOT_DENIED 0x07 // !< Delayed reception request was rejected due to a denied timeslot request.
100 #define NRF_802154_RX_ERROR_DELAYED_TIMEOUT         0x08 // !< Delayed reception timeslot ended.
101 #define NRF_802154_RX_ERROR_INVALID_LENGTH          0x09 // !< Received a frame with invalid length.
102 #define NRF_802154_RX_ERROR_DELAYED_ABORTED         0x0A // !< Delayed operation in the ongoing state was aborted by other request.
103 
104 /**
105  * @brief Possible errors during the energy detection.
106  */
107 typedef uint8_t nrf_802154_ed_error_t;
108 
109 #define NRF_802154_ED_ERROR_ABORTED 0x01 // !< Procedure was aborted by another operation.
110 
111 /**
112  * @brief Possible errors during the CCA procedure.
113  */
114 typedef uint8_t nrf_802154_cca_error_t;
115 
116 #define NRF_802154_CCA_ERROR_ABORTED 0x01 // !< Procedure was aborted by another operation.
117 
118 /**
119  * @brief Possible errors during sleep procedure call.
120  */
121 typedef uint8_t nrf_802154_sleep_error_t;
122 
123 #define NRF_802154_SLEEP_ERROR_NONE 0x00 // !< There is no error.
124 #define NRF_802154_SLEEP_ERROR_BUSY 0x01 // !< The driver cannot enter the sleep state due to the ongoing operation.
125 
126 /**
127  * @brief Possible errors during key handling.
128  */
129 typedef uint8_t nrf_802154_security_error_t;
130 
131 #define NRF_802154_SECURITY_ERROR_NONE                   0x00 // !< There is no error.
132 #define NRF_802154_SECURITY_ERROR_STORAGE_FULL           0x01 // !< The key storage is full - removal of stored keys is needed.
133 #define NRF_802154_SECURITY_ERROR_KEY_NOT_FOUND          0x02 // !< The provided key was not found inside the storage.
134 #define NRF_802154_SECURITY_ERROR_ALREADY_PRESENT        0x03 // !< The storage already has the key of the same ID.
135 #define NRF_802154_SECURITY_ERROR_TYPE_NOT_SUPPORTED     0x04 // !< The provided key type is not supported.
136 #define NRF_802154_SECURITY_ERROR_MODE_NOT_SUPPORTED     0x05 // !< The provided key id mode is not supported.
137 #define NRF_802154_SECURITY_ERROR_FRAME_COUNTER_OVERFLOW 0x06 // !< The associated frame counter overflowed.
138 
139 /**
140  * @brief Termination level selected for a particular request.
141  *
142  * Each request can terminate an ongoing operation. This type selects which operation should be
143  * aborted by a given request.
144  */
145 typedef uint8_t nrf_802154_term_t;
146 
147 #define NRF_802154_TERM_NONE   0x00 // !< Request is skipped if another operation is ongoing.
148 #define NRF_802154_TERM_802154 0x01 // !< Request terminates the ongoing 802.15.4 operation.
149 
150 /**
151  * @brief Structure for configuring CCA.
152  */
153 typedef struct
154 {
155     nrf_radio_cca_mode_t mode;           // !< CCA mode.
156     uint8_t              ed_threshold;   // !< Busy threshold of the CCA energy. Not used in @ref NRF_RADIO_CCA_MODE_CARRIER.
157     uint8_t              corr_threshold; // !< Busy threshold of the CCA correlator. Not used in @ref NRF_RADIO_CCA_MODE_ED.
158     uint8_t              corr_limit;     // !< Limit of occurrences above the busy threshold of the CCA correlator. Not used in @ref NRF_RADIO_CCA_MODE_ED.
159 } nrf_802154_cca_cfg_t;
160 
161 /**
162  * @brief Types of data that can be set in an ACK message.
163  */
164 typedef uint8_t nrf_802154_ack_data_t;
165 
166 #define NRF_802154_ACK_DATA_PENDING_BIT 0x00 // !< Frame Pending bit should be set in the Ack.
167 #define NRF_802154_ACK_DATA_IE          0x01 // !< Header Information Element should be set in the Ack.
168 
169 /**
170  * @brief Methods of source address matching.
171  *
172  * You can use one of the following methods that can be set during the initialization phase
173  * by calling @ref nrf_802154_src_addr_matching_method_set :
174  *   - For Thread: @ref NRF_802154_SRC_ADDR_MATCH_THREAD -- The pending bit is set only for the addresses found in the list.
175  *   - For Zigbee: @ref NRF_802154_SRC_ADDR_MATCH_ZIGBEE -- The pending bit is cleared only for the short addresses found in the list.\n
176  *     This method does not set pending bit in non-command and non-data-request frames.
177  *   - For standard-compliant implementation: @ref NRF_802154_SRC_ADDR_MATCH_ALWAYS_1 -- The pending bit is always set to 1.\n
178  *     This requires an empty data frame with AR set to 0 to be transmitted immediately afterwards.
179  */
180 typedef uint8_t nrf_802154_src_addr_match_t;
181 
182 #define NRF_802154_SRC_ADDR_MATCH_THREAD   0x00 // !< Implementation for the Thread protocol.
183 #define NRF_802154_SRC_ADDR_MATCH_ZIGBEE   0x01 // !< Implementation for the Zigbee protocol.
184 #define NRF_802154_SRC_ADDR_MATCH_ALWAYS_1 0x02 // !< Standard compliant implementation.
185 
186 /**
187  * @brief RSSI measurement results.
188  */
189 #define NRF_802154_RSSI_INVALID            INT8_MAX
190 
191 /**
192  * @brief Type holding the CSMA/CA backoff control test mode
193  *
194  * Possible values:
195  * - @ref NRF_802154_TEST_MODE_CSMACA_BACKOFF_RANDOM
196  * - @ref NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MAX
197  * - @ref NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MIN
198  */
199 typedef uint8_t nrf_802154_test_mode_csmaca_backoff_t;
200 
201 #define NRF_802154_TEST_MODE_CSMACA_BACKOFF_RANDOM     0x00 // !< The CSMA/CA uses random number of backoff periods (IEEE Std. 802.15.4 compliant)
202 #define NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MAX 0x01 // !< The CSMA/CA uses always maximum backoff periods (Test mode, non-compliant to IEEE Std. 802.15.4)
203 #define NRF_802154_TEST_MODE_CSMACA_BACKOFF_ALWAYS_MIN 0x02 // !< The CSMA/CA uses always minimum backoff periods (Test mode, non-compliant to IEEE Std. 802.15.4)
204 
205 /**
206  * @brief Mode of triggering receive request to Coex arbiter.
207  *
208  * Possible values:
209  * - @ref NRF_802154_COEX_RX_REQUEST_MODE_ENERGY_DETECTION,
210  * - @ref NRF_802154_COEX_RX_REQUEST_MODE_PREAMBLE,
211  * - @ref NRF_802154_COEX_RX_REQUEST_MODE_DESTINED
212  */
213 typedef uint8_t nrf_802154_coex_rx_request_mode_t;
214 
215 #define NRF_802154_COEX_RX_REQUEST_MODE_ENERGY_DETECTION 0x01 // !< Coex requests to arbiter in receive mode upon energy detected.
216 #define NRF_802154_COEX_RX_REQUEST_MODE_PREAMBLE         0x02 // !< Coex requests to arbiter in receive mode upon preamble reception.
217 #define NRF_802154_COEX_RX_REQUEST_MODE_DESTINED         0x03 // !< Coex requests to arbiter in receive mode upon detection that frame is addressed to this device.
218 
219 /**
220  * @brief Mode of triggering transmit request to Coex arbiter.
221  *
222  * Possible values:
223  * - @ref NRF_802154_COEX_TX_REQUEST_MODE_FRAME_READY,
224  * - @ref NRF_802154_COEX_TX_REQUEST_MODE_CCA_START,
225  * - @ref NRF_802154_COEX_TX_REQUEST_MODE_CCA_DONE,
226  * - @ref NRF_802154_COEX_TX_REQUEST_MODE_ON_CCA_TOGGLE
227  */
228 typedef uint8_t nrf_802154_coex_tx_request_mode_t;
229 
230 #define NRF_802154_COEX_TX_REQUEST_MODE_FRAME_READY   0x01 // !< Coex requests to arbiter in transmit mode when the frame is ready to be transmitted.
231 #define NRF_802154_COEX_TX_REQUEST_MODE_CCA_START     0x02 // !< Coex requests to arbiter in transmit mode before CCA is started.
232 #define NRF_802154_COEX_TX_REQUEST_MODE_CCA_DONE      0x03 // !< Coex requests to arbiter in transmit mode after CCA is finished.
233 #define NRF_802154_COEX_TX_REQUEST_MODE_ON_CCA_TOGGLE 0x04 // !< Coex requests to arbiter in transmit mode before CCA is started and releases the request if CCA reports busy channel.
234 
235 /**
236  * @brief Mode of handling Interframe spacing.
237  *
238  * Possible values:
239  * - @ref NRF_802154_IFS_MODE_DISABLED,
240  * - @ref NRF_802154_IFS_MODE_MATCHING_ADDRESSES,
241  * - @ref NRF_802154_IFS_MODE_ALWAYS
242  */
243 typedef uint8_t nrf_802154_ifs_mode_t;
244 
245 #define NRF_802154_IFS_MODE_DISABLED           0x00 // !< Interframe spacing is never inserted.
246 #define NRF_802154_IFS_MODE_MATCHING_ADDRESSES 0x01 // !< Interframe spacing is inserted only on matching addresses.
247 #define NRF_802154_IFS_MODE_ALWAYS             0x02 // !< Interframe spacing is always inserted.
248 
249 /**
250  * @brief Capabilities of nrf 802.15.4 radio driver
251  *
252  * Possible values:
253  * - @ref NRF_802154_CAPABILITY_CSMA,
254  * - @ref NRF_802154_CAPABILITY_DELAYED_TX,
255  * - @ref NRF_802154_CAPABILITY_DELAYED_RX,
256  * - @ref NRF_802154_CAPABILITY_ACK_TIMEOUT,
257  * - @ref NRF_802154_CAPABILITY_ANT_DIVERSITY,
258  * - @ref NRF_802154_CAPABILITY_IFS,
259  * - @ref NRF_802154_CAPABILITY_TIMESTAMP
260  * - @ref NRF_802154_CAPABILITY_SECURITY
261  *
262  */
263 typedef uint32_t nrf_802154_capabilities_t;
264 
265 #define NRF_802154_CAPABILITY_CSMA          (1UL << 0UL) // !< CSMA-CA supported
266 #define NRF_802154_CAPABILITY_DELAYED_TX    (1UL << 1UL) // !< TX at specified time supported
267 #define NRF_802154_CAPABILITY_DELAYED_RX    (1UL << 2UL) // !< RX at specified time supported
268 #define NRF_802154_CAPABILITY_ACK_TIMEOUT   (1UL << 3UL) // !< ACK timeout supported
269 #define NRF_802154_CAPABILITY_ANT_DIVERSITY (1UL << 4UL) // !< Antenna diversity supported
270 #define NRF_802154_CAPABILITY_IFS           (1UL << 5UL) // !< Inter-frame spacing supported
271 #define NRF_802154_CAPABILITY_TIMESTAMP     (1UL << 6UL) // !< Frame timestamping supported
272 #define NRF_802154_CAPABILITY_SECURITY      (1UL << 7UL) // !< Frame security supported
273 
274 /**
275  * @brief Types of keys which can be used with the nRF 802.15.4 Radio Driver.
276  *
277  * Possible values:
278  * - @ref NRF_802154_KEY_CLEARTEXT,
279  *
280  */
281 typedef uint32_t nrf_802154_key_type_t;
282 
283 #define NRF_802154_KEY_CLEARTEXT 0x00 // !< Key stored in clear text.
284 
285 /**
286  * @brief Type of structure holding statistic counters.
287  *
288  * This structure holds counters of @c uint32_t type only.
289  */
290 typedef struct
291 {
292     /**@brief Number of failed CCA attempts. */
293     uint32_t cca_failed_attempts;
294     /**@brief Number of frames received with correct CRC and with filtering passing. */
295     uint32_t received_frames;
296     /**@brief Number of times energy was detected in receive mode.*/
297     uint32_t received_energy_events;
298     /**@brief Number of times a preamble was received in receive mode. */
299     uint32_t received_preambles;
300     /**@brief Number of coex requests issued to coex arbiter. */
301     uint32_t coex_requests;
302     /**@brief Number of coex requests issued to coex arbiter that have been granted. */
303     uint32_t coex_granted_requests;
304     /**@brief Number of coex requests issued to coex arbiter that have been denied. */
305     uint32_t coex_denied_requests;
306     /**@brief Number of coex grant activations that have been not requested. */
307     uint32_t coex_unsolicited_grants;
308 } nrf_802154_stat_counters_t;
309 
310 /**
311  * @brief Type of structure holding time stamps of certain events.
312  */
313 typedef struct
314 {
315     /**@brief Time stamp of last CSMA/CA procedure started. */
316     uint64_t last_csmaca_start_timestamp;
317     /**@brief Time stamp of last CCA start attempt. */
318     uint64_t last_cca_start_timestamp;
319     /**@brief Time stamp of last CCA attempt finished with CCA IDLE (channel was free to transmit). */
320     uint64_t last_cca_idle_timestamp;
321     /**@brief Time stamp when last bit of transmitted frame was sent on the air. */
322     uint64_t last_tx_end_timestamp;
323     /**@brief Time stamp when last bit of acknowledge frame was received */
324     uint64_t last_ack_end_timestamp;
325     /**@brief Time stamp when last bit of received frame was received. */
326     uint64_t last_rx_end_timestamp;
327 } nrf_802154_stat_timestamps_t;
328 
329 /**
330  * @brief Type of structure holding total times spent in certain states.
331  *
332  * This structure holds fields of @c uint64_t type only.
333  */
334 typedef struct
335 {
336     /**@brief Total time in microseconds spent with receiver turned on, but not actually receiving any frames. */
337     uint64_t total_listening_time;
338     /**@brief Total time in microseconds spent with receiver turned on and actually receiving frames. */
339     uint64_t total_receive_time;
340     /**@brief Total time in microseconds spent on transmission. */
341     uint64_t total_transmit_time;
342 } nrf_802154_stat_totals_t;
343 
344 /**
345  * @brief Type of structure holding statistics about the Radio Driver behavior.
346  */
347 typedef struct
348 {
349     /**@brief Statistic counters */
350     nrf_802154_stat_counters_t   counters;
351 
352     /**@brief Time stamps of events */
353     nrf_802154_stat_timestamps_t timestamps;
354 } nrf_802154_stats_t;
355 
356 /**
357  * @brief Type holding the value of Key Id Mode of the key stored in nRF 802.15.4 Radio Driver.
358  */
359 typedef uint8_t nrf_802154_key_id_mode_t;
360 
361 /**
362  * @brief Type holding the value of Key Id for the keys stored in nRF 802.15.4 Radio Driver.
363  */
364 typedef struct
365 {
366     nrf_802154_key_id_mode_t mode;     // !< Key Id Mode (0..3)
367     uint8_t                * p_key_id; // !< Pointer to the Key Id field
368 } nrf_802154_key_id_t;
369 
370 /**
371  * @brief Type of structure holding a 802.15.4 MAC Security Key.
372  */
373 typedef struct
374 {
375     union
376     {
377         uint8_t * p_cleartext_key;                  // !< Pointer to the cleartext representation of the key.
378     }                     value;                    // !< Union holding different representations of the key.
379     nrf_802154_key_id_t   id;                       // !< Key Id of the key.
380     nrf_802154_key_type_t type;                     // !< @ref nrf_802154_key_type_t type of the key used.
381     uint32_t              frame_counter;            // !< Frame counter to use in case @ref use_global_frame_counter is set to false.
382     bool                  use_global_frame_counter; // !< Whether to use the global frame counter instead of the one defined in this structure.
383 } nrf_802154_key_t;
384 
385 /**
386  * @brief Structure with frame properties associated with the transmission operation.
387  *
388  * @note When using to request transmission, parameters contained here influence whether or not
389  *       the security related data transformation will be performed. In particular, the driver may:
390  *        - update frame counter field if the dynamic parts of the frame are not yet updated
391  *        - secure a non-secured frame on-the-fly
392  *       If performed, the above operations are configured by the IEEE 802.15.4 Auxiliary Security
393  *       Header present in the transmitted frame.
394  *
395  * @note It is recommended to use values defined in @ref NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT
396  *       to perform the first transmission attempt. Using other values may result in transmitting
397  *       malformed or incorrect frames and creating security breaches.
398  *
399  * @note The combination with is_secured = true and dynamic_data_is_set = false is not allowed.
400  *       An attempt to transmit a frame with such parameters will fail unconditionally.
401  */
402 typedef struct
403 {
404     bool is_secured;          // !< If the frame to be transmitted is already secured (in the sense of IEEE 802.15.4 security operations).
405     bool dynamic_data_is_set; // !< If dynamic data of the frame frame to be transmitted is set.
406 } nrf_802154_transmitted_frame_props_t;
407 
408 /**
409  * @brief Structure passed in transmit metadata with information needed to set transmission power.
410  *
411  * If the @p use_metadata_value field is set to true the power in dBm used to transmit the frame is set to the value of the
412  * field @p power.
413  * Otherwise the value from PIB set by @ref nrf_802154_tx_power_set is used
414  */
415 typedef struct
416 {
417     bool   use_metadata_value; // !< Set to true if the value in @p power should be used as the TX power in dBm
418     int8_t power;              // !< Transmission power in dBm
419 } nrf_802154_tx_power_metadata_t;
420 
421 /**
422  * @brief Default initializer for nrf_802154_transmitted_frame_props_t.
423  */
424 #define NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT \
425     (nrf_802154_transmitted_frame_props_t){             \
426         .is_secured          = false,                   \
427         .dynamic_data_is_set = false                    \
428     }
429 
430 /**
431  * @brief Structure with transmit request metadata for simple transmission request.
432  */
433 typedef struct
434 {
435     nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
436     bool                                 cca;         // !< If the driver is to perform a CCA procedure before transmission.
437     nrf_802154_tx_power_metadata_t       tx_power;    // !< Information about the TX power to be used
438 } nrf_802154_transmit_metadata_t;
439 
440 /**
441  * @brief Structure with transmit request metadata for scheduling transmission at a specific time.
442  */
443 typedef struct
444 {
445     nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
446     bool                                 cca;         // !< If the driver is to perform a CCA procedure before transmission.
447     uint8_t                              channel;     // !< Radio channel on which the frame is to be transmitted.
448     nrf_802154_tx_power_metadata_t       tx_power;    // !< Information about the TX power to be used
449 } nrf_802154_transmit_at_metadata_t;
450 
451 /**
452  * @brief Structure with transmit request metadata for transmission preceded by CSMA-CA procedure.
453  */
454 typedef struct
455 {
456     nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the frame to be transmitted.
457     nrf_802154_tx_power_metadata_t       tx_power;    // !< Information about the TX power to be used
458 } nrf_802154_transmit_csma_ca_metadata_t;
459 
460 /**
461  * @brief Structure that holds transmission result metadata.
462  */
463 typedef struct
464 {
465     nrf_802154_transmitted_frame_props_t frame_props; // !< Properties of the returned frame.
466 
467     union
468     {
469         struct
470         {
471             uint8_t * p_ack; // !< If NRF_802154_USE_RAW_API is disabled, p_ack is a pointer to a buffer that contains only the received ACK payload (PSDU excluding FCS).
472                              // If NRF_802154_USE_RAW_API is enabled, p_ack is a pointer to a buffer that contains PHR and PSDU of the received ACK. The first byte
473                              // in the buffer is the length of the frame (PHR). The following bytes contain the ACK frame itself (PSDU). The length byte
474                              // (PHR) includes FCS. FCS is already verified by the hardware and may be modified by the hardware.
475                              // If ACK was not requested or requested but not received, @ref p_ack is set to NULL.
476             uint8_t  length; // !< Length of the received ACK payload or 0 if @ref p_ack is NULL.
477             int8_t   power;  // !< RSSI of the received frame or 0 if @ref p_ack is NULL.
478             uint8_t  lqi;    // !< LQI of the received frame or 0 if @ref p_ack is NULL.
479             uint64_t time;   // !< Timestamp taken when the last symbol of ACK is received. If @ref p_ack is NULL, this field is set to 0, but is considered invalid.
480         } transmitted;       // !< Result values for a successful frame transmission.
481     } data;                  // !< Result values that are valid only for successful operations.
482 } nrf_802154_transmit_done_metadata_t;
483 
484 /**
485  * @brief Function pointer used for notifying about transmission failure.
486  */
487 typedef void (* nrf_802154_transmit_failed_notification_t)(
488     uint8_t                                   * p_frame,
489     nrf_802154_tx_error_t                       error,
490     const nrf_802154_transmit_done_metadata_t * p_meta);
491 
492 /**
493  *@}
494  **/
495 
496 #endif // NRF_802154_TYPES_H__
497