mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(rmt): add driver support on esp32c5
MP version
This commit is contained in:
parent
cb2898d033
commit
bfc29da19a
@ -70,7 +70,8 @@ static esp_err_t rmt_rx_init_dma_link(rmt_rx_channel_t *rx_channel, const rmt_rx
|
||||
gdma_rx_event_callbacks_t cbs = {
|
||||
.on_recv_done = rmt_dma_rx_one_block_cb,
|
||||
};
|
||||
gdma_register_rx_event_callbacks(rx_channel->base.dma_chan, &cbs, rx_channel);
|
||||
// register the DMA callbacks may fail if the interrupt service can not be installed successfully
|
||||
ESP_RETURN_ON_ERROR(gdma_register_rx_event_callbacks(rx_channel->base.dma_chan, &cbs, rx_channel), TAG, "register DMA callbacks failed");
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // SOC_RMT_SUPPORT_DMA
|
||||
|
@ -92,7 +92,8 @@ static esp_err_t rmt_tx_init_dma_link(rmt_tx_channel_t *tx_channel, const rmt_tx
|
||||
gdma_tx_event_callbacks_t cbs = {
|
||||
.on_trans_eof = rmt_dma_tx_eof_cb,
|
||||
};
|
||||
gdma_register_tx_event_callbacks(tx_channel->base.dma_chan, &cbs, tx_channel);
|
||||
// register the DMA callbacks may fail if the interrupt service can not be installed successfully
|
||||
ESP_RETURN_ON_ERROR(gdma_register_tx_event_callbacks(tx_channel->base.dma_chan, &cbs, tx_channel), TAG, "register DMA callbacks failed");
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // SOC_RMT_SUPPORT_DMA
|
||||
|
@ -485,7 +485,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
|
@ -427,7 +427,7 @@ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel,
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param channel RMT TX channel number
|
||||
* @param enable True to output carrier signal in all RMT state, False to only ouput carrier signal for effective data
|
||||
* @param enable True to output carrier signal in all RMT state, False to only output carrier signal for effective data
|
||||
*/
|
||||
static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable)
|
||||
{
|
||||
@ -658,7 +658,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include "sdkconfig.h" // TODO: [ESP32C5] IDF-8726
|
||||
#include "hal/misc.h"
|
||||
#include "hal/assert.h"
|
||||
#include "hal/rmt_types.h"
|
||||
@ -24,8 +23,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION
|
||||
|
||||
#define RMT_LL_EVENT_TX_DONE(channel) (1 << (channel))
|
||||
#define RMT_LL_EVENT_TX_THRES(channel) (1 << ((channel) + 8))
|
||||
#define RMT_LL_EVENT_TX_LOOP_END(channel) (1 << ((channel) + 12))
|
||||
@ -436,7 +433,7 @@ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel,
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param channel RMT TX channel number
|
||||
* @param enable True to output carrier signal in all RMT state, False to only ouput carrier signal for effective data
|
||||
* @param enable True to output carrier signal in all RMT state, False to only output carrier signal for effective data
|
||||
*/
|
||||
static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable)
|
||||
{
|
||||
@ -667,7 +664,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
@ -883,8 +880,6 @@ static inline uint32_t rmt_ll_get_tx_loop_interrupt_status(rmt_dev_t *dev)
|
||||
return (dev->int_st.val >> 12) & 0x03;
|
||||
}
|
||||
|
||||
#endif // CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -463,7 +463,7 @@ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel,
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param channel RMT TX channel number
|
||||
* @param enable True to output carrier signal in all RMT state, False to only ouput carrier signal for effective data
|
||||
* @param enable True to output carrier signal in all RMT state, False to only output carrier signal for effective data
|
||||
*/
|
||||
static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable)
|
||||
{
|
||||
@ -706,7 +706,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
|
@ -423,7 +423,7 @@ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel,
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param channel RMT TX channel number
|
||||
* @param enable True to output carrier signal in all RMT state, False to only ouput carrier signal for effective data
|
||||
* @param enable True to output carrier signal in all RMT state, False to only output carrier signal for effective data
|
||||
*/
|
||||
static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable)
|
||||
{
|
||||
@ -628,7 +628,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
|
@ -453,7 +453,7 @@ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel,
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param channel RMT TX channel number
|
||||
* @param enable True to output carrier signal in all RMT state, False to only ouput carrier signal for effective data
|
||||
* @param enable True to output carrier signal in all RMT state, False to only output carrier signal for effective data
|
||||
*/
|
||||
static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable)
|
||||
{
|
||||
@ -696,7 +696,7 @@ static inline void rmt_ll_enable_interrupt(rmt_dev_t *dev, uint32_t mask, bool e
|
||||
* @brief Clear RMT interrupt status by mask
|
||||
*
|
||||
* @param dev Peripheral instance address
|
||||
* @param mask Interupt status mask
|
||||
* @param mask Interrupt status mask
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
static inline void rmt_ll_clear_interrupt_status(rmt_dev_t *dev, uint32_t mask)
|
||||
|
@ -12,7 +12,7 @@ void rmt_hal_init(rmt_hal_context_t *hal)
|
||||
hal->regs = &RMT;
|
||||
rmt_ll_power_down_mem(hal->regs, false); // turn on RMTMEM power domain
|
||||
rmt_ll_enable_mem_access_nonfifo(hal->regs, true); // APB access the RMTMEM in nonfifo mode
|
||||
rmt_ll_enable_interrupt(hal->regs, UINT32_MAX, false); // disable all interupt events
|
||||
rmt_ll_enable_interrupt(hal->regs, UINT32_MAX, false); // disable all interrupt events
|
||||
rmt_ll_clear_interrupt_status(hal->regs, UINT32_MAX); // clear all pending events
|
||||
#if SOC_RMT_SUPPORT_TX_SYNCHRO
|
||||
rmt_ll_tx_clear_sync_group(hal->regs);
|
||||
@ -21,7 +21,7 @@ void rmt_hal_init(rmt_hal_context_t *hal)
|
||||
|
||||
void rmt_hal_deinit(rmt_hal_context_t *hal)
|
||||
{
|
||||
rmt_ll_enable_interrupt(hal->regs, UINT32_MAX, false); // disable all interupt events
|
||||
rmt_ll_enable_interrupt(hal->regs, UINT32_MAX, false); // disable all interrupt events
|
||||
rmt_ll_clear_interrupt_status(hal->regs, UINT32_MAX); // clear all pending events
|
||||
rmt_ll_power_down_mem(hal->regs, true); // turn off RMTMEM power domain
|
||||
hal->regs = NULL;
|
||||
|
@ -51,6 +51,10 @@ config SOC_I2S_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_RMT_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_GPSPI_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
@ -821,13 +821,13 @@ typedef union {
|
||||
} rmt_date_reg_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct rmt_dev_t {
|
||||
volatile rmt_chndata_reg_t chndata[4];
|
||||
volatile rmt_chnconf0_reg_t chnconf0[2];
|
||||
volatile rmt_chmconf0_reg_t ch2conf0;
|
||||
volatile rmt_chmconf1_reg_t ch2conf1;
|
||||
volatile rmt_chmconf0_reg_t ch3conf0;
|
||||
volatile rmt_chmconf1_reg_t ch3conf1;
|
||||
volatile struct {
|
||||
rmt_chmconf0_reg_t conf0;
|
||||
rmt_chmconf1_reg_t conf1;
|
||||
} chmconf[2];;
|
||||
volatile rmt_chnstatus_reg_t chnstatus[2];
|
||||
volatile rmt_chmstatus_reg_t chmstatus[2];
|
||||
volatile rmt_int_raw_reg_t int_raw;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#define SOC_RTC_FAST_MEM_SUPPORTED 1
|
||||
#define SOC_RTC_MEM_SUPPORTED 1
|
||||
#define SOC_I2S_SUPPORTED 1
|
||||
// #define SOC_RMT_SUPPORTED 1 // TODO: [ESP32C5] IDF-8726
|
||||
#define SOC_RMT_SUPPORTED 1
|
||||
// #define SOC_SDM_SUPPORTED 1 // TODO: [ESP32C5] IDF-8687
|
||||
#define SOC_GPSPI_SUPPORTED 1
|
||||
// #define SOC_LEDC_SUPPORTED 1 // TODO: [ESP32C5] IDF-8684
|
||||
|
@ -138,7 +138,6 @@ api-reference/peripherals/spi_master.rst
|
||||
api-reference/peripherals/index.rst
|
||||
api-reference/peripherals/sdmmc_host.rst
|
||||
api-reference/peripherals/ecdsa.rst
|
||||
api-reference/peripherals/rmt.rst
|
||||
api-reference/kconfig.rst
|
||||
api-reference/network/esp_openthread.rst
|
||||
api-reference/network/esp_eth.rst
|
||||
|
Loading…
Reference in New Issue
Block a user