forked from PAWPAW-Mirror/lib_xua
Initial work to move DSP location
This commit is contained in:
@@ -29,12 +29,16 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "xua_audio.h"
|
||||||
|
|
||||||
#include "commands.h"
|
#include "commands.h"
|
||||||
#include "xc_ptr.h"
|
#include "xc_ptr.h"
|
||||||
|
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
#include "xua_dsp.h"
|
//#include "xua_dsp.h"
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* TODO 32 is max expected channels */
|
/* TODO 32 is max expected channels */
|
||||||
static unsigned samplesOut[32];
|
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 */
|
/* 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[]
|
void UserBufferManagement(unsigned sampsFromUsbToAudio[], unsigned sampsFromAudioToUsb[]
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#pragma unsafe arrays
|
#pragma unsafe arrays
|
||||||
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord
|
static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, const unsigned underflowWord
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
outuint(c_out, underflowWord);
|
outuint(c_out, underflowWord);
|
||||||
@@ -281,9 +285,9 @@ static inline unsigned DoSampleTransfer(chanend c_out, const int readBuffNo, con
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
UserBufferManagement(samplesOut, samplesIn[readBuffNo]
|
UserBufferManagement(samplesOut, samplesIn[readBuffNo]
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#if NUM_USB_CHAN_IN > 0
|
#if NUM_USB_CHAN_IN > 0
|
||||||
@@ -447,9 +451,9 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
chanend c_pdm_pcm,
|
chanend c_pdm_pcm,
|
||||||
#endif
|
#endif
|
||||||
chanend ?unused
|
chanend ?unused
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -488,9 +492,9 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord
|
unsigned command = DoSampleTransfer(c_out, readBuffNo, underflowWord
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ADAT_TX
|
#ifdef ADAT_TX
|
||||||
@@ -823,15 +827,15 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
unsigned command;
|
unsigned command;
|
||||||
if(readBuffNo)
|
if(readBuffNo)
|
||||||
command = DoSampleTransfer(c_out, 1, underflowWord
|
command = DoSampleTransfer(c_out, 1, underflowWord
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
command = DoSampleTransfer(c_out, 0, underflowWord
|
command = DoSampleTransfer(c_out, 0, underflowWord
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -945,9 +949,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
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
|
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
|
||||||
@@ -1191,9 +1195,9 @@ chanend ?c_config, chanend ?c
|
|||||||
c_pdm_in,
|
c_pdm_in,
|
||||||
#endif
|
#endif
|
||||||
null
|
null
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
if(command == SET_SAMPLE_FREQ)
|
if(command == SET_SAMPLE_FREQ)
|
||||||
|
|||||||
@@ -1,9 +1,24 @@
|
|||||||
#ifndef __audio_h__
|
#ifndef __audio_h__
|
||||||
#define __audio_h__
|
#define __audio_h__
|
||||||
|
|
||||||
#include "devicedefines.h"
|
//#include "devicedefines.h"
|
||||||
#include "dfu_interface.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.
|
/** The audio driver thread.
|
||||||
*
|
*
|
||||||
@@ -31,9 +46,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
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
void SpdifTxWrapper(chanend c_spdif_tx);
|
void SpdifTxWrapper(chanend c_spdif_tx);
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ typedef interface dsp_if
|
|||||||
[[guarded]]
|
[[guarded]]
|
||||||
void transfer_buffers(int * unsafe in_aud_buf, int * unsafe in_usb_buf,
|
void transfer_buffers(int * unsafe in_aud_buf, int * unsafe in_usb_buf,
|
||||||
int * unsafe out_usb_buf, int * unsafe out_aud_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;
|
} dsp_if;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -419,9 +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
|
//#ifdef RUN_DSP_TASK
|
||||||
, client dsp_if i_dsp
|
, client audManage_if i_audMan
|
||||||
#endif
|
//#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef MIXER
|
#ifdef MIXER
|
||||||
@@ -465,9 +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
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,10 +560,11 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RUN_DSP_TASK
|
//#ifdef RUN_DSP_TASK
|
||||||
interface dsp_if i_dsp;
|
//interface dsp_if i_dsp;
|
||||||
interface dsp_ctrl_if i_dsp_ctrl[1]; // TODO NUM_DSP_CTRL_INTERFACES
|
//interface dsp_ctrl_if i_dsp_ctrl[1]; // TODO NUM_DSP_CTRL_INTERFACES
|
||||||
#endif
|
interface audManage_if i_audMan;
|
||||||
|
//#endif
|
||||||
|
|
||||||
USER_MAIN_DECLARATIONS
|
USER_MAIN_DECLARATIONS
|
||||||
par
|
par
|
||||||
@@ -610,9 +611,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
|
//#ifdef RUN_DSP_TASK
|
||||||
, i_dsp
|
, i_audMan
|
||||||
#endif
|
//#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||||
|
|||||||
Reference in New Issue
Block a user