mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(ieee802154): fix ieee802154 mac deinit and config ieee802154_enable
This commit is contained in:
parent
80c2bd3d7c
commit
04aa61717c
@ -2,7 +2,7 @@ menu "IEEE 802.15.4"
|
|||||||
visible if SOC_IEEE802154_SUPPORTED
|
visible if SOC_IEEE802154_SUPPORTED
|
||||||
|
|
||||||
config IEEE802154_ENABLED
|
config IEEE802154_ENABLED
|
||||||
bool
|
bool "IEEE802154 Enable"
|
||||||
default "y" if SOC_IEEE802154_SUPPORTED
|
default "y" if SOC_IEEE802154_SUPPORTED
|
||||||
|
|
||||||
config IEEE802154_RX_BUFFER_SIZE
|
config IEEE802154_RX_BUFFER_SIZE
|
||||||
@ -14,6 +14,7 @@ menu "IEEE 802.15.4"
|
|||||||
The number of 802.15.4 receive buffers
|
The number of 802.15.4 receive buffers
|
||||||
|
|
||||||
choice IEEE802154_CCA_MODE
|
choice IEEE802154_CCA_MODE
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
prompt "Clear Channel Assessment (CCA) mode"
|
prompt "Clear Channel Assessment (CCA) mode"
|
||||||
default IEEE802154_CCA_ED
|
default IEEE802154_CCA_ED
|
||||||
help
|
help
|
||||||
@ -41,6 +42,7 @@ menu "IEEE 802.15.4"
|
|||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
config IEEE802154_CCA_MODE
|
config IEEE802154_CCA_MODE
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
int
|
int
|
||||||
default 0 if IEEE802154_CCA_CARRIER
|
default 0 if IEEE802154_CCA_CARRIER
|
||||||
default 1 if IEEE802154_CCA_ED
|
default 1 if IEEE802154_CCA_ED
|
||||||
@ -49,6 +51,7 @@ menu "IEEE 802.15.4"
|
|||||||
|
|
||||||
config IEEE802154_CCA_THRESHOLD
|
config IEEE802154_CCA_THRESHOLD
|
||||||
int "CCA detection threshold"
|
int "CCA detection threshold"
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
range -120 0
|
range -120 0
|
||||||
default -60
|
default -60
|
||||||
help
|
help
|
||||||
@ -56,6 +59,7 @@ menu "IEEE 802.15.4"
|
|||||||
|
|
||||||
config IEEE802154_PENDING_TABLE_SIZE
|
config IEEE802154_PENDING_TABLE_SIZE
|
||||||
int "Pending table size"
|
int "Pending table size"
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
range 1 100
|
range 1 100
|
||||||
default 20
|
default 20
|
||||||
help
|
help
|
||||||
@ -63,12 +67,14 @@ menu "IEEE 802.15.4"
|
|||||||
|
|
||||||
config IEEE802154_MULTI_PAN_ENABLE
|
config IEEE802154_MULTI_PAN_ENABLE
|
||||||
bool "Enable multi-pan feature for frame filter"
|
bool "Enable multi-pan feature for frame filter"
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Enable IEEE802154 multi-pan
|
Enable IEEE802154 multi-pan
|
||||||
|
|
||||||
config IEEE802154_TIMING_OPTIMIZATION
|
config IEEE802154_TIMING_OPTIMIZATION
|
||||||
bool "Enable throughput optimization"
|
bool "Enable throughput optimization"
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Enabling this option increases throughput by ~5% at the expense of ~2.1k
|
Enabling this option increases throughput by ~5% at the expense of ~2.1k
|
||||||
@ -77,7 +83,7 @@ menu "IEEE 802.15.4"
|
|||||||
config IEEE802154_SLEEP_ENABLE
|
config IEEE802154_SLEEP_ENABLE
|
||||||
# Todo: Remove when support safe power-down of the power domain (IDF-7317)
|
# Todo: Remove when support safe power-down of the power domain (IDF-7317)
|
||||||
bool "Enable IEEE802154 light sleep"
|
bool "Enable IEEE802154 light sleep"
|
||||||
depends on PM_ENABLE
|
depends on PM_ENABLE && IEEE802154_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Enabling this option allows the IEEE802.15.4 module to be powered down during automatic light sleep,
|
Enabling this option allows the IEEE802.15.4 module to be powered down during automatic light sleep,
|
||||||
@ -85,6 +91,7 @@ menu "IEEE 802.15.4"
|
|||||||
|
|
||||||
menuconfig IEEE802154_DEBUG
|
menuconfig IEEE802154_DEBUG
|
||||||
bool "Enable IEEE802154 Debug"
|
bool "Enable IEEE802154 Debug"
|
||||||
|
depends on IEEE802154_ENABLED
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Enabling this option allows different kinds of IEEE802154 debug output.
|
Enabling this option allows different kinds of IEEE802154 debug output.
|
||||||
|
@ -51,6 +51,7 @@ static uint8_t s_rx_index = 0;
|
|||||||
static uint8_t s_enh_ack_frame[128];
|
static uint8_t s_enh_ack_frame[128];
|
||||||
static uint8_t s_recent_rx_frame_info_index;
|
static uint8_t s_recent_rx_frame_info_index;
|
||||||
static portMUX_TYPE s_ieee802154_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
static portMUX_TYPE s_ieee802154_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||||
|
static intr_handle_t ieee802154_isr_handle = NULL;
|
||||||
|
|
||||||
static esp_err_t ieee802154_sleep_init(void);
|
static esp_err_t ieee802154_sleep_init(void);
|
||||||
static void ieee802154_rf_enable(void);
|
static void ieee802154_rf_enable(void);
|
||||||
@ -655,7 +656,7 @@ esp_err_t ieee802154_mac_init(void)
|
|||||||
ieee802154_set_state(IEEE802154_STATE_IDLE);
|
ieee802154_set_state(IEEE802154_STATE_IDLE);
|
||||||
|
|
||||||
// TODO: Add flags for IEEE802154 ISR allocating. TZ-102
|
// TODO: Add flags for IEEE802154 ISR allocating. TZ-102
|
||||||
ret = esp_intr_alloc(ieee802154_periph.irq_id, 0, ieee802154_isr, NULL, NULL);
|
ret = esp_intr_alloc(ieee802154_periph.irq_id, 0, ieee802154_isr, NULL, &ieee802154_isr_handle);
|
||||||
ESP_RETURN_ON_FALSE(ret == ESP_OK, ESP_FAIL, IEEE802154_TAG, "IEEE802154 MAC init failed");
|
ESP_RETURN_ON_FALSE(ret == ESP_OK, ESP_FAIL, IEEE802154_TAG, "IEEE802154 MAC init failed");
|
||||||
|
|
||||||
ESP_RETURN_ON_FALSE(ieee802154_sleep_init() == ESP_OK, ESP_FAIL, IEEE802154_TAG, "IEEE802154 MAC sleep init failed");
|
ESP_RETURN_ON_FALSE(ieee802154_sleep_init() == ESP_OK, ESP_FAIL, IEEE802154_TAG, "IEEE802154 MAC sleep init failed");
|
||||||
@ -663,6 +664,14 @@ esp_err_t ieee802154_mac_init(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t ieee802154_mac_deinit(void)
|
||||||
|
{
|
||||||
|
esp_err_t ret = ESP_OK;
|
||||||
|
ret = esp_intr_free(ieee802154_isr_handle);
|
||||||
|
ieee802154_isr_handle = NULL;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
IEEE802154_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_enable_events(IEEE802154_EVENT_ED_DONE);
|
||||||
|
@ -29,8 +29,10 @@ esp_err_t esp_ieee802154_enable(void)
|
|||||||
|
|
||||||
esp_err_t esp_ieee802154_disable(void)
|
esp_err_t esp_ieee802154_disable(void)
|
||||||
{
|
{
|
||||||
|
esp_btbb_disable();
|
||||||
|
esp_phy_disable(PHY_MODEM_IEEE802154);
|
||||||
ieee802154_disable();
|
ieee802154_disable();
|
||||||
return ESP_OK;
|
return ieee802154_mac_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t esp_ieee802154_get_channel(void)
|
uint8_t esp_ieee802154_get_channel(void)
|
||||||
|
@ -65,6 +65,16 @@ void ieee802154_disable(void);
|
|||||||
*/
|
*/
|
||||||
esp_err_t ieee802154_mac_init(void);
|
esp_err_t ieee802154_mac_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Deinitialize the IEEE 802.15.4 MAC.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK on success.
|
||||||
|
* - ESP_FAIL on failure.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t ieee802154_mac_deinit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmit the given frame.
|
* @brief Transmit the given frame.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user