Browse Source

Fix compile errors on Teensy LC

dds
PaulStoffregen 4 years ago
parent
commit
7179fcee28
6 changed files with 17 additions and 10 deletions
  1. +2
    -0
      output_pt8211.cpp
  2. +5
    -9
      output_spdif.cpp
  3. +2
    -0
      output_tdm.cpp
  4. +4
    -0
      synth_karplusstrong.cpp
  5. +2
    -1
      synth_simple_drum.cpp
  6. +2
    -0
      synth_wavetable.cpp

+ 2
- 0
output_pt8211.cpp View File

@@ -113,7 +113,9 @@ void AudioOutputPT8211::isr(void)
audio_block_t *blockL, *blockR;
uint32_t saddr, offsetL, offsetR;

#if defined(KINETISK) || defined(__IMXRT1062__)
saddr = (uint32_t)(dma.TCD->SADDR);
#endif
dma.clearInterrupt();
if (saddr < (uint32_t)i2s_tx_buffer + sizeof(i2s_tx_buffer) / 2) {
// DMA is transmitting the first half of the buffer

+ 5
- 9
output_spdif.cpp View File

@@ -39,8 +39,7 @@ extern uint16_t spdif_bmclookup[256];
DMAMEM __attribute__((aligned(32)))
static uint32_t SPDIF_tx_buffer[AUDIO_BLOCK_SAMPLES * 4]; //2 KB


#if defined(KINETISK) || defined(__IMXRT1052__) || defined(__IMXRT1062__)
#if defined(KINETISK) || defined(__IMXRT1062__)

#define PREAMBLE_B (0xE8) //11101000
#define PREAMBLE_M (0xE2) //11100010
@@ -51,7 +50,6 @@ static uint32_t SPDIF_tx_buffer[AUDIO_BLOCK_SAMPLES * 4]; //2 KB

uint32_t AudioOutputSPDIF::vucp = VUCP_VALID;

#endif

FLASHMEM
void AudioOutputSPDIF::begin(void)
@@ -86,14 +84,9 @@ void AudioOutputSPDIF::begin(void)

I2S0_TCSR |= I2S_TCSR_TE | I2S_TCSR_BCE | I2S_TCSR_FRDE | I2S_TCSR_FR;
dma.attachInterrupt(isr);
#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)

#if defined(__IMXRT1052__)
CORE_PIN6_CONFIG = 3; //1:TX_DATA0
#elif defined(__IMXRT1062__)
CORE_PIN7_CONFIG = 3; //1:TX_DATA0
#endif
const int nbytes_mlno = 2 * 4; // 8 Bytes per minor loop

dma.TCD->SADDR = SPDIF_tx_buffer;
@@ -138,7 +131,9 @@ void AudioOutputSPDIF::isr(void)
uint32_t saddr, offset;
uint16_t sample, lo, hi, aux;

#if defined(KINETISK) || defined(__IMXRT1062__)
saddr = (uint32_t)(dma.TCD->SADDR);
#endif
dma.clearInterrupt();
if (saddr < (uint32_t)SPDIF_tx_buffer + sizeof(SPDIF_tx_buffer) / 2) {
// DMA is transmitting the first half of the buffer
@@ -386,7 +381,7 @@ void AudioOutputSPDIF::config_SPDIF(void)
CORE_PIN11_CONFIG = PORT_PCR_MUX(6); // pin 11, PTC6, I2S0_MCLK 11.43MHz
#endif

#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)
#elif defined(__IMXRT1062__)

CCM_CCGR5 |= CCM_CCGR5_SAI1(CCM_CCGR_ON);
//PLL:
@@ -443,6 +438,7 @@ void AudioOutputSPDIF::config_SPDIF(void)
#endif
}

#endif // KINETISK || __IMXRT1062__

#if defined(KINETISL)


+ 2
- 0
output_tdm.cpp View File

@@ -131,7 +131,9 @@ void AudioOutputTDM::isr(void)
const uint32_t *src1, *src2;
uint32_t i, saddr;

#if defined(KINETISK) || defined(__IMXRT1062__)
saddr = (uint32_t)(dma.TCD->SADDR);
#endif
dma.clearInterrupt();
if (saddr < (uint32_t)tdm_tx_buffer + sizeof(tdm_tx_buffer) / 2) {
// DMA is transmitting the first half of the buffer

+ 4
- 0
synth_karplusstrong.cpp View File

@@ -27,6 +27,7 @@
#include <Arduino.h>
#include "synth_karplusstrong.h"

#if defined(KINETISK) || defined(__IMXRT1062__)
static uint32_t pseudorand(uint32_t lo)
{
uint32_t hi;
@@ -38,10 +39,12 @@ static uint32_t pseudorand(uint32_t lo)
lo = (lo & 0x7FFFFFFF) + (lo >> 31);
return lo;
}
#endif


void AudioSynthKarplusStrong::update(void)
{
#if defined(KINETISK) || defined(__IMXRT1062__)
audio_block_t *block;

if (state == 0) return;
@@ -82,6 +85,7 @@ void AudioSynthKarplusStrong::update(void)

transmit(block);
release(block);
#endif
}



+ 2
- 1
synth_simple_drum.cpp View File

@@ -109,6 +109,7 @@ void AudioSynthSimpleDrum::pitchMod(float depth)

void AudioSynthSimpleDrum::update(void)
{
#if defined(KINETISK) || defined(__IMXRT1062__)
audio_block_t *block_wav;
int16_t *p_wave, *end;
int32_t sin_l, sin_r, interp, mod, mod2, delta;
@@ -204,6 +205,6 @@ void AudioSynthSimpleDrum::update(void)

transmit(block_wav, 0);
release(block_wav);
#endif
}


+ 2
- 0
synth_wavetable.cpp View File

@@ -164,6 +164,7 @@ void AudioSynthWavetable::setFrequency(float freq) {
*
*/
void AudioSynthWavetable::update(void) {
#if defined(KINETISK) || defined(__IMXRT1062__)
// exit if nothing to do
if (env_state == STATE_IDLE || (current_sample->LOOP == false && tone_phase >= current_sample->MAX_PHASE)) {
env_state = STATE_IDLE;
@@ -420,4 +421,5 @@ void AudioSynthWavetable::update(void) {

transmit(block);
release(block);
#endif
}

Loading…
Cancel
Save