Clear DMA chaining before abort
This commit is contained in:
parent
63ca3c6439
commit
178ba7bee0
16
src/main.c
16
src/main.c
|
@ -82,6 +82,14 @@ static queue_t iq_queue;
|
||||||
static uint8_t iq_queue_buffer[IQ_QUEUE_LEN][IQ_BLOCK_LEN];
|
static uint8_t iq_queue_buffer[IQ_QUEUE_LEN][IQ_BLOCK_LEN];
|
||||||
static size_t iq_queue_pos = 0;
|
static size_t iq_queue_pos = 0;
|
||||||
|
|
||||||
|
static void dma_channel_clear_chain_to(int ch)
|
||||||
|
{
|
||||||
|
uint32_t ctrl = dma_hw->ch[ch].al1_ctrl;
|
||||||
|
ctrl &= ~DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS;
|
||||||
|
ctrl |= ch << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB;
|
||||||
|
dma_hw->ch[ch].al1_ctrl = ctrl;
|
||||||
|
}
|
||||||
|
|
||||||
static void init_lo()
|
static void init_lo()
|
||||||
{
|
{
|
||||||
gpio_disable_pulls(LO_PIN);
|
gpio_disable_pulls(LO_PIN);
|
||||||
|
@ -329,7 +337,6 @@ static void rf_rx_start()
|
||||||
channel_config_set_transfer_data_size(&dma_conf, DMA_SIZE_32);
|
channel_config_set_transfer_data_size(&dma_conf, DMA_SIZE_32);
|
||||||
channel_config_set_read_increment(&dma_conf, false);
|
channel_config_set_read_increment(&dma_conf, false);
|
||||||
channel_config_set_write_increment(&dma_conf, false);
|
channel_config_set_write_increment(&dma_conf, false);
|
||||||
channel_config_set_ring(&dma_conf, false, 4);
|
|
||||||
channel_config_set_high_priority(&dma_conf, true);
|
channel_config_set_high_priority(&dma_conf, true);
|
||||||
channel_config_set_dreq(&dma_conf, dma_get_timer_dreq(dma_t_samp));
|
channel_config_set_dreq(&dma_conf, dma_get_timer_dreq(dma_t_samp));
|
||||||
dma_channel_configure(dma_ch_samp_cos, &dma_conf, &PIO->sm[AD_SM].instr, &samp_insn,
|
dma_channel_configure(dma_ch_samp_cos, &dma_conf, &PIO->sm[AD_SM].instr, &samp_insn,
|
||||||
|
@ -353,6 +360,12 @@ static void rf_rx_stop(void)
|
||||||
|
|
||||||
sleep_us(10);
|
sleep_us(10);
|
||||||
|
|
||||||
|
dma_channel_clear_chain_to(dma_ch_rx1);
|
||||||
|
dma_channel_clear_chain_to(dma_ch_rx2);
|
||||||
|
dma_channel_clear_chain_to(dma_ch_mix1);
|
||||||
|
dma_channel_clear_chain_to(dma_ch_mix2);
|
||||||
|
dma_channel_clear_chain_to(dma_ch_samp_cos);
|
||||||
|
|
||||||
dma_channel_abort(dma_ch_rx1);
|
dma_channel_abort(dma_ch_rx1);
|
||||||
dma_channel_abort(dma_ch_rx2);
|
dma_channel_abort(dma_ch_rx2);
|
||||||
dma_channel_abort(dma_ch_mix1);
|
dma_channel_abort(dma_ch_mix1);
|
||||||
|
@ -592,6 +605,7 @@ done:
|
||||||
|
|
||||||
rf_rx_stop();
|
rf_rx_stop();
|
||||||
|
|
||||||
|
dma_channel_clear_chain_to(dma_ch_in_cos);
|
||||||
dma_channel_abort(dma_ch_in_cos);
|
dma_channel_abort(dma_ch_in_cos);
|
||||||
dma_channel_cleanup(dma_ch_in_cos);
|
dma_channel_cleanup(dma_ch_in_cos);
|
||||||
dma_channel_unclaim(dma_ch_in_cos);
|
dma_channel_unclaim(dma_ch_in_cos);
|
||||||
|
|
Loading…
Reference in a new issue