Merge branch 'master' of github.com:xmos/lib_xua

This commit is contained in:
xross
2018-01-08 11:38:38 +00:00
11 changed files with 101 additions and 73 deletions

View File

@@ -22,7 +22,7 @@
* CODEC configuration functions. * CODEC configuration functions.
*/ */
void XUA_AudioHub(chanend ?c_aud void XUA_AudioHub(chanend ?c_aud
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, chanend c_spdif_tx , chanend c_spdif_tx
#endif #endif
#if(defined(SPDIF_RX) || defined(ADAT_RX)) #if(defined(SPDIF_RX) || defined(ADAT_RX))

View File

@@ -299,13 +299,8 @@
/** /**
* @brief Enables SPDIF Tx. Default: 0 (Disabled) * @brief Enables SPDIF Tx. Default: 0 (Disabled)
*/ */
#ifndef SPDIF_TX #ifndef XUA_SPDIF_TX_EN
#define SPDIF_TX (0) #define XUA_SPDIF_TX_EN (0)
#endif
/* Tidy up old SPDIF usage */
#if defined(SPDIF_TX) && (SPDIF_TX == 0)
#undef SPDIF_TX
#endif #endif
/** /**
@@ -412,10 +407,10 @@
* *
* Default: 1 (Enabled) * Default: 1 (Enabled)
*/ */
#if !defined(DFU) #if !defined(XUA_DFU_EN)
#define DFU (1) #define XUA_DFU_EN (1)
#elif defined(DFU) && (DFU == 0) #elif defined(XUA_DFU_EN) && (XUA_DFU_EN == 0)
#undef DFU #undef XUA_DFU_EN
#endif #endif
/** /**
@@ -521,21 +516,21 @@
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/ */
#ifndef BCD_DEVICE_J #ifndef BCD_DEVICE_J
#define BCD_DEVICE_J 1 #define BCD_DEVICE_J (1)
#endif #endif
/** /**
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/ */
#ifndef BCD_DEVICE_M #ifndef BCD_DEVICE_M
#define BCD_DEVICE_M 0 #define BCD_DEVICE_M (0)
#endif #endif
/** /**
* @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number.
*/ */
#ifndef BCD_DEVICE_N #ifndef BCD_DEVICE_N
#define BCD_DEVICE_N #define BCD_DEVICE_N (0)
#endif #endif
/** /**

17
lib_xua/doc/rst/index.rst Normal file
View File

@@ -0,0 +1,17 @@
.. include:: ../../../README.rst
XMOS USB Audio
==============
This document details the XMOS USB Audio Library. This library
enables the development of USB Audio devices on the XMOS xCORE architecture.
This document describes the structure of the library, its basic use
and resources required.
This document assumes familiarity with the XMOS xCORE architecture, the
Universal Serial Bus 2.0 Specification (and related specifications),
the XMOS tool chain and XC language.

View File

@@ -0,0 +1,2 @@
XMOSNEWSTYLE = 1
DOXYGEN_DIRS=../../api

View File

@@ -1,6 +1,6 @@
/** /**
* @file audio.xc * @file xua_audiohub.xc
* @brief XMOS L1/L2 USB 2,0 Audio Reference Design. Audio Functions. * @brief XMOS USB 2.0 Audio Reference Design. Audio Functions.
* @author Ross Owen, XMOS Semiconductor Ltd * @author Ross Owen, XMOS Semiconductor Ltd
* *
* This thread handles I2S and pars an additional SPDIF Tx thread. It forwards samples to the SPDIF Tx thread. * This thread handles I2S and pars an additional SPDIF Tx thread. It forwards samples to the SPDIF Tx thread.
@@ -19,7 +19,7 @@
#include "audioports.h" #include "audioports.h"
#include "audiohw.h" #include "audiohw.h"
#include "mic_array_conf.h" #include "mic_array_conf.h"
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN)
#include "SpdifTransmit.h" #include "SpdifTransmit.h"
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX
@@ -103,7 +103,7 @@ unsigned dsdMode = DSD_MODE_OFF;
extern unsafe port p_mclk_in; extern unsafe port p_mclk_in;
extern in port p_mclk_in2; extern in port p_mclk_in2;
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN)
extern buffered out port:32 p_spdif_tx; extern buffered out port:32 p_spdif_tx;
#endif #endif
@@ -113,9 +113,12 @@ extern buffered out port:32 p_adat_tx;
extern clock clk_audio_mclk; extern clock clk_audio_mclk;
extern clock clk_audio_bclk; extern clock clk_audio_bclk;
extern clock clk_mst_spd;
extern void device_reboot(void); #if XUA_SPDIF_TX_EN || defined(ADAT_TX)
extern clock clk_mst_spd;
#endif
//extern void device_reboot(void);
#define MAX_DIVIDE_48 (MCLK_48/MIN_FREQ_48/64) #define MAX_DIVIDE_48 (MCLK_48/MIN_FREQ_48/64)
#define MAX_DIVIDE_44 (MCLK_44/MIN_FREQ_44/64) #define MAX_DIVIDE_44 (MCLK_44/MIN_FREQ_44/64)
@@ -816,7 +819,7 @@ unsigned static deliver(chanend ?c_out, chanend ?c_spd_out
/* Request digital data (with prefill) */ /* Request digital data (with prefill) */
outuint(c_dig_rx, 0); outuint(c_dig_rx, 0);
#endif #endif
#if defined(SPDIF_TX) && (NUM_USB_CHAN_OUT > 0) #if (XUA_SPDIF_TX_EN) && (NUM_USB_CHAN_OUT > 0)
outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward sample to S/PDIF Tx thread */ outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward sample to S/PDIF Tx thread */
unsigned sample = samplesOut[SPDIF_TX_INDEX + 1]; unsigned sample = samplesOut[SPDIF_TX_INDEX + 1];
outuint(c_spd_out, sample); /* Forward sample to S/PDIF Tx thread */ outuint(c_spd_out, sample); /* Forward sample to S/PDIF Tx thread */
@@ -1023,7 +1026,7 @@ unsigned static deliver(chanend ?c_out, chanend ?c_spd_out
return 0; return 0;
} }
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
void SpdifTxWrapper(chanend c_spdif_tx) void SpdifTxWrapper(chanend c_spdif_tx)
{ {
unsigned portId; unsigned portId;
@@ -1102,11 +1105,11 @@ static void dummy_deliver(chanend ?c_out, unsigned &command)
} }
void XUA_AudioHub(chanend ?c_mix_out void XUA_AudioHub(chanend ?c_mix_out
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
chanend c_spdif_out, , chanend c_spdif_out
#endif #endif
#if (defined(ADAT_RX) || defined(SPDIF_RX)) #if (defined(ADAT_RX) || defined(SPDIF_RX))
chanend c_dig_rx, , chanend c_dig_rx
#endif #endif
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1) #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
, server interface i_dfu ?dfuInterface , server interface i_dfu ?dfuInterface
@@ -1116,7 +1119,7 @@ chanend c_dig_rx,
#endif #endif
) )
{ {
#if defined (SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
chan c_spdif_out; chan c_spdif_out;
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX
@@ -1152,16 +1155,22 @@ chanend c_dig_rx,
#endif #endif
#ifdef ADAT_TX #ifdef ADAT_TX
/* Share SPDIF clk blk */ /* Share SPDIF clk blk */
configure_clock_src(clk_mst_spd, p_mclk_in); unsafe
{
configure_clock_src(clk_mst_spd, (port)p_mclk_in);
}
configure_out_port_no_ready(p_adat_tx, clk_mst_spd, 0); configure_out_port_no_ready(p_adat_tx, clk_mst_spd, 0);
set_clock_fall_delay(clk_mst_spd, 7); set_clock_fall_delay(clk_mst_spd, 7);
#ifndef SPDIF_TX #if (XUA_SPDIF_TX_EN == 0)
start_clock(clk_mst_spd); start_clock(clk_mst_spd);
#endif #endif
#endif #endif
/* Configure ADAT/SPDIF tx ports */ /* Configure ADAT/SPDIF tx ports */
#if defined(SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
SpdifTransmitPortConfig(p_spdif_tx, clk_mst_spd, p_mclk_in); unsafe
{
SpdifTransmitPortConfig(p_spdif_tx, clk_mst_spd, (port)p_mclk_in);
}
#endif #endif
/* Perform required CODEC/ADC/DAC initialisation */ /* Perform required CODEC/ADC/DAC initialisation */
@@ -1307,7 +1316,7 @@ chanend c_dig_rx,
par par
{ {
#if defined(SPDIF_TX) && (SPDIF_TX_TILE == AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE == AUDIO_IO_TILE)
{ {
set_thread_fast_mode_on(); set_thread_fast_mode_on();
SpdifTransmit(p_spdif_tx, c_spdif_out); SpdifTransmit(p_spdif_tx, c_spdif_out);
@@ -1321,7 +1330,7 @@ chanend c_dig_rx,
} }
#endif #endif
{ {
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN)
/* Communicate master clock and sample freq to S/PDIF thread */ /* Communicate master clock and sample freq to S/PDIF thread */
outuint(c_spdif_out, curSamFreq); outuint(c_spdif_out, curSamFreq);
outuint(c_spdif_out, mClk); outuint(c_spdif_out, mClk);
@@ -1346,7 +1355,7 @@ chanend c_dig_rx,
outuint(c_adat_out, adatSmuxMode); outuint(c_adat_out, adatSmuxMode);
#endif #endif
command = deliver(c_mix_out command = deliver(c_mix_out
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN)
, c_spdif_out , c_spdif_out
#else #else
, null , null
@@ -1379,7 +1388,7 @@ chanend c_dig_rx,
curSamRes_DAC = inuint(c_mix_out); curSamRes_DAC = inuint(c_mix_out);
} }
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
/* Currently no more audio will happen after this point */ /* Currently no more audio will happen after this point */
if ((curSamFreq / AUD_TO_USB_RATIO) == AUDIO_STOP_FOR_DFU) if ((curSamFreq / AUD_TO_USB_RATIO) == AUDIO_STOP_FOR_DFU)
{ {
@@ -1412,7 +1421,7 @@ chanend c_dig_rx,
#endif /* NO_USB */ #endif /* NO_USB */
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN)
/* Notify S/PDIF task of impending new freq... */ /* Notify S/PDIF task of impending new freq... */
outct(c_spdif_out, XS1_CT_END); outct(c_spdif_out, XS1_CT_END);
#endif #endif

View File

@@ -44,7 +44,7 @@ enum USBInterfaceNumber
#if defined(USB_CONTROL_DESCS) && (USB_CONTROL_DESCS != 0) #if defined(USB_CONTROL_DESCS) && (USB_CONTROL_DESCS != 0)
INTERFACE_NUMBER_MISC_CONTROL, INTERFACE_NUMBER_MISC_CONTROL,
#endif #endif
#if defined(DFU) && (DFU != 0) #if defined(XUA_DFU_EN) && (XUA_DFU_EN != 0)
INTERFACE_NUMBER_DFU, INTERFACE_NUMBER_DFU,
#endif #endif
#if defined(IAP) && (IAP != 0) #if defined(IAP) && (IAP != 0)

View File

@@ -11,6 +11,7 @@
#ifndef NO_USB #ifndef NO_USB
#include "xud_device.h" /* Standard descriptor requests */ #include "xud_device.h" /* Standard descriptor requests */
#include "dfu_types.h"
#include "usbaudio20.h" /* Defines from USB Audio 2.0 spec */ #include "usbaudio20.h" /* Defines from USB Audio 2.0 spec */
#include "xua_ep0_descriptors.h" /* This devices descriptors */ #include "xua_ep0_descriptors.h" /* This devices descriptors */
#include "commands.h" #include "commands.h"
@@ -52,8 +53,8 @@
#warning DFU_PID not defined, Using PID_AUDIO_2. This is probably fine! #warning DFU_PID not defined, Using PID_AUDIO_2. This is probably fine!
#endif #endif
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
#include "dfu.h" #include "xua_dfu.h"
#define DFU_IF_NUM INPUT_INTERFACES + OUTPUT_INTERFACES + MIDI_INTERFACES + 1 #define DFU_IF_NUM INPUT_INTERFACES + OUTPUT_INTERFACES + MIDI_INTERFACES + 1
extern void device_reboot(chanend); extern void device_reboot(chanend);
#endif #endif
@@ -281,7 +282,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
VendorAudioRequestsInit(c_audioControl, c_mix_ctl, c_clk_ctl); VendorAudioRequestsInit(c_audioControl, c_mix_ctl, c_clk_ctl);
#endif #endif
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
/* Check if device has started in DFU mode */ /* Check if device has started in DFU mode */
if (DFUReportResetState(null)) if (DFUReportResetState(null))
{ {
@@ -547,7 +548,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
//unsigned request = (sp.bmRequestType.Recipient ) | (sp.bmRequestType.Type << 5); //unsigned request = (sp.bmRequestType.Recipient ) | (sp.bmRequestType.Type << 5);
/* TODO Check on return value retval = */ /* TODO Check on return value retval = */
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
unsigned DFU_IF = INTERFACE_NUMBER_DFU; unsigned DFU_IF = INTERFACE_NUMBER_DFU;
/* DFU interface number changes based on which mode we are currently running in */ /* DFU interface number changes based on which mode we are currently running in */
@@ -587,7 +588,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
* - Audio endpoint request (Audio 1.0 Sampling freq requests are sent to the endpoint) * - Audio endpoint request (Audio 1.0 Sampling freq requests are sent to the endpoint)
*/ */
if(((interfaceNum == 0) || (interfaceNum == 1) || (interfaceNum == 2)) if(((interfaceNum == 0) || (interfaceNum == 1) || (interfaceNum == 2))
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
&& !DFU_mode_active && !DFU_mode_active
#endif #endif
) )
@@ -639,7 +640,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
if(result == XUD_RES_ERR) if(result == XUD_RES_ERR)
{ {
#ifdef DFU #if (XUA_DFU_EN == 1)
if (!DFU_mode_active) if (!DFU_mode_active)
{ {
#endif #endif
@@ -750,8 +751,9 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
cfgDesc_Null, sizeof(cfgDesc_Null), cfgDesc_Null, sizeof(cfgDesc_Null),
(char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed); (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed);
#endif #endif
#if (XUA_DFU_EN == 1)
} }
#if (XUA_DFU == 1)
else else
{ {
/* Running in DFU mode - always return same descs for DFU whether HS or FS */ /* Running in DFU mode - always return same descs for DFU whether HS or FS */
@@ -776,7 +778,7 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
g_curStreamAlt_Out = 0; g_curStreamAlt_Out = 0;
g_curStreamAlt_In = 0; g_curStreamAlt_In = 0;
#if (XUA_DFU == 1) #if (XUA_DFU_EN == 1)
if (DFUReportResetState(null)) if (DFUReportResetState(null))
{ {
if (!DFU_mode_active) if (!DFU_mode_active)

View File

@@ -1,5 +1,5 @@
#include "xua.h" #include "xua.h"
#if (XUD_DFU == 1) #if (XUA_DFU_EN == 1)
#include "uac_hwresources.h" #include "uac_hwresources.h"
#include <xs1.h> #include <xs1.h>
#include <xclib.h> #include <xclib.h>

View File

@@ -137,7 +137,7 @@ unsafe
on tile[XUD_TILE] : in port p_for_mclk_count = PORT_MCLK_COUNT; on tile[XUD_TILE] : in port p_for_mclk_count = PORT_MCLK_COUNT;
#endif #endif
#ifdef SPDIF_TX #if (XUA_SPDIF_TX_EN == 1)
on tile[SPDIF_TX_TILE] : buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT; on tile[SPDIF_TX_TILE] : buffered out port:32 p_spdif_tx = PORT_SPDIF_OUT;
#endif #endif
@@ -177,7 +177,7 @@ clock clk_pdm = on tile[PDM_TILE]:
on tile[MIDI_TILE] : clock clk_midi = CLKBLK_MIDI; on tile[MIDI_TILE] : clock clk_midi = CLKBLK_MIDI;
#endif #endif
#if defined(SPDIF_TX) || defined(ADAT_TX) #if XUA_SPDIF_TX_EN || defined(ADAT_TX)
on tile[SPDIF_TX_TILE] : clock clk_mst_spd = CLKBLK_SPDIF_TX; on tile[SPDIF_TX_TILE] : clock clk_mst_spd = CLKBLK_SPDIF_TX;
#endif #endif
@@ -371,7 +371,10 @@ VENDOR_REQUESTS_PARAMS_DEC_
#endif #endif
//:buffer //:buffer
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/ XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
#if (NUM_USB_CHAN_IN > 0)
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */ c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
#endif
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */ c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
#endif #endif
@@ -423,7 +426,7 @@ VENDOR_REQUESTS_PARAMS_DEC_
#endif /* NO_USB */ #endif /* NO_USB */
void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc, void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
chanend c_spdif_tx, chanend c_spdif_tx,
#endif #endif
#ifdef MIXER #ifdef MIXER
@@ -433,7 +436,7 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
chanend ?c_adat_rx, chanend ?c_adat_rx,
chanend ?c_clk_ctl, chanend ?c_clk_ctl,
chanend ?c_clk_int chanend ?c_clk_int
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
, server interface i_dfu ?dfuInterface , server interface i_dfu ?dfuInterface
#endif #endif
#if (NUM_PDM_MICS > 0) #if (NUM_PDM_MICS > 0)
@@ -469,11 +472,11 @@ void usb_audio_io(chanend ?c_aud_in, chanend ?c_adc,
#define AUDIO_CHANNEL c_aud_in #define AUDIO_CHANNEL c_aud_in
#endif #endif
XUA_AudioHub(AUDIO_CHANNEL XUA_AudioHub(AUDIO_CHANNEL
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
c_spdif_tx, , c_spdif_tx
#endif #endif
#if defined(SPDIF_RX) || defined(ADAT_RX) #if defined(SPDIF_RX) || defined(ADAT_RX)
c_dig_rx, , c_dig_rx
#endif #endif
#if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1) #if (XUD_TILE != 0) && (AUDIO_IO_TILE == 0) && (XUA_DFU_EN == 1)
, dfuInterface , dfuInterface
@@ -545,7 +548,7 @@ int main()
#define c_adat_rx null #define c_adat_rx null
#endif #endif
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
chan c_spdif_tx; chan c_spdif_tx;
#endif #endif
@@ -558,7 +561,7 @@ int main()
#define c_clk_ctl null #define c_clk_ctl null
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
interface i_dfu dfuInterface; interface i_dfu dfuInterface;
#else #else
#define dfuInterface null #define dfuInterface null
@@ -583,7 +586,7 @@ int main()
{ {
#if (XUD_TILE == 0) #if (XUD_TILE == 0)
/* Check if USB is on the flash tile (tile 0) */ /* Check if USB is on the flash tile (tile 0) */
#ifdef DFU #if (XUA_DFU_EN == 1)
[[distribute]] [[distribute]]
DFUHandler(dfuInterface, null); DFUHandler(dfuInterface, null);
#endif #endif
@@ -617,7 +620,7 @@ int main()
p_mclk_in = p_mclk_in_; p_mclk_in = p_mclk_in_;
} }
usb_audio_io(c_mix_out, c_adc usb_audio_io(c_mix_out, c_adc
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
, c_spdif_tx , c_spdif_tx
#endif #endif
#ifdef MIXER #ifdef MIXER
@@ -633,7 +636,7 @@ int main()
); );
} }
#if defined(SPDIF_TX) && (SPDIF_TX_TILE != AUDIO_IO_TILE) #if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
on tile[SPDIF_TX_TILE]: on tile[SPDIF_TX_TILE]:
{ {
thread_speed(); thread_speed();

View File

@@ -76,7 +76,7 @@ void pdm_buffer(streaming chanend c_ds_output[2], chanend c_audio)
mic_array_frame_time_domain * unsafe current; mic_array_frame_time_domain * unsafe current;
mic_array_decimator_config_t dc[2]; mic_array_decimator_config_t dc[2];
/* Get initial sample-rate and compute decimation factor */ /* Get initial sample-rate to run this thread at and compute decimation factor */
c_audio :> samplerate; c_audio :> samplerate;
unsigned decimationfactor = 96000/samplerate; unsigned decimationfactor = 96000/samplerate;

View File

@@ -60,7 +60,7 @@ typedef struct
STR_TABLE_ENTRY(adatClockSourceStr); /* iClockSource for external S/PDIF clock */ STR_TABLE_ENTRY(adatClockSourceStr); /* iClockSource for external S/PDIF clock */
#endif #endif
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
STR_TABLE_ENTRY(dfuStr); /* iInterface for DFU interface */ STR_TABLE_ENTRY(dfuStr); /* iInterface for DFU interface */
#endif #endif
#ifdef USB_CONTROL_DESCS #ifdef USB_CONTROL_DESCS
@@ -333,7 +333,7 @@ StringDescTable_t g_strTable =
.adatClockSourceStr = APPEND_VENDOR_STR(ADAT Clock), .adatClockSourceStr = APPEND_VENDOR_STR(ADAT Clock),
#endif #endif
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
.dfuStr = APPEND_VENDOR_STR(DFU), .dfuStr = APPEND_VENDOR_STR(DFU),
#endif #endif
#ifdef USB_CONTROL_DESCS #ifdef USB_CONTROL_DESCS
@@ -517,7 +517,7 @@ unsigned char devQualDesc_Null[] =
#define MIDI_LENGTH (0) #define MIDI_LENGTH (0)
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
#define DFU_LENGTH (18) #define DFU_LENGTH (18)
#else #else
#define DFU_LENGTH (0) #define DFU_LENGTH (0)
@@ -739,7 +739,7 @@ typedef struct
unsigned char configDesc_Midi[MIDI_LENGTH]; unsigned char configDesc_Midi[MIDI_LENGTH];
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
/* DFU descriptors currently handled as a single block */ /* DFU descriptors currently handled as a single block */
unsigned char configDesc_DFU[DFU_LENGTH]; unsigned char configDesc_DFU[DFU_LENGTH];
#endif #endif
@@ -1978,14 +1978,14 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
}, },
#endif #endif
#ifdef DFU #if (XUA_DFU_EN == 1)
/* Standard DFU class Interface descriptor */ /* Standard DFU class Interface descriptor */
{0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */ {0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */ 0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
INTERFACE_NUMBER_DFU, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */ INTERFACE_NUMBER_DFU, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */ 0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */ 0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFE, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */ 0xFE, /* 5 bInterfaceClass : DFU. (Application Specific) (field size 1 bytes) */
0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */ 0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */ 0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
offsetof(StringDescTable_t, dfuStr)/sizeof(char *), /* 8 iInterface */ offsetof(StringDescTable_t, dfuStr)/sizeof(char *), /* 8 iInterface */
@@ -2268,7 +2268,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
#define NUM_CONTROL_USB_INTERFACES 0 #define NUM_CONTROL_USB_INTERFACES 0
#endif #endif
#if (DFU == 1) && (FORCE_UAC1_DFU == 1) #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1)
#define DFU_INTERFACE_BYTES 18 #define DFU_INTERFACE_BYTES 18
#define DFU_INTERFACES_A1 1 #define DFU_INTERFACES_A1 1
#else #else
@@ -2741,7 +2741,7 @@ unsigned char cfgDesc_Audio1[] =
0x00, 0x00, /* Unused */ 0x00, 0x00, /* Unused */
#endif #endif
#if (DFU == 1) && (FORCE_UAC1_DFU == 1) #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1)
/* NOTE: By default we turn off DFU in UAC1.0 mode for a better user experiance in Windows */ /* NOTE: By default we turn off DFU in UAC1.0 mode for a better user experiance in Windows */
@@ -2751,7 +2751,7 @@ unsigned char cfgDesc_Audio1[] =
(OUTPUT_INTERFACES_A1 + INPUT_INTERFACES_A1 + NUM_CONTROL_USB_INTERFACES + 1), /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */ (OUTPUT_INTERFACES_A1 + INPUT_INTERFACES_A1 + NUM_CONTROL_USB_INTERFACES + 1), /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */ 0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */ 0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFE, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */ 0xFE, /* 5 bInterfaceClass : DFU. (Application Specific) (field size 1 bytes) */
0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */ 0x01, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */ 0x01, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
offsetof(StringDescTable_t, dfuStr)/sizeof(char *), /* 8 iInterface */ offsetof(StringDescTable_t, dfuStr)/sizeof(char *), /* 8 iInterface */
@@ -2775,7 +2775,7 @@ unsigned char cfgDesc_Audio1[] =
(OUTPUT_INTERFACES_A1 + INPUT_INTERFACES_A1 + 1), /* 2 bInterfaceNumber */ (OUTPUT_INTERFACES_A1 + INPUT_INTERFACES_A1 + 1), /* 2 bInterfaceNumber */
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */ 0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */ 0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
0xFF, /* 5 bInterfaceClass : DFU. (field size 1 bytes) */ USB_CLASS_VENDOR_SPECIFIC, /* 5 bInterfaceClass : Vendor specific. (field size 1 bytes) */
0xFF, /* 6 bInterfaceSubclass : (field size 1 bytes) */ 0xFF, /* 6 bInterfaceSubclass : (field size 1 bytes) */
0xFF, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */ 0xFF, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */ offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */