espressif/rmt: Fix minor issues regarding formatting and comments

This commit only fix minor issues regarding formatting and comments
This commit is contained in:
Tiago Medicci Serrano
2024-03-25 16:53:35 -03:00
committed by Alan Carvalho de Assis
parent 5ba40d083a
commit 9520edeb16
20 changed files with 118 additions and 124 deletions
+26 -30
View File
@@ -222,7 +222,7 @@ struct rmt_dev_common_s
struct rmt_dev_lowerhalf_s struct rmt_dev_lowerhalf_s
{ {
/* The following block is part of the upper-hald device struct */ /* The following block is part of the upper-half device struct */
FAR const struct rmt_ops_s *ops; FAR const struct rmt_ops_s *ops;
FAR struct circbuf_s *circbuf; FAR struct circbuf_s *circbuf;
@@ -241,18 +241,18 @@ struct rmt_obj_s
size_t tx_len_rem; size_t tx_len_rem;
size_t tx_sub_len; size_t tx_sub_len;
bool wait_done; /* Mark whether wait tx done */ bool wait_done; /* Mark whether wait tx done */
bool loop_autostop; /* mark whether loop auto-stop is enabled */ bool loop_autostop; /* Mark whether loop auto-stop is enabled */
rmt_channel_t channel; rmt_channel_t channel;
const rmt_item32_t *tx_data; const rmt_item32_t *tx_data;
sem_t tx_sem; sem_t tx_sem;
#if CONFIG_SPIRAM_USE_MALLOC #ifdef CONFIG_SPIRAM_USE_MALLOC
int intr_alloc_flags; int intr_alloc_flags;
sem_t tx_sem_buffer; sem_t tx_sem_buffer;
#endif #endif
rmt_item32_t *tx_buf; rmt_item32_t *tx_buf;
struct circbuf_s rx_buf; struct circbuf_s rx_buf;
sem_t rx_sem; sem_t rx_sem;
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
rmt_item32_t *rx_item_buf; rmt_item32_t *rx_item_buf;
uint32_t rx_item_buf_size; uint32_t rx_item_buf_size;
uint32_t rx_item_len; uint32_t rx_item_len;
@@ -433,7 +433,7 @@ static void rmt_module_enable(void)
* *
****************************************************************************/ ****************************************************************************/
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en, static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
uint16_t evt_thresh) uint16_t evt_thresh)
{ {
@@ -496,7 +496,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)
{ {
irqstate_t flags; irqstate_t flags;
rmt_channel_t ch = RMT_DECODE_RX_CHANNEL(channel); rmt_channel_t ch = RMT_DECODE_RX_CHANNEL(channel);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
const uint32_t item_block_len = const uint32_t item_block_len =
rmt_ll_rx_get_mem_blocks(g_rmtdev_common.hal.regs, ch) * rmt_ll_rx_get_mem_blocks(g_rmtdev_common.hal.regs, ch) *
RMT_MEM_ITEM_NUM; RMT_MEM_ITEM_NUM;
@@ -517,7 +517,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs, rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_RX_DONE(ch), true); RMT_LL_EVENT_RX_DONE(ch), true);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
p_rmt_obj[channel]->rx_item_start_idx = 0; p_rmt_obj[channel]->rx_item_start_idx = 0;
p_rmt_obj[channel]->rx_item_len = 0; p_rmt_obj[channel]->rx_item_len = 0;
rmt_set_rx_thr_intr_en(channel, true, item_block_len / 2); rmt_set_rx_thr_intr_en(channel, true, item_block_len / 2);
@@ -560,7 +560,7 @@ static int rmt_tx_start(rmt_channel_t channel, bool tx_idx_rst)
rmt_ll_clear_interrupt_status(g_rmtdev_common.hal.regs, rmt_ll_clear_interrupt_status(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_DONE(channel)); RMT_LL_EVENT_TX_DONE(channel));
/* enable tx end interrupt in non-loop mode */ /* Enable tx end interrupt in non-loop mode */
if (!rmt_ll_tx_is_loop_enabled(g_rmtdev_common.hal.regs, channel)) if (!rmt_ll_tx_is_loop_enabled(g_rmtdev_common.hal.regs, channel))
{ {
@@ -938,7 +938,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
rmt_ll_rx_enable_filter(dev, RMT_DECODE_RX_CHANNEL(channel), rmt_ll_rx_enable_filter(dev, RMT_DECODE_RX_CHANNEL(channel),
rmt_param->rx_config.filter_en); rmt_param->rx_config.filter_en);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
/* always enable rx ping-pong */ /* always enable rx ping-pong */
@@ -1232,7 +1232,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
addr = (rmt_item32_t *) addr = (rmt_item32_t *)
RMTMEM.chan[RMT_ENCODE_RX_CHANNEL(channel)].data32; RMTMEM.chan[RMT_ENCODE_RX_CHANNEL(channel)].data32;
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
if (item_len > p_rmt->rx_item_start_idx) if (item_len > p_rmt->rx_item_start_idx)
{ {
item_len = item_len - p_rmt->rx_item_start_idx; item_len = item_len - p_rmt->rx_item_start_idx;
@@ -1272,7 +1272,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
rmterr("RMT RX BUFFER ERROR"); rmterr("RMT RX BUFFER ERROR");
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
p_rmt->rx_item_start_idx = 0; p_rmt->rx_item_start_idx = 0;
p_rmt->rx_item_len = 0; p_rmt->rx_item_len = 0;
memset((void *)p_rmt->rx_item_buf, 0, p_rmt->rx_item_buf_size); memset((void *)p_rmt->rx_item_buf, 0, p_rmt->rx_item_buf_size);
@@ -1287,7 +1287,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
RMT_LL_EVENT_RX_DONE(channel)); RMT_LL_EVENT_RX_DONE(channel));
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
/* Rx thres interrupt */ /* Rx thres interrupt */
@@ -1463,8 +1463,8 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
} }
#endif #endif
#if !CONFIG_SPIRAM_USE_MALLOC #ifndef CONFIG_SPIRAM_USE_MALLOC
p_rmt_obj[channel] = calloc(1, sizeof(rmt_obj_t)); p_rmt_obj[channel] = kmm_calloc(1, sizeof(rmt_obj_t));
#else #else
if (!(intr_alloc_flags & ESP_INTR_FLAG_IRAM)) if (!(intr_alloc_flags & ESP_INTR_FLAG_IRAM))
{ {
@@ -1472,9 +1472,7 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
} }
else else
{ {
p_rmt_obj[channel] = heap_caps_calloc(1, sizeof(rmt_obj_t), p_rmt_obj[channel] = kmm_calloc(1, sizeof(rmt_obj_t));
MALLOC_CAP_INTERNAL | \
MALLOC_CAP_8BIT);
} }
#endif #endif
@@ -1492,7 +1490,7 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
p_rmt_obj[channel]->wait_done = false; p_rmt_obj[channel]->wait_done = false;
p_rmt_obj[channel]->loop_autostop = false; p_rmt_obj[channel]->loop_autostop = false;
#if !CONFIG_SPIRAM_USE_MALLOC #ifndef CONFIG_SPIRAM_USE_MALLOC
nxsem_init(&p_rmt_obj[channel]->tx_sem, 0, 0); nxsem_init(&p_rmt_obj[channel]->tx_sem, 0, 0);
nxsem_init(&p_rmt_obj[channel]->rx_sem, 0, 0); nxsem_init(&p_rmt_obj[channel]->rx_sem, 0, 0);
#endif #endif
@@ -1504,24 +1502,22 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
circbuf_init(&p_rmt_obj[channel]->rx_buf, NULL, rx_buf_size); circbuf_init(&p_rmt_obj[channel]->rx_buf, NULL, rx_buf_size);
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
if (p_rmt_obj[channel]->rx_item_buf == NULL && rx_buf_size > 0) if (p_rmt_obj[channel]->rx_item_buf == NULL && rx_buf_size > 0)
{ {
#if !CONFIG_SPIRAM_USE_MALLOC # ifndef CONFIG_SPIRAM_USE_MALLOC
p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size); p_rmt_obj[channel]->rx_item_buf = kmm_calloc(1, rx_buf_size);
#else # else
if (!(p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM)) if (!(p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM))
{ {
p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size); p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size);
} }
else else
{ {
p_rmt_obj[channel]->rx_item_buf = p_rmt_obj[channel]->rx_item_buf = kmm_calloc(1, rx_buf_size);
heap_caps_calloc(1, rx_buf_size,
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
} }
#endif # endif
if (p_rmt_obj[channel]->rx_item_buf == NULL) if (p_rmt_obj[channel]->rx_item_buf == NULL)
{ {
rmterr("RMT malloc fail"); rmterr("RMT malloc fail");
@@ -1605,12 +1601,12 @@ static int rmt_write_items(rmt_channel_t channel,
channel); channel);
DEBUGASSERT(mem_blocks + channel <= SOC_RMT_CHANNELS_PER_GROUP); DEBUGASSERT(mem_blocks + channel <= SOC_RMT_CHANNELS_PER_GROUP);
#if CONFIG_SPIRAM_USE_MALLOC #ifdef CONFIG_SPIRAM_USE_MALLOC
if (p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM) if (p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM)
{ {
if (!esp_ptr_internal(rmt_item)) if (!esp_ptr_internal(rmt_item))
{ {
remterr(RMT_PSRAM_BUFFER_WARN_STR); rmterr(RMT_PSRAM_BUFFER_WARN_STR);
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
} }
@@ -1904,7 +1900,7 @@ static struct rmt_dev_s
* Initialize the selected RMT device in TX mode * Initialize the selected RMT device in TX mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -1926,7 +1922,7 @@ struct rmt_dev_s *esp_rmt_tx_init(int ch, int pin)
* Initialize the selected RMT device in RC mode * Initialize the selected RMT device in RC mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
+2 -2
View File
@@ -72,7 +72,7 @@ extern "C"
* Initialize the selected RMT device in TX mode * Initialize the selected RMT device in TX mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -89,7 +89,7 @@ struct rmt_dev_s *esp_rmt_tx_init(int ch, int pin);
* Initialize the selected RMT device in RC mode * Initialize the selected RMT device in RC mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -126,9 +126,9 @@ extern uint32_t g_rmt_source_clock_hz;
* *
* Description: * Description:
* Maps a byte to a sequence of RMT items. Each bit in the byte is * Maps a byte to a sequence of RMT items. Each bit in the byte is
* represented by an RMT item (32-bit value). Iterates over each bit in * represented by an RMT item (32-bit value). The function iterates over
* the byte, creating an RMT item for each bit, set or not. The created * each bit in the byte, creating an RMT item for each bit, HIGH or LOW.
* RMT items are stored in the destination array. * The created RMT items are stored in the destination array.
* *
* Input Parameters: * Input Parameters:
* dev - Pointer to the RMT-based WS2812 device structure. * dev - Pointer to the RMT-based WS2812 device structure.
+4 -2
View File
@@ -3,5 +3,7 @@ config ESP_RMT
default n default n
depends on RMT depends on RMT
---help--- ---help---
Remote Control Module is currently used to control WS2812 The RMT (Remote Control Transceiver) peripheral was designed to act as
RGB LED normally used on LED strips. an infrared transceiver. However, due to the flexibility of its data
format, RMT can be extended to a versatile and general-purpose
transceiver, transmitting or receiving many other types of signals.
+26 -30
View File
@@ -268,7 +268,7 @@ struct rmt_dev_common_s
struct rmt_dev_lowerhalf_s struct rmt_dev_lowerhalf_s
{ {
/* The following block is part of the upper-hald device struct */ /* The following block is part of the upper-half device struct */
FAR const struct rmt_ops_s *ops; FAR const struct rmt_ops_s *ops;
FAR struct circbuf_s *circbuf; FAR struct circbuf_s *circbuf;
@@ -287,18 +287,18 @@ struct rmt_obj_s
size_t tx_len_rem; size_t tx_len_rem;
size_t tx_sub_len; size_t tx_sub_len;
bool wait_done; /* Mark whether wait tx done */ bool wait_done; /* Mark whether wait tx done */
bool loop_autostop; /* mark whether loop auto-stop is enabled */ bool loop_autostop; /* Mark whether loop auto-stop is enabled */
rmt_channel_t channel; rmt_channel_t channel;
const rmt_item32_t *tx_data; const rmt_item32_t *tx_data;
sem_t tx_sem; sem_t tx_sem;
#if CONFIG_SPIRAM_USE_MALLOC #ifdef CONFIG_SPIRAM_USE_MALLOC
int intr_alloc_flags; int intr_alloc_flags;
sem_t tx_sem_buffer; sem_t tx_sem_buffer;
#endif #endif
rmt_item32_t *tx_buf; rmt_item32_t *tx_buf;
struct circbuf_s rx_buf; struct circbuf_s rx_buf;
sem_t rx_sem; sem_t rx_sem;
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
rmt_item32_t *rx_item_buf; rmt_item32_t *rx_item_buf;
uint32_t rx_item_buf_size; uint32_t rx_item_buf_size;
uint32_t rx_item_len; uint32_t rx_item_len;
@@ -479,7 +479,7 @@ static void rmt_module_enable(void)
* *
****************************************************************************/ ****************************************************************************/
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en, static int rmt_set_rx_thr_intr_en(rmt_channel_t channel, bool en,
uint16_t evt_thresh) uint16_t evt_thresh)
{ {
@@ -543,7 +543,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)
{ {
irqstate_t flags; irqstate_t flags;
rmt_channel_t ch = RMT_DECODE_RX_CHANNEL(channel); rmt_channel_t ch = RMT_DECODE_RX_CHANNEL(channel);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
const uint32_t item_block_len = const uint32_t item_block_len =
rmt_ll_rx_get_mem_blocks(g_rmtdev_common.hal.regs, ch) * rmt_ll_rx_get_mem_blocks(g_rmtdev_common.hal.regs, ch) *
RMT_MEM_ITEM_NUM; RMT_MEM_ITEM_NUM;
@@ -564,7 +564,7 @@ static int rmt_rx_start(rmt_channel_t channel, bool rx_idx_rst)
rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs, rmt_ll_enable_interrupt(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_RX_DONE(ch), true); RMT_LL_EVENT_RX_DONE(ch), true);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
p_rmt_obj[channel]->rx_item_start_idx = 0; p_rmt_obj[channel]->rx_item_start_idx = 0;
p_rmt_obj[channel]->rx_item_len = 0; p_rmt_obj[channel]->rx_item_len = 0;
rmt_set_rx_thr_intr_en(channel, true, item_block_len / 2); rmt_set_rx_thr_intr_en(channel, true, item_block_len / 2);
@@ -607,7 +607,7 @@ static int rmt_tx_start(rmt_channel_t channel, bool tx_idx_rst)
rmt_ll_clear_interrupt_status(g_rmtdev_common.hal.regs, rmt_ll_clear_interrupt_status(g_rmtdev_common.hal.regs,
RMT_LL_EVENT_TX_DONE(channel)); RMT_LL_EVENT_TX_DONE(channel));
/* enable tx end interrupt in non-loop mode */ /* Enable tx end interrupt in non-loop mode */
if (!rmt_ll_tx_is_loop_enabled(g_rmtdev_common.hal.regs, channel)) if (!rmt_ll_tx_is_loop_enabled(g_rmtdev_common.hal.regs, channel))
{ {
@@ -985,7 +985,7 @@ static int rmt_internal_config(rmt_dev_t *dev,
rmt_ll_rx_enable_filter(dev, RMT_DECODE_RX_CHANNEL(channel), rmt_ll_rx_enable_filter(dev, RMT_DECODE_RX_CHANNEL(channel),
rmt_param->rx_config.filter_en); rmt_param->rx_config.filter_en);
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
/* always enable rx ping-pong */ /* always enable rx ping-pong */
@@ -1283,7 +1283,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
addr = (rmt_item32_t *) addr = (rmt_item32_t *)
RMTMEM.chan[RMT_ENCODE_RX_CHANNEL(channel)].data32; RMTMEM.chan[RMT_ENCODE_RX_CHANNEL(channel)].data32;
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
if (item_len > p_rmt->rx_item_start_idx) if (item_len > p_rmt->rx_item_start_idx)
{ {
item_len = item_len - p_rmt->rx_item_start_idx; item_len = item_len - p_rmt->rx_item_start_idx;
@@ -1323,7 +1323,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
rmterr("RMT RX BUFFER ERROR"); rmterr("RMT RX BUFFER ERROR");
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
p_rmt->rx_item_start_idx = 0; p_rmt->rx_item_start_idx = 0;
p_rmt->rx_item_len = 0; p_rmt->rx_item_len = 0;
memset((void *)p_rmt->rx_item_buf, 0, p_rmt->rx_item_buf_size); memset((void *)p_rmt->rx_item_buf, 0, p_rmt->rx_item_buf_size);
@@ -1338,7 +1338,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
RMT_LL_EVENT_RX_DONE(channel)); RMT_LL_EVENT_RX_DONE(channel));
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
/* Rx thres interrupt */ /* Rx thres interrupt */
@@ -1514,8 +1514,8 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
} }
#endif #endif
#if !CONFIG_SPIRAM_USE_MALLOC #ifndef CONFIG_SPIRAM_USE_MALLOC
p_rmt_obj[channel] = calloc(1, sizeof(rmt_obj_t)); p_rmt_obj[channel] = kmm_calloc(1, sizeof(rmt_obj_t));
#else #else
if (!(intr_alloc_flags & ESP_INTR_FLAG_IRAM)) if (!(intr_alloc_flags & ESP_INTR_FLAG_IRAM))
{ {
@@ -1523,9 +1523,7 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
} }
else else
{ {
p_rmt_obj[channel] = heap_caps_calloc(1, sizeof(rmt_obj_t), p_rmt_obj[channel] = kmm_calloc(1, sizeof(rmt_obj_t));
MALLOC_CAP_INTERNAL | \
MALLOC_CAP_8BIT);
} }
#endif #endif
@@ -1543,7 +1541,7 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
p_rmt_obj[channel]->wait_done = false; p_rmt_obj[channel]->wait_done = false;
p_rmt_obj[channel]->loop_autostop = false; p_rmt_obj[channel]->loop_autostop = false;
#if !CONFIG_SPIRAM_USE_MALLOC #ifndef CONFIG_SPIRAM_USE_MALLOC
nxsem_init(&p_rmt_obj[channel]->tx_sem, 0, 0); nxsem_init(&p_rmt_obj[channel]->tx_sem, 0, 0);
nxsem_init(&p_rmt_obj[channel]->rx_sem, 0, 0); nxsem_init(&p_rmt_obj[channel]->rx_sem, 0, 0);
#endif #endif
@@ -1555,24 +1553,22 @@ static int rmt_driver_install(rmt_channel_t channel, size_t rx_buf_size,
circbuf_init(&p_rmt_obj[channel]->rx_buf, NULL, rx_buf_size); circbuf_init(&p_rmt_obj[channel]->rx_buf, NULL, rx_buf_size);
} }
#if SOC_RMT_SUPPORT_RX_PINGPONG #ifdef SOC_RMT_SUPPORT_RX_PINGPONG
if (p_rmt_obj[channel]->rx_item_buf == NULL && rx_buf_size > 0) if (p_rmt_obj[channel]->rx_item_buf == NULL && rx_buf_size > 0)
{ {
#if !CONFIG_SPIRAM_USE_MALLOC # ifndef CONFIG_SPIRAM_USE_MALLOC
p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size); p_rmt_obj[channel]->rx_item_buf = kmm_calloc(1, rx_buf_size);
#else # else
if (!(p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM)) if (!(p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM))
{ {
p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size); p_rmt_obj[channel]->rx_item_buf = calloc(1, rx_buf_size);
} }
else else
{ {
p_rmt_obj[channel]->rx_item_buf = p_rmt_obj[channel]->rx_item_buf = kmm_calloc(1, rx_buf_size);
heap_caps_calloc(1, rx_buf_size,
MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
} }
#endif # endif
if (p_rmt_obj[channel]->rx_item_buf == NULL) if (p_rmt_obj[channel]->rx_item_buf == NULL)
{ {
rmterr("RMT malloc fail"); rmterr("RMT malloc fail");
@@ -1656,12 +1652,12 @@ static int rmt_write_items(rmt_channel_t channel,
channel); channel);
DEBUGASSERT(mem_blocks + channel <= SOC_RMT_CHANNELS_PER_GROUP); DEBUGASSERT(mem_blocks + channel <= SOC_RMT_CHANNELS_PER_GROUP);
#if CONFIG_SPIRAM_USE_MALLOC #ifdef CONFIG_SPIRAM_USE_MALLOC
if (p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM) if (p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM)
{ {
if (!esp_ptr_internal(rmt_item)) if (!esp_ptr_internal(rmt_item))
{ {
remterr(RMT_PSRAM_BUFFER_WARN_STR); rmterr(RMT_PSRAM_BUFFER_WARN_STR);
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
} }
@@ -1955,7 +1951,7 @@ static struct rmt_dev_s
* Initialize the selected RMT device in TX mode * Initialize the selected RMT device in TX mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -1977,7 +1973,7 @@ struct rmt_dev_s *esp_rmt_tx_init(int ch, int pin)
* Initialize the selected RMT device in RC mode * Initialize the selected RMT device in RC mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
+2 -2
View File
@@ -72,7 +72,7 @@ extern "C"
* Initialize the selected RMT device in TX mode * Initialize the selected RMT device in TX mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -89,7 +89,7 @@ struct rmt_dev_s *esp_rmt_tx_init(int ch, int pin);
* Initialize the selected RMT device in RC mode * Initialize the selected RMT device in RC mode
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -126,9 +126,9 @@ extern uint32_t g_rmt_source_clock_hz;
* *
* Description: * Description:
* Maps a byte to a sequence of RMT items. Each bit in the byte is * Maps a byte to a sequence of RMT items. Each bit in the byte is
* represented by an RMT item (32-bit value). Iterates over each bit in * represented by an RMT item (32-bit value). The function iterates over
* the byte, creating an RMT item for each bit, set or not. The created * each bit in the byte, creating an RMT item for each bit, HIGH or LOW.
* RMT items are stored in the destination array. * The created RMT items are stored in the destination array.
* *
* Input Parameters: * Input Parameters:
* dev - Pointer to the RMT-based WS2812 device structure. * dev - Pointer to the RMT-based WS2812 device structure.
@@ -65,9 +65,9 @@ extern "C"
****************************************************************************/ ****************************************************************************/
struct ws2812_dev_s *esp_ws2812_setup(const char *path, struct ws2812_dev_s *esp_ws2812_setup(const char *path,
struct rmt_dev_s *rmt, struct rmt_dev_s *rmt,
uint16_t pixel_count, uint16_t pixel_count,
bool has_white); bool has_white);
/**************************************************************************** /****************************************************************************
* Name: esp_ws2812_release * Name: esp_ws2812_release
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -72,10 +72,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -103,10 +103,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -72,10 +72,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -103,10 +103,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -72,10 +72,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -103,10 +103,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -74,10 +74,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -105,10 +105,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -141,7 +141,7 @@ int board_rmt_txinitialize(int ch, int pin)
#ifdef CONFIG_WS2812_NON_SPI_DRIVER #ifdef CONFIG_WS2812_NON_SPI_DRIVER
led = esp_ws2812_setup("/dev/leds0", rmt, led = esp_ws2812_setup("/dev/leds0", rmt,
CONFIG_WS2812_LED_COUNT, false); CONFIG_WS2812_LED_COUNT, false);
if (led == NULL) if (led == NULL)
{ {
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -74,10 +74,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -105,10 +105,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -56,10 +56,10 @@ extern "C"
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -73,10 +73,10 @@ int board_rmt_rxinitialize(int ch, int pin);
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value:
@@ -74,10 +74,10 @@
* Name: board_rmt_rxinitialize * Name: board_rmt_rxinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a RX device. * Initialize the RMT peripheral and register an RX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the RX channel * pin - The pin used for the RX channel
* *
* Returned Value: * Returned Value:
@@ -105,10 +105,10 @@ int board_rmt_rxinitialize(int ch, int pin)
* Name: board_rmt_txinitialize * Name: board_rmt_txinitialize
* *
* Description: * Description:
* Initialize the RMT peripheral and register a TX device. * Initialize the RMT peripheral and register an TX device.
* *
* Input Parameters: * Input Parameters:
* ch - the RMT's channel that will be used * ch - The RMT's channel that will be used
* pin - The pin used for the TX channel * pin - The pin used for the TX channel
* *
* Returned Value: * Returned Value: