mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(ieee802154): using link0/2 for ieee802154 in esp32h2 chip
This commit is contained in:
parent
179e3293be
commit
9a2b707e76
@ -30,12 +30,12 @@
|
||||
#include "esp_pm.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "esp_private/sleep_retention.h"
|
||||
static bool g_sleep_rf = false;
|
||||
// #if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
// #define BTBB_LINK_OWNER ENTRY(3)
|
||||
// #else
|
||||
static bool s_rf_closed = false;
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#define IEEE802154_LINK_OWNER ENTRY(3)
|
||||
#else
|
||||
#define IEEE802154_LINK_OWNER ENTRY(0) | ENTRY(2)
|
||||
// #endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif
|
||||
|
||||
#define CCA_DETECTION_TIME 8
|
||||
@ -52,6 +52,7 @@ static uint8_t s_recent_rx_frame_info_index;
|
||||
static portMUX_TYPE s_ieee802154_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
static esp_err_t ieee802154_sleep_init(void);
|
||||
static void ieee802154_rf_enable(void);
|
||||
|
||||
static IRAM_ATTR void event_end_process(void)
|
||||
{
|
||||
@ -679,8 +680,7 @@ IEEE802154_STATIC void tx_init(const uint8_t *frame)
|
||||
|
||||
esp_err_t ieee802154_transmit(const uint8_t *frame, bool cca)
|
||||
{
|
||||
ieee802154_wakeup();
|
||||
|
||||
ieee802154_rf_enable();
|
||||
ieee802154_enter_critical();
|
||||
tx_init(frame);
|
||||
|
||||
@ -708,9 +708,7 @@ esp_err_t ieee802154_transmit_at(const uint8_t *frame, bool cca, uint32_t time)
|
||||
{
|
||||
uint32_t tx_target_time;
|
||||
uint32_t current_time;
|
||||
|
||||
ieee802154_wakeup();
|
||||
|
||||
ieee802154_rf_enable();
|
||||
tx_init(frame);
|
||||
IEEE802154_SET_TXRX_PTI(IEEE802154_SCENE_TX_AT);
|
||||
if (cca) {
|
||||
@ -752,7 +750,7 @@ esp_err_t ieee802154_receive(void)
|
||||
// already in rx state, don't abort current rx operation
|
||||
return ESP_OK;
|
||||
}
|
||||
ieee802154_wakeup();
|
||||
ieee802154_rf_enable();
|
||||
|
||||
ieee802154_enter_critical();
|
||||
rx_init();
|
||||
@ -765,7 +763,7 @@ esp_err_t ieee802154_receive_at(uint32_t time)
|
||||
{
|
||||
uint32_t rx_target_time = time - IEEE802154_RX_RAMPUP_TIME_US;
|
||||
uint32_t current_time;
|
||||
ieee802154_wakeup();
|
||||
ieee802154_rf_enable();
|
||||
rx_init();
|
||||
IEEE802154_SET_TXRX_PTI(IEEE802154_SCENE_RX_AT);
|
||||
set_next_rx_buffer();
|
||||
@ -794,22 +792,22 @@ static esp_err_t ieee802154_sleep_init(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
IRAM_ATTR void ieee802154_enter_sleep(void)
|
||||
IRAM_ATTR static void ieee802154_rf_disable(void)
|
||||
{
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
if (g_sleep_rf == false) {
|
||||
if (s_rf_closed == false) {
|
||||
esp_phy_disable();
|
||||
g_sleep_rf = true;
|
||||
s_rf_closed = true;
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
}
|
||||
|
||||
IRAM_ATTR void ieee802154_wakeup(void)
|
||||
IRAM_ATTR static void ieee802154_rf_enable(void)
|
||||
{
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
if (g_sleep_rf) {
|
||||
if (s_rf_closed) {
|
||||
esp_phy_enable();
|
||||
g_sleep_rf = false;
|
||||
s_rf_closed = false;
|
||||
}
|
||||
#endif //CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
}
|
||||
@ -820,18 +818,15 @@ esp_err_t ieee802154_sleep(void)
|
||||
ieee802154_enter_critical();
|
||||
stop_current_operation();
|
||||
ieee802154_set_state(IEEE802154_STATE_SLEEP);
|
||||
|
||||
ieee802154_exit_critical();
|
||||
|
||||
ieee802154_enter_sleep(); // colse rf
|
||||
ieee802154_rf_disable(); // colse rf
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t ieee802154_energy_detect(uint32_t duration)
|
||||
{
|
||||
ieee802154_wakeup();
|
||||
|
||||
ieee802154_rf_enable();
|
||||
ieee802154_enter_critical();
|
||||
|
||||
stop_current_operation();
|
||||
@ -847,8 +842,7 @@ esp_err_t ieee802154_energy_detect(uint32_t duration)
|
||||
|
||||
esp_err_t ieee802154_cca(void)
|
||||
{
|
||||
ieee802154_wakeup();
|
||||
|
||||
ieee802154_rf_enable();
|
||||
ieee802154_enter_critical();
|
||||
|
||||
stop_current_operation();
|
||||
|
@ -178,18 +178,6 @@ uint8_t ieee802154_get_recent_lqi(void);
|
||||
*/
|
||||
ieee802154_state_t ieee802154_get_state(void);
|
||||
|
||||
/**
|
||||
* @brief The IEEE 802.15.4 enter sleep.
|
||||
*
|
||||
*/
|
||||
void ieee802154_enter_sleep(void);
|
||||
|
||||
/**
|
||||
* @brief The IEEE 802.15.4 wakeup.
|
||||
*
|
||||
*/
|
||||
void ieee802154_wakeup(void);
|
||||
|
||||
/** The following three functions are only used for internal test. **/
|
||||
/**
|
||||
* @brief The clear channel assessment done.
|
||||
|
@ -26,10 +26,11 @@ examples/openthread/ot_rcp:
|
||||
temporary: true
|
||||
reason: only test on esp32c6
|
||||
|
||||
# To add support for the ESP32-C6 in TZ-302
|
||||
examples/openthread/ot_sleepy_device:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32h2", "esp32c6"]
|
||||
- if: IDF_TARGET in ["esp32h2"]
|
||||
disable_test:
|
||||
- if: IDF_TARGET in ["esp32h2", "esp32c6"]
|
||||
- if: IDF_TARGET in ["esp32h2"]
|
||||
temporary: true
|
||||
reason: No support # TO-DO: TZ-134
|
||||
|
@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32-C6 | ESP32-H2 |
|
||||
| ----------------- | -------- | -------- |
|
||||
| Supported Targets | ESP32-H2 |
|
||||
| ----------------- | -------- |
|
||||
|
||||
# OpenThread Sleepy Device Example
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
// When JIRA PM-3 fix, uart clock can autoswitch.
|
||||
// When JIRA PM-3 is fixed, the UART clock will automatically switch.
|
||||
#define ESP_OPENTHREAD_DEFAULT_HOST_CONFIG() \
|
||||
{ \
|
||||
.host_connection_mode = HOST_CONNECTION_MODE_CLI_UART, \
|
||||
|
Loading…
Reference in New Issue
Block a user