Skip to content

Commit 216d652

Browse files
dawidprzybylorlubos
authored andcommitted
nrf_802154: rev 3c1dbd7510dd87450aa8fbb2746388fa06e3e5f3
This commit updates revision of the nrf_802154 component. Signed-off-by: Dawid Przybylo <dawid.przybylo@nordicsemi.no>
1 parent 9bfb9e6 commit 216d652

12 files changed

Lines changed: 884 additions & 715 deletions

nrf_802154/common/include/nrf_802154_const.h

Lines changed: 191 additions & 191 deletions
Large diffs are not rendered by default.

nrf_802154/common/include/nrf_802154_types.h

Lines changed: 149 additions & 160 deletions
Large diffs are not rendered by default.

nrf_802154/driver/src/mac_features/ack_generator/nrf_802154_ack_data.c

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,52 +48,52 @@
4848
#include "nrf_802154_config.h"
4949
#include "nrf_802154_const.h"
5050

51-
/// Maximum number of Short Addresses of nodes for which there is ACK data to set.
51+
/** Maximum number of Short Addresses of nodes for which there is ACK data to set. */
5252
#define NUM_SHORT_ADDRESSES NRF_802154_PENDING_SHORT_ADDRESSES
53-
/// Maximum number of Extended Addresses of nodes for which there is ACK data to set.
53+
/** Maximum number of Extended Addresses of nodes for which there is ACK data to set. */
5454
#define NUM_EXTENDED_ADDRESSES NRF_802154_PENDING_EXTENDED_ADDRESSES
5555

56-
/// Structure representing pending bit setting variables.
56+
/** Structure representing pending bit setting variables. */
5757
typedef struct
5858
{
59-
bool enabled; /// If setting pending bit is enabled.
60-
uint8_t short_addr[NUM_SHORT_ADDRESSES][SHORT_ADDRESS_SIZE]; /// Array of short addresses of nodes for which there is pending data in the buffer.
61-
uint8_t extended_addr[NUM_EXTENDED_ADDRESSES][EXTENDED_ADDRESS_SIZE]; /// Array of extended addresses of nodes for which there is pending data in the buffer.
62-
uint32_t num_of_short_addr; /// Current number of short addresses of nodes for which there is pending data in the buffer.
63-
uint32_t num_of_ext_addr; /// Current number of extended addresses of nodes for which there is pending data in the buffer.
59+
bool enabled; /**< If setting pending bit is enabled. */
60+
uint8_t short_addr[NUM_SHORT_ADDRESSES][SHORT_ADDRESS_SIZE]; /**< Array of short addresses of nodes for which there is pending data in the buffer. */
61+
uint8_t extended_addr[NUM_EXTENDED_ADDRESSES][EXTENDED_ADDRESS_SIZE]; /**< Array of extended addresses of nodes for which there is pending data in the buffer. */
62+
uint32_t num_of_short_addr; /**< Current number of short addresses of nodes for which there is pending data in the buffer. */
63+
uint32_t num_of_ext_addr; /**< Current number of extended addresses of nodes for which there is pending data in the buffer. */
6464
} pending_bit_arrays_t;
6565

66-
// Structure representing a single IE record.
66+
/* Structure representing a single IE record. */
6767
typedef struct
6868
{
69-
uint8_t p_data[NRF_802154_MAX_ACK_IE_SIZE]; /// Pointer to IE data buffer.
70-
uint8_t len; /// Length of the buffer.
69+
uint8_t p_data[NRF_802154_MAX_ACK_IE_SIZE]; /**< Pointer to IE data buffer. */
70+
uint8_t len; /**< Length of the buffer. */
7171
} ie_data_t;
7272

73-
// Structure representing IE records sent in an ACK message to a given short address.
73+
/* Structure representing IE records sent in an ACK message to a given short address. */
7474
typedef struct
7575
{
76-
uint8_t addr[SHORT_ADDRESS_SIZE]; /// Short address of peer node.
77-
ie_data_t ie_data; /// Pointer to IE records.
76+
uint8_t addr[SHORT_ADDRESS_SIZE]; /**< Short address of peer node. */
77+
ie_data_t ie_data; /**< Pointer to IE records. */
7878
} ack_short_ie_data_t;
7979

