Skip to content

Commit adef454

Browse files
committed
samd: audio dma: enable/disable supervisor tick as needed
1 parent 23ba58b commit adef454

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ports/atmel-samd/audio_dma.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include "shared-bindings/audiocore/RawSample.h"
3333
#include "shared-bindings/audiocore/WaveFile.h"
34+
#include "supervisor/shared/tick.h"
3435

3536
#include "py/mpstate.h"
3637
#include "py/runtime.h"
@@ -60,6 +61,7 @@ void audio_dma_free_channel(uint8_t channel) {
6061
assert(audio_dma_allocated[channel]);
6162
audio_dma_disable_channel(channel);
6263
audio_dma_allocated[channel] = false;
64+
supervisor_disable_tick();
6365
}
6466

6567
void audio_dma_disable_channel(uint8_t channel) {
@@ -71,6 +73,7 @@ void audio_dma_disable_channel(uint8_t channel) {
7173
void audio_dma_enable_channel(uint8_t channel) {
7274
if (channel >= AUDIO_DMA_CHANNEL_COUNT)
7375
return;
76+
supervisor_enable_tick();
7477
dma_enable_channel(channel);
7578
}
7679

@@ -318,6 +321,9 @@ void audio_dma_reset(void) {
318321
for (uint8_t i = 0; i < AUDIO_DMA_CHANNEL_COUNT; i++) {
319322
audio_dma_state[i] = NULL;
320323
audio_dma_pending[i] = false;
324+
if (audio_dma_allocated[i]) {
325+
supervisor_disable_tick();
326+
}
321327
audio_dma_allocated[i] = false;
322328
audio_dma_disable_channel(i);
323329
dma_descriptor(i)->BTCTRL.bit.VALID = false;

0 commit comments

Comments
 (0)