mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'backport/ieee802154_feature' into 'release/v5.1'
Backport some IEEE802154 related MR to 5.1(Backport 5.1) See merge request espressif/esp-idf!24678
This commit is contained in:
commit
966312e54f
@ -9,5 +9,6 @@
|
||||
#include <stdbool.h>
|
||||
#include "hal/ieee802154_common_ll.h"
|
||||
|
||||
#define IEEE802154_TXPOWER_VALUE_MAX 21
|
||||
#define IEEE802154_TXPOWER_VALUE_MIN -24
|
||||
#define IEEE802154_TXPOWER_VALUE_MAX 20
|
||||
#define IEEE802154_TXPOWER_VALUE_MIN -15
|
||||
#define IEEE802154_TXPOWER_INDEX_MIN 3
|
||||
|
@ -9,5 +9,6 @@
|
||||
#include <stdbool.h>
|
||||
#include "hal/ieee802154_common_ll.h"
|
||||
|
||||
#define IEEE802154_TXPOWER_VALUE_MAX 21
|
||||
#define IEEE802154_TXPOWER_VALUE_MAX 20
|
||||
#define IEEE802154_TXPOWER_VALUE_MIN -24
|
||||
#define IEEE802154_TXPOWER_INDEX_MIN 0
|
||||
|
@ -14,6 +14,12 @@ if(CONFIG_IEEE802154_ENABLED)
|
||||
"driver/esp_ieee802154_sec.c"
|
||||
"driver/esp_ieee802154_timer.c")
|
||||
list(APPEND private_include "private_include")
|
||||
|
||||
if(CONFIG_IEEE802154_TEST)
|
||||
list(REMOVE_ITEM private_include "private_include")
|
||||
list(APPEND include "private_include")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
idf_component_register(
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
extern void bt_bb_set_zb_tx_on_delay(uint16_t time);
|
||||
|
||||
static volatile ieee802154_state_t s_ieee802154_state;
|
||||
IEEE802154_STATIC volatile ieee802154_state_t s_ieee802154_state;
|
||||
static uint8_t *s_tx_frame = NULL;
|
||||
static uint8_t s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE][127 + 1 + 1]; // +1: len, +1: for dma test
|
||||
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE];
|
||||
@ -76,7 +76,7 @@ uint8_t ieee802154_get_recent_lqi(void)
|
||||
return s_rx_frame_info[s_recent_rx_frame_info_index].lqi;
|
||||
}
|
||||
|
||||
static void set_next_rx_buffer(void)
|
||||
IEEE802154_STATIC void set_next_rx_buffer(void)
|
||||
{
|
||||
if (s_rx_frame[s_rx_index][0] != 0) {
|
||||
s_rx_index++;
|
||||
@ -185,7 +185,7 @@ static bool stop_ed(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool stop_current_operation(void)
|
||||
IEEE802154_STATIC bool stop_current_operation(void)
|
||||
{
|
||||
event_end_process();
|
||||
switch (s_ieee802154_state) {
|
||||
@ -257,11 +257,17 @@ static void isr_handle_timer0_done(void)
|
||||
esp_ieee802154_transmit_failed(s_tx_frame, ESP_IEEE802154_TX_ERR_NO_ACK);
|
||||
next_operation();
|
||||
}
|
||||
#if CONFIG_IEEE802154_TEST
|
||||
esp_ieee802154_timer0_done();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void isr_handle_timer1_done(void)
|
||||
{
|
||||
// timer 1 is now unused.
|
||||
#if CONFIG_IEEE802154_TEST
|
||||
esp_ieee802154_timer1_done();
|
||||
#endif
|
||||
}
|
||||
|
||||
static IRAM_ATTR void isr_handle_tx_done(void)
|
||||
@ -302,12 +308,14 @@ static IRAM_ATTR void isr_handle_rx_done(void)
|
||||
s_rx_frame_info[s_rx_index].pending = ieee802154_ack_config_pending_bit(s_rx_frame[s_rx_index]);
|
||||
// For 2015 enh-ack, SW should generate an enh-ack then send it manually
|
||||
if (esp_ieee802154_enh_ack_generator(s_rx_frame[s_rx_index], &s_rx_frame_info[s_rx_index], s_enh_ack_frame) == ESP_OK) {
|
||||
#if !CONFIG_IEEE802154_TEST
|
||||
// Send the Enh-Ack frame if generator succeeds.
|
||||
ieee802154_ll_set_tx_addr(s_enh_ack_frame);
|
||||
s_tx_frame = s_enh_ack_frame;
|
||||
ieee802154_sec_update();
|
||||
ieee802154_ll_enhack_generate_done_notify();
|
||||
s_ieee802154_state = IEEE802154_STATE_TX_ENH_ACK;
|
||||
#endif
|
||||
} else {
|
||||
// Stop current process if generator returns errors.
|
||||
ieee802154_ll_set_cmd(IEEE802154_CMD_STOP);
|
||||
@ -355,6 +363,10 @@ static IRAM_ATTR void isr_handle_rx_abort(void)
|
||||
case IEEE802154_RX_ABORT_BY_UNEXPECTED_ACK:
|
||||
case IEEE802154_RX_ABORT_BY_RX_RESTART:
|
||||
assert(s_ieee802154_state == IEEE802154_STATE_RX);
|
||||
#if CONFIG_IEEE802154_TEST
|
||||
esp_ieee802154_receive_failed(rx_status);
|
||||
next_operation();
|
||||
#endif
|
||||
break;
|
||||
case IEEE802154_RX_ABORT_BY_COEX_BREAK:
|
||||
assert(s_ieee802154_state == IEEE802154_STATE_RX);
|
||||
@ -369,13 +381,21 @@ static IRAM_ATTR void isr_handle_rx_abort(void)
|
||||
case IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT:
|
||||
case IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK:
|
||||
assert(s_ieee802154_state == IEEE802154_STATE_TX_ACK || s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK);
|
||||
#if !CONFIG_IEEE802154_TEST
|
||||
esp_ieee802154_receive_done((uint8_t *)s_rx_frame[s_rx_index], &s_rx_frame_info[s_rx_index]);
|
||||
next_operation();
|
||||
#else
|
||||
esp_ieee802154_receive_failed(rx_status);
|
||||
#endif
|
||||
break;
|
||||
case IEEE802154_RX_ABORT_BY_ENHACK_SECURITY_ERROR:
|
||||
assert(s_ieee802154_state == IEEE802154_STATE_TX_ENH_ACK);
|
||||
#if !CONFIG_IEEE802154_TEST
|
||||
esp_ieee802154_receive_done((uint8_t *)s_rx_frame[s_rx_index], &s_rx_frame_info[s_rx_index]);
|
||||
next_operation();
|
||||
#else
|
||||
esp_ieee802154_receive_failed(rx_status);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
@ -525,7 +545,12 @@ static void ieee802154_isr(void *arg)
|
||||
}
|
||||
|
||||
if (events & IEEE802154_EVENT_TIMER0_OVERFLOW) {
|
||||
#if !CONFIG_IEEE802154_TEST
|
||||
assert(s_ieee802154_state == IEEE802154_STATE_RX_ACK);
|
||||
#else
|
||||
extern bool ieee802154_timer0_test;
|
||||
assert(ieee802154_timer0_test || s_ieee802154_state == IEEE802154_STATE_RX_ACK);
|
||||
#endif
|
||||
isr_handle_timer0_done();
|
||||
|
||||
events &= (uint16_t)(~IEEE802154_EVENT_TIMER0_OVERFLOW);
|
||||
@ -542,12 +567,12 @@ static void ieee802154_isr(void *arg)
|
||||
|
||||
}
|
||||
|
||||
static IRAM_ATTR void ieee802154_enter_critical(void)
|
||||
IEEE802154_STATIC IRAM_ATTR void ieee802154_enter_critical(void)
|
||||
{
|
||||
portENTER_CRITICAL(&s_ieee802154_spinlock);
|
||||
}
|
||||
|
||||
static IRAM_ATTR void ieee802154_exit_critical(void)
|
||||
IEEE802154_STATIC IRAM_ATTR void ieee802154_exit_critical(void)
|
||||
{
|
||||
portEXIT_CRITICAL(&s_ieee802154_spinlock);
|
||||
}
|
||||
@ -565,11 +590,13 @@ void ieee802154_disable(void)
|
||||
esp_err_t ieee802154_mac_init(void)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
modem_clock_module_mac_reset(PERIPH_IEEE802154_MODULE); // reset ieee802154 MAC
|
||||
ieee802154_pib_init();
|
||||
|
||||
ieee802154_ll_enable_events(IEEE802154_EVENT_MASK);
|
||||
#if !CONFIG_IEEE802154_TEST
|
||||
ieee802154_ll_disable_events((IEEE802154_EVENT_TIMER0_OVERFLOW) | (IEEE802154_EVENT_TIMER1_OVERFLOW));
|
||||
|
||||
#endif
|
||||
ieee802154_ll_enable_tx_abort_events(BIT(IEEE802154_TX_ABORT_BY_RX_ACK_TIMEOUT - 1) | BIT(IEEE802154_TX_ABORT_BY_TX_COEX_BREAK - 1) | BIT(IEEE802154_TX_ABORT_BY_TX_SECURITY_ERROR - 1) | BIT(IEEE802154_TX_ABORT_BY_CCA_FAILED - 1) | BIT(IEEE802154_TX_ABORT_BY_CCA_BUSY - 1));
|
||||
ieee802154_ll_enable_rx_abort_events(BIT(IEEE802154_RX_ABORT_BY_TX_ACK_TIMEOUT - 1) | BIT(IEEE802154_RX_ABORT_BY_TX_ACK_COEX_BREAK - 1));
|
||||
|
||||
@ -598,14 +625,14 @@ esp_err_t ieee802154_mac_init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void start_ed(uint32_t duration)
|
||||
IEEE802154_STATIC void start_ed(uint32_t duration)
|
||||
{
|
||||
ieee802154_ll_enable_events(IEEE802154_EVENT_ED_DONE);
|
||||
ieee802154_ll_set_ed_duration(duration);
|
||||
ieee802154_ll_set_cmd(IEEE802154_CMD_ED_START);
|
||||
}
|
||||
|
||||
static void tx_init(const uint8_t *frame)
|
||||
IEEE802154_STATIC void tx_init(const uint8_t *frame)
|
||||
{
|
||||
s_tx_frame = (uint8_t *)frame;
|
||||
stop_current_operation();
|
||||
@ -678,7 +705,7 @@ esp_err_t ieee802154_transmit_at(const uint8_t *frame, bool cca, uint32_t time)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void rx_init(void)
|
||||
IEEE802154_STATIC void rx_init(void)
|
||||
{
|
||||
stop_current_operation();
|
||||
ieee802154_pib_update();
|
||||
|
@ -12,45 +12,45 @@
|
||||
|
||||
static const char *TAG = "ieee802154 frame";
|
||||
|
||||
static inline bool is_security_enabled(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_security_enabled(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_SECURITY_OFFSET] & IEEE802154_FRAME_SECURITY_BIT;
|
||||
}
|
||||
|
||||
static inline bool is_ie_present(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_ie_present(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_IE_OFFSET] & IEEE802154_FRAME_IE_BIT;
|
||||
}
|
||||
|
||||
static inline bool is_dsn_present(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_dsn_present(const uint8_t *frame)
|
||||
{
|
||||
return ((ieee802154_frame_get_version(frame) != IEEE802154_FRAME_VERSION_2) ||
|
||||
!(frame[IEEE802154_FRAME_DSN_OFFSET] & IEEE802154_FRAME_DSN_BIT));
|
||||
}
|
||||
|
||||
static inline uint8_t dst_addr_mode(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE uint8_t dst_addr_mode(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_DST_MODE_OFFSET] & IEEE802154_FRAME_DST_MODE_MASK;
|
||||
}
|
||||
|
||||
static inline uint8_t src_addr_mode(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE uint8_t src_addr_mode(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_SRC_MODE_OFFSET] & IEEE802154_FRAME_SRC_MODE_MASK;
|
||||
}
|
||||
|
||||
static inline bool is_panid_compression(const uint8_t *frame)
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_panid_compression(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_PANID_COMP_OFFSET] & IEEE802154_FRAME_PANID_COMP_BIT;
|
||||
}
|
||||
|
||||
static inline bool is_suported_frame_type(uint8_t frame_type)
|
||||
IEEE802154_STATIC IEEE802154_INLINE bool is_suported_frame_type(uint8_t frame_type)
|
||||
{
|
||||
// HW supports 4 kinds of frame type: Beacon, Ack, Data, Command.
|
||||
return (frame_type == IEEE802154_FRAME_TYPE_BEACON || frame_type == IEEE802154_FRAME_TYPE_DATA ||
|
||||
frame_type == IEEE802154_FRAME_TYPE_ACK || frame_type == IEEE802154_FRAME_TYPE_COMMAND);
|
||||
}
|
||||
|
||||
static bool is_dst_panid_present(const uint8_t *frame)
|
||||
IEEE802154_STATIC bool is_dst_panid_present(const uint8_t *frame)
|
||||
{
|
||||
uint8_t dst_mode = dst_addr_mode(frame);
|
||||
bool dst_panid_present = false;
|
||||
@ -80,7 +80,7 @@ static bool is_dst_panid_present(const uint8_t *frame)
|
||||
return dst_panid_present;
|
||||
}
|
||||
|
||||
static bool is_src_panid_present(const uint8_t *frame)
|
||||
IEEE802154_STATIC bool is_src_panid_present(const uint8_t *frame)
|
||||
{
|
||||
uint8_t src_mode = src_addr_mode(frame);
|
||||
bool panid_compression = is_panid_compression(frame);
|
||||
@ -109,12 +109,12 @@ static bool is_src_panid_present(const uint8_t *frame)
|
||||
return src_panid_present;
|
||||
}
|
||||
|
||||
static uint8_t inline ieee802154_frame_address_offset(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t IEEE802154_INLINE ieee802154_frame_address_offset(const uint8_t *frame)
|
||||
{
|
||||
return IEEE802154_FRAME_PHR_SIZE + IEEE802154_FRAME_FCF_SIZE + (is_dsn_present(frame) ? IEEE802154_FRAME_DSN_SIZE : 0);
|
||||
}
|
||||
|
||||
static IRAM_ATTR uint8_t ieee802154_frame_address_size(const uint8_t *frame)
|
||||
IEEE802154_STATIC IRAM_ATTR uint8_t ieee802154_frame_address_size(const uint8_t *frame)
|
||||
{
|
||||
uint8_t address_size = 0;
|
||||
|
||||
@ -161,7 +161,7 @@ static IRAM_ATTR uint8_t ieee802154_frame_address_size(const uint8_t *frame)
|
||||
return address_size;
|
||||
}
|
||||
|
||||
static uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, TAG, "invalid frame type");
|
||||
uint8_t offset = ieee802154_frame_address_offset(frame);
|
||||
@ -175,7 +175,7 @@ static uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame)
|
||||
return offset;
|
||||
}
|
||||
|
||||
static uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_OFFSET, TAG, "invalid frame type");
|
||||
|
||||
@ -211,7 +211,7 @@ static uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame)
|
||||
return security_field_len;
|
||||
}
|
||||
|
||||
static uint8_t ieee802154_frame_ie_header_offset(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_ie_header_offset(const uint8_t *frame)
|
||||
{
|
||||
uint8_t offset = ieee802154_frame_security_header_offset(frame);
|
||||
uint8_t security_field_len = ieee802154_frame_get_security_field_len(frame);
|
||||
@ -221,7 +221,7 @@ static uint8_t ieee802154_frame_ie_header_offset(const uint8_t *frame)
|
||||
return offset;
|
||||
}
|
||||
|
||||
static uint8_t ieee802154_frame_get_mic_len(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_get_mic_len(const uint8_t *frame)
|
||||
{
|
||||
uint8_t offset = ieee802154_frame_security_header_offset(frame);
|
||||
uint8_t mic_len = 0;
|
||||
@ -247,7 +247,7 @@ static uint8_t ieee802154_frame_get_mic_len(const uint8_t *frame)
|
||||
return mic_len;
|
||||
}
|
||||
|
||||
static uint8_t ieee802154_frame_get_ie_field_len(const uint8_t *frame)
|
||||
IEEE802154_STATIC uint8_t ieee802154_frame_get_ie_field_len(const uint8_t *frame)
|
||||
{
|
||||
uint8_t offset = ieee802154_frame_ie_header_offset(frame);
|
||||
uint8_t ie_field_len = 0;
|
||||
@ -274,7 +274,7 @@ static uint8_t ieee802154_frame_get_ie_field_len(const uint8_t *frame)
|
||||
return ie_field_len;
|
||||
}
|
||||
|
||||
static IRAM_ATTR uint8_t ieee802154_frame_payload_offset(const uint8_t *frame)
|
||||
IEEE802154_STATIC IRAM_ATTR uint8_t ieee802154_frame_payload_offset(const uint8_t *frame)
|
||||
{
|
||||
uint8_t offset = ieee802154_frame_security_header_offset(frame);
|
||||
if (is_security_enabled(frame)) {
|
||||
@ -298,17 +298,17 @@ static IRAM_ATTR uint8_t ieee802154_frame_payload_offset(const uint8_t *frame)
|
||||
return offset - 1;
|
||||
}
|
||||
|
||||
uint8_t inline ieee802154_frame_get_type(const uint8_t *frame)
|
||||
uint8_t IEEE802154_INLINE ieee802154_frame_get_type(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_TYPE_OFFSET] & IEEE802154_FRAME_TYPE_MASK;
|
||||
}
|
||||
|
||||
uint8_t inline ieee802154_frame_get_version(const uint8_t *frame)
|
||||
uint8_t IEEE802154_INLINE ieee802154_frame_get_version(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_VERSION_OFFSET] & IEEE802154_FRAME_VERSION_MASK;
|
||||
}
|
||||
|
||||
bool inline ieee802154_frame_is_ack_required(const uint8_t *frame)
|
||||
bool IEEE802154_INLINE ieee802154_frame_is_ack_required(const uint8_t *frame)
|
||||
{
|
||||
return frame[IEEE802154_FRAME_AR_OFFSET] & IEEE802154_FRAME_AR_BIT;
|
||||
}
|
||||
|
@ -47,15 +47,15 @@ void ieee802154_pib_init(void)
|
||||
|
||||
static uint8_t ieee802154_txpower_convert(int8_t txpower)
|
||||
{
|
||||
uint8_t ieee820154_txpower_value = 0;
|
||||
if (txpower > IEEE802154_TXPOWER_VALUE_MAX) {
|
||||
ieee820154_txpower_value = 15;
|
||||
} else if (txpower < IEEE802154_TXPOWER_VALUE_MIN) {
|
||||
ieee820154_txpower_value = 0;
|
||||
uint8_t ieee820154_txpower_index = 0;
|
||||
if (txpower >= IEEE802154_TXPOWER_VALUE_MAX) {
|
||||
ieee820154_txpower_index = 15;
|
||||
} else if (txpower <= IEEE802154_TXPOWER_VALUE_MIN) {
|
||||
ieee820154_txpower_index = IEEE802154_TXPOWER_INDEX_MIN;
|
||||
} else {
|
||||
ieee820154_txpower_value = (uint8_t)((txpower - IEEE802154_TXPOWER_VALUE_MIN) / 3);
|
||||
ieee820154_txpower_index = (uint8_t)((txpower - IEEE802154_TXPOWER_VALUE_MIN) / 3) + IEEE802154_TXPOWER_INDEX_MIN;
|
||||
}
|
||||
return ieee820154_txpower_value;
|
||||
return ieee820154_txpower_index;
|
||||
}
|
||||
|
||||
void ieee802154_pib_update(void)
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
esp_err_t esp_ieee802154_enable(void)
|
||||
{
|
||||
|
||||
ieee802154_enable();
|
||||
esp_phy_enable();
|
||||
esp_btbb_enable();
|
||||
@ -381,3 +380,13 @@ __attribute__((weak)) esp_err_t esp_ieee802154_enh_ack_generator(uint8_t *frame,
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void esp_ieee802154_timer0_done(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
__attribute__((weak)) void esp_ieee802154_timer1_done(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -201,6 +201,17 @@ extern void esp_ieee802154_receive_failed(uint16_t error);
|
||||
*
|
||||
*/
|
||||
extern void esp_ieee802154_ed_failed(uint16_t error);
|
||||
|
||||
#if CONFIG_IEEE802154_TEST
|
||||
#define IEEE802154_STATIC
|
||||
#define IEEE802154_INLINE
|
||||
extern void esp_ieee802154_timer0_done(void);
|
||||
extern void esp_ieee802154_timer1_done(void);
|
||||
#else
|
||||
#define IEEE802154_STATIC static
|
||||
#define IEEE802154_INLINE inline
|
||||
#endif // CONFIG_IEEE802154_TEST
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "ieee802154_cmd.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/ieee802154_reg.h"
|
||||
|
||||
static uint8_t s_tx_frame[131] = { 0 };
|
||||
static const char* TAG = "i154test";
|
||||
@ -34,6 +35,7 @@ static void register_cca(void);
|
||||
static void register_esp154(void);
|
||||
static void register_reg(void);
|
||||
static void register_free(void);
|
||||
static void register_restart(void);
|
||||
|
||||
void register_ieee802154_cmd(void)
|
||||
{
|
||||
@ -52,6 +54,7 @@ void register_ieee802154_cmd(void)
|
||||
register_esp154();
|
||||
register_reg();
|
||||
register_free();
|
||||
register_restart();
|
||||
}
|
||||
|
||||
static struct {
|
||||
@ -670,9 +673,7 @@ static void register_free()
|
||||
}
|
||||
|
||||
/* 'reg' command reads/writes the registers */
|
||||
extern uint32_t IEEE802154;
|
||||
static struct {
|
||||
struct arg_lit *base;
|
||||
struct arg_int *get_reg;
|
||||
struct arg_int *set_reg;
|
||||
struct arg_int *value;
|
||||
@ -681,7 +682,7 @@ static struct {
|
||||
|
||||
static int process_reg(int argc, char **argv)
|
||||
{
|
||||
uint32_t *base = &IEEE802154;
|
||||
uint32_t base = IEEE802154_REG_BASE;
|
||||
|
||||
int nerrors = arg_parse(argc, argv, (void **) ®_args);
|
||||
if (nerrors != 0) {
|
||||
@ -840,6 +841,24 @@ static void register_rx(void)
|
||||
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||
}
|
||||
|
||||
/* 'restart' command restarts the program */
|
||||
static int restart(int argc, char **argv)
|
||||
{
|
||||
ESP_EARLY_LOGI(TAG, "Restarting");
|
||||
esp_restart();
|
||||
}
|
||||
|
||||
static void register_restart(void)
|
||||
{
|
||||
const esp_console_cmd_t cmd = {
|
||||
.command = "restart",
|
||||
.help = "Restart the program",
|
||||
.hint = NULL,
|
||||
.func = &restart
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
|
||||
}
|
||||
|
||||
void esp_ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info)
|
||||
{
|
||||
ESP_EARLY_LOGI(TAG, "Tx Done %d bytes", frame[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user