mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
esp_system: sync with C3 changes
Fixes interrupt allocation issue
This commit is contained in:
committed by
Angus Gratton
parent
f54e9269f3
commit
eed154a583
@@ -68,6 +68,7 @@ typedef enum {
|
|||||||
ESP_SLEEP_WAKEUP_WIFI, //!< Wakeup caused by WIFI (light sleep only)
|
ESP_SLEEP_WAKEUP_WIFI, //!< Wakeup caused by WIFI (light sleep only)
|
||||||
ESP_SLEEP_WAKEUP_COCPU, //!< Wakeup caused by COCPU int
|
ESP_SLEEP_WAKEUP_COCPU, //!< Wakeup caused by COCPU int
|
||||||
ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG, //!< Wakeup caused by COCPU crash
|
ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG, //!< Wakeup caused by COCPU crash
|
||||||
|
ESP_SLEEP_WAKEUP_BT, //!< Wakeup caused by BT (light sleep only)
|
||||||
} esp_sleep_source_t;
|
} esp_sleep_source_t;
|
||||||
|
|
||||||
/* Leave this type define for compatibility */
|
/* Leave this type define for compatibility */
|
||||||
|
@@ -42,6 +42,8 @@ typedef enum {
|
|||||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES
|
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||||
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES
|
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
#define UNIVERSAL_MAC_ADDR_NUM CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES
|
||||||
#endif
|
#endif
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
|
@@ -585,6 +585,13 @@ esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusre
|
|||||||
esp_intr_disable(ret);
|
esp_intr_disable(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_ESP32C3
|
||||||
|
// TODO ESP32-C3 IDF-2126, these need to be set or the new interrupt won't fire, but are currently hard-coded
|
||||||
|
// for priority and level...
|
||||||
|
esprv_intc_int_set_priority(intr, 1);
|
||||||
|
esprv_intc_int_set_type(BIT(intr), INTR_TYPE_LEVEL);
|
||||||
|
#endif
|
||||||
|
|
||||||
portEXIT_CRITICAL(&spinlock);
|
portEXIT_CRITICAL(&spinlock);
|
||||||
|
|
||||||
//Fill return handle if needed, otherwise free handle.
|
//Fill return handle if needed, otherwise free handle.
|
||||||
|
@@ -9,17 +9,15 @@
|
|||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#include "freertos/queue.h"
|
#include "freertos/queue.h"
|
||||||
#include "freertos/xtensa_api.h"
|
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "soc/uart_periph.h"
|
#include "soc/uart_periph.h"
|
||||||
#include "soc/dport_reg.h"
|
|
||||||
#include "soc/gpio_periph.h"
|
#include "soc/gpio_periph.h"
|
||||||
#include "esp_intr_alloc.h"
|
#include "esp_intr_alloc.h"
|
||||||
#include "driver/periph_ctrl.h"
|
#include "driver/periph_ctrl.h"
|
||||||
#include "driver/timer.h"
|
#include "driver/timer.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
|
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3,ESP32C3)
|
||||||
|
|
||||||
#define TIMER_DIVIDER 16 /*!< Hardware timer clock divider */
|
#define TIMER_DIVIDER 16 /*!< Hardware timer clock divider */
|
||||||
#define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER) /*!< used to calculate counter value */
|
#define TIMER_SCALE (TIMER_BASE_CLK / TIMER_DIVIDER) /*!< used to calculate counter value */
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "esp_rom_sys.h"
|
#include "esp_rom_sys.h"
|
||||||
|
|
||||||
|
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C3, ESP32S3)
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
#include "esp32/clk.h"
|
#include "esp32/clk.h"
|
||||||
@@ -31,8 +32,6 @@
|
|||||||
#include "esp32s3/rom/rtc.h"
|
#include "esp32s3/rom/rtc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
|
|
||||||
|
|
||||||
#define ESP_EXT0_WAKEUP_LEVEL_LOW 0
|
#define ESP_EXT0_WAKEUP_LEVEL_LOW 0
|
||||||
#define ESP_EXT0_WAKEUP_LEVEL_HIGH 1
|
#define ESP_EXT0_WAKEUP_LEVEL_HIGH 1
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ TEST_CASE("wake up from deep sleep using timer", "[deepsleep][reset=DEEPSLEEP_RE
|
|||||||
esp_deep_sleep_start();
|
esp_deep_sleep_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
|
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32C3)
|
||||||
TEST_CASE("light sleep followed by deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]")
|
TEST_CASE("light sleep followed by deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]")
|
||||||
{
|
{
|
||||||
esp_sleep_enable_timer_wakeup(1000000);
|
esp_sleep_enable_timer_wakeup(1000000);
|
||||||
@@ -82,7 +81,7 @@ TEST_CASE("wake up from light sleep using timer", "[deepsleep]")
|
|||||||
(tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f;
|
(tv_stop.tv_usec - tv_start.tv_usec) * 1e-3f;
|
||||||
TEST_ASSERT_INT32_WITHIN(500, 2000, (int) dt);
|
TEST_ASSERT_INT32_WITHIN(500, 2000, (int) dt);
|
||||||
}
|
}
|
||||||
#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
|
#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32C3)
|
||||||
|
|
||||||
static void test_light_sleep(void* arg)
|
static void test_light_sleep(void* arg)
|
||||||
{
|
{
|
||||||
@@ -417,7 +416,7 @@ __attribute__((unused)) static uint32_t get_cause(void)
|
|||||||
return wakeup_cause;
|
return wakeup_cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
|
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32C3)
|
||||||
// This test case verifies deactivation of trigger for wake up sources
|
// This test case verifies deactivation of trigger for wake up sources
|
||||||
TEST_CASE("disable source trigger behavior", "[deepsleep]")
|
TEST_CASE("disable source trigger behavior", "[deepsleep]")
|
||||||
{
|
{
|
||||||
@@ -490,7 +489,7 @@ TEST_CASE("disable source trigger behavior", "[deepsleep]")
|
|||||||
// Disable ext0 wakeup source, as this might interfere with other tests
|
// Disable ext0 wakeup source, as this might interfere with other tests
|
||||||
ESP_ERROR_CHECK(esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0));
|
ESP_ERROR_CHECK(esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0));
|
||||||
}
|
}
|
||||||
#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
|
#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32C3)
|
||||||
|
|
||||||
static RTC_DATA_ATTR struct timeval start;
|
static RTC_DATA_ATTR struct timeval start;
|
||||||
static void trigger_deepsleep(void)
|
static void trigger_deepsleep(void)
|
||||||
@@ -527,4 +526,4 @@ static void check_time_deepsleep(void)
|
|||||||
|
|
||||||
TEST_CASE_MULTIPLE_STAGES("check a time after wakeup from deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]", trigger_deepsleep, check_time_deepsleep);
|
TEST_CASE_MULTIPLE_STAGES("check a time after wakeup from deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]", trigger_deepsleep, check_time_deepsleep);
|
||||||
|
|
||||||
#endif // #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
|
#endif // #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C3, ESP32S3)
|
||||||
|
Reference in New Issue
Block a user