Merge branch 'feature/graduate_tsens_hal_component_v6.0' into 'release/v6.0'

feat(tsens): graduate temperature sensor hal component (v6.0)

See merge request espressif/esp-idf!44357
This commit is contained in:
morris
2026-01-30 18:43:06 +08:00
35 changed files with 126 additions and 91 deletions
-4
View File
@@ -74,10 +74,6 @@ if(CONFIG_SOC_I3C_MASTER_SUPPORTED)
list(APPEND srcs "${target_folder}/i3c_master_periph.c")
endif()
if(CONFIG_SOC_TEMP_SENSOR_SUPPORTED)
list(APPEND srcs "${target_folder}/temperature_sensor_periph.c")
endif()
if(CONFIG_SOC_MPI_SUPPORTED)
list(APPEND srcs "${target_folder}/mpi_periph.c")
endif()
@@ -1,16 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/temperature_sensor_periph.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
@@ -1,16 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/temperature_sensor_periph.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
@@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "soc/regdma.h"
#include "soc/temperature_sensor_periph.h"
#include "soc/apb_saradc_reg.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
// Temperature sensor sleep retention entries
// Temperature sensor registers require set the reg_update bit to make the configuration take effect
/* Temperature sensor Registers Context
Include: APB_SARADC_INT_ENA_REG /
APB_SARADC_APB_TSENS_CTRL_REG / APB_SARADC_TSENS_CTRL2_REG / APB_TSENS_WAKE_REG / APB_TSENS_SAMPLE_REG
*/
#define TEMPERATURE_SENSOR_RETENTION_REGS_CNT 5
#define TEMPERATURE_SENSOR_RETENTION_MAP_BASE APB_SARADC_INT_ENA_REG
static const uint32_t temperature_sensor_regs_map[4] = {0x6c1, 0, 0, 0};
static const regdma_entries_config_t temperature_sensor_regs_entries[] = {
[0] = {
.config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_TSENS_LINK(0x00), TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_REGS_CNT, 0, 0, temperature_sensor_regs_map[0], temperature_sensor_regs_map[1], temperature_sensor_regs_map[2], temperature_sensor_regs_map[3]), \
.owner = ENTRY(0) | ENTRY(2)
}, \
};
const temperature_sensor_reg_ctx_link_t temperature_sensor_regs_retention = {
.link_list = temperature_sensor_regs_entries,
.link_num = ARRAY_SIZE(temperature_sensor_regs_entries),
.module_id = SLEEP_RETENTION_MODULE_TEMP_SENSOR,
};
@@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "soc/regdma.h"
#include "soc/temperature_sensor_periph.h"
#include "soc/apb_saradc_reg.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
// Temperature sensor sleep retention entries
// Temperature sensor registers require set the reg_update bit to make the configuration take effect
/* Temperature sensor Registers Context
Include: APB_SARADC_INT_ENA_REG /
APB_SARADC_APB_TSENS_CTRL_REG / APB_SARADC_TSENS_CTRL2_REG / APB_TSENS_WAKE_REG / APB_TSENS_SAMPLE_REG
*/
#define TEMPERATURE_SENSOR_RETENTION_REGS_CNT 5
#define TEMPERATURE_SENSOR_RETENTION_MAP_BASE APB_SARADC_INT_ENA_REG
static const uint32_t temperature_sensor_regs_map[4] = {0x6c1, 0, 0, 0};
static const regdma_entries_config_t temperature_sensor_regs_entries[] = {
[0] = {
.config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_TSENS_LINK(0x00), TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_REGS_CNT, 0, 0, temperature_sensor_regs_map[0], temperature_sensor_regs_map[1], temperature_sensor_regs_map[2], temperature_sensor_regs_map[3]), \
.owner = ENTRY(0) | ENTRY(2)
}, \
};
const temperature_sensor_reg_ctx_link_t temperature_sensor_regs_retention = {
.link_list = temperature_sensor_regs_entries,
.link_num = ARRAY_SIZE(temperature_sensor_regs_entries),
.module_id = SLEEP_RETENTION_MODULE_TEMP_SENSOR,
};
@@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "soc/regdma.h"
#include "soc/temperature_sensor_periph.h"
#include "soc/apb_saradc_reg.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
// Temperature sensor sleep retention entries
// Temperature sensor registers require set the reg_update bit to make the configuration take effect
/* Temperature sensor Registers Context
Include: SARADC_INT_ENA_REG /
APB_SARADC_APB_TSENS_CTRL_REG / APB_SARADC_TSENS_CTRL2_REG / APB_TSENS_WAKE_REG / APB_TSENS_SAMPLE_REG
*/
#define TEMPERATURE_SENSOR_RETENTION_REGS_CNT 5
#define TEMPERATURE_SENSOR_RETENTION_MAP_BASE SARADC_INT_ENA_REG
static const uint32_t temperature_sensor_regs_map[4] = {0x6c1, 0, 0, 0};
static const regdma_entries_config_t temperature_sensor_regs_entries[] = {
[0] = {
.config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_TSENS_LINK(0x00), TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_REGS_CNT, 0, 0, temperature_sensor_regs_map[0], temperature_sensor_regs_map[1], temperature_sensor_regs_map[2], temperature_sensor_regs_map[3]), \
.owner = ENTRY(0) | ENTRY(2)
}, \
};
const temperature_sensor_reg_ctx_link_t temperature_sensor_regs_retention = {
.link_list = temperature_sensor_regs_entries,
.link_num = ARRAY_SIZE(temperature_sensor_regs_entries),
.module_id = SLEEP_RETENTION_MODULE_TEMP_SENSOR,
};
@@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdint.h>
#include "soc/regdma.h"
#include "soc/temperature_sensor_periph.h"
#include "soc/apb_saradc_reg.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
// Temperature sensor sleep retention entries
// Temperature sensor registers require set the reg_update bit to make the configuration take effect
/* Temperature sensor Registers Context
Include: APB_SARADC_INT_ENA_REG /
APB_SARADC_APB_TSENS_CTRL_REG / APB_SARADC_TSENS_CTRL2_REG / APB_TSENS_WAKE_REG / APB_TSENS_SAMPLE_REG
*/
#define TEMPERATURE_SENSOR_RETENTION_REGS_CNT 5
#define TEMPERATURE_SENSOR_RETENTION_MAP_BASE APB_SARADC_INT_ENA_REG
static const uint32_t temperature_sensor_regs_map[4] = {0x6c1, 0, 0, 0};
static const regdma_entries_config_t temperature_sensor_regs_entries[] = {
[0] = {
.config = REGDMA_LINK_ADDR_MAP_INIT(REGDMA_TSENS_LINK(0x00), TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_MAP_BASE, TEMPERATURE_SENSOR_RETENTION_REGS_CNT, 0, 0, temperature_sensor_regs_map[0], temperature_sensor_regs_map[1], temperature_sensor_regs_map[2], temperature_sensor_regs_map[3]), \
.owner = ENTRY(0) | ENTRY(2)
}, \
};
const temperature_sensor_reg_ctx_link_t temperature_sensor_regs_retention = {
.link_list = temperature_sensor_regs_entries,
.link_num = ARRAY_SIZE(temperature_sensor_regs_entries),
.module_id = SLEEP_RETENTION_MODULE_TEMP_SENSOR,
};
@@ -1,16 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/temperature_sensor_periph.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
@@ -1,16 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/temperature_sensor_periph.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
@@ -1,16 +0,0 @@
/*
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/temperature_sensor_periph.h"
const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM] = {
/*Offset reg_val min max error */
{-2, 5, 50, 125, 3},
{-1, 7, 20, 100, 2},
{ 0, 15, -10, 80, 1},
{ 1, 11, -30, 50, 2},
{ 2, 10, -40, 20, 3},
};
@@ -1,42 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "soc/regdma.h"
#if SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION
#include "soc/retention_periph_defs.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define TEMPERATURE_SENSOR_ATTR_RANGE_NUM (5)
typedef struct {
int offset;
int reg_val;
int range_min;
int range_max;
int error_max;
} temperature_sensor_attribute_t;
extern const temperature_sensor_attribute_t temperature_sensor_attributes[TEMPERATURE_SENSOR_ATTR_RANGE_NUM];
#if SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION
typedef struct {
const regdma_entries_config_t *link_list;
uint32_t link_num;
periph_retention_module_t module_id;
} temperature_sensor_reg_ctx_link_t;
extern const temperature_sensor_reg_ctx_link_t temperature_sensor_regs_retention;
#endif // SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION
#ifdef __cplusplus
}
#endif