mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 22:54:33 +02:00
Merge branch 'feature/united_sar_periph_ctrl' into 'master'
rtc: united sar peripheral control Closes IDF-6110 See merge request espressif/esp-idf!20750
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* See target/sar_periph_ctrl.c to know involved peripherals
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise SAR related peripheral register settings
|
||||||
|
* Should only be used when running into app stage
|
||||||
|
*/
|
||||||
|
void sar_periph_ctrl_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@@ -11,7 +11,8 @@ set(srcs
|
|||||||
"chip_info.c")
|
"chip_info.c")
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
list(APPEND srcs "cache_sram_mmu.c")
|
list(APPEND srcs "cache_sram_mmu.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
||||||
|
@@ -12,6 +12,9 @@
|
|||||||
#include "soc/dport_reg.h"
|
#include "soc/dport_reg.h"
|
||||||
#include "hal/efuse_ll.h"
|
#include "hal/efuse_ll.h"
|
||||||
#include "soc/gpio_periph.h"
|
#include "soc/gpio_periph.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void rtc_init(rtc_config_t cfg)
|
void rtc_init(rtc_config_t cfg)
|
||||||
@@ -94,6 +97,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
|
|
||||||
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
||||||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
||||||
|
37
components/esp_hw_support/port/esp32/sar_periph_ctrl.c
Normal file
37
components/esp_hw_support/port/esp32/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "hal/sar_ctrl_ll.h"
|
||||||
|
|
||||||
|
extern portMUX_TYPE rtc_spinlock;
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//Put SAR control mux to ON state
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_ON);
|
||||||
|
|
||||||
|
//Add other periph power control initialisation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_OFF);
|
||||||
|
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
}
|
@@ -4,8 +4,13 @@ set(srcs "rtc_clk_init.c"
|
|||||||
"rtc_pm.c"
|
"rtc_pm.c"
|
||||||
"rtc_sleep.c"
|
"rtc_sleep.c"
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
if(NOT BOOTLOADER_BUILD)
|
||||||
|
|
||||||
|
list(APPEND srcs "sar_periph_ctrl.c")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}")
|
||||||
|
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
#include "esp_hw_log.h"
|
#include "esp_hw_log.h"
|
||||||
#include "esp_efuse.h"
|
#include "esp_efuse.h"
|
||||||
#include "esp_efuse_table.h"
|
#include "esp_efuse_table.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "rtc_init";
|
static const char *TAG = "rtc_init";
|
||||||
|
|
||||||
@@ -121,6 +124,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
||||||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||||
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_CK, 1);
|
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_CK, 1);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
||||||
|
38
components/esp_hw_support/port/esp32c2/sar_periph_ctrl.c
Normal file
38
components/esp_hw_support/port/esp32c2/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "hal/sar_ctrl_ll.h"
|
||||||
|
|
||||||
|
extern portMUX_TYPE rtc_spinlock;
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//Put SAR control mux to FSM state
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||||
|
|
||||||
|
//Add other periph power control initialisation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_OFF);
|
||||||
|
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
}
|
@@ -4,12 +4,12 @@ set(srcs "rtc_clk_init.c"
|
|||||||
"rtc_pm.c"
|
"rtc_pm.c"
|
||||||
"rtc_sleep.c"
|
"rtc_sleep.c"
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
list(APPEND srcs "esp_crypto_lock.c"
|
list(APPEND srcs "esp_crypto_lock.c"
|
||||||
"esp_ds.c")
|
"esp_ds.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
|
|
||||||
# init constructor for wifi
|
# init constructor for wifi
|
||||||
list(APPEND srcs "adc2_init_cal.c")
|
list(APPEND srcs "adc2_init_cal.c")
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
#include "esp_hw_log.h"
|
#include "esp_hw_log.h"
|
||||||
#include "esp_efuse.h"
|
#include "esp_efuse.h"
|
||||||
#include "esp_efuse_table.h"
|
#include "esp_efuse_table.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "rtc_init";
|
static const char *TAG = "rtc_init";
|
||||||
|
|
||||||
@@ -156,6 +159,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
||||||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||||
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_CK, 1);
|
REGI2C_WRITE_MASK(I2C_ULP, I2C_ULP_IR_FORCE_XPD_CK, 1);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
||||||
|
38
components/esp_hw_support/port/esp32c3/sar_periph_ctrl.c
Normal file
38
components/esp_hw_support/port/esp32c3/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "hal/sar_ctrl_ll.h"
|
||||||
|
|
||||||
|
extern portMUX_TYPE rtc_spinlock;
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//Put SAR control mux to FSM state
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||||
|
|
||||||
|
//Add other periph power control initialisation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_OFF);
|
||||||
|
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
}
|
@@ -4,13 +4,13 @@ set(srcs "rtc_clk_init.c"
|
|||||||
# "rtc_pm.c" // TODO: IDF-5645
|
# "rtc_pm.c" // TODO: IDF-5645
|
||||||
# "rtc_sleep.c" // TODO: IDF-5645
|
# "rtc_sleep.c" // TODO: IDF-5645
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
# list(APPEND srcs "esp_hmac.c" // TODO: IDF-5355
|
# list(APPEND srcs "esp_hmac.c" // TODO: IDF-5355
|
||||||
# "esp_crypto_lock.c"
|
# "esp_crypto_lock.c"
|
||||||
# "esp_ds.c") // TODO: IDF-5360
|
# "esp_ds.c") // TODO: IDF-5360
|
||||||
|
list(APPEND srcs "sar_periph_ctrl.c")
|
||||||
|
|
||||||
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
||||||
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
||||||
|
29
components/esp_hw_support/port/esp32c6/sar_periph_ctrl.c
Normal file
29
components/esp_hw_support/port/esp32c6/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6124
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6124
|
||||||
|
}
|
@@ -4,12 +4,12 @@ set(srcs "rtc_clk_init.c"
|
|||||||
"rtc_pm.c"
|
"rtc_pm.c"
|
||||||
"rtc_sleep.c"
|
"rtc_sleep.c"
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
list(APPEND srcs "esp_crypto_lock.c"
|
list(APPEND srcs "esp_crypto_lock.c"
|
||||||
"esp_ds.c")
|
"esp_ds.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
|
|
||||||
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
||||||
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
||||||
|
@@ -20,6 +20,9 @@
|
|||||||
#include "esp_efuse_table.h"
|
#include "esp_efuse_table.h"
|
||||||
#include "i2c_pmu.h"
|
#include "i2c_pmu.h"
|
||||||
#include "soc/clkrst_reg.h"
|
#include "soc/clkrst_reg.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
void pmu_ctl(void);
|
void pmu_ctl(void);
|
||||||
void dcdc_ctl(uint32_t mode);
|
void dcdc_ctl(uint32_t mode);
|
||||||
@@ -135,6 +138,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
}
|
}
|
||||||
/* config dcdc frequency */
|
/* config dcdc frequency */
|
||||||
REG_SET_FIELD(RTC_CNTL_DCDC_CTRL0_REG, RTC_CNTL_FSW_DCDC, RTC_CNTL_DCDC_FREQ_DEFAULT);
|
REG_SET_FIELD(RTC_CNTL_DCDC_CTRL0_REG, RTC_CNTL_FSW_DCDC, RTC_CNTL_DCDC_FREQ_DEFAULT);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void pmu_ctl(void)
|
void pmu_ctl(void)
|
||||||
|
30
components/esp_hw_support/port/esp32h2/sar_periph_ctrl.c
Normal file
30
components/esp_hw_support/port/esp32h2/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6123
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6123
|
||||||
|
}
|
@@ -8,13 +8,13 @@ set(srcs
|
|||||||
"rtc_pm.c"
|
"rtc_pm.c"
|
||||||
"rtc_sleep.c"
|
"rtc_sleep.c"
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
list(APPEND srcs "memprot.c"
|
list(APPEND srcs "memprot.c"
|
||||||
"esp_crypto_lock.c"
|
"esp_crypto_lock.c"
|
||||||
"esp_ds.c")
|
"esp_ds.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
|
|
||||||
# init constructor for wifi
|
# init constructor for wifi
|
||||||
list(APPEND srcs "adc2_init_cal.c")
|
list(APPEND srcs "adc2_init_cal.c")
|
||||||
|
@@ -18,6 +18,9 @@
|
|||||||
#include "esp_hw_log.h"
|
#include "esp_hw_log.h"
|
||||||
#include "esp_efuse.h"
|
#include "esp_efuse.h"
|
||||||
#include "esp_efuse_table.h"
|
#include "esp_efuse_table.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
__attribute__((unused)) static const char *TAG = "rtc_init";
|
__attribute__((unused)) static const char *TAG = "rtc_init";
|
||||||
|
|
||||||
@@ -163,6 +166,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
|
|
||||||
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
||||||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
||||||
|
38
components/esp_hw_support/port/esp32s2/sar_periph_ctrl.c
Normal file
38
components/esp_hw_support/port/esp32s2/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "hal/sar_ctrl_ll.h"
|
||||||
|
|
||||||
|
extern portMUX_TYPE rtc_spinlock;
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//Put SAR control mux to FSM state
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||||
|
|
||||||
|
//Add other periph power control initialisation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_OFF);
|
||||||
|
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
}
|
@@ -8,12 +8,12 @@ set(srcs
|
|||||||
"rtc_pm.c"
|
"rtc_pm.c"
|
||||||
"rtc_sleep.c"
|
"rtc_sleep.c"
|
||||||
"rtc_time.c"
|
"rtc_time.c"
|
||||||
"chip_info.c"
|
"chip_info.c")
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
list(APPEND srcs "esp_ds.c"
|
list(APPEND srcs "esp_ds.c"
|
||||||
"esp_crypto_lock.c")
|
"esp_crypto_lock.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
|
|
||||||
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE)
|
||||||
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c")
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include "esp_efuse_table.h"
|
#include "esp_efuse_table.h"
|
||||||
#include "esp_private/spi_flash_os.h"
|
#include "esp_private/spi_flash_os.h"
|
||||||
#include "hal/efuse_hal.h"
|
#include "hal/efuse_hal.h"
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RTC_CNTL_MEM_FORCE_NOISO (RTC_CNTL_SLOWMEM_FORCE_NOISO | RTC_CNTL_FASTMEM_FORCE_NOISO)
|
#define RTC_CNTL_MEM_FORCE_NOISO (RTC_CNTL_SLOWMEM_FORCE_NOISO | RTC_CNTL_FASTMEM_FORCE_NOISO)
|
||||||
|
|
||||||
@@ -196,6 +199,11 @@ void rtc_init(rtc_config_t cfg)
|
|||||||
|
|
||||||
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
REG_WRITE(RTC_CNTL_INT_ENA_REG, 0);
|
||||||
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
REG_WRITE(RTC_CNTL_INT_CLR_REG, UINT32_MAX);
|
||||||
|
|
||||||
|
#ifndef BOOTLOADER_BUILD
|
||||||
|
//initialise SAR related peripheral register settings
|
||||||
|
sar_periph_ctrl_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
rtc_vddsdio_config_t rtc_vddsdio_get_config(void)
|
||||||
|
38
components/esp_hw_support/port/esp32s3/sar_periph_ctrl.c
Normal file
38
components/esp_hw_support/port/esp32s3/sar_periph_ctrl.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent. This file
|
||||||
|
* provides a united control to these registers, as multiple
|
||||||
|
* components require these controls.
|
||||||
|
*
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "esp_private/sar_periph_ctrl.h"
|
||||||
|
#include "hal/sar_ctrl_ll.h"
|
||||||
|
|
||||||
|
extern portMUX_TYPE rtc_spinlock;
|
||||||
|
|
||||||
|
void sar_periph_ctrl_init(void)
|
||||||
|
{
|
||||||
|
//Put SAR control mux to FSM state
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_FSM);
|
||||||
|
|
||||||
|
//Add other periph power control initialisation here
|
||||||
|
}
|
||||||
|
|
||||||
|
void sar_periph_ctrl_power_disable(void)
|
||||||
|
{
|
||||||
|
portENTER_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
sar_ctrl_ll_set_power_mode(SAR_CTRL_LL_POWER_OFF);
|
||||||
|
portEXIT_CRITICAL_SAFE(&rtc_spinlock);
|
||||||
|
}
|
56
components/hal/esp32/include/hal/sar_ctrl_ll.h
Normal file
56
components/hal/esp32/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "soc/sens_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||||
|
SENS.sar_meas_wait2.force_xpd_sar = 0x0;
|
||||||
|
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||||
|
SENS.sar_meas_wait2.force_xpd_sar = 0x3;
|
||||||
|
} else {
|
||||||
|
SENS.sar_meas_wait2.force_xpd_sar = 0x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
57
components/hal/esp32c2/include/hal/sar_ctrl_ll.h
Normal file
57
components/hal/esp32c2/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "soc/rtc_cntl_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x0;
|
||||||
|
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x3;
|
||||||
|
} else {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
57
components/hal/esp32c3/include/hal/sar_ctrl_ll.h
Normal file
57
components/hal/esp32c3/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "soc/rtc_cntl_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x0;
|
||||||
|
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x3;
|
||||||
|
} else {
|
||||||
|
RTCCNTL.sensor_ctrl.force_xpd_sar = 0x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
50
components/hal/esp32c6/include/hal/sar_ctrl_ll.h
Normal file
50
components/hal/esp32c6/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6124
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
51
components/hal/esp32h2/include/hal/sar_ctrl_ll.h
Normal file
51
components/hal/esp32h2/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
//TODO: IDF-6123
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
57
components/hal/esp32s2/include/hal/sar_ctrl_ll.h
Normal file
57
components/hal/esp32s2/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "soc/sens_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x0;
|
||||||
|
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x3;
|
||||||
|
} else {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
57
components/hal/esp32s3/include/hal/sar_ctrl_ll.h
Normal file
57
components/hal/esp32s3/include/hal/sar_ctrl_ll.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SAR related peripherals are interdependent.
|
||||||
|
* Related peripherals are:
|
||||||
|
* - ADC
|
||||||
|
* - PWDET
|
||||||
|
* - Temp Sensor
|
||||||
|
*
|
||||||
|
* All of above peripherals require SAR to work correctly.
|
||||||
|
* As SAR has some registers that will influence above mentioned peripherals.
|
||||||
|
* This file gives an abstraction for such registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "soc/sens_struct.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SAR_CTRL_LL_POWER_FSM, //SAR power controlled by FSM
|
||||||
|
SAR_CTRL_LL_POWER_ON, //SAR power on
|
||||||
|
SAR_CTRL_LL_POWER_OFF, //SAR power off
|
||||||
|
} sar_ctrl_ll_power_t;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------
|
||||||
|
SAR power control
|
||||||
|
---------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* Set SAR power mode
|
||||||
|
*
|
||||||
|
* @param mode See `sar_ctrl_ll_power_t`
|
||||||
|
*/
|
||||||
|
static inline void sar_ctrl_ll_set_power_mode(sar_ctrl_ll_power_t mode)
|
||||||
|
{
|
||||||
|
if (mode == SAR_CTRL_LL_POWER_FSM) {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x0;
|
||||||
|
} else if (mode == SAR_CTRL_LL_POWER_ON) {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x3;
|
||||||
|
} else {
|
||||||
|
SENS.sar_power_xpd_sar.force_xpd_sar = 0x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@@ -246,7 +246,6 @@
|
|||||||
#define SOC_RTCIO_HOLD_SUPPORTED 1
|
#define SOC_RTCIO_HOLD_SUPPORTED 1
|
||||||
#define SOC_RTCIO_WAKE_SUPPORTED 1
|
#define SOC_RTCIO_WAKE_SUPPORTED 1
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------- Sigma Delta Modulator CAPS -----------------*/
|
/*-------------------------- Sigma Delta Modulator CAPS -----------------*/
|
||||||
#define SOC_SDM_GROUPS 1U
|
#define SOC_SDM_GROUPS 1U
|
||||||
#define SOC_SDM_CHANNELS_PER_GROUP 8
|
#define SOC_SDM_CHANNELS_PER_GROUP 8
|
||||||
|
Reference in New Issue
Block a user