mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ieee802154: change light sleep config in ieee802154
This commit is contained in:
parent
aee329de2b
commit
043893a49f
@ -76,6 +76,7 @@ menu "IEEE 802.15.4"
|
||||
|
||||
|
||||
config IEEE802154_SLEEP_ENABLE
|
||||
# Todo: Remove when support safe power-down of the power domain (IDF-7317)
|
||||
bool "Enable IEEE802154 light sleep"
|
||||
depends on PM_ENABLE && PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP
|
||||
default n
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_phy_init.h"
|
||||
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "esp_pm.h"
|
||||
#include "esp_private/esp_clk.h"
|
||||
#include "esp_private/sleep_retention.h"
|
||||
@ -762,7 +762,7 @@ esp_err_t ieee802154_receive_at(uint32_t time)
|
||||
static esp_err_t ieee802154_sleep_init(void)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if SOC_PM_MODEM_RETENTION_BY_REGDMA && CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#define N_REGS_IEEE802154() (((IEEE802154_MAC_DATE_REG - IEEE802154_REG_BASE) / 4) + 1)
|
||||
const static sleep_retention_entries_config_t ieee802154_mac_regs_retention[] = {
|
||||
[0] = { .config = REGDMA_LINK_CONTINUOUS_INIT(REGDMA_MODEM_IEEE802154_LINK(0x00), IEEE802154_REG_BASE, IEEE802154_REG_BASE, N_REGS_IEEE802154(), 0, 0), .owner = ENTRY(3) },
|
||||
@ -777,24 +777,24 @@ static esp_err_t ieee802154_sleep_init(void)
|
||||
|
||||
IRAM_ATTR void ieee802154_enter_sleep(void)
|
||||
{
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
esp_phy_disable();
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(true);// backup
|
||||
#endif
|
||||
ieee802154_disable(); // IEEE802154 CLOCK Disable
|
||||
#endif // CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
}
|
||||
|
||||
IRAM_ATTR void ieee802154_wakeup(void)
|
||||
{
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
ieee802154_enable(); // IEEE802154 CLOCK Enable
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(false);// restore
|
||||
#endif
|
||||
esp_phy_enable();
|
||||
#endif //CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#endif //CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
}
|
||||
|
||||
esp_err_t ieee802154_sleep(void)
|
||||
|
@ -12,7 +12,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#ifdef CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
/**
|
||||
* @brief This function initializes the OpenThread sleep.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -22,7 +22,6 @@
|
||||
#include "openthread/tasklet.h"
|
||||
#include "openthread/thread.h"
|
||||
|
||||
|
||||
static int hex_digit_to_int(char hex)
|
||||
{
|
||||
if ('A' <= hex && hex <= 'F') {
|
||||
@ -61,7 +60,7 @@ esp_err_t esp_openthread_init(const esp_openthread_platform_config_t *config)
|
||||
{
|
||||
ESP_RETURN_ON_ERROR(esp_openthread_platform_init(config), OT_PLAT_LOG_TAG,
|
||||
"Failed to initialize OpenThread platform driver");
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
ESP_RETURN_ON_ERROR(esp_openthread_sleep_init(), OT_PLAT_LOG_TAG,
|
||||
"Failed to initialize OpenThread esp pm_lock");
|
||||
#endif
|
||||
@ -165,7 +164,7 @@ esp_err_t esp_openthread_launch_mainloop(void)
|
||||
mainloop.timeout.tv_sec = 0;
|
||||
mainloop.timeout.tv_usec = 0;
|
||||
}
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
esp_openthread_sleep_process();
|
||||
#endif
|
||||
esp_openthread_lock_release();
|
||||
@ -173,7 +172,7 @@ esp_err_t esp_openthread_launch_mainloop(void)
|
||||
if (select(mainloop.max_fd + 1, &mainloop.read_fds, &mainloop.write_fds, &mainloop.error_fds,
|
||||
&mainloop.timeout) >= 0) {
|
||||
esp_openthread_lock_acquire(portMAX_DELAY);
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
esp_openthread_wakeup_process();
|
||||
#endif
|
||||
error = esp_openthread_platform_process(instance, &mainloop);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "esp_check.h"
|
||||
#include "esp_ieee802154.h"
|
||||
|
||||
#if CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "esp_pm.h"
|
||||
static esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
static const char* TAG = "esp openthread sleep";
|
||||
@ -48,4 +48,4 @@ void esp_openthread_wakeup_process(void)
|
||||
s_ot_sleep = false;
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_IEEE802154_SLEEP_ENABLE
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
@ -12,4 +12,4 @@ In this folder, it contains following OpenThread examples:
|
||||
|
||||
* [ot_br](ot_br) is an [OpenThread Border Router](https://openthread.io/guides/border-router) example. It runs on a Wi-Fi SoC such as ESP32, ESP32-C3 and ESP32-S3. It needs an 802.15.4 SoC like ESP32-H2 running [ot_rcp](ot_rcp) example to provide 802.15.4 radio.
|
||||
|
||||
* [ot_sleepy_device](ot_sleepy_device) is an OpenThread sleepy device example, it supports 802.15.4 radio light sleep. It runs on an 802.15.4 SoC like ESP32-C6.
|
||||
* [ot_sleepy_device](ot_sleepy_device) is an OpenThread sleepy device example, it supports 802.15.4 radio light sleep. It runs on an 802.15.4 SoC like ESP32-C6.
|
||||
|
@ -3,4 +3,3 @@
|
||||
nvs, data, nvs, 0x9000, 0x6000,
|
||||
phy_init, data, phy, 0xf000, 0x1000,
|
||||
factory, app, factory, 0x10000, 0x120000,
|
||||
ot_storage, data, 0x3a, , 0x2000,
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user