forked from espressif/esp-idf
feat(parlio_tx): backport the clock change to v5.3
This commit is contained in:
@@ -475,6 +475,7 @@ static void IRAM_ATTR parlio_tx_do_transaction(parlio_tx_unit_t *tx_unit, parlio
|
||||
|
||||
esp_err_t parlio_tx_unit_enable(parlio_tx_unit_handle_t tx_unit)
|
||||
{
|
||||
parlio_hal_context_t *hal = &tx_unit->base.group->hal;
|
||||
ESP_RETURN_ON_FALSE(tx_unit, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
parlio_tx_fsm_t expected_fsm = PARLIO_TX_FSM_INIT;
|
||||
if (atomic_compare_exchange_strong(&tx_unit->fsm, &expected_fsm, PARLIO_TX_FSM_ENABLE_WAIT)) {
|
||||
@@ -482,13 +483,16 @@ esp_err_t parlio_tx_unit_enable(parlio_tx_unit_handle_t tx_unit)
|
||||
if (tx_unit->pm_lock) {
|
||||
esp_pm_lock_acquire(tx_unit->pm_lock);
|
||||
}
|
||||
parlio_hal_context_t *hal = &tx_unit->base.group->hal;
|
||||
parlio_ll_enable_interrupt(hal->regs, PARLIO_LL_EVENT_TX_EOF, true);
|
||||
atomic_store(&tx_unit->fsm, PARLIO_TX_FSM_ENABLE);
|
||||
} else {
|
||||
ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_STATE, TAG, "unit not in init state");
|
||||
}
|
||||
|
||||
PARLIO_CLOCK_SRC_ATOMIC() {
|
||||
parlio_ll_tx_enable_clock(hal->regs, true);
|
||||
}
|
||||
|
||||
// check if we need to start one pending transaction
|
||||
parlio_tx_trans_desc_t *t = NULL;
|
||||
expected_fsm = PARLIO_TX_FSM_ENABLE;
|
||||
@@ -630,9 +634,6 @@ static void IRAM_ATTR parlio_tx_default_isr(void *args)
|
||||
|
||||
if (status & PARLIO_LL_EVENT_TX_EOF) {
|
||||
parlio_ll_clear_interrupt_status(hal->regs, PARLIO_LL_EVENT_TX_EOF);
|
||||
PARLIO_CLOCK_SRC_ATOMIC() {
|
||||
parlio_ll_tx_enable_clock(hal->regs, false);
|
||||
}
|
||||
parlio_ll_tx_start(hal->regs, false);
|
||||
|
||||
parlio_tx_trans_desc_t *trans_desc = NULL;
|
||||
|
@@ -329,18 +329,6 @@ static void test_use_external_non_free_running_clock(parlio_tx_unit_handle_t tx_
|
||||
|
||||
TEST_CASE("parallel tx unit use external non-free running clock", "[parlio_tx]")
|
||||
{
|
||||
printf("use gpio as external clock source\r\n");
|
||||
// configure the data gpio for loopback test
|
||||
gpio_config_t gpio_conf = {
|
||||
.mode = GPIO_MODE_INPUT,
|
||||
.pin_bit_mask = BIT64(TEST_DATA0_GPIO) | BIT64(TEST_DATA1_GPIO) | BIT64(TEST_DATA2_GPIO) | BIT64(TEST_DATA3_GPIO) |
|
||||
BIT64(TEST_DATA4_GPIO) | BIT64(TEST_DATA5_GPIO) | BIT64(TEST_DATA6_GPIO) | BIT64(TEST_DATA7_GPIO),
|
||||
};
|
||||
TEST_ESP_OK(gpio_config(&gpio_conf));
|
||||
// configure the external clock output gpio
|
||||
gpio_conf.mode = GPIO_MODE_OUTPUT;
|
||||
gpio_conf.pin_bit_mask = BIT64(TEST_EXT_CLK_GPIO);
|
||||
TEST_ESP_OK(gpio_config(&gpio_conf));
|
||||
|
||||
printf("install parlio tx unit\r\n");
|
||||
parlio_tx_unit_handle_t tx_unit = NULL;
|
||||
@@ -366,6 +354,7 @@ TEST_CASE("parallel tx unit use external non-free running clock", "[parlio_tx]")
|
||||
.max_transfer_size = 256,
|
||||
.bit_pack_order = PARLIO_BIT_PACK_ORDER_LSB,
|
||||
.sample_edge = PARLIO_SAMPLE_EDGE_POS,
|
||||
.flags.io_loop_back = true,
|
||||
};
|
||||
|
||||
uint8_t test_round = 50;
|
||||
@@ -376,9 +365,4 @@ TEST_CASE("parallel tx unit use external non-free running clock", "[parlio_tx]")
|
||||
config.input_clk_src_freq_hz = 1 * 1000 * 1000;
|
||||
printf("test special condition, input clk freq equals to output clk freq\r\n");
|
||||
test_use_external_non_free_running_clock(tx_unit, config, test_round);
|
||||
|
||||
TEST_ESP_OK(gpio_reset_pin(TEST_EXT_CLK_GPIO));
|
||||
for (int i = 0; i < 8; i++) {
|
||||
TEST_ESP_OK(gpio_reset_pin(config.data_gpio_nums[i]));
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user