Initial work to move DSP location

This commit is contained in:
Ross Owen
2016-05-17 11:06:19 +01:00
parent 563763bceb
commit 702e7a7e1f
4 changed files with 72 additions and 48 deletions

View File

@@ -29,12 +29,16 @@
#endif
#endif
#include "xua_audio.h"
#include "commands.h"
#include "xc_ptr.h"
#ifdef RUN_DSP_TASK
#include "xua_dsp.h"
#endif
//#ifdef RUN_DSP_TASK
//#include "xua_dsp.h"
//#endif
/* TODO 32 is max expected channels */
static unsigned samplesOut[32];
@@ -227,16 +231,16 @@ 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 */
/* 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[]
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
);
#pragma unsafe arrays
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
)
{
outuint(c_out, underflowWord);
@@ -281,9 +285,9 @@ static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, con
#endif
UserBufferManagement(samplesOut, samplesIn[readBuffNo]
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
#if NUM_USB_CHAN_IN > 0
@@ -447,9 +451,9 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
chanend c_pdm_pcm,
#endif
chanend ?unused
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
)
{
@@ -488,9 +492,9 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
#endif
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
#ifdef ADAT_TX
@@ -823,15 +827,15 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
unsigned command;
if(readBuffNo)
command = DoSampleTransfer(c_out, 1, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
else
command = DoSampleTransfer(c_out, 0, underflowWord
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
@@ -945,9 +949,9 @@ chanend ?c_config, chanend ?c
#if (NUM_PDM_MICS > 0)
, chanend c_pdm_in
#endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
)
{
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
@@ -1191,9 +1195,9 @@ chanend ?c_config, chanend ?c
c_pdm_in,
#endif
null
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
if(command == SET_SAMPLE_FREQ)

View File

@@ -1,9 +1,24 @@
#ifndef __audio_h__
#define __audio_h__
#include "devicedefines.h"
//#include "devicedefines.h"
#include "dfu_interface.h"
#include "xua_dsp.h"
//#include "xua_dsp.h"
typedef interface audManage_if
{
[[guarded]]
void transfer_buffers(int * unsafe in_aud_buf, int * unsafe in_usb_buf,
int * unsafe out_usb_buf, int * unsafe out_aud_buf);
[[guarded]]
void transfer_samples(int in_mic_buf[], int in_spk_buf[], int out_mic_buf[], int out_spk_buf[]);
} audManage_if;
/** The audio driver thread.
*
@@ -31,9 +46,9 @@ void audio(chanend c_in,
#if (NUM_PDM_MICS > 0)
, chanend c_pdm_in
#endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
);
void SpdifTxWrapper(chanend c_spdif_tx);

View File

@@ -9,6 +9,10 @@ typedef interface dsp_if
[[guarded]]
void transfer_buffers(int * unsafe in_aud_buf, int * unsafe in_usb_buf,
int * unsafe out_usb_buf, int * unsafe out_aud_buf);
[[guarded]]
void transfer_samples(int in_mic_buf[], int in_spk_buf[], int out_mic_buf[], int out_spk_buf[]);
} dsp_if;

View File

@@ -419,9 +419,9 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
#if (NUM_PDM_MICS > 0)
, chanend c_pdm_pcm
#endif
#ifdef RUN_DSP_TASK
, client dsp_if i_dsp
#endif
//#ifdef RUN_DSP_TASK
, client audManage_if i_audMan
//#endif
)
{
#ifdef MIXER
@@ -465,9 +465,9 @@ void usb_audio_io(chanend c_aud_in, chanend ?c_adc,
#if (NUM_PDM_MICS > 0)
, c_pdm_pcm
#endif
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
}
@@ -560,10 +560,11 @@ int main()
#endif
#endif
#ifdef RUN_DSP_TASK
interface dsp_if i_dsp;
interface dsp_ctrl_if i_dsp_ctrl[1]; // TODO NUM_DSP_CTRL_INTERFACES
#endif
//#ifdef RUN_DSP_TASK
//interface dsp_if i_dsp;
//interface dsp_ctrl_if i_dsp_ctrl[1]; // TODO NUM_DSP_CTRL_INTERFACES
interface audManage_if i_audMan;
//#endif
USER_MAIN_DECLARATIONS
par
@@ -610,9 +611,9 @@ int main()
#if (NUM_PDM_MICS > 0)
, c_pdm_pcm
#endif
#ifdef RUN_DSP_TASK
, i_dsp
#endif
//#ifdef RUN_DSP_TASK
, i_audMan
//#endif
);
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)