Skip to content

Commit

Permalink
Avoid allocating unneeded DMA channels
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Sep 15, 2014
1 parent bdd6750 commit e8cb489
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#endif

#include "DMAChannel.h"
#ifndef DMACHANNEL_HAS_BEGIN
#if !defined(DMACHANNEL_HAS_BEGIN) || !defined(DMACHANNEL_HAS_BOOLEAN_CTOR)
#error "You need to update DMAChannel.h & DMAChannel.cpp"
#error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.h"
#error "https://github.com/PaulStoffregen/cores/blob/master/teensy3/DMAChannel.cpp"
Expand Down
14 changes: 0 additions & 14 deletions examples/HardwareTesting/PassThroughMono/PassThroughMono.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ void loop() {
// Do nothing here. The Audio flows automatically

// When AudioInputAnalog is running, analogRead() must NOT be used.
delay(200);
Serial.print("PDB: SC=");
Serial.print(PDB0_SC, HEX);
Serial.print(", CONFIG=");
Serial.print(PDB_CONFIG, HEX);
Serial.print(", MOD=");
Serial.print(PDB0_MOD);
Serial.print(", IDLY=");
Serial.print(PDB0_IDLY);
Serial.print(", CH0C1=");
Serial.print(PDB0_CH0C1);
Serial.print(", DMA: ");
Serial.print(dma_channel_allocated_mask, HEX);
Serial.println();
}


2 changes: 1 addition & 1 deletion input_adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES];
audio_block_t * AudioInputAnalog::block_left = NULL;
uint16_t AudioInputAnalog::block_offset = 0;
bool AudioInputAnalog::update_responsibility = false;
DMAChannel AudioInputAnalog::dma;
DMAChannel AudioInputAnalog::dma(false);


AudioInputAnalog::AudioInputAnalog() : AudioStream(0, NULL)
Expand Down
2 changes: 1 addition & 1 deletion input_i2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ audio_block_t * AudioInputI2S::block_left = NULL;
audio_block_t * AudioInputI2S::block_right = NULL;
uint16_t AudioInputI2S::block_offset = 0;
bool AudioInputI2S::update_responsibility = false;
DMAChannel AudioInputI2S::dma;
DMAChannel AudioInputI2S::dma(false);


void AudioInputI2S::begin(void)
Expand Down
2 changes: 1 addition & 1 deletion output_dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DMAMEM static uint16_t dac_buffer[AUDIO_BLOCK_SAMPLES*2];
audio_block_t * AudioOutputAnalog::block_left_1st = NULL;
audio_block_t * AudioOutputAnalog::block_left_2nd = NULL;
bool AudioOutputAnalog::update_responsibility = false;
DMAChannel AudioOutputAnalog::dma;
DMAChannel AudioOutputAnalog::dma(false);

void AudioOutputAnalog::begin(void)
{
Expand Down
2 changes: 1 addition & 1 deletion output_i2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ uint16_t AudioOutputI2S::block_left_offset = 0;
uint16_t AudioOutputI2S::block_right_offset = 0;
bool AudioOutputI2S::update_responsibility = false;
DMAMEM static uint32_t i2s_tx_buffer[AUDIO_BLOCK_SAMPLES];
DMAChannel AudioOutputI2S::dma;
DMAChannel AudioOutputI2S::dma(false);

void AudioOutputI2S::begin(void)
{
Expand Down
2 changes: 1 addition & 1 deletion output_pwm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bool AudioOutputPWM::update_responsibility = false;
uint8_t AudioOutputPWM::interrupt_count = 0;

DMAMEM uint32_t pwm_dma_buffer[AUDIO_BLOCK_SAMPLES*2];
DMAChannel AudioOutputPWM::dma;
DMAChannel AudioOutputPWM::dma(false);

// TODO: this code assumes F_BUS is 48 MHz.
// supporting other speeds is not easy, but should be done someday
Expand Down

0 comments on commit e8cb489

Please sign in to comment.