forked from PAWPAW-Mirror/lib_xua
@@ -412,10 +412,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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1379,7 +1379,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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -558,7 +558,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 +583,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
|
||||||
|
|||||||
@@ -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,7 +1978,7 @@ 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) */
|
||||||
@@ -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 */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user