forked from PAWPAW-Mirror/lib_xua
Tidy
This commit is contained in:
@@ -53,27 +53,27 @@ unsigned char DFUdevDesc[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
unsigned char DFUcfgDesc[] = {
|
unsigned char DFUcfgDesc[] = {
|
||||||
/* Standard USB device descriptor */
|
/* Standard USB device descriptor */
|
||||||
0x09, /* 0 bLength */
|
0x09, /* 0 bLength */
|
||||||
CONFIGURATION, /* 1 bDescriptorType */
|
USB_CONFIGURATION, /* 1 bDescriptorType */
|
||||||
0x1b, /* 2 wTotalLength */
|
0x1b, /* 2 wTotalLength */
|
||||||
0x00, /* 3 wTotalLength */
|
0x00, /* 3 wTotalLength */
|
||||||
1, /* 4 bNumInterface: Number of interfaces*/
|
1, /* 4 bNumInterface: Number of interfaces*/
|
||||||
0x01, /* 5 bConfigurationValue */
|
0x01, /* 5 bConfigurationValue */
|
||||||
0x00, /* 6 iConfiguration */
|
0x00, /* 6 iConfiguration */
|
||||||
0xC0, /* 7 bmAttributes */
|
0xC0, /* 7 bmAttributes */
|
||||||
0x32, /* 8 bMaxPower */
|
0x32, /* 8 bMaxPower */
|
||||||
|
|
||||||
/* 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) */
|
||||||
0x00, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
|
0x00, /* 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 : AUDIO. (field size 1 bytes) */
|
0xFE, /* 5 bInterfaceClass : AUDIO. (field size 1 bytes) */
|
||||||
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
||||||
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
||||||
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* DFU 1.0 Standard DFU class functional descriptor */
|
/* DFU 1.0 Standard DFU class functional descriptor */
|
||||||
@@ -86,72 +86,22 @@ unsigned char DFUcfgDesc[] = {
|
|||||||
0x00
|
0x00
|
||||||
#else
|
#else
|
||||||
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
||||||
0x09, /* 0 Size */
|
0x09, /* 0 Size */
|
||||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
||||||
0x07, /* 2 bmAttributes */
|
0x07, /* 2 bmAttributes */
|
||||||
0xFA, /* 3 wDetachTimeOut */
|
0xFA, /* 3 wDetachTimeOut */
|
||||||
0x00, /* 4 wDetachTimeOut */
|
0x00, /* 4 wDetachTimeOut */
|
||||||
0x40, /* 5 wTransferSize */
|
0x40, /* 5 wTransferSize */
|
||||||
0x00, /* 6 wTransferSize */
|
0x00, /* 6 wTransferSize */
|
||||||
0x10, /* 7 bcdDFUVersion */
|
0x10, /* 7 bcdDFUVersion */
|
||||||
0x01, /* 7 bcdDFUVersion */
|
0x01, /* 7 bcdDFUVersion */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned char DFUoSpeedCfgDesc[] =
|
|
||||||
{
|
|
||||||
/* Standard USB device descriptor */
|
|
||||||
0x09, /* 0 bLength */
|
|
||||||
OTHER_SPEED_CONFIGURATION, /* 1 bDescriptorType */
|
|
||||||
0x1b, /* 2 wTotalLength */
|
|
||||||
0x00, /* 3 wTotalLength */
|
|
||||||
1, /* 4 bNumInterface: Number of interfaces*/
|
|
||||||
0x01, /* 5 bConfigurationValue */
|
|
||||||
0x00, /* 6 iConfiguration */
|
|
||||||
0xC0, /* 7 bmAttributes */
|
|
||||||
0x32, /* 8 bMaxPower */
|
|
||||||
|
|
||||||
/* Standard DFU class interface descriptor */
|
|
||||||
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
|
||||||
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
|
|
||||||
0x00, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
|
|
||||||
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
|
|
||||||
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
|
|
||||||
0xFE, /* 5 bInterfaceClass : AUDIO. (field size 1 bytes) */
|
|
||||||
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
|
||||||
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
|
||||||
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
|
||||||
|
|
||||||
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
|
||||||
0x09, /* 0 Size */
|
|
||||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
|
||||||
0x07, /* 2 bmAttributes */
|
|
||||||
0xFA, /* 3 wDetachTimeOut */
|
|
||||||
0x00, /* 4 wDetachTimeOut */
|
|
||||||
0x40, /* 5 wTransferSize */
|
|
||||||
0x00, /* 6 wTransferSize */
|
|
||||||
0x10, /* 7 bcdDFUVersion */
|
|
||||||
0x01, /* 7 bcdDFUVersion */
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned char DFUdevQualDesc[] =
|
|
||||||
{
|
|
||||||
10, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
|
||||||
DEVICE_QUALIFIER, /* 1 bdescriptorType */
|
|
||||||
0, /* 2 bcdUSB */
|
|
||||||
2, /* 3 bcdUSB */
|
|
||||||
0xfe, /* 4 bDeviceClass */
|
|
||||||
1, /* 5 bDeviceSubClass */
|
|
||||||
0, /* 6 bDeviceProtocol */
|
|
||||||
64, /* 7 bMaxPacketSize */
|
|
||||||
0x01, /* 8 bNumConfigurations : Number of possible configs */ \
|
|
||||||
0x00 /* 9 bReserved (must be zero) */ \
|
|
||||||
};
|
|
||||||
|
|
||||||
int DFUReportResetState(chanend ?c_user_cmd);
|
int DFUReportResetState(chanend ?c_user_cmd);
|
||||||
int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset);
|
int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -390,14 +390,14 @@ int XMOS_DFU_LoadState()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset)
|
int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset)
|
||||||
{
|
{
|
||||||
unsigned int return_data_len = 0;
|
unsigned int return_data_len = 0;
|
||||||
unsigned int data_buffer_len = 0;
|
unsigned int data_buffer_len = 0;
|
||||||
unsigned int data_buffer[17];
|
unsigned int data_buffer[17];
|
||||||
unsigned int reset_device_after_ack = 0;
|
unsigned int reset_device_after_ack = 0;
|
||||||
|
|
||||||
if(sp.bmRequestType.Direction == BM_REQTYPE_DIRECTION_OUT)
|
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D)
|
||||||
{
|
{
|
||||||
// Host to device
|
// Host to device
|
||||||
if (sp.wLength)
|
if (sp.wLength)
|
||||||
@@ -465,7 +465,7 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp.bmRequestType.Direction == BM_REQTYPE_DIRECTION_IN && sp.wLength != 0)
|
if (sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_D2H && sp.wLength != 0)
|
||||||
{
|
{
|
||||||
// Device to host
|
// Device to host
|
||||||
#ifdef ARCH_G
|
#ifdef ARCH_G
|
||||||
@@ -477,9 +477,9 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef ARCH_G
|
#ifdef ARCH_G
|
||||||
XUD_DoSetRequestStatus(ep0_out, 0);
|
XUD_DoSetRequestStatus(ep0_out);
|
||||||
#else
|
#else
|
||||||
XUD_DoSetRequestStatus(ep0_in, 0);
|
XUD_DoSetRequestStatus(ep0_in);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,14 @@
|
|||||||
#include <print.h>
|
#include <print.h>
|
||||||
#include <xs1_su.h>
|
#include <xs1_su.h>
|
||||||
|
|
||||||
#include "clocking.h"
|
|
||||||
#include "audioports.h"
|
#include "audioports.h"
|
||||||
#include "codec.h"
|
#include "audiohw.h"
|
||||||
#include "devicedefines.h"
|
#include "devicedefines.h"
|
||||||
#include "SpdifTransmit.h"
|
#include "SpdifTransmit.h"
|
||||||
|
|
||||||
|
//#define DSD_OUTPUT 1
|
||||||
|
|
||||||
|
|
||||||
unsigned g_adcVal = 0;
|
unsigned g_adcVal = 0;
|
||||||
|
|
||||||
//#define RAMP_CHECK 1
|
//#define RAMP_CHECK 1
|
||||||
@@ -30,18 +32,6 @@ unsigned g_adcVal = 0;
|
|||||||
//#pragma xta command "analyse path i2s_output_r i2s_output_l"
|
//#pragma xta command "analyse path i2s_output_r i2s_output_l"
|
||||||
//#pragma xta command "set required - 2000 ns"
|
//#pragma xta command "set required - 2000 ns"
|
||||||
|
|
||||||
#define DSD_OVER_PCM 1
|
|
||||||
#ifdef DSD_OVER_PCM
|
|
||||||
unsigned dopMarkerCount = 0;
|
|
||||||
#define DOP_MARKER_1 0x05
|
|
||||||
#define DOP_MARKER_2 0xFA
|
|
||||||
#define DOP_MARKER_XOR 0xFF
|
|
||||||
#define DOP_MARKER_THRESH 32 /* How many DSD markers we must see before switching to DSD mode */
|
|
||||||
#define DSD_MASK_IN(x) ((x & 0xFF000000) >> 24)
|
|
||||||
|
|
||||||
unsigned dopMarker = DOP_MARKER_1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* I2S Data I/O*/
|
/* I2S Data I/O*/
|
||||||
#if (I2S_CHANS_DAC != 0)
|
#if (I2S_CHANS_DAC != 0)
|
||||||
extern buffered out port:32 p_i2s_dac[I2S_WIRES_DAC];
|
extern buffered out port:32 p_i2s_dac[I2S_WIRES_DAC];
|
||||||
@@ -60,26 +50,35 @@ extern in port p_lrclk;
|
|||||||
extern in port p_bclk;
|
extern in port p_bclk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unsigned dsdMode = 0;
|
||||||
|
#ifdef DSD_OUTPUT
|
||||||
|
#define p_dsd_clk p_i2s_dac[1]
|
||||||
|
#define p_dsd_left p_i2s_dac[0]
|
||||||
|
#define p_dsd_right p_lrclk
|
||||||
|
#define DSD_MARKER_1 0xFA
|
||||||
|
#define DSD_MARKER_2 0x05
|
||||||
|
#define DSD_MARKER_XOR 0xFF
|
||||||
|
#define DSD_EN_THRESH 32 /* Number of consecutive DSD markers before switching to DSD mode */
|
||||||
|
#define DSD_MASK(x) ((x >> 24) & 0xff)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Master clock input */
|
/* Master clock input */
|
||||||
extern port p_mclk;
|
extern port p_mclk;
|
||||||
|
|
||||||
#ifdef SPDIF
|
#ifdef SPDIF
|
||||||
extern buffered out port:32 p_spdif_tx;
|
extern buffered out port:32 p_spdif_tx;
|
||||||
extern clock clk_mst_spd;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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);
|
extern void device_reboot(void);
|
||||||
|
|
||||||
/* I2S delivery thread */
|
/* I2S delivery thread */
|
||||||
#pragma unsafe arrays
|
#pragma unsafe arrays
|
||||||
unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_dig_rx, chanend ?c_adc
|
unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_dig_rx, chanend ?c_adc)
|
||||||
#ifdef DSD_OVER_PCM
|
|
||||||
, int dop
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
unsigned sample;
|
unsigned sample;
|
||||||
#if NUM_USB_CHAN_OUT > 0
|
#if NUM_USB_CHAN_OUT > 0
|
||||||
@@ -98,7 +97,13 @@ unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_
|
|||||||
int started = 0;
|
int started = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int dsdmode = 0;
|
#ifdef DSD_OUTPUT
|
||||||
|
unsigned dsdMarker = DSD_MARKER_2; /* This alternates between DSD_MARKER_1 and DSD_MARKER_2 */
|
||||||
|
int dsdCount = 0;
|
||||||
|
int everyOther = 0;
|
||||||
|
unsigned dsdSample_l = 0;
|
||||||
|
unsigned dsdSample_r = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if NUM_USB_CHAN_IN > 0
|
#if NUM_USB_CHAN_IN > 0
|
||||||
@@ -218,7 +223,7 @@ unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
p_lrclk <: 0x7FFFFFFF;
|
p_lrclk <: 0x7FFFFFFF;
|
||||||
p_bclk <: 0xAAAAAAAA;
|
p_bclk <: 0xAAAAAAAA;//32clks
|
||||||
p_bclk <: 0xAAAAAAAA;
|
p_bclk <: 0xAAAAAAAA;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -322,57 +327,101 @@ unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_
|
|||||||
asm("ldw %0, dp[g_digData+36]":"=r"(samplesIn[ADAT_RX_INDEX + 7]));
|
asm("ldw %0, dp[g_digData+36]":"=r"(samplesIn[ADAT_RX_INDEX + 7]));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DSD_OVER_PCM
|
|
||||||
/* Inspect for DSD markers */
|
|
||||||
if((DSD_MASK_IN(samplesOut[0]) == dopMarker) && (DSD_MASK_IN(samplesOut[1]) == dopMarker))
|
|
||||||
{
|
|
||||||
dopMarker ^= DOP_MARKER_XOR;
|
|
||||||
|
|
||||||
dopMarkerCount++;
|
|
||||||
|
|
||||||
if(!dsdmode)
|
|
||||||
{
|
|
||||||
if(dopMarkerCount >= DOP_MARKER_THRESH)
|
|
||||||
{
|
|
||||||
dopMarkerCount=0;
|
|
||||||
dopMarker ^= DOP_MARKER_XOR;
|
|
||||||
printstr("DSD\n");
|
|
||||||
dsdmode = 1;
|
|
||||||
//return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Reset DOP detect state */
|
|
||||||
dopMarkerCount = 0;
|
|
||||||
if(dsdmode)
|
|
||||||
{
|
|
||||||
//if(samplesOut[0] == 0)
|
|
||||||
//else
|
|
||||||
if(DSD_MASK_IN(samplesOut[0]) == (dopMarker ^ 0xff))
|
|
||||||
{
|
|
||||||
printstr("almost stopped");
|
|
||||||
//dopMarker ^= 0xff;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We were running in DOP mode, but it stopped... */
|
|
||||||
//return 0;
|
|
||||||
dsdmode = 0;
|
|
||||||
printstr("PCM\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
/* Request digital data (with prefill) */
|
/* Request digital data (with prefill) */
|
||||||
outuint(c_dig_rx, 0);
|
outuint(c_dig_rx, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
|
#ifdef DSD_OUTPUT
|
||||||
|
#error
|
||||||
|
if(dsdMode)
|
||||||
|
{
|
||||||
|
//while(1)
|
||||||
|
{
|
||||||
|
if(!everyOther)
|
||||||
|
{
|
||||||
|
dsdSample_l = ((samplesOut[0] & 0xffff00) << 8);
|
||||||
|
dsdSample_r = ((samplesOut[1] & 0xffff00) << 8);
|
||||||
|
|
||||||
|
everyOther = 1;
|
||||||
|
|
||||||
|
switch (divide*4)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
p_bclk <: 0xCCCCCCCC;
|
||||||
|
p_bclk <: 0xCCCCCCCC;
|
||||||
|
//p_bclk <: 0xCCCCCCCC;
|
||||||
|
//p_bclk <: 0xCCCCCCCC;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
//p_bclk <: 0xAAAAAAAA;
|
||||||
|
p_bclk <: 0xAAAAAAAA;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(everyOther)
|
||||||
|
{
|
||||||
|
everyOther = 0;
|
||||||
|
dsdSample_l = dsdSample_l | ((samplesOut[0] & 0xffff00) >> 8);
|
||||||
|
dsdSample_r = dsdSample_r | ((samplesOut[1] & 0xffff00) >> 8);
|
||||||
|
|
||||||
|
|
||||||
|
// Output 16 clocks DSD to all
|
||||||
|
p_dsd_left <: bitrev(dsdSample_l);
|
||||||
|
p_dsd_right <: bitrev(dsdSample_r);
|
||||||
|
switch (divide*4)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
//p_bclk <: 0xF0F0F0F0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
p_bclk <: 0xCCCCCCCC;
|
||||||
|
p_bclk <: 0xCCCCCCCC;
|
||||||
|
//p_bclk <: 0xCCCCCCCC;
|
||||||
|
//p_bclk <: 0xCCCCCCCC;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
//p_bclk <: 0xAAAAAAAA;
|
||||||
|
p_bclk <: 0xAAAAAAAA;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
#pragma xta endpoint "i2s_output_l"
|
#pragma xta endpoint "i2s_output_l"
|
||||||
|
|
||||||
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
||||||
#pragma loop unroll
|
#pragma loop unroll
|
||||||
for(int i = 0; i < I2S_CHANS_DAC; i+=2)
|
for(int i = 0; i < I2S_CHANS_DAC; i+=2)
|
||||||
@@ -440,12 +489,10 @@ unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SPDIF) && (NUM_USB_CHAN_OUT > 0)
|
#if defined(SPDIF) && (NUM_USB_CHAN_OUT > 0)
|
||||||
if(!dop)
|
outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward sample to SPDIF txt thread */
|
||||||
{ outuint(c_spd_out, samplesOut[SPDIF_TX_INDEX]); /* Forward sample to SPDIF txt thread */
|
|
||||||
sample = samplesOut[SPDIF_TX_INDEX + 1];
|
sample = samplesOut[SPDIF_TX_INDEX + 1];
|
||||||
outuint(c_spd_out, sample); /* Forward sample to SPDIF txt thread */
|
outuint(c_spd_out, sample); /* Forward sample to SPDIF txt thread */
|
||||||
}
|
|
||||||
#ifdef RAMP_CHECK
|
#ifdef RAMP_CHECK
|
||||||
sample >>= 8;
|
sample >>= 8;
|
||||||
if (started<10000) {
|
if (started<10000) {
|
||||||
@@ -462,7 +509,6 @@ if(!dop)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
#pragma xta endpoint "i2s_output_r"
|
#pragma xta endpoint "i2s_output_r"
|
||||||
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
#if (I2S_CHANS_DAC != 0) && (NUM_USB_CHAN_OUT != 0)
|
||||||
@@ -513,8 +559,6 @@ if(!dop)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if (I2S_CHANS_ADC != 0)
|
#if (I2S_CHANS_ADC != 0)
|
||||||
/* Input previous L ADC sample */
|
/* Input previous L ADC sample */
|
||||||
index = 0;
|
index = 0;
|
||||||
@@ -538,6 +582,48 @@ if(!dop)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
} // !dsdMode
|
||||||
|
#if defined (DSD_OUTPUT) && (NUM_USB_CHAN_OUT > 0)
|
||||||
|
#error
|
||||||
|
/* Check for DSD */
|
||||||
|
/* Currently we only check on channel 0 - we get all 0's on channels without data */
|
||||||
|
|
||||||
|
if(!dsdMode)
|
||||||
|
{
|
||||||
|
if((DSD_MASK(samplesOut[0]) == dsdMarker) && (DSD_MASK(samplesOut[1]) == dsdMarker))
|
||||||
|
{
|
||||||
|
dsdCount++;
|
||||||
|
dsdMarker ^= DSD_MARKER_XOR;
|
||||||
|
if(dsdCount == DSD_EN_THRESH)
|
||||||
|
{
|
||||||
|
dsdMode = 1;
|
||||||
|
dsdCount = 0;
|
||||||
|
dsdMarker = DSD_MARKER_2;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dsdCount = 0;
|
||||||
|
dsdMarker = DSD_MARKER_2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // DSD Mode
|
||||||
|
{
|
||||||
|
if((DSD_MASK(samplesOut[0]) != dsdMarker) && (DSD_MASK(samplesOut[1]) != dsdMarker))
|
||||||
|
{
|
||||||
|
if(!((dsdCount == 0) && (DSD_MASK(samplesOut[0]) == (dsdMarker ^DSD_MARKER_XOR))
|
||||||
|
&& (DSD_MASK(samplesOut[1]) == (dsdMarker ^ DSD_MARKER_XOR))))
|
||||||
|
{
|
||||||
|
dsdCount = 0;
|
||||||
|
dsdMode = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -601,12 +687,10 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
|
|||||||
chan c_spdif_out;
|
chan c_spdif_out;
|
||||||
#endif
|
#endif
|
||||||
unsigned curSamFreq = DEFAULT_FREQ;
|
unsigned curSamFreq = DEFAULT_FREQ;
|
||||||
|
unsigned retVal;
|
||||||
unsigned mClk;
|
unsigned mClk;
|
||||||
unsigned divide;
|
unsigned divide;
|
||||||
unsigned firstRun = 1;
|
unsigned firstRun = 1;
|
||||||
#ifdef DSD_OVER_PCM
|
|
||||||
unsigned dop = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SU1_ADC_ENABLE
|
#ifdef SU1_ADC_ENABLE
|
||||||
/* Setup galaxian ADC */
|
/* Setup galaxian ADC */
|
||||||
@@ -646,112 +730,92 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialise master clock generation */
|
/* Initialise master clock generation */
|
||||||
ClockingInit(c_config);
|
//ClockingInit(c_config);
|
||||||
|
|
||||||
/* Perform required CODEC/ADC/DAC initialisation */
|
/* Perform required CODEC/ADC/DAC initialisation */
|
||||||
CodecInit(c_config);
|
AudioHwInit(c_config);
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
/* Calculate what master clock we should be using */
|
||||||
if(curSamFreq)
|
if ((curSamFreq % 22050) == 0)
|
||||||
{
|
{
|
||||||
|
mClk = MCLK_441;
|
||||||
/* Calculate what master clock we should be using */
|
|
||||||
if ((curSamFreq % 22050) == 0)
|
|
||||||
{
|
|
||||||
mClk = MCLK_441;
|
|
||||||
}
|
|
||||||
else if ((curSamFreq % 24000) == 0)
|
|
||||||
{
|
|
||||||
mClk = MCLK_48;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Calculate divide required for bit clock e.g. 11.289600 / (176400 * 64) = 1 */
|
|
||||||
divide = mClk / ( curSamFreq * 64 );
|
|
||||||
|
|
||||||
/* Configure clocking for required master clock */
|
|
||||||
ClockingConfig(mClk, c_config);
|
|
||||||
|
|
||||||
if(!firstRun)
|
|
||||||
{
|
|
||||||
/* TODO wait for good mclk instead of delay */
|
|
||||||
/* No delay for DFU modes */
|
|
||||||
if ((curSamFreq != AUDIO_REBOOT_FROM_DFU) && (curSamFreq != AUDIO_STOP_FOR_DFU))
|
|
||||||
{
|
|
||||||
timer t;
|
|
||||||
unsigned time;
|
|
||||||
t :> time;
|
|
||||||
t when timerafter(time+AUDIO_PLL_LOCK_DELAY) :> void;
|
|
||||||
|
|
||||||
/* Handshake back */
|
|
||||||
outct(c_mix_out, XS1_CT_END);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
firstRun = 0;
|
|
||||||
|
|
||||||
/* Configure CODEC/DAC/ADC for SampleFreq/MClk */
|
|
||||||
CodecConfig(curSamFreq, mClk, c_config);
|
|
||||||
|
|
||||||
/* Configure audio ports */
|
|
||||||
ConfigAudioPorts(divide);
|
|
||||||
}
|
}
|
||||||
else
|
else if ((curSamFreq % 24000) == 0)
|
||||||
{
|
{
|
||||||
if(!dop)
|
mClk = MCLK_48;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Calculate divide required for bit clock e.g. 11.289600 / (176400 * 64) = 1 */
|
||||||
|
divide = mClk / ( curSamFreq * 64 );
|
||||||
|
|
||||||
|
/* Configure clocking for required master clock */
|
||||||
|
//ClockingConfig(mClk, c_config);
|
||||||
|
|
||||||
|
/* Configure CODEC/DAC/ADC for SampleFreq/MClk */
|
||||||
|
AudioHwConfig(curSamFreq, mClk, c_config, dsdMode);
|
||||||
|
|
||||||
|
/* Configure audio ports */
|
||||||
|
ConfigAudioPorts(divide);
|
||||||
|
|
||||||
|
if(!firstRun)
|
||||||
|
{
|
||||||
|
/* TODO wait for good mclk instead of delay */
|
||||||
|
/* No delay for DFU modes */
|
||||||
|
if ((curSamFreq != AUDIO_REBOOT_FROM_DFU) && (curSamFreq != AUDIO_STOP_FOR_DFU) && retVal)
|
||||||
{
|
{
|
||||||
/* DOP detected! */
|
timer t;
|
||||||
printstrln("DOP Detect");
|
unsigned time;
|
||||||
dop = 1;
|
t :> time;
|
||||||
/* TODO:
|
t when timerafter(time+AUDIO_PLL_LOCK_DELAY) :> void;
|
||||||
* Config ports for DSD
|
|
||||||
* Config CODEC for DSD
|
/* Handshake back */
|
||||||
*/
|
outct(c_mix_out, XS1_CT_END);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* DOP mode end */
|
|
||||||
printstrln("DOP end");
|
|
||||||
dop = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
firstRun = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
par
|
par
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef SPDIF
|
#ifdef SPDIF
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if(!dop)
|
set_thread_fast_mode_on();
|
||||||
{
|
SpdifTransmit(p_spdif_tx, c_spdif_out);
|
||||||
set_thread_fast_mode_on();
|
|
||||||
SpdifTransmit(p_spdif_tx, c_spdif_out);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef SPDIF
|
#ifdef SPDIF
|
||||||
if(!dop)
|
|
||||||
{
|
|
||||||
/* 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);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
curSamFreq = deliver(c_mix_out,
|
retVal = deliver(c_mix_out,
|
||||||
#ifdef SPDIF
|
#ifdef SPDIF
|
||||||
c_spdif_out,
|
c_spdif_out,
|
||||||
#else
|
#else
|
||||||
null,
|
null,
|
||||||
#endif
|
#endif
|
||||||
divide, c_dig_rx, c
|
divide, c_dig_rx, c);
|
||||||
#ifdef DSD_OVER_PCM
|
|
||||||
, dop
|
#ifdef DSD_OUTPUT
|
||||||
|
if(retVal == 0)
|
||||||
|
{
|
||||||
|
// Check DSD mode here..
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curSamFreq = retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
curSamFreq = retVal;
|
||||||
#endif
|
#endif
|
||||||
);
|
|
||||||
|
|
||||||
// Currently no more audio will happen after this point
|
// Currently no more audio will happen after this point
|
||||||
if (curSamFreq == AUDIO_STOP_FOR_DFU)
|
if (curSamFreq == AUDIO_STOP_FOR_DFU)
|
||||||
@@ -773,7 +837,6 @@ void audio(chanend c_mix_out, chanend ?c_dig_rx, chanend ?c_config, chanend ?c)
|
|||||||
|
|
||||||
#ifdef SPDIF
|
#ifdef SPDIF
|
||||||
/* Notify S/PDIF thread of impending new freq... */
|
/* Notify S/PDIF thread of impending new freq... */
|
||||||
if(!dop)
|
|
||||||
outct(c_spdif_out, XS1_CT_END);
|
outct(c_spdif_out, XS1_CT_END);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
14
module_usb_audio/audiohw.h
Normal file
14
module_usb_audio/audiohw.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef _CODEC_H_
|
||||||
|
#define _CODEC_H_
|
||||||
|
|
||||||
|
/* These functions must be implemented for the CODEC/ADC/DAC arrangement of a specific design */
|
||||||
|
|
||||||
|
/* TODO Are the channel args required? */
|
||||||
|
|
||||||
|
/* Any required clocking and CODEC initialisation - run once at start up */
|
||||||
|
void AudioHwInit(chanend ?c_codec);
|
||||||
|
|
||||||
|
/* Configure audio hardware (clocking, CODECs etc) for a specific mClk/Sample frquency - run on every sample frequency change */
|
||||||
|
void AudioHwConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec, int dsdMode);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
/* Any actions required for stream start e.g. DAC un-mute - run every stream start */
|
/* Any actions required for stream start e.g. DAC un-mute - run every stream start */
|
||||||
void AudioStreamStart(void);
|
void UserAudioStreamStart(void);
|
||||||
|
|
||||||
/* Any actions required on stream stop e.g. DAC mute - run every steam stop */
|
/* Any actions required on stream stop e.g. DAC mute - run every steam stop */
|
||||||
void AudioStreamStop(void);
|
void UserAudioStreamStop(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,6 @@
|
|||||||
#ifndef _CLOCKING_H_
|
#ifndef _CLOCKING_H_
|
||||||
#define _CLOCKING_H_
|
#define _CLOCKING_H_
|
||||||
|
|
||||||
/* Functions that handle master clock generation. These need modifying for an existing design */
|
|
||||||
|
|
||||||
/* Any initialisation required for master clock generation - run once at start up */
|
|
||||||
void ClockingInit(chanend ?c);
|
|
||||||
|
|
||||||
/* Configuration for a specific master clock frequency - run every sample frequency change */
|
|
||||||
void ClockingConfig(unsigned mClkFreq, chanend ?c);
|
|
||||||
|
|
||||||
|
|
||||||
/** Clock generation and digital audio I/O handling.
|
/** Clock generation and digital audio I/O handling.
|
||||||
*
|
*
|
||||||
* \param c_spdif_rx channel connected to S/PDIF receive thread
|
* \param c_spdif_rx channel connected to S/PDIF receive thread
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#ifndef _CODEC_H_
|
|
||||||
#define _CODEC_H_
|
|
||||||
|
|
||||||
/* These functions must be implemented for the CODEC/ADC/DAC arrangement of a specific design */
|
|
||||||
|
|
||||||
/* TODO Are the channel args required? */
|
|
||||||
|
|
||||||
/* Any required CODEC initialisation - run once at start up */
|
|
||||||
void CodecInit(chanend ?c_codec);
|
|
||||||
|
|
||||||
/* Configure condec for a specific mClk/Sample frquency - run on every sample frequency change */
|
|
||||||
void CodecConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* @file internaldefines.h
|
|
||||||
* @brief Defines relating to device configuration and customisation.
|
* @brief Defines relating to device configuration and customisation.
|
||||||
* @author Ross Owen, XMOS Limited
|
* @author Ross Owen, XMOS Limited
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@
|
|||||||
unsigned char devDesc_Audio1[] =
|
unsigned char devDesc_Audio1[] =
|
||||||
{
|
{
|
||||||
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
||||||
DEVICE, /* 1 bdescriptorType */
|
USB_DEVICE, /* 1 bdescriptorType */
|
||||||
0x0, /* 2 bcd USB */
|
0x0, /* 2 bcd USB */
|
||||||
0x1, /* 3 bcdUSB */
|
0x1, /* 3 bcdUSB */
|
||||||
0, /* 4 bDeviceClass */
|
0, /* 4 bDeviceClass */
|
||||||
@@ -34,8 +34,8 @@ unsigned char devDesc_Audio1[] =
|
|||||||
(BCD_DEVICE & 0xFF), /* 12 bcdDevice : Device release number */
|
(BCD_DEVICE & 0xFF), /* 12 bcdDevice : Device release number */
|
||||||
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
||||||
MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
|
MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
|
||||||
PRODUCT_STR_INDEX, /* 15 iProduct : Index of product string descriptor */
|
8, /* 15 iProduct : Index of product string descriptor */
|
||||||
0,//SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */
|
0,//SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */
|
||||||
0x01 /* 17 bNumConfigurations : Number of possible configs. */
|
0x01 /* 17 bNumConfigurations : Number of possible configs. */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -44,7 +44,7 @@ unsigned char devDesc_Audio1[] =
|
|||||||
unsigned char devDesc_Audio2[] =
|
unsigned char devDesc_Audio2[] =
|
||||||
{
|
{
|
||||||
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
||||||
DEVICE, /* 1 bdescriptorType */
|
USB_DEVICE, /* 1 bdescriptorType */
|
||||||
0, /* 2 bcdUSB */
|
0, /* 2 bcdUSB */
|
||||||
2, /* 3 bcdUSB */
|
2, /* 3 bcdUSB */
|
||||||
0xEF, /* 4 bDeviceClass (See Audio Class Spec page 45) */
|
0xEF, /* 4 bDeviceClass (See Audio Class Spec page 45) */
|
||||||
@@ -68,7 +68,7 @@ unsigned char devDesc_Audio2[] =
|
|||||||
unsigned char devDesc_Null[] =
|
unsigned char devDesc_Null[] =
|
||||||
{
|
{
|
||||||
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
18, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
||||||
DEVICE, /* 1 bdescriptorType */
|
USB_DEVICE, /* 1 bdescriptorType */
|
||||||
0, /* 2 bcdUSB */
|
0, /* 2 bcdUSB */
|
||||||
2, /* 3 bcdUSB */
|
2, /* 3 bcdUSB */
|
||||||
0x0, /* 4 bDeviceClass */
|
0x0, /* 4 bDeviceClass */
|
||||||
@@ -94,7 +94,7 @@ unsigned char devDesc_Null[] =
|
|||||||
unsigned char devQualDesc_Audio2[] =
|
unsigned char devQualDesc_Audio2[] =
|
||||||
{
|
{
|
||||||
10, /* 0 bLength (10 Bytes) */
|
10, /* 0 bLength (10 Bytes) */
|
||||||
DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
USB_DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
||||||
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
||||||
0x02, /* 3 bcdUSB */
|
0x02, /* 3 bcdUSB */
|
||||||
0xEF, /* 4 bDeviceClass */
|
0xEF, /* 4 bDeviceClass */
|
||||||
@@ -110,7 +110,7 @@ unsigned char devQualDesc_Audio2[] =
|
|||||||
unsigned char devQualDesc_Audio1[] =
|
unsigned char devQualDesc_Audio1[] =
|
||||||
{
|
{
|
||||||
10, /* 0 bLength (10 Bytes) */
|
10, /* 0 bLength (10 Bytes) */
|
||||||
DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
USB_DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
||||||
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
||||||
0x02, /* 3 bcdUSB */
|
0x02, /* 3 bcdUSB */
|
||||||
0x00, /* 4 bDeviceClass */
|
0x00, /* 4 bDeviceClass */
|
||||||
@@ -126,7 +126,7 @@ unsigned char devQualDesc_Audio1[] =
|
|||||||
unsigned char devQualDesc_Null[] =
|
unsigned char devQualDesc_Null[] =
|
||||||
{
|
{
|
||||||
10, /* 0 bLength (10 Bytes) */
|
10, /* 0 bLength (10 Bytes) */
|
||||||
DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
USB_DEVICE_QUALIFIER, /* 1 bDescriptorType */
|
||||||
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
0x00, /* 2 bcdUSB (Binary Coded Decimal of usb version) */
|
||||||
0x02, /* 3 bcdUSB */
|
0x02, /* 3 bcdUSB */
|
||||||
0x00, /* 4 bDeviceClass */
|
0x00, /* 4 bDeviceClass */
|
||||||
@@ -228,8 +228,8 @@ unsigned char devQualDesc_Null[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Positions in strDescs_Audio2
|
// Positions in strDescs_Audio2
|
||||||
#define INTERNAL_CLOCK_STRING_INDEX 9
|
#define INTERNAL_CLOCK_STRING_INDEX 14
|
||||||
#define SPDIF_CLOCK_STRING_INDEX 10
|
#define SPDIF_CLOCK_STRING_INDEX 15
|
||||||
|
|
||||||
#ifdef SPDIF_RX
|
#ifdef SPDIF_RX
|
||||||
#define ADAT_CLOCK_STRING_INDEX (SPDIF_CLOCK_STRING_INDEX + 1)
|
#define ADAT_CLOCK_STRING_INDEX (SPDIF_CLOCK_STRING_INDEX + 1)
|
||||||
@@ -299,7 +299,7 @@ unsigned char hidReportDescriptor[] = {
|
|||||||
unsigned char cfgDesc_Audio2[] =
|
unsigned char cfgDesc_Audio2[] =
|
||||||
{
|
{
|
||||||
0x09, /* 0 bLength */
|
0x09, /* 0 bLength */
|
||||||
CONFIGURATION, /* 1 bDescriptorType */
|
USB_CONFIGURATION, /* 1 bDescriptorType */
|
||||||
(CFG_TOTAL_LENGTH_A2 & 0xFF), /* 2 wTotalLength */
|
(CFG_TOTAL_LENGTH_A2 & 0xFF), /* 2 wTotalLength */
|
||||||
(CFG_TOTAL_LENGTH_A2 >> 8), /* 3 wTotalLength */
|
(CFG_TOTAL_LENGTH_A2 >> 8), /* 3 wTotalLength */
|
||||||
NUM_INTERFACES, /* 4 bNumInterface: Number of interfaces*/
|
NUM_INTERFACES, /* 4 bNumInterface: Number of interfaces*/
|
||||||
@@ -325,7 +325,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard Audio Control Interface Descriptor (Note: Must be first with lowest interface number)r */
|
/* Standard Audio Control Interface Descriptor (Note: Must be first with lowest interface number)r */
|
||||||
0x09, /* 0 bLength: 9 */
|
0x09, /* 0 bLength: 9 */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
0x00, /* 2 bInterfaceNumber */
|
0x00, /* 2 bInterfaceNumber */
|
||||||
0x00, /* 3 bAlternateSetting: Must be 0 */
|
0x00, /* 3 bAlternateSetting: Must be 0 */
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
@@ -780,7 +780,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
#ifdef OUTPUT
|
#ifdef OUTPUT
|
||||||
/* Standard AS Interface Descriptor (4.9.1) */
|
/* Standard AS Interface Descriptor (4.9.1) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
1, /* 2 bInterfaceNumber: Number of interface */
|
1, /* 2 bInterfaceNumber: Number of interface */
|
||||||
0, /* 3 bAlternateSetting */
|
0, /* 3 bAlternateSetting */
|
||||||
0, /* 4 bNumEndpoints */
|
0, /* 4 bNumEndpoints */
|
||||||
@@ -791,7 +791,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
1, /* 2 bInterfaceNumber: Number of interface */
|
1, /* 2 bInterfaceNumber: Number of interface */
|
||||||
1, /* 3 bAlternateSetting */
|
1, /* 3 bAlternateSetting */
|
||||||
2, /* 4 bNumEndpoints */
|
2, /* 4 bNumEndpoints */
|
||||||
@@ -822,7 +822,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x01, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x01, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
0x05, /* 3 bmAttributes (bitmap) */
|
0x05, /* 3 bmAttributes (bitmap) */
|
||||||
0,4, /* 4 wMaxPacketSize */
|
0,4, /* 4 wMaxPacketSize */
|
||||||
@@ -839,7 +839,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Feedback EP */
|
/* Feedback EP */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
17, /* 3 bmAttributes (bitmap) */
|
17, /* 3 bmAttributes (bitmap) */
|
||||||
4,0, /* 4 wMaxPacketSize */
|
4,0, /* 4 wMaxPacketSize */
|
||||||
@@ -848,7 +848,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
#ifdef ADAT_TX
|
#ifdef ADAT_TX
|
||||||
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
1, /* 2 bInterfaceNumber: Number of interface */
|
1, /* 2 bInterfaceNumber: Number of interface */
|
||||||
2, /* 3 bAlternateSetting */
|
2, /* 3 bAlternateSetting */
|
||||||
2, /* 4 bNumEndpoints */
|
2, /* 4 bNumEndpoints */
|
||||||
@@ -879,7 +879,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x01, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x01, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
0x05, /* 3 bmAttributes (bitmap) */
|
0x05, /* 3 bmAttributes (bitmap) */
|
||||||
0,4, /* 4 wMaxPacketSize */
|
0,4, /* 4 wMaxPacketSize */
|
||||||
@@ -896,7 +896,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Feedback EP */
|
/* Feedback EP */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x81, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
17, /* 3 bmAttributes (bitmap) */
|
17, /* 3 bmAttributes (bitmap) */
|
||||||
4,0, /* 4 wMaxPacketSize */
|
4,0, /* 4 wMaxPacketSize */
|
||||||
@@ -908,7 +908,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
#ifdef INPUT
|
#ifdef INPUT
|
||||||
/* Standard AS Interface Descriptor (4.9.1) */
|
/* Standard AS Interface Descriptor (4.9.1) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
||||||
0, /* 3 bAlternateSetting */
|
0, /* 3 bAlternateSetting */
|
||||||
0, /* 4 bNumEndpoints */
|
0, /* 4 bNumEndpoints */
|
||||||
@@ -919,7 +919,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
||||||
1, /* 3 bAlternateSetting */
|
1, /* 3 bAlternateSetting */
|
||||||
1, /* 4 bNumEndpoints */
|
1, /* 4 bNumEndpoints */
|
||||||
@@ -950,7 +950,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x82, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x82, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
5, /* 3 bmAttributes (bitmap) */
|
5, /* 3 bmAttributes (bitmap) */
|
||||||
0,4, /* 4 wMaxPacketSize */
|
0,4, /* 4 wMaxPacketSize */
|
||||||
@@ -968,7 +968,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
#ifdef ADAT_RX
|
#ifdef ADAT_RX
|
||||||
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
/* Standard AS Interface Descriptor (4.9.1) (Alt) */
|
||||||
0x09, /* 0 bLength: (in bytes, 9) */
|
0x09, /* 0 bLength: (in bytes, 9) */
|
||||||
INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
USB_INTERFACE, /* 1 bDescriptorType: INTERFACE */
|
||||||
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
(OUTPUT_INTERFACES + 1), /* 2 bInterfaceNumber: Number of interface */
|
||||||
2, /* 3 bAlternateSetting */
|
2, /* 3 bAlternateSetting */
|
||||||
1, /* 4 bNumEndpoints */
|
1, /* 4 bNumEndpoints */
|
||||||
@@ -999,7 +999,7 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
|
|
||||||
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
/* Standard AS Isochronous Audio Data Endpoint Descriptor (4.10.1.1) */
|
||||||
0x07, /* 0 bLength: 7 */
|
0x07, /* 0 bLength: 7 */
|
||||||
ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
USB_ENDPOINT, /* 1 bDescriptorType: ENDPOINT */
|
||||||
0x82, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
0x82, /* 2 bEndpointAddress (D7: 0:out, 1:in) */
|
||||||
5, /* 3 bmAttributes (bitmap) */
|
5, /* 3 bmAttributes (bitmap) */
|
||||||
0,4, /* 4 wMaxPacketSize */
|
0,4, /* 4 wMaxPacketSize */
|
||||||
@@ -1342,20 +1342,29 @@ unsigned char cfgDesc_Audio2[] =
|
|||||||
#define STR_INDEX_OUT_CHAN (10 + SPDIF_RX_NUM_STRS + ADAT_RX_NUM_STRS + MIDI_NUM_STRS + DFU_NUM_STRS)
|
#define STR_INDEX_OUT_CHAN (10 + SPDIF_RX_NUM_STRS + ADAT_RX_NUM_STRS + MIDI_NUM_STRS + DFU_NUM_STRS)
|
||||||
#define STR_INDEX_IN_CHAN (STR_INDEX_OUT_CHAN + NUM_USB_CHAN_OUT)
|
#define STR_INDEX_IN_CHAN (STR_INDEX_OUT_CHAN + NUM_USB_CHAN_OUT)
|
||||||
|
|
||||||
static unsigned char strDescs_Audio2[][40] =
|
static unsigned char strDescs[][40] =
|
||||||
{
|
{
|
||||||
"Langids", /* String 0 (LangIDs) place holder */
|
"Langids", /* String 0 (LangIDs) place holder */
|
||||||
APPEND_VENDOR_STR( ), // 1 iManufacturer (at MANUFACTURER_STRING_INDEX)
|
APPEND_VENDOR_STR( ), // 1 iManufacturer (at MANUFACTURER_STRING_INDEX)
|
||||||
|
|
||||||
|
/* Audio 2.0 Strings */
|
||||||
APPEND_VENDOR_STR(USB Audio 2.0), // 2 iProduct and iInterface for control interface (at PRODUCT_STR_INDEX)
|
APPEND_VENDOR_STR(USB Audio 2.0), // 2 iProduct and iInterface for control interface (at PRODUCT_STR_INDEX)
|
||||||
"",//SERIAL_STR, // 3 iSerialNumber (at SERIAL_STR_INDEX)
|
"",//SERIAL_STR, // 3 iSerialNumber (at SERIAL_STR_INDEX)
|
||||||
APPEND_VENDOR_STR(USB 2.0 Audio Out), // 4 iInterface for Streaming interaces
|
APPEND_VENDOR_STR(USB 2.0 Audio Out), // 4 iInterface for Streaming interaces
|
||||||
APPEND_VENDOR_STR(USB 2.0 Audio In), // 5
|
APPEND_VENDOR_STR(USB 2.0 Audio In), // 5
|
||||||
|
|
||||||
APPEND_VENDOR_STR(Audio 2.0 Output), // 6 "USB Input Terminal" (User sees as output from host)
|
APPEND_VENDOR_STR(Audio 2.0 Output), // 6 "USB Input Terminal" (User sees as output from host)
|
||||||
APPEND_VENDOR_STR(Audio 2.0 Input), // 7 "USB Output Terminal" (User sees as input to host)
|
APPEND_VENDOR_STR(Audio 2.0 Input), // 7 "USB Output Terminal" (User sees as input to host)
|
||||||
|
|
||||||
APPEND_VENDOR_STR(Clock Selector), // 8 iClockSel
|
/* Audio 1.0 Strings */
|
||||||
APPEND_VENDOR_STR(Internal Clock), // 9 iClockSource
|
APPEND_VENDOR_STR(USB Audio 1.0), // 8 iProduct and iInterface for control interface
|
||||||
|
APPEND_VENDOR_STR(USB 1.0 Audio Out), // 9 iInterface for Streaming interaces
|
||||||
|
APPEND_VENDOR_STR(USB 1.0 Audio In), // 10
|
||||||
|
APPEND_VENDOR_STR(Audio 1.0 Output), // 11 "USB Input Terminal" (User sees as output from host)
|
||||||
|
APPEND_VENDOR_STR(Audio 1.0 Input), // 12 "USB Output Terminal" (User sees as input to host)
|
||||||
|
|
||||||
|
APPEND_VENDOR_STR(Clock Selector), // 13 iClockSel
|
||||||
|
APPEND_VENDOR_STR(Internal Clock), // 14 iClockSource
|
||||||
#ifdef SPDIF_RX
|
#ifdef SPDIF_RX
|
||||||
APPEND_VENDOR_STR(S/PDIF Clock), // iClockSource
|
APPEND_VENDOR_STR(S/PDIF Clock), // iClockSource
|
||||||
#endif
|
#endif
|
||||||
@@ -1526,7 +1535,7 @@ static unsigned char strDescs_Audio2[][40] =
|
|||||||
unsigned char cfgDesc_Null[] =
|
unsigned char cfgDesc_Null[] =
|
||||||
{
|
{
|
||||||
0x09, /* 0 bLength */
|
0x09, /* 0 bLength */
|
||||||
CONFIGURATION, /* 1 bDescriptorType */
|
USB_CONFIGURATION, /* 1 bDescriptorType */
|
||||||
0x12, /* 2 wTotalLength */
|
0x12, /* 2 wTotalLength */
|
||||||
0x00, /* 3 wTotalLength */
|
0x00, /* 3 wTotalLength */
|
||||||
0x01, /* 4 bNumInterface: Number of interfaces*/
|
0x01, /* 4 bNumInterface: Number of interfaces*/
|
||||||
@@ -1589,8 +1598,9 @@ unsigned char oSpeedCfgDesc[] =
|
|||||||
#ifdef AUDIO_CLASS_FALLBACK
|
#ifdef AUDIO_CLASS_FALLBACK
|
||||||
unsigned char cfgDesc_Audio1[] =
|
unsigned char cfgDesc_Audio1[] =
|
||||||
{
|
{
|
||||||
/* Configuration descriptor */ 0x09,
|
/* Configuration descriptor */
|
||||||
CONFIGURATION,
|
0x09,
|
||||||
|
USB_CONFIGURATION,
|
||||||
(CFG_TOTAL_LENGTH_A1 & 0xFF), /* wTotalLength */
|
(CFG_TOTAL_LENGTH_A1 & 0xFF), /* wTotalLength */
|
||||||
(CFG_TOTAL_LENGTH_A1 >> 8), /* wTotalLength */
|
(CFG_TOTAL_LENGTH_A1 >> 8), /* wTotalLength */
|
||||||
NUM_INTERFACES_A1, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/
|
NUM_INTERFACES_A1, /* numInterfaces - we dont support MIDI in audio 1.0 mode*/
|
||||||
@@ -1606,22 +1616,22 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
|
|
||||||
/* Standard AC interface descriptor */
|
/* Standard AC interface descriptor */
|
||||||
0x09,
|
0x09,
|
||||||
INTERFACE,
|
USB_INTERFACE,
|
||||||
0x00, /* Interface No */
|
0x00, /* Interface No */
|
||||||
0x00, /* Alternate setting*/
|
0x00, /* Alternate setting*/
|
||||||
0x00, /* Num endpoints */
|
0x00, /* Num endpoints */
|
||||||
AUDIO,
|
AUDIO,
|
||||||
AUDIOCONTROL,
|
AUDIOCONTROL,
|
||||||
0x00, /* Unused */
|
0x00, /* Unused */
|
||||||
PRODUCT_STR_INDEX, /* iInterface - re-use iProduct */
|
8, /* iInterface - re-use iProduct */
|
||||||
|
|
||||||
/* CS (Class Specific) AudioControl interface header descriptor (4.3.2) */
|
/* CS (Class Specific) AudioControl interface header descriptor (4.3.2) */
|
||||||
AC_LENGTH,
|
AC_LENGTH,
|
||||||
CS_INTERFACE,
|
CS_INTERFACE,
|
||||||
0x01, /* HEADER */
|
0x01, /* HEADER */
|
||||||
0x00, 0x01, /* Class spec revision - 1.0 */
|
0x00, 0x01, /* Class spec revision - 1.0 */
|
||||||
(AC_TOTAL_LENGTH & 0xFF), /* wTotallength (Combined length of this descriptor and all Unit and Terminal Descriptors) */
|
(AC_TOTAL_LENGTH & 0xFF), /* wTotallength (Combined length of this descriptor and all Unit and Terminal Descriptors) */
|
||||||
(AC_TOTAL_LENGTH >> 8), /* wTotalLength */
|
(AC_TOTAL_LENGTH >> 8), /* wTotalLength */
|
||||||
STREAMING_INTERFACES, /* Num streaming interfaces */
|
STREAMING_INTERFACES, /* Num streaming interfaces */
|
||||||
#ifdef OUTPUT
|
#ifdef OUTPUT
|
||||||
0x01, /* AudioStreaming interface 1 belongs to AC interface */
|
0x01, /* AudioStreaming interface 1 belongs to AC interface */
|
||||||
@@ -1641,7 +1651,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
2, /* bNrChannels */
|
2, /* bNrChannels */
|
||||||
0x03, 0x00, /* wChannelConfig */
|
0x03, 0x00, /* wChannelConfig */
|
||||||
0x00, /* iChannelNames - Unused */
|
0x00, /* iChannelNames - Unused */
|
||||||
0x06, /* iTerminal */
|
11, /* iTerminal */
|
||||||
|
|
||||||
/* CS_Interface class specific AC interface feature unit descriptor - mute & volume for dac */
|
/* CS_Interface class specific AC interface feature unit descriptor - mute & volume for dac */
|
||||||
0x0A,
|
0x0A,
|
||||||
@@ -1678,7 +1688,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
2, /* bNrChannels */
|
2, /* bNrChannels */
|
||||||
0x03, 0x00, /* wChannelConfigs */
|
0x03, 0x00, /* wChannelConfigs */
|
||||||
0x00, /* iChannelNames */
|
0x00, /* iChannelNames */
|
||||||
0x07, /* iTerminal */
|
12, /* iTerminal */
|
||||||
|
|
||||||
/* CS_Interface Output Terminal Descriptor - USB Streaming Device to Host*/
|
/* CS_Interface Output Terminal Descriptor - USB Streaming Device to Host*/
|
||||||
0x09,
|
0x09,
|
||||||
@@ -1713,7 +1723,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
0x01, /* bInterfaceClass - AUDIO */
|
0x01, /* bInterfaceClass - AUDIO */
|
||||||
0x02, /* bInterfaceSubclass - AUDIO_STREAMING */
|
0x02, /* bInterfaceSubclass - AUDIO_STREAMING */
|
||||||
0x00, /* bInterfaceProtocol - Not used */
|
0x00, /* bInterfaceProtocol - Not used */
|
||||||
0x04, /* iInterface */
|
0x09, /* iInterface */
|
||||||
|
|
||||||
/* Standard As Interface Descriptor (4.5.1) */
|
/* Standard As Interface Descriptor (4.5.1) */
|
||||||
0x09,
|
0x09,
|
||||||
@@ -1807,7 +1817,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
0x01, /* Interface class - AUDIO */
|
0x01, /* Interface class - AUDIO */
|
||||||
0x02, /* Subclass - AUDIO_STREAMING */
|
0x02, /* Subclass - AUDIO_STREAMING */
|
||||||
0x00, /* Unused */
|
0x00, /* Unused */
|
||||||
0x05, /* String table index */
|
0x0A, /* String table index */
|
||||||
|
|
||||||
/* CS_Interface AC interface header descriptor */
|
/* CS_Interface AC interface header descriptor */
|
||||||
0x07,
|
0x07,
|
||||||
@@ -1900,7 +1910,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define APPEND_VENDOR_STR(x) VENDOR_STR#x
|
#define APPEND_VENDOR_STR(x) VENDOR_STR#x
|
||||||
|
#if 0
|
||||||
static unsigned char strDescs_Audio1[][40] =
|
static unsigned char strDescs_Audio1[][40] =
|
||||||
{
|
{
|
||||||
"Langids", /* String 0 (LangIDs) place holder */
|
"Langids", /* String 0 (LangIDs) place holder */
|
||||||
@@ -1916,5 +1926,5 @@ static unsigned char strDescs_Audio1[][40] =
|
|||||||
|
|
||||||
APPEND_VENDOR_STR(DFU) // 8 iInterface for DFU interface
|
APPEND_VENDOR_STR(DFU) // 8 iInterface for DFU interface
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,6 @@
|
|||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
#include <print.h>
|
#include <print.h>
|
||||||
|
|
||||||
//In this file xud.h is not included since we are interpreting the
|
|
||||||
//assembly functions GetData/SetData as taking xc_ptrs
|
|
||||||
//#include "xud.h"
|
|
||||||
|
|
||||||
#define XUD_SPEED_HS 2
|
|
||||||
|
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "devicedefines.h"
|
#include "devicedefines.h"
|
||||||
#include "usb_midi.h"
|
#include "usb_midi.h"
|
||||||
@@ -98,24 +92,24 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
XUD_ep ep_aud_out = XUD_Init_Ep(c_aud_out);
|
XUD_ep ep_aud_out = XUD_InitEp(c_aud_out);
|
||||||
XUD_ep ep_aud_in = XUD_Init_Ep(c_aud_in);
|
XUD_ep ep_aud_in = XUD_InitEp(c_aud_in);
|
||||||
XUD_ep ep_aud_fb = XUD_Init_Ep(c_aud_fb);
|
XUD_ep ep_aud_fb = XUD_InitEp(c_aud_fb);
|
||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
XUD_ep ep_midi_from_host = XUD_Init_Ep(c_midi_from_host);
|
XUD_ep ep_midi_from_host = XUD_InitEp(c_midi_from_host);
|
||||||
XUD_ep ep_midi_to_host = XUD_Init_Ep(c_midi_to_host);
|
XUD_ep ep_midi_to_host = XUD_InitEp(c_midi_to_host);
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
XUD_ep ep_iap_from_host = XUD_Init_Ep(c_iap_from_host);
|
XUD_ep ep_iap_from_host = XUD_InitEp(c_iap_from_host);
|
||||||
XUD_ep ep_iap_to_host = XUD_Init_Ep(c_iap_to_host);
|
XUD_ep ep_iap_to_host = XUD_InitEp(c_iap_to_host);
|
||||||
XUD_ep ep_iap_to_host_int = XUD_Init_Ep(c_iap_to_host_int);
|
XUD_ep ep_iap_to_host_int = XUD_InitEp(c_iap_to_host_int);
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||||
XUD_ep ep_int = XUD_Init_Ep(c_int);
|
XUD_ep ep_int = XUD_InitEp(c_int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HID_CONTROLS
|
#ifdef HID_CONTROLS
|
||||||
XUD_ep ep_hid = XUD_Init_Ep(c_hid);
|
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -699,7 +693,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Too many events from device - drop
|
// Too many events from device - drop
|
||||||
printstr("DROP");
|
//printstr("DROP");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Once we have the whole message, sent it to host */
|
/* Once we have the whole message, sent it to host */
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
|
|
||||||
#include "devicedefines.h"
|
#include "devicedefines.h"
|
||||||
|
#include "hostactive.h"
|
||||||
#ifdef HOST_ACTIVE_CALL
|
#include "audiostream.h"
|
||||||
void VendorHostActive(int valid);
|
|
||||||
|
|
||||||
void XUD_UserSuspend(void)
|
void XUD_UserSuspend(void)
|
||||||
{
|
{
|
||||||
VendorHostActive(0);
|
UserAudioStreamStop();
|
||||||
|
UserHostActive(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XUD_UserResume(void)
|
void XUD_UserResume(void)
|
||||||
{
|
{
|
||||||
unsigned config;
|
unsigned config;
|
||||||
|
|
||||||
asm("ldw %0, dp[g_config]" : "=r" (config):);
|
asm("ldw %0, dp[g_currentConfig]" : "=r" (config):);
|
||||||
|
|
||||||
if(config == 1)
|
if(config == 1)
|
||||||
{
|
{
|
||||||
VendorHostActive(1);
|
UserHostActive(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
Reference in New Issue
Block a user