forked from espressif/esp-idf
clk_gate_ll: remove DPORT_ prefix as this is not required for H2/C6
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "soc/periph_defs.h"
|
#include "soc/periph_defs.h"
|
||||||
#include "soc/pcr_reg.h"
|
#include "soc/pcr_reg.h"
|
||||||
#include "soc/dport_access.h"
|
#include "soc/soc.h"
|
||||||
#include "esp_attr.h"
|
#include "esp_attr.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -141,20 +141,20 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en
|
|||||||
case PERIPH_AES_MODULE:
|
case PERIPH_AES_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature, otherwise AES unit is held in reset
|
// Clear reset on digital signature, otherwise AES unit is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_AES_RST_EN;
|
return PCR_AES_RST_EN;
|
||||||
case PERIPH_SHA_MODULE:
|
case PERIPH_SHA_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature and HMAC, otherwise SHA is held in reset
|
// Clear reset on digital signature and HMAC, otherwise SHA is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_SHA_RST_EN;
|
return PCR_SHA_RST_EN;
|
||||||
case PERIPH_RSA_MODULE:
|
case PERIPH_RSA_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature, otherwise RSA is held in reset
|
// Clear reset on digital signature, otherwise RSA is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_RSA_RST_EN;
|
return PCR_RSA_RST_EN;
|
||||||
case PERIPH_HMAC_MODULE:
|
case PERIPH_HMAC_MODULE:
|
||||||
@@ -314,26 +314,26 @@ static uint32_t periph_ll_get_rst_en_reg(periph_module_t periph)
|
|||||||
|
|
||||||
static inline void periph_ll_enable_clk_clear_rst(periph_module_t periph)
|
static inline void periph_ll_enable_clk_clear_rst(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
SET_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, true));
|
CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void periph_ll_disable_clk_set_rst(periph_module_t periph)
|
static inline void periph_ll_disable_clk_set_rst(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
CLEAR_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void periph_ll_reset(periph_module_t periph)
|
static inline void periph_ll_reset(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IRAM_ATTR periph_ll_periph_enabled(periph_module_t periph)
|
static inline bool IRAM_ATTR periph_ll_periph_enabled(periph_module_t periph)
|
||||||
{
|
{
|
||||||
return DPORT_REG_GET_BIT(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false)) == 0 &&
|
return REG_GET_BIT(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false)) == 0 &&
|
||||||
DPORT_REG_GET_BIT(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph)) != 0;
|
REG_GET_BIT(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "soc/periph_defs.h"
|
#include "soc/periph_defs.h"
|
||||||
#include "soc/pcr_reg.h"
|
#include "soc/pcr_reg.h"
|
||||||
#include "soc/dport_access.h"
|
#include "soc/soc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -131,20 +131,20 @@ static inline uint32_t periph_ll_get_rst_en_mask(periph_module_t periph, bool en
|
|||||||
case PERIPH_AES_MODULE:
|
case PERIPH_AES_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature, otherwise AES unit is held in reset
|
// Clear reset on digital signature, otherwise AES unit is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_AES_RST_EN;
|
return PCR_AES_RST_EN;
|
||||||
case PERIPH_SHA_MODULE:
|
case PERIPH_SHA_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature and HMAC, otherwise SHA is held in reset
|
// Clear reset on digital signature and HMAC, otherwise SHA is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_HMAC_CONF_REG, PCR_HMAC_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_SHA_RST_EN;
|
return PCR_SHA_RST_EN;
|
||||||
case PERIPH_RSA_MODULE:
|
case PERIPH_RSA_MODULE:
|
||||||
if (enable == true) {
|
if (enable == true) {
|
||||||
// Clear reset on digital signature, otherwise RSA is held in reset
|
// Clear reset on digital signature, otherwise RSA is held in reset
|
||||||
DPORT_CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
CLEAR_PERI_REG_MASK(PCR_DS_CONF_REG, PCR_DS_RST_EN);
|
||||||
}
|
}
|
||||||
return PCR_RSA_RST_EN;
|
return PCR_RSA_RST_EN;
|
||||||
case PERIPH_HMAC_MODULE:
|
case PERIPH_HMAC_MODULE:
|
||||||
@@ -291,14 +291,14 @@ static uint32_t periph_ll_get_rst_en_reg(periph_module_t periph)
|
|||||||
|
|
||||||
static inline void periph_ll_enable_clk_clear_rst(periph_module_t periph)
|
static inline void periph_ll_enable_clk_clear_rst(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
SET_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, true));
|
CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void periph_ll_disable_clk_set_rst(periph_module_t periph)
|
static inline void periph_ll_disable_clk_set_rst(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
CLEAR_PERI_REG_MASK(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph));
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void periph_ll_wifi_bt_module_enable_clk_clear_rst(void)
|
static inline void periph_ll_wifi_bt_module_enable_clk_clear_rst(void)
|
||||||
@@ -315,14 +315,14 @@ static inline void periph_ll_wifi_bt_module_disable_clk_set_rst(void)
|
|||||||
|
|
||||||
static inline void periph_ll_reset(periph_module_t periph)
|
static inline void periph_ll_reset(periph_module_t periph)
|
||||||
{
|
{
|
||||||
DPORT_SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
SET_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
DPORT_CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
CLEAR_PERI_REG_MASK(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool periph_ll_periph_enabled(periph_module_t periph)
|
static inline bool periph_ll_periph_enabled(periph_module_t periph)
|
||||||
{
|
{
|
||||||
return DPORT_REG_GET_BIT(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false)) == 0 &&
|
return REG_GET_BIT(periph_ll_get_rst_en_reg(periph), periph_ll_get_rst_en_mask(periph, false)) == 0 &&
|
||||||
DPORT_REG_GET_BIT(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph)) != 0;
|
REG_GET_BIT(periph_ll_get_clk_en_reg(periph), periph_ll_get_clk_en_mask(periph)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void periph_ll_wifi_module_enable_clk_clear_rst(void)
|
static inline void periph_ll_wifi_module_enable_clk_clear_rst(void)
|
||||||
|
Reference in New Issue
Block a user