mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
feat(sdm): add driver support for esp32p4
This commit is contained in:
parent
9879615053
commit
846751216b
@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
58
components/hal/esp32p4/include/hal/sdm_ll.h
Normal file
58
components/hal/esp32p4/include/hal/sdm_ll.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "hal/misc.h"
|
||||
#include "hal/assert.h"
|
||||
#include "soc/gpio_ext_struct.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Set Sigma-delta enable
|
||||
*
|
||||
* @param hw Peripheral SIGMADELTA hardware instance address.
|
||||
* @param en Sigma-delta enable value
|
||||
*/
|
||||
static inline void sdm_ll_enable_clock(gpio_sd_dev_t *hw, bool en)
|
||||
{
|
||||
hw->misc.function_clk_en = en;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Sigma-delta channel duty.
|
||||
*
|
||||
* @param hw Peripheral SIGMADELTA hardware instance address.
|
||||
* @param channel Sigma-delta channel number
|
||||
* @param density Sigma-delta quantized density of one channel, the value ranges from -128 to 127, recommended range is -90 ~ 90.
|
||||
* The waveform is more like a random one in this range.
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void sdm_ll_set_pulse_density(gpio_sd_dev_t *hw, int channel, int8_t density)
|
||||
{
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[channel], duty, (uint32_t)density);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Sigma-delta channel's clock pre-scale value.
|
||||
*
|
||||
* @param hw Peripheral SIGMADELTA hardware instance address.
|
||||
* @param channel Sigma-delta channel number
|
||||
* @param prescale The divider of source clock, ranges from 1 to 256
|
||||
*/
|
||||
static inline void sdm_ll_set_prescale(gpio_sd_dev_t *hw, int channel, uint32_t prescale)
|
||||
{
|
||||
HAL_ASSERT(prescale && prescale <= 256);
|
||||
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[channel], prescale, prescale - 1);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -87,6 +87,10 @@ config SOC_I2S_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_SDM_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_GPSPI_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
@ -909,7 +913,7 @@ config SOC_SDM_GROUPS
|
||||
|
||||
config SOC_SDM_CHANNELS_PER_GROUP
|
||||
int
|
||||
default 4
|
||||
default 8
|
||||
|
||||
config SOC_SDM_CLK_SUPPORT_PLL_F80M
|
||||
bool
|
||||
|
@ -477,7 +477,21 @@ typedef enum {
|
||||
ISP_CLK_SRC_PLL240 = SOC_MOD_CLK_PLL_F240M, /*!< Select SOC_MOD_CLK_PLL_F240M as ISP source clock */
|
||||
} soc_periph_isp_clk_src_t;
|
||||
|
||||
//////////////////////////////////////////////////SDM//////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////SDM///////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* @brief Array initializer for all supported clock sources of SDM
|
||||
*/
|
||||
#define SOC_SDM_CLKS {SOC_MOD_CLK_PLL_F80M, SOC_MOD_CLK_XTAL}
|
||||
|
||||
/**
|
||||
* @brief Sigma Delta Modulator clock source
|
||||
*/
|
||||
typedef enum {
|
||||
SDM_CLK_SRC_XTAL = SOC_MOD_CLK_XTAL, /*!< Select XTAL clock as the source clock */
|
||||
SDM_CLK_SRC_PLL_F80M = SOC_MOD_CLK_PLL_F80M, /*!< Select PLL_F80M clock as the source clock */
|
||||
SDM_CLK_SRC_DEFAULT = SOC_MOD_CLK_PLL_F80M, /*!< Select PLL_F80M clock as the default clock choice */
|
||||
} soc_periph_sdm_clk_src_t;
|
||||
|
||||
//////////////////////////////////////////////////GPIO Glitch Filter////////////////////////////////////////////////////
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
#define SOC_RTC_MEM_SUPPORTED 1
|
||||
#define SOC_RMT_SUPPORTED 1
|
||||
#define SOC_I2S_SUPPORTED 1
|
||||
// #define SOC_SDM_SUPPORTED 1 //TODO: IDF-7551
|
||||
#define SOC_SDM_SUPPORTED 1
|
||||
#define SOC_GPSPI_SUPPORTED 1
|
||||
#define SOC_LEDC_SUPPORTED 1
|
||||
#define SOC_I2C_SUPPORTED 1 //TODO: IDF-6507, TODO: IDF-7491
|
||||
@ -408,7 +408,7 @@
|
||||
|
||||
/*-------------------------- Sigma Delta Modulator CAPS -----------------*/
|
||||
#define SOC_SDM_GROUPS 1U
|
||||
#define SOC_SDM_CHANNELS_PER_GROUP 4
|
||||
#define SOC_SDM_CHANNELS_PER_GROUP 8
|
||||
#define SOC_SDM_CLK_SUPPORT_PLL_F80M 1
|
||||
#define SOC_SDM_CLK_SUPPORT_XTAL 1
|
||||
|
||||
|
@ -8,5 +8,30 @@
|
||||
#include "soc/gpio_sig_map.h"
|
||||
|
||||
const sigma_delta_signal_conn_t sigma_delta_periph_signals = {
|
||||
|
||||
.channels = {
|
||||
[0] = {
|
||||
GPIO_SD0_OUT_IDX
|
||||
},
|
||||
[1] = {
|
||||
GPIO_SD1_OUT_IDX
|
||||
},
|
||||
[2] = {
|
||||
GPIO_SD2_OUT_IDX
|
||||
},
|
||||
[3] = {
|
||||
GPIO_SD3_OUT_IDX
|
||||
},
|
||||
[4] = {
|
||||
GPIO_SD4_OUT_IDX
|
||||
},
|
||||
[5] = {
|
||||
GPIO_SD5_OUT_IDX
|
||||
},
|
||||
[6] = {
|
||||
GPIO_SD6_OUT_IDX
|
||||
},
|
||||
[7] = {
|
||||
GPIO_SD7_OUT_IDX
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
# Sigma Delta Modulation DAC Example
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
# Sigma Delta Modulation LED Example
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user