80-
// Structure representing IE records sent in an ACK message to a given extended address.
80+
/* Structure representing IE records sent in an ACK message to a given extended address. */
8181
typedef struct
8282
{
83-
uint8_t addr[EXTENDED_ADDRESS_SIZE]; /// Extended address of peer node.
84-
ie_data_t ie_data; /// Pointer to IE records.
83+
uint8_t addr[EXTENDED_ADDRESS_SIZE]; /**< Extended address of peer node. */
84+
ie_data_t ie_data; /**< Pointer to IE records. */
8585
} ack_ext_ie_data_t;
8686

87-
// Structure representing IE data setting variables.
87+
/* Structure representing IE data setting variables. */
8888
typedef struct
8989
{
90-
ack_short_ie_data_t short_data[NUM_SHORT_ADDRESSES]; /// Array of short addresses and IE records sent to these addresses.
91-
ack_ext_ie_data_t ext_data[NUM_EXTENDED_ADDRESSES]; /// Array of extended addresses and IE records sent to these addresses.
92-
uint32_t num_of_short_data; /// Current number of short addresses stored in @p short_data.
93-
uint32_t num_of_ext_data; /// Current number of extended addresses stored in @p ext_data.
90+
ack_short_ie_data_t short_data[NUM_SHORT_ADDRESSES]; /**< Array of short addresses and IE records sent to these addresses. */
91+
ack_ext_ie_data_t ext_data[NUM_EXTENDED_ADDRESSES]; /**< Array of extended addresses and IE records sent to these addresses. */
92+
uint32_t num_of_short_data; /**< Current number of short addresses stored in @p short_data. */
93+
uint32_t num_of_ext_data; /**< Current number of extended addresses stored in @p ext_data. */
9494
} ie_arrays_t;
9595

96-
// TODO: Combine below arrays to perform binary search only once per Ack generation.
96+
/* TODO: Combine below arrays to perform binary search only once per ACK generation. */
9797
static pending_bit_arrays_t m_pending_bit;
9898
static ie_arrays_t m_ie;
9999
static nrf_802154_src_addr_match_t m_src_matching_method;
@@ -117,7 +117,7 @@ static int8_t extended_addr_compare(const uint8_t * p_first_addr, const uint8_t
117117
uint32_t first_addr;
118118
uint32_t second_addr;
119119

120-
// Compare extended address in two steps to prevent unaligned access error.
120+
/* Compare extended address in two steps to prevent unaligned access error. */
121121
for (uint32_t i = 0; i < EXTENDED_ADDRESS_SIZE / sizeof(uint32_t); i++)
122122
{
123123
first_addr = *(const uint32_t *)(p_first_addr + (i * sizeof(uint32_t)));
@@ -230,7 +230,7 @@ static bool addr_binary_search(const uint8_t * p_addr,
230230
break;
231231
}
232232

233-
// The actual algorithm
233+
/* The actual algorithm */
234234
int32_t low = 0;
235235
uint32_t midpoint = 0;
236236
int32_t high = addr_array_len;
@@ -270,7 +270,8 @@ static bool addr_binary_search(const uint8_t * p_addr,
270270
* last iteration, midpoint is equal to 1 and low and high are equal to 0. Midpoint is then set
271271
* to 0 and with last case being utilized, low is set to 1. However, midpoint equal to 0 is
272272
* incorrect, as in the last iteration first element of the array proves to be less than the
273-
* element to be added to the array. With the below code, midpoint is then shifted to 1. */
273+
* element to be added to the array. With the below code, midpoint is then shifted to 1.
274+
*/
274275
if ((uint32_t)low == midpoint + 1)
275276
{
276277
midpoint++;
@@ -339,7 +340,7 @@ static bool addr_match_thread(const nrf_802154_frame_t * p_frame_data)
339340
bool extended = nrf_802154_frame_src_addr_is_extended(p_frame_data);
340341
const uint8_t * p_src_addr = nrf_802154_frame_src_addr_get(p_frame_data);
341342

342-
// The pending bit is set by default.
343+
/* The pending bit is set by default. */
343344
if (!m_pending_bit.enabled || (NULL == p_src_addr))
344345
{
345346
return true;
@@ -364,25 +365,25 @@ static bool addr_match_zigbee(const nrf_802154_frame_t * p_frame_data)
364365
const uint8_t * p_src_addr;
365366
bool ret = false;
366367

367-
// If ack data generator module is disabled do not perform check, return true by default.
368+
/* If ack data generator module is disabled do not perform check, return true by default. */
368369
if (!m_pending_bit.enabled)
369370
{
370371
return true;
371372
}
372373

373-
// Check the frame type.
374+
/* Check the frame type. */
374375
p_src_addr = nrf_802154_frame_src_addr_get(p_frame_data);
375376
src_addr_type = nrf_802154_frame_src_addr_type_get(p_frame_data);
376377

377378
p_cmd = nrf_802154_frame_mac_command_id_get(p_frame_data);
378379

379-
// Check frame type and command type.
380+
/* Check frame type and command type. */
380381
if ((p_cmd != NULL) && (*p_cmd == MAC_CMD_DATA_REQ))
381382
{
382-
// Check addressing type - in long case address, pb should always be 1.
383+
/* Check addressing type - in long case address, pb should always be 1. */
383384
if (src_addr_type == SRC_ADDR_TYPE_SHORT)
384385
{
385-
// Return true if address is not found on the m_pending_bits list.
386+
/* Return true if address is not found on the m_pending_bits list. */
386387
ret = !addr_index_find(p_src_addr,
387388
&location,
388389
NRF_802154_ACK_DATA_PENDING_BIT,
@@ -494,7 +495,8 @@ static bool addr_add(const uint8_t * p_addr,
494495
if (data_type == NRF_802154_ACK_DATA_IE)
495496
{
496497
/* The content of ie_data_t in the structure indexed by location
497-
* is uninitialized (can have old content). Let's initialize it. */
498+
* is uninitialized (can have old content). Let's initialize it.
499+
*/
498500
ie_data_t * p_ie_data = extended ?
499501
&(((ack_ext_ie_data_t *)p_entry_at_location)->ie_data) :
500502
&(((ack_short_ie_data_t *)p_entry_at_location)->ie_data);
@@ -619,7 +621,6 @@ static bool ie_data_set(uint32_t location, bool extended, const uint8_t * p_data
619621
}
620622

621623
/* Append IE data with the new IE. */
622-
623624
if (ie_data->len + data_len > NRF_802154_MAX_ACK_IE_SIZE)
624625
{
625626
/* No space to fit it the new IE. */

nrf_802154/driver/src/mac_features/ack_generator/nrf_802154_ack_data.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include "mac_features/nrf_802154_frame.h"
4949

5050
/**
51-
* @brief Initializes the ACK data generator module.
51+
* @brief Initialize the ACK data generator module.
5252
*/
5353
void nrf_802154_ack_data_init(void);
5454

@@ -60,7 +60,7 @@ void nrf_802154_ack_data_init(void);
6060
void nrf_802154_ack_data_enable(bool enabled);
6161

6262
/**
63-
* @brief Adds an address to the ACK data list.
63+
* @brief Add an address to the ACK data list.
6464
*
6565
* ACK frames sent in response to frames with the source address matching any address from the ACK data list
6666
* will have the appropriate data set. If the source address does not match any of the addresses in the
@@ -82,7 +82,7 @@ bool nrf_802154_ack_data_for_addr_set(const uint8_t * p_addr,
8282
uint8_t data_len);
8383

8484
/**
85-
* @brief Removes an address from the ACK data list.
85+
* @brief Remove an address from the ACK data list.
8686
*
8787
* ACK frames sent in response to frames with the source address matching any address from
8888
* the ACK data list will have the appropriate data set. If the source address does not match
@@ -100,7 +100,7 @@ bool nrf_802154_ack_data_for_addr_clear(const uint8_t * p_addr,
100100
nrf_802154_ack_data_t data_type);
101101

102102
/**
103-
* @brief Removes all addresses of a given length from the ACK data list.
103+
* @brief Remove all addresses of a given length from the ACK data list.
104104
*
105105
* @param[in] extended Indication if all extended addresses or all short addresses are
106106
* to be removed from the list.
@@ -122,7 +122,7 @@ void nrf_802154_ack_data_reset(bool extended, nrf_802154_ack_data_t data_type);
122122
void nrf_802154_ack_data_src_addr_matching_method_set(nrf_802154_src_addr_match_t match_method);
123123

124124
/**
125-
* @brief Checks if a pending bit is to be set in the ACK frame sent in response to a given frame.
125+
* @brief Check if a pending bit is to be set in the ACK frame sent in response to a given frame.
126126
*
127127
* @param[in] p_frame_data Pointer to the frame parser data for which the ACK frame is being prepared.
128128
*
@@ -133,7 +133,7 @@ bool nrf_802154_ack_data_pending_bit_should_be_set(
133133
const nrf_802154_frame_t * p_frame_data);
134134

135135
/**
136-
* @brief Gets the IE data stored in the list for the source address of the provided frame.
136+
* @brief Get the IE data stored in the list for the source address of the provided frame.
137137
*
138138
* @param[in] p_src_addr Pointer to the source address to search for in the list.
139139
* @param[in] src_addr_ext If the source address is extended.
@@ -145,4 +145,4 @@ const uint8_t * nrf_802154_ack_data_ie_get(const uint8_t * p_src_addr,
145145
bool src_addr_ext,
146146
uint8_t * p_ie_length);
147147

148-
#endif // NRF_802154_ACK_DATA_H
148+
#endif /* NRF_802154_ACK_DATA_H */

nrf_802154/driver/src/mac_features/ack_generator/nrf_802154_ack_generator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,21 @@ static frame_version_t frame_version_is_2015_or_above(
7272

7373
void nrf_802154_ack_generator_init(void)
7474
{
75-
// Both generators are initialized to enable sending both Imm-Acks and Enh-Acks.
75+
/* Both generators are initialized to enable sending both Imm-Acks and Enh-Acks. */
7676
nrf_802154_imm_ack_generator_init();
7777
nrf_802154_enh_ack_generator_init();
7878
}
7979

8080
void nrf_802154_ack_generator_reset(void)
8181
{
82-
// Both generators are reset to enable sending both Imm-Ack and Enh-Ack.
82+
/* Both generators are reset to enable sending both Imm-Ack and Enh-Ack. */
8383
nrf_802154_imm_ack_generator_reset();
8484
nrf_802154_enh_ack_generator_reset();
8585
}
8686

8787
uint8_t * nrf_802154_ack_generator_create(const nrf_802154_frame_t * p_frame_data)
8888
{
89-
// This function should not be called if ACK is not requested.
89+
/* This function should not be called if ACK is not requested. */
9090
NRF_802154_ASSERT(nrf_802154_frame_ar_bit_is_set(p_frame_data));
9191

9292
switch (frame_version_is_2015_or_above(p_frame_data))

nrf_802154/driver/src/mac_features/ack_generator/nrf_802154_ack_generator.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,21 @@
4444

4545
#include "mac_features/nrf_802154_frame.h"
4646

47-
/** Initializes the ACK generator module. */
47+
/**
48+
* @brief Initialize the ACK generator module.
49+
*/
4850
void nrf_802154_ack_generator_init(void);
4951

50-
/** @brief Resets the ACK generator module.
52+
/**
53+
* @brief Reset the ACK generator module.
5154
*
5255
* @note This function should be called for every received frame to be acknowledged before
5356
* @ref nrf_802154_ack_generator_create is called for that frame.
5457
*/
5558
void nrf_802154_ack_generator_reset(void);
5659

57-
/** @brief Creates an ACK in response to the provided frame and inserts it into a radio buffer.
60+
/**
61+
* @brief Create an ACK in response to the provided frame and insert it into a radio buffer.
5862
*
5963
* @note Only those contents of the frame being acknowledged marked by @p p_frame_data as valid
6064
* are used for ACK generation. If any data necessary to generate an ACK is missing or marked as
@@ -68,7 +72,6 @@ void nrf_802154_ack_generator_reset(void);
6872
* @returns Either pointer to a constant buffer that contains PHR and PSDU
6973
* of the created ACK frame, or NULL when the response cannot be created.
7074
*/
71-
uint8_t * nrf_802154_ack_generator_create(
72-
const nrf_802154_frame_t * p_frame_data);
75+
uint8_t * nrf_802154_ack_generator_create(const nrf_802154_frame_t * p_frame_data);
7376

74-
#endif // NRF_802154_ACK_GENERATOR_H
77+
#endif /* NRF_802154_ACK_GENERATOR_H */

0 commit comments

Comments
 (0)