mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(hal): graudate the RMT hal driver into a new component
This commit is contained in:
committed by
suda-morris
parent
c740652f3d
commit
10c473fbbd
@@ -9,9 +9,19 @@ project(rmt_test)
|
||||
|
||||
idf_build_get_property(elf EXECUTABLE)
|
||||
if(CONFIG_COMPILER_DUMP_RTL_FILES)
|
||||
|
||||
# Collect RTL directories in a variable for readability. Join them
|
||||
# with commas so they are passed as a single --rtl-dirs argument to the script.
|
||||
set(RMT_RTL_DIRS
|
||||
${CMAKE_BINARY_DIR}/esp-idf/esp_driver_rmt
|
||||
${CMAKE_BINARY_DIR}/esp-idf/hal
|
||||
${CMAKE_BINARY_DIR}/esp-idf/esp_hal_rmt
|
||||
)
|
||||
string(JOIN "," RMT_RTL_DIRS_JOINED ${RMT_RTL_DIRS})
|
||||
|
||||
add_custom_target(check_test_app_sections ALL
|
||||
COMMAND ${PYTHON} $ENV{IDF_PATH}/tools/ci/check_callgraph.py
|
||||
--rtl-dirs ${CMAKE_BINARY_DIR}/esp-idf/esp_driver_rmt/,${CMAKE_BINARY_DIR}/esp-idf/hal/
|
||||
--rtl-dirs ${RMT_RTL_DIRS_JOINED}
|
||||
--elf-file ${CMAKE_BINARY_DIR}/rmt_test.elf
|
||||
find-refs
|
||||
--from-sections=.iram0.text
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "driver/rmt_tx.h"
|
||||
#include "driver/rmt_rx.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/rmt_ll.h"
|
||||
#include "test_board.h"
|
||||
|
||||
TEST_CASE("rmt channel install & uninstall", "[rmt]")
|
||||
@@ -23,55 +24,55 @@ TEST_CASE("rmt channel install & uninstall", "[rmt]")
|
||||
.resolution_hz = 1000000,
|
||||
.trans_queue_depth = 1,
|
||||
};
|
||||
rmt_channel_handle_t tx_channels[SOC_RMT_TX_CANDIDATES_PER_GROUP] = {};
|
||||
rmt_channel_handle_t tx_channels[RMT_LL_GET(TX_CANDIDATES_PER_INST)] = {};
|
||||
rmt_rx_channel_config_t rx_channel_cfg = {
|
||||
.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL,
|
||||
.gpio_num = TEST_RMT_GPIO_NUM_B,
|
||||
.clk_src = RMT_CLK_SRC_DEFAULT,
|
||||
.resolution_hz = 1000000,
|
||||
};
|
||||
rmt_channel_handle_t rx_channels[SOC_RMT_RX_CANDIDATES_PER_GROUP] = {};
|
||||
rmt_channel_handle_t rx_channels[RMT_LL_GET(RX_CANDIDATES_PER_INST)] = {};
|
||||
|
||||
printf("install tx/rx channels, each channel takes one memory block\r\n");
|
||||
for (int i = 0; i < SOC_RMT_TX_CANDIDATES_PER_GROUP; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(TX_CANDIDATES_PER_INST); i++) {
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[i]));
|
||||
}
|
||||
// alloc more when tx channels are exhausted should report error
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[0]));
|
||||
for (int i = 0; i < SOC_RMT_TX_CANDIDATES_PER_GROUP; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(TX_CANDIDATES_PER_INST); i++) {
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channels[i]));
|
||||
}
|
||||
for (int i = 0; i < SOC_RMT_RX_CANDIDATES_PER_GROUP; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(RX_CANDIDATES_PER_INST); i++) {
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channels[i]));
|
||||
}
|
||||
// alloc more when rx channels are exhausted should report error
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, rmt_new_rx_channel(&rx_channel_cfg, &rx_channels[0]));
|
||||
for (int i = 0; i < SOC_RMT_RX_CANDIDATES_PER_GROUP; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(RX_CANDIDATES_PER_INST); i++) {
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channels[i]));
|
||||
}
|
||||
|
||||
printf("install tx/rx channels, each channel takes two memory blocks\r\n");
|
||||
tx_channel_cfg.mem_block_symbols = 2 * SOC_RMT_MEM_WORDS_PER_CHANNEL;
|
||||
rx_channel_cfg.mem_block_symbols = 2 * SOC_RMT_MEM_WORDS_PER_CHANNEL;
|
||||
for (int i = 0; i < SOC_RMT_TX_CANDIDATES_PER_GROUP / 2; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(TX_CANDIDATES_PER_INST) / 2; i++) {
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[i]));
|
||||
}
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[0]));
|
||||
for (int i = 0; i < SOC_RMT_TX_CANDIDATES_PER_GROUP / 2; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(TX_CANDIDATES_PER_INST) / 2; i++) {
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channels[i]));
|
||||
}
|
||||
for (int i = 0; i < SOC_RMT_RX_CANDIDATES_PER_GROUP / 2; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(RX_CANDIDATES_PER_INST) / 2; i++) {
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channels[i]));
|
||||
}
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_FOUND, rmt_new_rx_channel(&rx_channel_cfg, &rx_channels[0]));
|
||||
for (int i = 0; i < SOC_RMT_RX_CANDIDATES_PER_GROUP / 2; i++) {
|
||||
for (int i = 0; i < RMT_LL_GET(RX_CANDIDATES_PER_INST) / 2; i++) {
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channels[i]));
|
||||
}
|
||||
|
||||
printf("install tx+rx channels, memory blocks exhaustive\r\n");
|
||||
tx_channel_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL;
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[0]));
|
||||
tx_channel_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL * (SOC_RMT_CHANNELS_PER_GROUP - 2);
|
||||
tx_channel_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL * (RMT_LL_GET(CHANS_PER_INST) - 2);
|
||||
TEST_ESP_OK(rmt_new_tx_channel(&tx_channel_cfg, &tx_channels[1]));
|
||||
rx_channel_cfg.mem_block_symbols = SOC_RMT_MEM_WORDS_PER_CHANNEL;
|
||||
TEST_ESP_OK(rmt_new_rx_channel(&rx_channel_cfg, &rx_channels[0]));
|
||||
@@ -156,7 +157,7 @@ TEST_CASE("rmt interrupt priority", "[rmt]")
|
||||
TEST_ESP_OK(rmt_del_channel(another_rx_channel));
|
||||
}
|
||||
|
||||
#if !SOC_RMT_CHANNEL_CLK_INDEPENDENT
|
||||
#if !RMT_LL_GET(CHANNEL_CLK_INDEPENDENT)
|
||||
TEST_CASE("rmt multiple channels with different resolution", "[rmt]")
|
||||
{
|
||||
rmt_tx_channel_config_t tx_channel_cfg = {
|
||||
@@ -185,4 +186,4 @@ TEST_CASE("rmt multiple channels with different resolution", "[rmt]")
|
||||
TEST_ESP_OK(rmt_del_channel(tx_channel));
|
||||
TEST_ESP_OK(rmt_del_channel(rx_channel));
|
||||
}
|
||||
#endif //SOC_RMT_CHANNEL_CLK_INDEPENDENT
|
||||
#endif //RMT_LL_GET(CHANNEL_CLK_INDEPENDENT)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "driver/rmt_rx.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/rmt_ll.h"
|
||||
#include "test_util_rmt_encoders.h"
|
||||
#include "test_board.h"
|
||||
|
||||
@@ -136,7 +137,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
TEST_ASSERT_EQUAL(test_user_data.received_symbol_num, mem_block_symbols);
|
||||
#endif // SOC_RMT_SUPPORT_RX_PINGPONG
|
||||
|
||||
#if SOC_RMT_SUPPORT_RX_DEMODULATION
|
||||
#if RMT_LL_SUPPORT(RX_DEMODULATION)
|
||||
rmt_carrier_config_t carrier_cfg = {
|
||||
.duty_cycle = 0.33,
|
||||
.frequency_hz = 38000,
|
||||
@@ -170,7 +171,7 @@ static void test_rmt_rx_nec_carrier(size_t mem_block_symbols, bool with_dma, rmt
|
||||
printf("disable modulation and demodulation for tx and rx channels\r\n");
|
||||
TEST_ESP_OK(rmt_apply_carrier(tx_channel, NULL));
|
||||
TEST_ESP_OK(rmt_apply_carrier(rx_channel, NULL));
|
||||
#endif // SOC_RMT_SUPPORT_RX_DEMODULATION
|
||||
#endif // RMT_LL_SUPPORT(RX_DEMODULATION)
|
||||
|
||||
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");
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_timer.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/rmt_ll.h"
|
||||
#include "test_util_rmt_encoders.h"
|
||||
#include "test_board.h"
|
||||
|
||||
@@ -619,13 +620,13 @@ static void test_rmt_multi_channels_trans(size_t channel0_mem_block_symbols, siz
|
||||
.tx_channel_array = tx_channels,
|
||||
.array_size = test_rmt_chans,
|
||||
};
|
||||
#if SOC_RMT_SUPPORT_TX_SYNCHRO
|
||||
#if RMT_LL_SUPPORT(TX_SYNCHRO)
|
||||
TEST_ESP_OK(rmt_new_sync_manager(&synchro_config, &synchro));
|
||||
#else
|
||||
TEST_ASSERT_EQUAL(ESP_ERR_NOT_SUPPORTED, rmt_new_sync_manager(&synchro_config, &synchro));
|
||||
#endif // SOC_RMT_SUPPORT_TX_SYNCHRO
|
||||
#endif // RMT_LL_SUPPORT(TX_SYNCHRO)
|
||||
|
||||
#if SOC_RMT_SUPPORT_TX_SYNCHRO
|
||||
#if RMT_LL_SUPPORT(TX_SYNCHRO)
|
||||
printf("transmit with synchronization\r\n");
|
||||
for (int i = 0; i < test_rmt_chans; i++) {
|
||||
TEST_ESP_OK(rmt_transmit(tx_channels[i], led_strip_encoders[i], leds_grb, test_led_num * 3, &transmit_config));
|
||||
@@ -662,7 +663,7 @@ static void test_rmt_multi_channels_trans(size_t channel0_mem_block_symbols, siz
|
||||
|
||||
printf("delete sync manager\r\n");
|
||||
TEST_ESP_OK(rmt_del_sync_manager(synchro));
|
||||
#endif // SOC_RMT_SUPPORT_TX_SYNCHRO
|
||||
#endif // RMT_LL_SUPPORT(TX_SYNCHRO)
|
||||
|
||||
printf("disable tx channels\r\n");
|
||||
for (int i = 0; i < test_rmt_chans; i++) {
|
||||
|
||||
Reference in New Issue
Block a user