All instances of i_dsp guarded by RUN_DSP_TASK

This commit is contained in:
Ross Owen
2016-04-22 17:23:37 +01:00
parent bcdc690d0d
commit c4d4505e83
4 changed files with 62 additions and 13 deletions

View File

@@ -226,12 +226,19 @@ static inline void TransferAdatTxSamples(chanend c_adat_out, const unsigned samp
/* sampsFromUsbToAudio: The sample frame the device has recived from the host and is going to play to the output audio interfaces */ /* sampsFromUsbToAudio: The sample frame the device has recived from the host and is going to play to the output audio interfaces */
/* sampsFromAudioToUsb: The sample frame that was received from the audio interfaces and that the device is going to send to the host */ /* sampsFromAudioToUsb: The sample frame that was received from the audio interfaces and that the device is going to send to the host */
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[], client dsp_if i_dsp); void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
);
#pragma unsafe arrays #pragma unsafe arrays
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord, client dsp_if i_dsp) static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
)
{ {
outuint(c_out, underflowWord); outuint(c_out, underflowWord);
/* Check for sample freq change (or other command) or new samples from mixer*/ /* Check for sample freq change (or other command) or new samples from mixer*/
@@ -273,7 +280,11 @@ static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, con
inuint(c_out); inuint(c_out);
#endif #endif
UserBufferManagement(samplesOut, samplesIn[readBuffNo], i_dsp); UserBufferManagement(samplesOut, samplesIn[readBuffNo]
#ifdef RUN_DSP_TASK
, i_dsp
#endif
);
#if NUM_USB_CHAN_IN > 0 #if NUM_USB_CHAN_IN > 0
#pragma loop unroll #pragma loop unroll
@@ -435,8 +446,11 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
chanend c_pdm_pcm, chanend c_pdm_pcm,
#endif #endif
chanend ?unused, chanend ?unused
client dsp_if i_dsp) #ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
)
{ {
/* Since DAC and ADC buffered ports off by one sample we buffer previous ADC frame */ /* Since DAC and ADC buffered ports off by one sample we buffer previous ADC frame */
@@ -473,7 +487,12 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
} }
#endif #endif
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord, i_dsp); unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
);
#ifdef ADAT_TX #ifdef ADAT_TX
unsafe{ unsafe{
//TransferAdatTxSamples(c_adat_out, samplesOut, adatSmuxMode, 0); //TransferAdatTxSamples(c_adat_out, samplesOut, adatSmuxMode, 0);
@@ -803,9 +822,17 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
/* The below looks a bit odd but forces the compiler to inline twice */ /* The below looks a bit odd but forces the compiler to inline twice */
unsigned command; unsigned command;
if(readBuffNo) if(readBuffNo)
command = DoSampleTransfer(c_out, 1, underflowWord, i_dsp); command = DoSampleTransfer(c_out, 1, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
);
else else
command = DoSampleTransfer(c_out, 0, underflowWord, i_dsp); command = DoSampleTransfer(c_out, 0, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
);
if(command) if(command)
@@ -918,7 +945,9 @@ chanend ?c_config, chanend ?c
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_in , chanend c_pdm_in
#endif #endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp , client dsp_if i_dsp
#endif
) )
{ {
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE) #if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
@@ -1161,7 +1190,11 @@ chanend ?c_config, chanend ?c
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
c_pdm_in, c_pdm_in,
#endif #endif
null, i_dsp); null
#ifdef RUN_DSP_TASK
, i_dsp
#endif
);
if(command == SET_SAMPLE_FREQ) if(command == SET_SAMPLE_FREQ)
{ {

View File

@@ -1,9 +1,18 @@
#include "xccompat.h" #include "xccompat.h"
#include "devicedefines.h"
/* Default implentation for UserBufferManagement() */ /* Default implentation for UserBufferManagement() */
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[], unsigned i_dsp) __attribute__ ((weak)); void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[], unsigned i_dsp) #ifdef RUN_DSP_TASK
, unsigned i_dsp
#endif
) __attribute__ ((weak));
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]
#ifdef RUN_DSP_TASK
, unsigned i_dsp
#endif
)
{ {
/* Do nothing */ /* Do nothing */
} }

View File

@@ -31,7 +31,9 @@ void audio(chanend c_in,
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_in , chanend c_pdm_in
#endif #endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp , client dsp_if i_dsp
#endif
); );
void SpdifTxWrapper(chanend c_spdif_tx); void SpdifTxWrapper(chanend c_spdif_tx);

View File

@@ -419,7 +419,9 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, chanend c_pdm_pcm , chanend c_pdm_pcm
#endif #endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp , client dsp_if i_dsp
#endif
) )
{ {
#ifdef MIXER #ifdef MIXER
@@ -463,7 +465,9 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, c_pdm_pcm , c_pdm_pcm
#endif #endif
#ifdef RUN_DSP_TASK
, i_dsp , i_dsp
#endif
); );
} }
@@ -606,8 +610,9 @@ int main()
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
, c_pdm_pcm , c_pdm_pcm
#endif #endif
#ifdef RUN_DSP_TASK
, i_dsp , i_dsp
#endif
); );
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)