mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-11 21:10:20 +00:00
feat(rmt): add driver support for esp32p4
including DMA feature
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "hal/misc.h"
|
||||
#include "hal/assert.h"
|
||||
#include "soc/rmt_struct.h"
|
||||
#include "soc/dport_reg.h"
|
||||
#include "hal/rmt_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -40,6 +41,41 @@ typedef enum {
|
||||
RMT_LL_MEM_OWNER_HW = 1,
|
||||
} rmt_ll_mem_owner_t;
|
||||
|
||||
/**
|
||||
* @brief Enable the bus clock for RMT module
|
||||
*
|
||||
* @param group_id Group ID
|
||||
* @param enable true to enable, false to disable
|
||||
*/
|
||||
static inline void rmt_ll_enable_bus_clock(int group_id, bool enable)
|
||||
{
|
||||
(void)group_id;
|
||||
uint32_t reg_val = DPORT_READ_PERI_REG(DPORT_PERIP_CLK_EN_REG);
|
||||
reg_val &= ~DPORT_RMT_CLK_EN;
|
||||
reg_val |= enable << 9;
|
||||
DPORT_WRITE_PERI_REG(DPORT_PERIP_CLK_EN_REG, reg_val);
|
||||
}
|
||||
|
||||
/// use a macro to wrap the function, force the caller to use it in a critical section
|
||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||
#define rmt_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; rmt_ll_enable_bus_clock(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Reset the RMT module
|
||||
*
|
||||
* @param group_id Group ID
|
||||
*/
|
||||
static inline void rmt_ll_reset_register(int group_id)
|
||||
{
|
||||
(void)group_id;
|
||||
DPORT_WRITE_PERI_REG(DPORT_PERIP_RST_EN_REG, DPORT_RMT_RST);
|
||||
DPORT_WRITE_PERI_REG(DPORT_PERIP_RST_EN_REG, 0);
|
||||
}
|
||||
|
||||
/// use a macro to wrap the function, force the caller to use it in a critical section
|
||||
/// the critical section needs to declare the __DECLARE_RCC_ATOMIC_ENV variable in advance
|
||||
#define rmt_ll_reset_register(...) (void)__DECLARE_RCC_ATOMIC_ENV; rmt_ll_reset_register(__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Enable clock gate for register and memory
|
||||
*
|
||||
|
Reference in New Issue
Block a user