From d012b952e97f687b5276940d5ef059db72d146ce Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Fri, 26 Jun 2020 22:42:43 -0700 Subject: [PATCH] Fix PT8211 on Teensy 4.x --- output_pt8211.cpp | 5 ++++- output_pt8211_2.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/output_pt8211.cpp b/output_pt8211.cpp index 02be2668..93e73c1a 100644 --- a/output_pt8211.cpp +++ b/output_pt8211.cpp @@ -109,7 +109,7 @@ void AudioOutputPT8211::begin(void) void AudioOutputPT8211::isr(void) { - int16_t *dest; + int16_t *dest, *dest_copy; audio_block_t *blockL, *blockR; uint32_t saddr, offsetL, offsetR; @@ -129,6 +129,7 @@ void AudioOutputPT8211::isr(void) // so we must fill the first half dest = (int16_t *)i2s_tx_buffer; } + dest_copy = dest; blockL = AudioOutputPT8211::block_left_1st; blockR = AudioOutputPT8211::block_right_1st; @@ -343,6 +344,8 @@ void AudioOutputPT8211::isr(void) return; } + arm_dcache_flush_delete(dest_copy, sizeof(i2s_tx_buffer) / 2); + if (offsetL < AUDIO_BLOCK_SAMPLES) { AudioOutputPT8211::block_left_offset = offsetL; } else { diff --git a/output_pt8211_2.cpp b/output_pt8211_2.cpp index 7b2f45c4..54357bef 100644 --- a/output_pt8211_2.cpp +++ b/output_pt8211_2.cpp @@ -80,7 +80,7 @@ void AudioOutputPT8211_2::begin(void) void AudioOutputPT8211_2::isr(void) { - int16_t *dest; + int16_t *dest, *dest_copy; audio_block_t *blockL, *blockR; uint32_t saddr, offsetL, offsetR; @@ -100,6 +100,7 @@ void AudioOutputPT8211_2::isr(void) // so we must fill the first half dest = (int16_t *)i2s_tx_buffer; } + dest_copy = dest; blockL = AudioOutputPT8211_2::block_left_1st; blockR = AudioOutputPT8211_2::block_right_1st; @@ -314,6 +315,8 @@ void AudioOutputPT8211_2::isr(void) return; } + arm_dcache_flush_delete(dest_copy, sizeof(i2s_tx_buffer) / 2); + if (offsetL < AUDIO_BLOCK_SAMPLES) { AudioOutputPT8211_2::block_left_offset = offsetL; } else {