mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-03 08:31:44 +01:00
timer group: add timer group and WDT support for ESP32S3
Regenerate timer group header files and update LL, check examples and update docs.
This commit is contained in:
@@ -27,20 +27,39 @@ extern "C" {
|
||||
#include "hal/wdt_types.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
/* The value that needs to be written to MWDT_LL_WKEY to write-enable the wdt registers */
|
||||
#define MWDT_LL_WKEY_VALUE 0x50D83AA1
|
||||
|
||||
/* Possible values for MWDT_LL_STGx */
|
||||
#define MWDT_LL_STG_SEL_OFF 0
|
||||
#define MWDT_LL_STG_SEL_INT 1
|
||||
#define MWDT_LL_STG_SEL_RESET_CPU 2
|
||||
#define MWDT_LL_STG_SEL_RESET_SYSTEM 3
|
||||
|
||||
/* Possible values for MWDT_LL_CPU_RESET_LENGTH and MWDT_LL_SYS_RESET_LENGTH */
|
||||
#define MWDT_LL_RESET_LENGTH_100_NS 0
|
||||
#define MWDT_LL_RESET_LENGTH_200_NS 1
|
||||
#define MWDT_LL_RESET_LENGTH_300_NS 2
|
||||
#define MWDT_LL_RESET_LENGTH_400_NS 3
|
||||
#define MWDT_LL_RESET_LENGTH_500_NS 4
|
||||
#define MWDT_LL_RESET_LENGTH_800_NS 5
|
||||
#define MWDT_LL_RESET_LENGTH_1600_NS 6
|
||||
#define MWDT_LL_RESET_LENGTH_3200_NS 7
|
||||
|
||||
//Type check wdt_stage_action_t
|
||||
_Static_assert(WDT_STAGE_ACTION_OFF == TIMG_WDT_STG_SEL_OFF, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_INT == TIMG_WDT_STG_SEL_INT, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_CPU == TIMG_WDT_STG_SEL_RESET_CPU, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_SYSTEM == TIMG_WDT_STG_SEL_RESET_SYSTEM, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_OFF == MWDT_LL_STG_SEL_OFF, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_INT == MWDT_LL_STG_SEL_INT, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_CPU == MWDT_LL_STG_SEL_RESET_CPU, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_SYSTEM == MWDT_LL_STG_SEL_RESET_SYSTEM, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
//Type check wdt_reset_sig_length_t
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_100ns == TIMG_WDT_RESET_LENGTH_100_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_200ns == TIMG_WDT_RESET_LENGTH_200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_300ns == TIMG_WDT_RESET_LENGTH_300_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_400ns == TIMG_WDT_RESET_LENGTH_400_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_500ns == TIMG_WDT_RESET_LENGTH_500_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_800ns == TIMG_WDT_RESET_LENGTH_800_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_1_6us == TIMG_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_3_2us == TIMG_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_100ns == MWDT_LL_RESET_LENGTH_100_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_200ns == MWDT_LL_RESET_LENGTH_200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_300ns == MWDT_LL_RESET_LENGTH_300_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_400ns == MWDT_LL_RESET_LENGTH_400_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_500ns == MWDT_LL_RESET_LENGTH_500_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_800ns == MWDT_LL_RESET_LENGTH_800_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_1_6us == MWDT_LL_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_3_2us == MWDT_LL_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
|
||||
/**
|
||||
* @brief Enable the MWDT
|
||||
@@ -49,7 +68,7 @@ _Static_assert(WDT_RESET_SIG_LENGTH_3_2us == TIMG_WDT_RESET_LENGTH_3200_NS, "Add
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_enable(timg_dev_t *hw)
|
||||
{
|
||||
hw->wdt_config0.en = 1;
|
||||
hw->wdtconfig0.wdt_en = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +81,7 @@ FORCE_INLINE_ATTR void mwdt_ll_enable(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_disable(timg_dev_t *hw)
|
||||
{
|
||||
hw->wdt_config0.en = 0;
|
||||
hw->wdtconfig0.wdt_en = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,7 +92,7 @@ FORCE_INLINE_ATTR void mwdt_ll_disable(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR bool mwdt_ll_check_if_enabled(timg_dev_t *hw)
|
||||
{
|
||||
return (hw->wdt_config0.en) ? true : false;
|
||||
return (hw->wdtconfig0.wdt_en) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,20 +107,20 @@ FORCE_INLINE_ATTR void mwdt_ll_config_stage(timg_dev_t *hw, wdt_stage_t stage, u
|
||||
{
|
||||
switch (stage) {
|
||||
case WDT_STAGE0:
|
||||
hw->wdt_config0.stg0 = behavior;
|
||||
hw->wdt_config2 = timeout;
|
||||
hw->wdtconfig0.wdt_stg0 = behavior;
|
||||
hw->wdtconfig2.wdt_stg0_hold = timeout;
|
||||
break;
|
||||
case WDT_STAGE1:
|
||||
hw->wdt_config0.stg1 = behavior;
|
||||
hw->wdt_config3 = timeout;
|
||||
hw->wdtconfig0.wdt_stg1 = behavior;
|
||||
hw->wdtconfig3.wdt_stg1_hold = timeout;
|
||||
break;
|
||||
case WDT_STAGE2:
|
||||
hw->wdt_config0.stg2 = behavior;
|
||||
hw->wdt_config4 = timeout;
|
||||
hw->wdtconfig0.wdt_stg2 = behavior;
|
||||
hw->wdtconfig4.wdt_stg2_hold = timeout;
|
||||
break;
|
||||
case WDT_STAGE3:
|
||||
hw->wdt_config0.stg3 = behavior;
|
||||
hw->wdt_config5 = timeout;
|
||||
hw->wdtconfig0.wdt_stg3 = behavior;
|
||||
hw->wdtconfig5.wdt_stg3_hold = timeout;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -118,16 +137,16 @@ FORCE_INLINE_ATTR void mwdt_ll_disable_stage(timg_dev_t *hw, uint32_t stage)
|
||||
{
|
||||
switch (stage) {
|
||||
case WDT_STAGE0:
|
||||
hw->wdt_config0.stg0 = WDT_STAGE_ACTION_OFF;
|
||||
hw->wdtconfig0.wdt_stg0 = WDT_STAGE_ACTION_OFF;
|
||||
break;
|
||||
case WDT_STAGE1:
|
||||
hw->wdt_config0.stg1 = WDT_STAGE_ACTION_OFF;
|
||||
hw->wdtconfig0.wdt_stg1 = WDT_STAGE_ACTION_OFF;
|
||||
break;
|
||||
case WDT_STAGE2:
|
||||
hw->wdt_config0.stg2 = WDT_STAGE_ACTION_OFF;
|
||||
hw->wdtconfig0.wdt_stg2 = WDT_STAGE_ACTION_OFF;
|
||||
break;
|
||||
case WDT_STAGE3:
|
||||
hw->wdt_config0.stg3 = WDT_STAGE_ACTION_OFF;
|
||||
hw->wdtconfig0.wdt_stg3 = WDT_STAGE_ACTION_OFF;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -152,7 +171,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_edge_intr(timg_dev_t *hw, bool enable)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_level_intr(timg_dev_t *hw, bool enable)
|
||||
{
|
||||
hw->int_ena.wdt = enable;
|
||||
hw->int_ena_timers.wdt_int_ena = enable;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,7 +182,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_level_intr(timg_dev_t *hw, bool enable)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_cpu_reset_length(timg_dev_t *hw, wdt_reset_sig_length_t length)
|
||||
{
|
||||
hw->wdt_config0.cpu_reset_length = length;
|
||||
hw->wdtconfig0.wdt_cpu_reset_length = length;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,7 +193,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_cpu_reset_length(timg_dev_t *hw, wdt_reset_si
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_sys_reset_length(timg_dev_t *hw, wdt_reset_sig_length_t length)
|
||||
{
|
||||
hw->wdt_config0.sys_reset_length = length;
|
||||
hw->wdtconfig0.wdt_sys_reset_length = length;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -189,7 +208,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_sys_reset_length(timg_dev_t *hw, wdt_reset_si
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_flashboot_en(timg_dev_t *hw, bool enable)
|
||||
{
|
||||
hw->wdt_config0.flashboot_mod_en = (enable) ? 1 : 0;
|
||||
hw->wdtconfig0.wdt_flashboot_mod_en = (enable) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +219,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_flashboot_en(timg_dev_t *hw, bool enable)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_prescaler(timg_dev_t *hw, uint32_t prescaler)
|
||||
{
|
||||
hw->wdt_config1.clk_prescale = prescaler;
|
||||
hw->wdtconfig1.wdt_clk_prescale = prescaler;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +231,7 @@ FORCE_INLINE_ATTR void mwdt_ll_set_prescaler(timg_dev_t *hw, uint32_t prescaler)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_feed(timg_dev_t *hw)
|
||||
{
|
||||
hw->wdt_feed = 1;
|
||||
hw->wdtfeed.wdt_feed = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +243,7 @@ FORCE_INLINE_ATTR void mwdt_ll_feed(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_write_protect_enable(timg_dev_t *hw)
|
||||
{
|
||||
hw->wdt_wprotect = 0;
|
||||
hw->wdtwprotect.wdt_wkey = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +253,7 @@ FORCE_INLINE_ATTR void mwdt_ll_write_protect_enable(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_write_protect_disable(timg_dev_t *hw)
|
||||
{
|
||||
hw->wdt_wprotect = TIMG_WDT_WKEY_VALUE;
|
||||
hw->wdtwprotect.wdt_wkey = MWDT_LL_WKEY_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +263,7 @@ FORCE_INLINE_ATTR void mwdt_ll_write_protect_disable(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_clear_intr_status(timg_dev_t *hw)
|
||||
{
|
||||
hw->int_clr.wdt = 1;
|
||||
hw->int_clr_timers.wdt_int_clr = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,7 +274,7 @@ FORCE_INLINE_ATTR void mwdt_ll_clear_intr_status(timg_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void mwdt_ll_set_intr_enable(timg_dev_t *hw, bool enable)
|
||||
{
|
||||
hw->int_ena.wdt = (enable) ? 1 : 0;
|
||||
hw->int_ena_timers.wdt_int_ena = (enable) ? 1 : 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -28,21 +28,42 @@ extern "C" {
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
/* The value that needs to be written to RTC_CNTL_WDT_WKEY to write-enable the wdt registers */
|
||||
#define RWDT_LL_WDT_WKEY_VALUE 0x50D83AA1
|
||||
|
||||
|
||||
/* stage action selection values */
|
||||
#define RWDT_LL_STG_SEL_OFF 0
|
||||
#define RWDT_LL_STG_SEL_INT 1
|
||||
#define RWDT_LL_STG_SEL_RESET_CPU 2
|
||||
#define RWDT_LL_STG_SEL_RESET_SYSTEM 3
|
||||
#define RWDT_LL_STG_SEL_RESET_RTC 4
|
||||
|
||||
/* Possible values for RTC_CNTL_WDT_CPU_RESET_LENGTH and RTC_CNTL_WDT_SYS_RESET_LENGTH */
|
||||
#define RWDT_LL_RESET_LENGTH_100_NS 0
|
||||
#define RWDT_LL_RESET_LENGTH_200_NS 1
|
||||
#define RWDT_LL_RESET_LENGTH_300_NS 2
|
||||
#define RWDT_LL_RESET_LENGTH_400_NS 3
|
||||
#define RWDT_LL_RESET_LENGTH_500_NS 4
|
||||
#define RWDT_LL_RESET_LENGTH_800_NS 5
|
||||
#define RWDT_LL_RESET_LENGTH_1600_NS 6
|
||||
#define RWDT_LL_RESET_LENGTH_3200_NS 7
|
||||
|
||||
//Type check wdt_stage_action_t
|
||||
_Static_assert(WDT_STAGE_ACTION_OFF == RTC_WDT_STG_SEL_OFF, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_INT == RTC_WDT_STG_SEL_INT, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_CPU == RTC_WDT_STG_SEL_RESET_CPU, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_SYSTEM == RTC_WDT_STG_SEL_RESET_SYSTEM, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_RTC == RTC_WDT_STG_SEL_RESET_RTC, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_OFF == RWDT_LL_STG_SEL_OFF, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_INT == RWDT_LL_STG_SEL_INT, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_CPU == RWDT_LL_STG_SEL_RESET_CPU, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_SYSTEM == RWDT_LL_STG_SEL_RESET_SYSTEM, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
_Static_assert(WDT_STAGE_ACTION_RESET_RTC == RWDT_LL_STG_SEL_RESET_RTC, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_stage_action_t");
|
||||
//Type check wdt_reset_sig_length_t
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_100ns == RTC_WDT_RESET_LENGTH_100_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_200ns == RTC_WDT_RESET_LENGTH_200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_300ns == RTC_WDT_RESET_LENGTH_300_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_400ns == RTC_WDT_RESET_LENGTH_400_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_500ns == RTC_WDT_RESET_LENGTH_500_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_800ns == RTC_WDT_RESET_LENGTH_800_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_1_6us == RTC_WDT_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_3_2us == RTC_WDT_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_100ns == RWDT_LL_RESET_LENGTH_100_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_200ns == RWDT_LL_RESET_LENGTH_200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_300ns == RWDT_LL_RESET_LENGTH_300_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_400ns == RWDT_LL_RESET_LENGTH_400_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_500ns == RWDT_LL_RESET_LENGTH_500_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_800ns == RWDT_LL_RESET_LENGTH_800_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_1_6us == RWDT_LL_RESET_LENGTH_1600_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
_Static_assert(WDT_RESET_SIG_LENGTH_3_2us == RWDT_LL_RESET_LENGTH_3200_NS, "Add mapping to LL watchdog timeout behavior, since it's no longer naturally compatible with wdt_reset_sig_length_t");
|
||||
|
||||
/**
|
||||
* @brief Enable the RWDT
|
||||
@@ -270,7 +291,7 @@ FORCE_INLINE_ATTR void rwdt_ll_write_protect_enable(rtc_cntl_dev_t *hw)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void rwdt_ll_write_protect_disable(rtc_cntl_dev_t *hw)
|
||||
{
|
||||
hw->wdt_wprotect = RTC_CNTL_WDT_WKEY_VALUE;
|
||||
hw->wdt_wprotect = RWDT_LL_WDT_WKEY_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,10 +53,10 @@ static inline void timer_ll_set_divider(timg_dev_t *hw, timer_idx_t timer_num, u
|
||||
if (divider >= 65536) {
|
||||
divider = 0;
|
||||
}
|
||||
int timer_en = hw->hw_timer[timer_num].config.enable;
|
||||
hw->hw_timer[timer_num].config.enable = 0;
|
||||
hw->hw_timer[timer_num].config.divider = divider;
|
||||
hw->hw_timer[timer_num].config.enable = timer_en;
|
||||
int timer_en = hw->hw_timer[timer_num].config.tn_en;
|
||||
hw->hw_timer[timer_num].config.tn_en = 0;
|
||||
hw->hw_timer[timer_num].config.tn_divider = divider;
|
||||
hw->hw_timer[timer_num].config.tn_en = timer_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ static inline void timer_ll_set_divider(timg_dev_t *hw, timer_idx_t timer_num, u
|
||||
*/
|
||||
static inline void timer_ll_get_divider(timg_dev_t *hw, timer_idx_t timer_num, uint32_t *divider)
|
||||
{
|
||||
uint32_t d = hw->hw_timer[timer_num].config.divider;
|
||||
uint32_t d = hw->hw_timer[timer_num].config.tn_divider;
|
||||
if (d == 0) {
|
||||
d = 65536;
|
||||
} else if (d == 1) {
|
||||
@@ -90,9 +90,9 @@ static inline void timer_ll_get_divider(timg_dev_t *hw, timer_idx_t timer_num, u
|
||||
*/
|
||||
static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t load_val)
|
||||
{
|
||||
hw->hw_timer[timer_num].load_high.load_hi = (uint32_t) (load_val >> 32);
|
||||
hw->hw_timer[timer_num].load_low = (uint32_t) load_val;
|
||||
hw->hw_timer[timer_num].reload = 1;
|
||||
hw->hw_timer[timer_num].loadhi.tn_load_hi = (uint32_t) (load_val >> 32);
|
||||
hw->hw_timer[timer_num].loadlo.tn_load_lo = (uint32_t) load_val;
|
||||
hw->hw_timer[timer_num].load.tn_load = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,9 +106,9 @@ static inline void timer_ll_set_counter_value(timg_dev_t *hw, timer_idx_t timer_
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *timer_val)
|
||||
{
|
||||
hw->hw_timer[timer_num].update.update = 1;
|
||||
while (hw->hw_timer[timer_num].update.update) {}
|
||||
*timer_val = ((uint64_t) hw->hw_timer[timer_num].cnt_high.hi << 32) | (hw->hw_timer[timer_num].cnt_low);
|
||||
hw->hw_timer[timer_num].update.tn_update = 1;
|
||||
while (hw->hw_timer[timer_num].update.tn_update) {}
|
||||
*timer_val = ((uint64_t) hw->hw_timer[timer_num].hi.tn_hi << 32) | (hw->hw_timer[timer_num].lo.tn_lo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +122,7 @@ FORCE_INLINE_ATTR void timer_ll_get_counter_value(timg_dev_t *hw, timer_idx_t ti
|
||||
*/
|
||||
static inline void timer_ll_set_counter_increase(timg_dev_t *hw, timer_idx_t timer_num, bool increase_en)
|
||||
{
|
||||
hw->hw_timer[timer_num].config.increase = increase_en;
|
||||
hw->hw_timer[timer_num].config.tn_increase = increase_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +137,7 @@ static inline void timer_ll_set_counter_increase(timg_dev_t *hw, timer_idx_t tim
|
||||
*/
|
||||
static inline bool timer_ll_get_counter_increase(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
return hw->hw_timer[timer_num].config.increase;
|
||||
return hw->hw_timer[timer_num].config.tn_increase;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +151,7 @@ static inline bool timer_ll_get_counter_increase(timg_dev_t *hw, timer_idx_t tim
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_set_counter_enable(timg_dev_t *hw, timer_idx_t timer_num, bool counter_en)
|
||||
{
|
||||
hw->hw_timer[timer_num].config.enable = counter_en;
|
||||
hw->hw_timer[timer_num].config.tn_en = counter_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,7 +166,7 @@ FORCE_INLINE_ATTR void timer_ll_set_counter_enable(timg_dev_t *hw, timer_idx_t t
|
||||
*/
|
||||
static inline bool timer_ll_get_counter_enable(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
return hw->hw_timer[timer_num].config.enable;
|
||||
return hw->hw_timer[timer_num].config.tn_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +180,7 @@ static inline bool timer_ll_get_counter_enable(timg_dev_t *hw, timer_idx_t timer
|
||||
*/
|
||||
static inline void timer_ll_set_auto_reload(timg_dev_t *hw, timer_idx_t timer_num, bool auto_reload_en)
|
||||
{
|
||||
hw->hw_timer[timer_num].config.autoreload = auto_reload_en;
|
||||
hw->hw_timer[timer_num].config.tn_autoreload = auto_reload_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +195,7 @@ static inline void timer_ll_set_auto_reload(timg_dev_t *hw, timer_idx_t timer_nu
|
||||
*/
|
||||
FORCE_INLINE_ATTR bool timer_ll_get_auto_reload(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
return hw->hw_timer[timer_num].config.autoreload;
|
||||
return hw->hw_timer[timer_num].config.tn_autoreload;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,8 +209,8 @@ FORCE_INLINE_ATTR bool timer_ll_get_auto_reload(timg_dev_t *hw, timer_idx_t time
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_set_alarm_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t alarm_value)
|
||||
{
|
||||
hw->hw_timer[timer_num].alarm_high.alarm_hi = (uint32_t) (alarm_value >> 32);
|
||||
hw->hw_timer[timer_num].alarm_low = (uint32_t) alarm_value;
|
||||
hw->hw_timer[timer_num].alarmhi.tn_alarm_hi = (uint32_t) (alarm_value >> 32);
|
||||
hw->hw_timer[timer_num].alarmlo.tn_alarm_lo = (uint32_t) alarm_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ FORCE_INLINE_ATTR void timer_ll_set_alarm_value(timg_dev_t *hw, timer_idx_t time
|
||||
*/
|
||||
static inline void timer_ll_get_alarm_value(timg_dev_t *hw, timer_idx_t timer_num, uint64_t *alarm_value)
|
||||
{
|
||||
*alarm_value = ((uint64_t) hw->hw_timer[timer_num].alarm_high.alarm_hi << 32) | (hw->hw_timer[timer_num].alarm_low);
|
||||
*alarm_value = ((uint64_t) hw->hw_timer[timer_num].alarmhi.tn_alarm_hi << 32) | (hw->hw_timer[timer_num].alarmlo.tn_alarm_lo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +238,7 @@ static inline void timer_ll_get_alarm_value(timg_dev_t *hw, timer_idx_t timer_nu
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_set_alarm_enable(timg_dev_t *hw, timer_idx_t timer_num, bool alarm_en)
|
||||
{
|
||||
hw->hw_timer[timer_num].config.alarm_en = alarm_en;
|
||||
hw->hw_timer[timer_num].config.tn_alarm_en = alarm_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,7 +253,7 @@ FORCE_INLINE_ATTR void timer_ll_set_alarm_enable(timg_dev_t *hw, timer_idx_t tim
|
||||
*/
|
||||
static inline bool timer_ll_get_alarm_enable(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
return hw->hw_timer[timer_num].config.alarm_en;
|
||||
return hw->hw_timer[timer_num].config.tn_alarm_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ static inline bool timer_ll_get_alarm_enable(timg_dev_t *hw, timer_idx_t timer_n
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_intr_enable(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
hw->int_ena.val |= BIT(timer_num);
|
||||
hw->int_ena_timers.val |= BIT(timer_num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +279,7 @@ FORCE_INLINE_ATTR void timer_ll_intr_enable(timg_dev_t *hw, timer_idx_t timer_nu
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_intr_disable(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
hw->int_ena.val &= (~BIT(timer_num));
|
||||
hw->int_ena_timers.val &= (~BIT(timer_num));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +292,7 @@ FORCE_INLINE_ATTR void timer_ll_intr_disable(timg_dev_t *hw, timer_idx_t timer_n
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_clear_intr_status(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
hw->int_clr.val |= BIT(timer_num);
|
||||
hw->int_clr_timers.val |= BIT(timer_num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,7 +305,7 @@ FORCE_INLINE_ATTR void timer_ll_clear_intr_status(timg_dev_t *hw, timer_idx_t ti
|
||||
*/
|
||||
FORCE_INLINE_ATTR void timer_ll_get_intr_status(timg_dev_t *hw, uint32_t *intr_status)
|
||||
{
|
||||
*intr_status = hw->int_st.val & 0x03;
|
||||
*intr_status = hw->int_st_timers.val & 0x03;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ FORCE_INLINE_ATTR void timer_ll_get_intr_status(timg_dev_t *hw, uint32_t *intr_s
|
||||
FORCE_INLINE_ATTR void timer_ll_get_intr_raw_status(timer_group_t group_num, uint32_t *intr_raw_status)
|
||||
{
|
||||
timg_dev_t *hw = TIMER_LL_GET_HW(group_num);
|
||||
*intr_raw_status = hw->int_raw.val & 0x03;
|
||||
*intr_raw_status = hw->int_raw_timers.val & 0x03;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,7 +388,7 @@ static inline bool timer_ll_get_edge_int_enable(timg_dev_t *hw, timer_idx_t time
|
||||
*/
|
||||
static inline uint32_t timer_ll_get_intr_status_reg(timg_dev_t *hw)
|
||||
{
|
||||
return (uint32_t) & (hw->int_st.val);
|
||||
return (uint32_t) & (hw->int_st_timers.val);
|
||||
}
|
||||
|
||||
static inline uint32_t timer_ll_get_intr_mask_bit(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
@@ -406,7 +406,7 @@ static inline uint32_t timer_ll_get_intr_mask_bit(timg_dev_t *hw, timer_idx_t ti
|
||||
*/
|
||||
static inline void timer_ll_set_use_xtal(timg_dev_t *hw, timer_idx_t timer_num, bool use_xtal_en)
|
||||
{
|
||||
hw->hw_timer[timer_num].config.use_xtal = use_xtal_en;
|
||||
hw->hw_timer[timer_num].config.tn_use_xtal = use_xtal_en;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -420,7 +420,7 @@ static inline void timer_ll_set_use_xtal(timg_dev_t *hw, timer_idx_t timer_num,
|
||||
*/
|
||||
static inline bool timer_ll_get_use_xtal(timg_dev_t *hw, timer_idx_t timer_num)
|
||||
{
|
||||
return hw->hw_timer[timer_num].config.use_xtal;
|
||||
return hw->hw_timer[timer_num].config.tn_use_xtal;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user