mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
feat(parlio_tx): support loop transmission
This commit is contained in:
@@ -291,7 +291,7 @@ TEST_CASE("parallel_tx_clock_gating", "[paralio_tx]")
|
||||
#endif // SOC_PARLIO_TX_CLK_SUPPORT_GATING
|
||||
|
||||
#if SOC_PSRAM_DMA_CAPABLE
|
||||
TEST_CASE("parlio can transmit PSRAM buffer", "[parlio_tx]")
|
||||
TEST_CASE("parlio_tx_can_transmit_PSRAM_buffer", "[parlio_tx]")
|
||||
{
|
||||
printf("install parlio tx unit\r\n");
|
||||
parlio_tx_unit_handle_t tx_unit = NULL;
|
||||
@@ -447,3 +447,85 @@ TEST_CASE("parallel tx unit use external non-free running clock", "[parlio_tx]")
|
||||
TEST_ESP_OK(gpio_reset_pin(config.data_gpio_nums[i]));
|
||||
}
|
||||
};
|
||||
|
||||
#if SOC_PARLIO_TX_SUPPORT_LOOP_TRANSMISSION
|
||||
TEST_CASE("parlio_tx_loop_transmission", "[parlio_tx]")
|
||||
{
|
||||
printf("install parlio tx unit\r\n");
|
||||
parlio_tx_unit_handle_t tx_unit = NULL;
|
||||
parlio_tx_unit_config_t config = {
|
||||
.clk_src = PARLIO_CLK_SRC_DEFAULT,
|
||||
.data_width = 8,
|
||||
.clk_in_gpio_num = -1, // use internal clock source
|
||||
.valid_gpio_num = -1,
|
||||
.clk_out_gpio_num = TEST_CLK_GPIO,
|
||||
.data_gpio_nums = {
|
||||
TEST_DATA0_GPIO,
|
||||
TEST_DATA1_GPIO,
|
||||
TEST_DATA2_GPIO,
|
||||
TEST_DATA3_GPIO,
|
||||
TEST_DATA4_GPIO,
|
||||
TEST_DATA5_GPIO,
|
||||
TEST_DATA6_GPIO,
|
||||
TEST_DATA7_GPIO,
|
||||
},
|
||||
.output_clk_freq_hz = 10 * 1000 * 1000,
|
||||
.trans_queue_depth = 3,
|
||||
.max_transfer_size = 256,
|
||||
.bit_pack_order = PARLIO_BIT_PACK_ORDER_LSB,
|
||||
.sample_edge = PARLIO_SAMPLE_EDGE_POS,
|
||||
};
|
||||
TEST_ESP_OK(parlio_new_tx_unit(&config, &tx_unit));
|
||||
TEST_ESP_OK(parlio_tx_unit_enable(tx_unit));
|
||||
|
||||
printf("send packets and check event is fired\r\n");
|
||||
parlio_transmit_config_t transmit_config = {
|
||||
.idle_value = 0x00,
|
||||
.flags.loop_transmission = true,
|
||||
};
|
||||
__attribute__((aligned(64))) uint8_t payload_loop1[256] = {0};
|
||||
__attribute__((aligned(64))) uint8_t payload_loop2[256] = {0};
|
||||
__attribute__((aligned(64))) uint8_t payload_oneshot[256] = {0};
|
||||
for (int i = 0; i < 256; i++) {
|
||||
payload_loop1[i] = i;
|
||||
payload_loop2[i] = 255 - i;
|
||||
payload_oneshot[i] = i * 2 + 1;
|
||||
}
|
||||
if (parlio_ll_tx_support_dma_eof(NULL)) { // for some chips, only support in particular ECO version
|
||||
transmit_config.flags.loop_transmission = true;
|
||||
int lopp_count = 3;
|
||||
while (lopp_count--) {
|
||||
TEST_ESP_OK(parlio_tx_unit_transmit(tx_unit, payload_loop1, 256 * sizeof(uint8_t) * 8, &transmit_config));
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
// Should be sent after the previous frame has been completely sent
|
||||
TEST_ESP_OK(parlio_tx_unit_transmit(tx_unit, payload_loop2, 256 * sizeof(uint8_t) * 8, &transmit_config));
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
transmit_config.flags.loop_transmission = false;
|
||||
// should be pending in queue
|
||||
TEST_ESP_OK(parlio_tx_unit_transmit(tx_unit, payload_oneshot, 256 * sizeof(uint8_t) * 8, &transmit_config));
|
||||
transmit_config.flags.loop_transmission = true;
|
||||
// there is a oneshot trans in queue, should also be pending in queue
|
||||
TEST_ESP_OK(parlio_tx_unit_transmit(tx_unit, payload_loop1, 256 * sizeof(uint8_t) * 8, &transmit_config));
|
||||
|
||||
TEST_ESP_ERR(ESP_ERR_TIMEOUT, parlio_tx_unit_wait_all_done(tx_unit, 50));
|
||||
|
||||
// stop infinite loop transmission
|
||||
parlio_tx_unit_disable(tx_unit);
|
||||
// We should see 1 oneshot frame and 1 loop transmission (both pending in queue)
|
||||
parlio_tx_unit_enable(tx_unit);
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
// stop the second infinite loop transmission
|
||||
parlio_tx_unit_disable(tx_unit);
|
||||
parlio_tx_unit_enable(tx_unit);
|
||||
} else {
|
||||
TEST_ESP_ERR(ESP_ERR_NOT_SUPPORTED, parlio_tx_unit_transmit(tx_unit, payload_loop1, 256 * sizeof(uint8_t) * 8, &transmit_config));
|
||||
}
|
||||
|
||||
TEST_ESP_OK(parlio_tx_unit_wait_all_done(tx_unit, -1));
|
||||
TEST_ESP_OK(parlio_tx_unit_disable(tx_unit));
|
||||
TEST_ESP_OK(parlio_del_tx_unit(tx_unit));
|
||||
}
|
||||
#endif // SOC_PARLIO_TX_SUPPORT_LOOP_TRANSMISSION
|
||||
|
||||
Reference in New Issue
Block a user