mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(rmt): add driver support for esp32p4
including DMA feature
This commit is contained in:
@@ -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 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#define TEST_RMT_GPIO_NUM_A 0
|
||||
#define TEST_RMT_GPIO_NUM_B 2
|
||||
@@ -12,12 +12,13 @@
|
||||
#include "driver/rmt_tx.h"
|
||||
#include "driver/rmt_rx.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "test_board.h"
|
||||
|
||||
TEST_CASE("rmt channel install & uninstall", "[rmt]")
|
||||
{
|
||||
rmt_tx_channel_config_t tx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000,
|
||||
.trans_queue_depth = 1,
|
||||
@@ -25,7 +26,7 @@ TEST_CASE("rmt channel install & uninstall", "[rmt]")
|
||||
rmt_channel_handle_t tx_channels[SOC_RMT_TX_CANDIDATES_PER_GROUP] = {};
|
||||
rmt_rx_channel_config_t rx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.gpio_num = 2,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_B,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000,
|
||||
};
|
||||
@@ -98,3 +99,60 @@ TEST_CASE("rmt channel install & uninstall", "[rmt]")
|
||||
}
|
||||
#endif // SOC_RMT_SUPPORT_DMA
|
||||
}
|
||||
|
||||
TEST_CASE("RMT interrupt priority", "[rmt]")
|
||||
{
|
||||
rmt_tx_channel_config_t tx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.intr_priority = 3
|
||||
};
|
||||
// --- Check if specifying interrupt priority works
|
||||
printf("install tx channel\r\n");
|
||||
rmt_channel_handle_t tx_channel = NULL;
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channel));
|
||||
|
||||
rmt_channel_handle_t another_tx_channel = NULL;
|
||||
rmt_tx_channel_config_t another_tx_channel_cfg = tx_channel_cfg;
|
||||
// --- Check if rmt interrupt priority valid check works
|
||||
another_tx_channel_cfg.intr_priority = 4;
|
||||
TEST_ESP_ERR(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel), ESP_ERR_INVALID_ARG);
|
||||
// --- Check if rmt interrupt priority conflict check works
|
||||
another_tx_channel_cfg.intr_priority = 1; ///< Specifying a conflict intr_priority
|
||||
TEST_ESP_ERR(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel), ESP_ERR_INVALID_ARG);
|
||||
another_tx_channel_cfg.intr_priority = 0; ///< Do not specify an intr_priority, should not conflict
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel));
|
||||
|
||||
rmt_rx_channel_config_t rx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.gpio_num = 0,
|
||||
.flags.with_dma = false, // Interrupt will only be allocated when dma disabled
|
||||
.flags.io_loop_back = true, // the GPIO will act like a loopback
|
||||
.intr_priority = 3,
|
||||
};
|
||||
// --- Check if specifying interrupt priority works
|
||||
printf("install rx channel\r\n");
|
||||
rmt_channel_handle_t rx_channel = NULL;
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
|
||||
|
||||
rmt_channel_handle_t another_rx_channel = NULL;
|
||||
rmt_rx_channel_config_t another_rx_channel_cfg = rx_channel_cfg;
|
||||
// --- Check if rmt interrupt priority valid check works
|
||||
another_rx_channel_cfg.intr_priority = 4; ///< Specifying a invalid intr_priority
|
||||
TEST_ESP_ERR(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel), ESP_ERR_INVALID_ARG);
|
||||
// --- Check if rmt interrupt priority conflict check works
|
||||
another_rx_channel_cfg.intr_priority = 1; ///< Specifying a conflict intr_priority
|
||||
TEST_ESP_ERR(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel), ESP_ERR_INVALID_ARG);
|
||||
another_rx_channel_cfg.intr_priority = 0; ///< Do not specify an intr_priority, should not conflict
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel));
|
||||
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(another_tx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(another_rx_channel));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "esp_timer.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "test_util_rmt_encoders.h"
|
||||
#include "test_board.h"
|
||||
|
||||
static void IRAM_ATTR test_delay_post_cache_disable(void *args)
|
||||
{
|
||||
@@ -29,7 +30,7 @@ static void test_rmt_tx_iram_safe(size_t mem_block_symbols, bool with_dma)
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
};
|
||||
printf("install tx channel\r\n");
|
||||
@@ -86,8 +87,6 @@ TEST_CASE("rmt tx iram safe", "[rmt]")
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void IRAM_ATTR test_simulate_input_post_cache_disable(void *args)
|
||||
{
|
||||
int gpio_num = (int)args;
|
||||
@@ -121,7 +120,7 @@ static void test_rmt_rx_iram_safe(size_t mem_block_symbols, bool with_dma, rmt_c
|
||||
.clk_src = clk_src,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = mem_block_symbols,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.flags.io_loop_back = true, // the GPIO will act like a loopback
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "driver/rmt_rx.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "test_util_rmt_encoders.h"
|
||||
#include "test_board.h"
|
||||
|
||||
#if CONFIG_RMT_ISR_IRAM_SAFE
|
||||
#define TEST_RMT_CALLBACK_ATTR IRAM_ATTR
|
||||
@@ -42,11 +43,16 @@ static bool test_rmt_rx_done_callback(rmt_channel_handle_t channel, const rmt_rx
|
||||
|
||||
static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt_clock_source_t clk_src)
|
||||
{
|
||||
uint32_t const test_rx_buffer_symbols = 128;
|
||||
rmt_symbol_word_t *remote_codes = heap_caps_aligned_calloc(64, test_rx_buffer_symbols, sizeof(rmt_symbol_word_t),
|
||||
MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA);
|
||||
TEST_ASSERT_NOT_NULL(remote_codes);
|
||||
|
||||
rmt_rx_channel_config_t rx_channel_cfg = {
|
||||
.clk_src = clk_src,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = mem_block_symbols,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.flags.io_loop_back = true, // the GPIO will act like a loopback
|
||||
};
|
||||
@@ -67,7 +73,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.io_loop_back = true, // TX channel and RX channel will bounded to the same GPIO
|
||||
};
|
||||
printf("install tx channel\r\n");
|
||||
@@ -86,15 +92,13 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
printf("enable rx channel\r\n");
|
||||
TEST_ESP_OK(rmt_enable(rx_channel));
|
||||
|
||||
rmt_symbol_word_t remote_codes[128];
|
||||
|
||||
rmt_receive_config_t receive_config = {
|
||||
.signal_range_min_ns = 1250,
|
||||
.signal_range_max_ns = 12000000,
|
||||
};
|
||||
|
||||
// ready to receive
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send NEC frame without carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0x0440, 0x3003 // address, command
|
||||
@@ -102,7 +106,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ASSERT_NOT_EQUAL(0, ulTaskNotifyTake(pdFALSE, pdMS_TO_TICKS(1000)));
|
||||
TEST_ASSERT_EQUAL(34, test_user_data.received_symbol_num);
|
||||
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send NEC frame without carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0x0440, 0x3003 // address, command
|
||||
@@ -112,7 +116,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
|
||||
#if SOC_RMT_SUPPORT_RX_PINGPONG
|
||||
// ready to receive
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send customized NEC frame without carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0xFF00, 0xFF00, 0xFF00, 0xFF00
|
||||
@@ -121,7 +125,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ASSERT_EQUAL(66, test_user_data.received_symbol_num);
|
||||
#else
|
||||
// ready to receive
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send customized NEC frame without carrier\r\n");
|
||||
// the maximum symbols can receive is its memory block capacity
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
@@ -144,7 +148,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
carrier_cfg.frequency_hz = 25000;
|
||||
TEST_ESP_OK(rmt_apply_carrier(rx_channel, &carrier_cfg));
|
||||
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send NEC frame with carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0x0440, 0x3003 // address, command
|
||||
@@ -153,7 +157,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ASSERT_EQUAL(34, test_user_data.received_symbol_num);
|
||||
|
||||
#if SOC_RMT_SUPPORT_RX_PINGPONG
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send customized frame with carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0xFF00, 0xFF00, 0xFF00, 0xFF00
|
||||
@@ -167,7 +171,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ESP_OK(rmt_apply_carrier(rx_channel, NULL));
|
||||
#endif // SOC_RMT_SUPPORT_RX_DEMODULATION
|
||||
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, sizeof(remote_codes), &receive_config));
|
||||
TEST_ESP_OK(rmt_receive(rx_channel, remote_codes, test_rx_buffer_symbols * sizeof(rmt_symbol_word_t), &receive_config));
|
||||
printf("send NEC frame without carrier\r\n");
|
||||
TEST_ESP_OK(rmt_transmit(tx_channel, nec_encoder, (uint16_t[]) {
|
||||
0x0440, 0x3003 // address, command
|
||||
@@ -183,6 +187,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channel));
|
||||
TEST_ESP_OK(rmt_del_encoder(nec_encoder));
|
||||
free(remote_codes);
|
||||
}
|
||||
|
||||
TEST_CASE("rmt rx nec with carrier", "[rmt]")
|
||||
@@ -196,40 +201,3 @@ TEST_CASE("rmt rx nec with carrier", "[rmt]")
|
||||
test_rmt_rx_nec_carrier(128, true, RMT_CLK_SRC_DEFAULT);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("RMT RX test specifying interrupt priority", "[rmt]")
|
||||
{
|
||||
rmt_clock_source_t clk_srcs[] = SOC_RMT_CLKS;
|
||||
rmt_rx_channel_config_t rx_channel_cfg = {
|
||||
.clk_src = clk_srcs[0],
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.gpio_num = 0,
|
||||
.flags.with_dma = false, // Interrupt will only be allocated when dma disabled
|
||||
.flags.io_loop_back = true, // the GPIO will act like a loopback
|
||||
.intr_priority = 3,
|
||||
};
|
||||
// --- Check if specifying interrupt priority works
|
||||
printf("install rx channel\r\n");
|
||||
rmt_channel_handle_t rx_channel = NULL;
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channel));
|
||||
|
||||
rmt_channel_handle_t another_rx_channel = NULL;
|
||||
rmt_rx_channel_config_t another_rx_channel_cfg = rx_channel_cfg;
|
||||
// --- Check if rmt interrupt priority valid check works
|
||||
another_rx_channel_cfg.intr_priority = 4; ///< Specifying a invalid intr_priority
|
||||
TEST_ESP_ERR(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel), ESP_ERR_INVALID_ARG);
|
||||
// --- Check if rmt interrupt priority conflict check works
|
||||
another_rx_channel_cfg.intr_priority = 1; ///< Specifying a conflict intr_priority
|
||||
TEST_ESP_ERR(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel), ESP_ERR_INVALID_ARG);
|
||||
another_rx_channel_cfg.intr_priority = 0; ///< Do not specify an intr_priority, should not conflict
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&another_rx_channel_cfg, &another_rx_channel));
|
||||
// --- Check if channel works
|
||||
TEST_ESP_OK(rmt_enable(rx_channel));
|
||||
TEST_ESP_OK(rmt_enable(another_rx_channel));
|
||||
// --- Post-test
|
||||
TEST_ESP_OK(rmt_disable(rx_channel));
|
||||
TEST_ESP_OK(rmt_disable(another_rx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(another_rx_channel));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "esp_timer.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "test_util_rmt_encoders.h"
|
||||
#include "test_board.h"
|
||||
|
||||
#if CONFIG_RMT_ISR_IRAM_SAFE
|
||||
#define TEST_RMT_CALLBACK_ATTR IRAM_ATTR
|
||||
@@ -27,7 +28,7 @@ TEST_CASE("rmt bytes encoder", "[rmt]")
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.intr_priority = 3
|
||||
};
|
||||
printf("install tx channel\r\n");
|
||||
@@ -89,7 +90,7 @@ static void test_rmt_channel_single_trans(size_t mem_block_symbols, bool with_dm
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.intr_priority = 2
|
||||
};
|
||||
@@ -144,7 +145,7 @@ static void test_rmt_ping_pong_trans(size_t mem_block_symbols, bool with_dma)
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.intr_priority = 1
|
||||
};
|
||||
@@ -215,7 +216,6 @@ TEST_CASE("rmt ping-pong transaction", "[rmt]")
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TEST_RMT_CALLBACK_ATTR
|
||||
static bool test_rmt_tx_done_cb_check_event_data(rmt_channel_handle_t channel, const rmt_tx_done_event_data_t *edata, void *user_data)
|
||||
{
|
||||
@@ -231,7 +231,7 @@ static void test_rmt_trans_done_event(size_t mem_block_symbols, bool with_dma)
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
.trans_queue_depth = 1,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.intr_priority = 3
|
||||
};
|
||||
@@ -305,7 +305,7 @@ static void test_rmt_loop_trans(size_t mem_block_symbols, bool with_dma)
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 10000000, // 10MHz, 1 tick = 0.1us (led strip needs a high resolution)
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_A,
|
||||
.flags.with_dma = with_dma,
|
||||
.intr_priority = 2
|
||||
};
|
||||
@@ -365,7 +365,7 @@ TEST_CASE("rmt infinite loop transaction", "[rmt]")
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.gpio_num = 2,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_B,
|
||||
.trans_queue_depth = 3,
|
||||
.intr_priority = 1
|
||||
};
|
||||
@@ -444,7 +444,7 @@ static void test_rmt_tx_nec_carrier(size_t mem_block_symbols, bool with_dma)
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.mem_block_symbols = mem_block_symbols,
|
||||
.gpio_num = 2,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_B,
|
||||
.trans_queue_depth = 4,
|
||||
.flags.with_dma = with_dma,
|
||||
.intr_priority = 3
|
||||
@@ -503,7 +503,6 @@ TEST_CASE("rmt tx nec with carrier", "[rmt]")
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
TEST_RMT_CALLBACK_ATTR
|
||||
static bool test_rmt_tx_done_cb_record_time(rmt_channel_handle_t channel, const rmt_tx_done_event_data_t *edata, void *user_data)
|
||||
{
|
||||
@@ -526,7 +525,7 @@ static void test_rmt_multi_channels_trans(size_t channel0_mem_block_symbols, siz
|
||||
};
|
||||
printf("install tx channels\r\n");
|
||||
rmt_channel_handle_t tx_channels[TEST_RMT_CHANS] = {NULL};
|
||||
int gpio_nums[TEST_RMT_CHANS] = {0, 2};
|
||||
int gpio_nums[TEST_RMT_CHANS] = {TEST_RMT_GPIO_NUM_A, TEST_RMT_GPIO_NUM_B};
|
||||
size_t mem_blk_syms[TEST_RMT_CHANS] = {channel0_mem_block_symbols, channel1_mem_block_symbols};
|
||||
bool dma_flags[TEST_RMT_CHANS] = {channel0_with_dma, channel1_with_dma};
|
||||
for (int i = 0; i < TEST_RMT_CHANS; i++) {
|
||||
@@ -655,38 +654,3 @@ TEST_CASE("rmt multiple channels transaction", "[rmt]")
|
||||
test_rmt_multi_channels_trans(1024, SOC_RMT_MEM_WORDS_PER_CHANNEL, true, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("RMT TX test specifying interrupt priority", "[rmt]")
|
||||
{
|
||||
rmt_tx_channel_config_t tx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000, // 1MHz, 1 tick = 1us
|
||||
.trans_queue_depth = 4,
|
||||
.gpio_num = 0,
|
||||
.intr_priority = 3
|
||||
};
|
||||
// --- Check if specifying interrupt priority works
|
||||
printf("install tx channel\r\n");
|
||||
rmt_channel_handle_t tx_channel = NULL;
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channel));
|
||||
|
||||
rmt_channel_handle_t another_tx_channel = NULL;
|
||||
rmt_tx_channel_config_t another_tx_channel_cfg = tx_channel_cfg;
|
||||
// --- Check if rmt interrupt priority valid check works
|
||||
another_tx_channel_cfg.intr_priority = 4;
|
||||
TEST_ESP_ERR(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel), ESP_ERR_INVALID_ARG);
|
||||
// --- Check if rmt interrupt priority conflict check works
|
||||
another_tx_channel_cfg.intr_priority = 1; ///< Specifying a conflict intr_priority
|
||||
TEST_ESP_ERR(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel), ESP_ERR_INVALID_ARG);
|
||||
another_tx_channel_cfg.intr_priority = 0; ///< Do not specify an intr_priority, should not conflict
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&another_tx_channel_cfg, &another_tx_channel));
|
||||
// --- Check if channel works
|
||||
TEST_ESP_OK(rmt_enable(tx_channel));
|
||||
TEST_ESP_OK(rmt_enable(another_tx_channel));
|
||||
// --- Post-test
|
||||
TEST_ESP_OK(rmt_disable(tx_channel));
|
||||
TEST_ESP_OK(rmt_disable(another_tx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(another_tx_channel));
|
||||
}
|
||||
|
||||
@@ -11,12 +11,6 @@
|
||||
#include "driver/rmt_encoder.h"
|
||||
#include "esp_attr.h"
|
||||
|
||||
#if CONFIG_RMT_ISR_IRAM_SAFE
|
||||
#define TEST_RMT_ENCODER_ATTR IRAM_ATTR
|
||||
#else
|
||||
#define TEST_RMT_ENCODER_ATTR
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
rmt_encoder_t base;
|
||||
rmt_encoder_t *bytes_encoder;
|
||||
@@ -25,8 +19,7 @@ typedef struct {
|
||||
rmt_symbol_word_t reset_code;
|
||||
} rmt_led_strip_encoder_t;
|
||||
|
||||
TEST_RMT_ENCODER_ATTR
|
||||
static size_t rmt_encode_led_strip(rmt_encoder_t *encoder, rmt_channel_handle_t channel, const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
|
||||
IRAM_ATTR static size_t rmt_encode_led_strip(rmt_encoder_t *encoder, rmt_channel_handle_t channel, const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
|
||||
{
|
||||
rmt_led_strip_encoder_t *led_encoder = __containerof(encoder, rmt_led_strip_encoder_t, base);
|
||||
rmt_encode_state_t session_state = RMT_ENCODING_RESET;
|
||||
@@ -119,7 +112,7 @@ typedef struct {
|
||||
int state;
|
||||
} rmt_nec_protocol_encoder_t;
|
||||
|
||||
static size_t rmt_encode_nec_protocol(rmt_encoder_t *encoder, rmt_channel_handle_t channel, const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
|
||||
IRAM_ATTR static size_t rmt_encode_nec_protocol(rmt_encoder_t *encoder, rmt_channel_handle_t channel, const void *primary_data, size_t data_size, rmt_encode_state_t *ret_state)
|
||||
{
|
||||
rmt_nec_protocol_encoder_t *nec_encoder = __containerof(encoder, rmt_nec_protocol_encoder_t, base);
|
||||
rmt_encode_state_t session_state = RMT_ENCODING_RESET;
|
||||
|
||||
Reference in New Issue
Block a user