samd: audio_dma_stop: Clear out audio_dma_state[]
As identified in #1908, when both AudioOut and PDMIn are used, hard locks can occur. Because audio_dma_stop didn't clear audio_dma_state[], a future call to audio_dma_load_next_block could occur using a DMA object which belongs to PDMIn. I believe that this Closes: #1908 though perhaps it is still not the full story. Testing performed: Loaded a sketch similar to the one on #1908 that tends to reproduce the bug within ~30s. Ran for >300s without hard lock. HOWEVER, while my cpx is no longer hard locking, it occasionally (<1 / 200s) announces Code done running. Waiting for reload. (and does so), even though my main loop is surrounded by a 'while True:' condition, so there are still gremlins nearby.
This commit is contained in:
parent
47a0b7cba1
commit
6253f11503
@ -261,6 +261,7 @@ void audio_dma_stop(audio_dma_t* dma) {
|
|||||||
dma_disable_channel(dma->dma_channel);
|
dma_disable_channel(dma->dma_channel);
|
||||||
disable_event_channel(dma->event_channel);
|
disable_event_channel(dma->event_channel);
|
||||||
MP_STATE_PORT(playing_audio)[dma->dma_channel] = NULL;
|
MP_STATE_PORT(playing_audio)[dma->dma_channel] = NULL;
|
||||||
|
audio_dma_state[dma->dma_channel] = NULL;
|
||||||
|
|
||||||
dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT;
|
dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user