feat(802.15.4): IEEE802.15.4 add some minor edits for readability

This commit is contained in:
Tan Yan Quan
2024-11-28 20:09:07 +08:00
parent 979e1d86cb
commit c667d67248
7 changed files with 10 additions and 11 deletions

View File

@ -375,6 +375,7 @@ void ieee802154_txrx_statistic_print(void)
#define IEEE802154_RX_BUFFER_GET_USED_LEVEL(a) (((a) * IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL) / (CONFIG_IEEE802154_RX_BUFFER_SIZE + 1)) #define IEEE802154_RX_BUFFER_GET_USED_LEVEL(a) (((a) * IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL) / (CONFIG_IEEE802154_RX_BUFFER_SIZE + 1))
static uint16_t s_rx_buffer_used_nums = 0; static uint16_t s_rx_buffer_used_nums = 0;
static uint64_t s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1]; static uint64_t s_rx_buffer_used_water_level[IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1];
void ieee802154_rx_buffer_statistic_is_free(bool is_free) void ieee802154_rx_buffer_statistic_is_free(bool is_free)
{ {
if (is_free) { if (is_free) {
@ -394,7 +395,7 @@ void ieee802154_rx_buffer_statistic_clear(void)
memset((void*)s_rx_buffer_used_water_level, 0, sizeof(uint64_t)*(IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1)); memset((void*)s_rx_buffer_used_water_level, 0, sizeof(uint64_t)*(IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1));
} }
void ieee802154_rx_buffer_statistic_printf(void) void ieee802154_rx_buffer_statistic_print(void)
{ {
uint64_t total_times = 0; uint64_t total_times = 0;
for (uint8_t i = 0; i < (IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1); i++) { for (uint8_t i = 0; i < (IEEE802154_RX_BUFFER_USED_TOTAL_LEVEL + 1); i++) {

View File

@ -88,9 +88,7 @@ static void ieee802154_receive_done(uint8_t *data, esp_ieee802154_frame_info_t *
{ {
// If the RX done packet is written in the stub buffer, drop it silently. // If the RX done packet is written in the stub buffer, drop it silently.
IEEE802154_RX_BUFFER_STAT_IS_FREE(false); IEEE802154_RX_BUFFER_STAT_IS_FREE(false);
if (s_rx_index == CONFIG_IEEE802154_RX_BUFFER_SIZE) { if (s_rx_index != CONFIG_IEEE802154_RX_BUFFER_SIZE) {
esp_rom_printf("receive buffer full, drop the current frame.\n");
} else {
// Otherwise, post it to the upper layer. // Otherwise, post it to the upper layer.
// Ignore bit8 for the frame length, due to the max frame length is 127 based 802.15.4 spec. // Ignore bit8 for the frame length, due to the max frame length is 127 based 802.15.4 spec.
data[0] = data[0] & 0x7f; data[0] = data[0] & 0x7f;

View File

@ -423,9 +423,9 @@ void esp_ieee802154_rx_buffer_statistic_clear(void)
ieee802154_rx_buffer_statistic_clear(); ieee802154_rx_buffer_statistic_clear();
} }
void esp_ieee802154_rx_buffer_statistic_printf(void) void esp_ieee802154_rx_buffer_statistic_print(void)
{ {
ieee802154_rx_buffer_statistic_printf(); ieee802154_rx_buffer_statistic_print();
} }
#endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC #endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC

View File

@ -635,7 +635,7 @@ void esp_ieee802154_rx_buffer_statistic_clear(void);
* @brief Clear the current IEEE802.15.4 rx buffer statistic. * @brief Clear the current IEEE802.15.4 rx buffer statistic.
* *
*/ */
void esp_ieee802154_rx_buffer_statistic_printf(void); void esp_ieee802154_rx_buffer_statistic_print(void);
#endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC #endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC
#if CONFIG_IEEE802154_RECORD #if CONFIG_IEEE802154_RECORD

View File

@ -277,12 +277,12 @@ void ieee802154_rx_buffer_statistic_clear(void);
* @brief Print the current IEEE802.15.4 rx buffer statistic. * @brief Print the current IEEE802.15.4 rx buffer statistic.
* *
*/ */
void ieee802154_rx_buffer_statistic_printf(void); void ieee802154_rx_buffer_statistic_print(void);
#define IEEE802154_RX_BUFFER_STAT_IS_FREE(a) ieee802154_rx_buffer_statistic_is_free(a) #define IEEE802154_RX_BUFFER_STAT_IS_FREE(a) ieee802154_rx_buffer_statistic_is_free(a)
#else #else
#define IEEE802154_RX_BUFFER_STAT_IS_FREE(a) #define IEEE802154_RX_BUFFER_STAT_IS_FREE(a)
#endif #endif // CONFIG_IEEE802154_RX_BUFFER_STATISTIC
// TODO: replace etm code using common interface // TODO: replace etm code using common interface

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Unlicense OR CC0-1.0 * SPDX-License-Identifier: Unlicense OR CC0-1.0
*/ */

View File

@ -56,7 +56,7 @@ static int process_rx_buffer_statistic(int argc, char **argv)
return 1; return 1;
} }
if (rx_buff_stat_args.print->count) { if (rx_buff_stat_args.print->count) {
esp_ieee802154_rx_buffer_statistic_printf(); esp_ieee802154_rx_buffer_statistic_print();
} }
if (rx_buff_stat_args.clear->count) { if (rx_buff_stat_args.clear->count) {
esp_ieee802154_rx_buffer_statistic_clear(); esp_ieee802154_rx_buffer_statistic_clear();