mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(tempertuer_sensor): Fix regs on temperature sensor is not volatile due to GCC bug
This commit is contained in:
parent
ff8a6a5bf9
commit
3d42ac21fa
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "hal/temperature_sensor_types.h"
|
#include "hal/temperature_sensor_types.h"
|
||||||
#include "hal/assert.h"
|
#include "hal/assert.h"
|
||||||
|
#include "hal/misc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -92,7 +93,7 @@ static inline void temperature_sensor_ll_set_range(uint32_t range)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_reg_tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_reg_tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,7 +117,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_reg_tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_reg_tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,7 +130,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
APB_SARADC.saradc_apb_tsens_ctrl.saradc_reg_tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_reg_tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -23,6 +23,7 @@
|
|||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
#include "hal/temperature_sensor_types.h"
|
#include "hal/temperature_sensor_types.h"
|
||||||
#include "hal/assert.h"
|
#include "hal/assert.h"
|
||||||
|
#include "hal/misc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -92,7 +93,7 @@ static inline void temperature_sensor_ll_set_range(uint32_t range)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.apb_tsens_ctrl.tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.apb_tsens_ctrl, tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,7 +117,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.apb_tsens_ctrl.tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.apb_tsens_ctrl, tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,7 +130,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
APB_SARADC.apb_tsens_ctrl.tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.apb_tsens_ctrl, tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -103,7 +103,7 @@ static inline void temperature_sensor_ll_set_range(uint32_t range)
|
|||||||
__attribute__((always_inline))
|
__attribute__((always_inline))
|
||||||
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +127,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +140,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,7 +172,7 @@ static inline void temperature_sensor_ll_wakeup_enable(bool en)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
||||||
{
|
{
|
||||||
APB_SARADC.tsens_wake.saradc_wakeup_th_low = th_low;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_wake, saradc_wakeup_th_low, th_low);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +182,7 @@ static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_th_high_val(uint8_t th_high)
|
static inline void temperature_sensor_ll_set_th_high_val(uint8_t th_high)
|
||||||
{
|
{
|
||||||
APB_SARADC.tsens_wake.saradc_wakeup_th_high = th_high;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_wake, saradc_wakeup_th_high, th_high);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -103,7 +103,7 @@ static inline void temperature_sensor_ll_set_range(uint32_t range)
|
|||||||
__attribute__((always_inline))
|
__attribute__((always_inline))
|
||||||
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -127,7 +127,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,7 +140,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
APB_SARADC.saradc_apb_tsens_ctrl.saradc_tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.saradc_apb_tsens_ctrl, saradc_tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,7 +172,7 @@ static inline void temperature_sensor_ll_wakeup_enable(bool en)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
||||||
{
|
{
|
||||||
APB_SARADC.tsens_wake.saradc_wakeup_th_low = th_low;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_wake, saradc_wakeup_th_low, th_low);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -182,7 +182,7 @@ static inline void temperature_sensor_ll_set_th_low_val(uint8_t th_low)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_th_high_val(uint8_t th_high)
|
static inline void temperature_sensor_ll_set_th_high_val(uint8_t th_high)
|
||||||
{
|
{
|
||||||
APB_SARADC.tsens_wake.saradc_wakeup_th_high = th_high;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(APB_SARADC.tsens_wake, saradc_wakeup_th_high, th_high);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
#include "soc/sens_struct.h"
|
#include "soc/sens_struct.h"
|
||||||
#include "hal/temperature_sensor_types.h"
|
#include "hal/temperature_sensor_types.h"
|
||||||
|
#include "hal/misc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -82,7 +83,7 @@ static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
|||||||
while (!SENS.sar_tctrl.tsens_ready) {
|
while (!SENS.sar_tctrl.tsens_ready) {
|
||||||
}
|
}
|
||||||
SENS.sar_tctrl.tsens_dump_out = 0;
|
SENS.sar_tctrl.tsens_dump_out = 0;
|
||||||
return SENS.sar_tctrl.tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(SENS.sar_tctrl, tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +107,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return SENS.sar_tctrl.tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +120,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
SENS.sar_tctrl.tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "soc/rtc_cntl_reg.h"
|
#include "soc/rtc_cntl_reg.h"
|
||||||
#include "soc/sens_struct.h"
|
#include "soc/sens_struct.h"
|
||||||
#include "hal/temperature_sensor_types.h"
|
#include "hal/temperature_sensor_types.h"
|
||||||
|
#include "hal/misc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -82,7 +83,7 @@ static inline uint32_t temperature_sensor_ll_get_raw_value(void)
|
|||||||
while (!SENS.sar_tctrl.tsens_ready) {
|
while (!SENS.sar_tctrl.tsens_ready) {
|
||||||
}
|
}
|
||||||
SENS.sar_tctrl.tsens_dump_out = 0;
|
SENS.sar_tctrl.tsens_dump_out = 0;
|
||||||
return SENS.sar_tctrl.tsens_out;
|
return HAL_FORCE_READ_U32_REG_FIELD(SENS.sar_tctrl, tsens_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,7 +107,7 @@ static inline uint32_t temperature_sensor_ll_get_offset(void)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
||||||
{
|
{
|
||||||
return SENS.sar_tctrl.tsens_clk_div;
|
return HAL_FORCE_READ_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,7 +120,7 @@ static inline uint32_t temperature_sensor_ll_get_clk_div(void)
|
|||||||
*/
|
*/
|
||||||
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
static inline void temperature_sensor_ll_set_clk_div(uint8_t clk_div)
|
||||||
{
|
{
|
||||||
SENS.sar_tctrl.tsens_clk_div = clk_div;
|
HAL_FORCE_MODIFY_U32_REG_FIELD(SENS.sar_tctrl, tsens_clk_div, clk_div);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user