forked from PAWPAW-Mirror/lib_xua
Output functional in simple app. Issue at high volume. Still uses sc_i2c.
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
|
||||
/* A very simple example of a USB audio application (and as such is un-verified)
|
||||
*
|
||||
/* A very simple *example* of a USB audio application (and as such is un-verified for production)
|
||||
*
|
||||
* It uses the main blocks from the lib_xua
|
||||
*
|
||||
* - 2 in/ 2 out I2S only
|
||||
* - No DFU
|
||||
* - I2S only
|
||||
*
|
||||
*/
|
||||
|
||||
#include <xs1.h>
|
||||
@@ -11,26 +15,21 @@
|
||||
#include "xud_device.h"
|
||||
#include "xua.h"
|
||||
|
||||
/* Ports - note the defines come from the xn file */
|
||||
/* Port declarations. Note, the defines come from the xn file */
|
||||
buffered out port:32 p_i2s_dac[] = {PORT_I2S_DAC0}; /* I2S Data-line(s) */
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK; /* I2S Bit-clock */
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK; /* I2S L/R-clock */
|
||||
|
||||
/* I2S ports - Data-line, bit-clock and L/R clock */
|
||||
buffered out port:32 p_i2s_dac[] = {PORT_I2S_DAC0};
|
||||
buffered out port:32 p_lrclk = PORT_I2S_LRCLK;
|
||||
buffered out port:32 p_bclk = PORT_I2S_BCLK;
|
||||
port p_mclk_in = PORT_MCLK_IN; /* Audio master clock input */
|
||||
|
||||
/* Audio master-clock port */
|
||||
port p_mclk_in = PORT_MCLK_IN;
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT; /* Extra port for counting master clock ticks */
|
||||
|
||||
/* Port for counting master clocks */
|
||||
in port p_for_mclk_count = PORT_MCLK_COUNT;
|
||||
|
||||
/* Clock-blocks for master-clock and bit-clock */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4;
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5;
|
||||
/* Clock-block declarations */
|
||||
clock clk_audio_bclk = on tile[0]: XS1_CLKBLK_4; /* Bit clock */
|
||||
clock clk_audio_mclk = on tile[0]: XS1_CLKBLK_5; /* Master clock */
|
||||
|
||||
/* Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also
|
||||
* if the endpoint wishes to be informed of USB bus resets
|
||||
*/
|
||||
* if the endpoint wishes to be informed of USB bus resets */
|
||||
XUD_EpType epTypeTableOut[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
XUD_EpType epTypeTableIn[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO};
|
||||
|
||||
@@ -40,13 +39,18 @@ int main()
|
||||
chan c_ep_out[2];
|
||||
chan c_ep_in[2];
|
||||
|
||||
/* TODO handle this */
|
||||
chan c_aud_ctl;
|
||||
|
||||
/* Channel for communicating SOF notifications from XUD to the Buffering cores */
|
||||
chan c_sof;
|
||||
|
||||
/* Channel for audio data between buffering cores and audio IO core */
|
||||
chan c_aud;
|
||||
|
||||
/* Channel for communcating control messages from EP0 to the rest of the device (via the buffering cores */
|
||||
chan c_aud_ctl;
|
||||
|
||||
/* TODO handle this */
|
||||
interface audManage_if i_audMan;
|
||||
|
||||
par
|
||||
{
|
||||
@@ -61,31 +65,13 @@ int main()
|
||||
/* Note, since we are not using many features we pass in null for quite a few params.. */
|
||||
on tile[1]: XUA_Endpoint0(c_ep_out[0], c_ep_in[0], c_aud_ctl, null, null, null, null);
|
||||
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data from the audio I/O core */
|
||||
/* Buffering cores - handles audio data to/from EP's and gives/gets data to/from the audio I/O core */
|
||||
/* Note, this spawns two cores */
|
||||
on tile[1]: XUA_Buffer(c_ep_out[1], c_ep_in[1], c_sof, c_aud_ctl, p_for_mclk_count, c_aud);
|
||||
|
||||
|
||||
#if 0
|
||||
/* Audio I/o core i.e. I2S */
|
||||
on tile[1]: audio(AUDIO_CHANNEL,
|
||||
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
c_spdif_tx,
|
||||
#endif
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
c_dig_rx,
|
||||
#endif
|
||||
c_aud_cfg, c_adc
|
||||
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0)
|
||||
, dfuInterface
|
||||
#endif
|
||||
#if (NUM_PDM_MICS > 0)
|
||||
, c_pdm_pcm
|
||||
#endif
|
||||
, i_audMan
|
||||
);
|
||||
#endif
|
||||
}
|
||||
/* IOHub core does most of the audio IO i.e. I2S (also serves as a hub for all audio) */
|
||||
on tile[0]: XUA_AudioHub(c_aud, i_audMan);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user