forked from PAWPAW-Mirror/lib_xua
serial string removal and dfu changes for su1
This commit is contained in:
@@ -292,11 +292,6 @@
|
||||
|
||||
#define ID_MIXER_1 60
|
||||
|
||||
#ifndef SERIAL_STR
|
||||
#define SERIAL_STR "0000" /* Serial number string */
|
||||
#endif
|
||||
|
||||
#define SERIAL_STR_INDEX 0x03
|
||||
#define MANUFACTURER_STR_INDEX 0x01
|
||||
#define PRODUCT_STR_INDEX 0x02
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ unsigned char devDesc_Audio1[] =
|
||||
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
||||
MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
|
||||
PRODUCT_STR_INDEX, /* 15 iProduct : Index of product string descriptor */
|
||||
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. */
|
||||
};
|
||||
#endif
|
||||
@@ -60,7 +60,7 @@ unsigned char devDesc_Audio2[] =
|
||||
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
||||
MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
|
||||
PRODUCT_STR_INDEX, /* 15 iProduct : Index of product string descriptor */
|
||||
SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */
|
||||
0,// SERIAL_STR_INDEX, /* 16 iSerialNumber : Index of serial number decriptor */
|
||||
0x02 /* 17 bNumConfigurations : Number of possible configs. Set to 2 so that Windows
|
||||
does not load Composite driver. */
|
||||
};
|
||||
@@ -84,7 +84,7 @@ unsigned char devDesc_Null[] =
|
||||
(BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */
|
||||
MANUFACTURER_STR_INDEX, /* 14 iManufacturer : Index of manufacturer string */
|
||||
PRODUCT_STR_INDEX, /* 15 iProduct : Index of product string descriptor */
|
||||
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 */
|
||||
};
|
||||
|
||||
@@ -1338,7 +1338,7 @@ static unsigned char strDescs_Audio2[][40] =
|
||||
"Langids", /* String 0 (LangIDs) place holder */
|
||||
APPEND_VENDOR_STR( ), // 1 iManufacturer (at MANUFACTURER_STRING_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 In), // 5
|
||||
|
||||
@@ -1576,7 +1576,7 @@ unsigned char oSpeedCfgDesc[] =
|
||||
#define STREAMING_INTERFACES (INPUT_INTERFACES + OUTPUT_INTERFACES)
|
||||
|
||||
|
||||
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES * 61) + (OUTPUT_INTERFACES * 70) + (DFU_INTERFACES * 18))
|
||||
#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES * 61) + (OUTPUT_INTERFACES * 70))
|
||||
#ifdef AUDIO_CLASS_FALLBACK
|
||||
unsigned char cfgDesc_Audio1[] =
|
||||
{
|
||||
@@ -1876,6 +1876,7 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x40,
|
||||
0x00
|
||||
#else
|
||||
#if 0
|
||||
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
||||
0x09, /* 0 Size */
|
||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
||||
@@ -1886,7 +1887,7 @@ unsigned char cfgDesc_Audio1[] =
|
||||
0x00, /* 6 wTransferSize */
|
||||
0x10, /* 7 bcdDFUVersion */
|
||||
0x01, /* 7 bcdDFUVersion */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -1899,7 +1900,7 @@ static unsigned char strDescs_Audio1[][40] =
|
||||
"Langids", /* String 0 (LangIDs) place holder */
|
||||
APPEND_VENDOR_STR(), // 1 iManufacturer
|
||||
APPEND_VENDOR_STR(USB Audio 1.0), // 2 iProduct and iInterface for control interface
|
||||
SERIAL_STR, // 3 iSerialNumber
|
||||
"",//SERIAL_STR, // 3 iSerialNumber
|
||||
|
||||
APPEND_VENDOR_STR(USB 1.0 Audio Out), // 4 iInterface for Streaming interaces
|
||||
APPEND_VENDOR_STR(USB 1.0 Audio In), // 5
|
||||
|
||||
@@ -24,6 +24,20 @@
|
||||
#include "hid.h"
|
||||
#endif
|
||||
|
||||
#define GLXID 0x0001
|
||||
#define PLL_CTRL_VAL ((1<<23) | (499<<8) | (2<<0))
|
||||
void glx_link_setup(unsigned myid, unsigned glxid);
|
||||
void glx_link_setup_with(unsigned myid, unsigned glxid, unsigned link_setup_val);
|
||||
int write_glx_periph_word(unsigned destId, unsigned periphAddress, unsigned destRegAddr, unsigned data);
|
||||
int read_glx_periph_word(unsigned dest_id, unsigned periph_addr, unsigned dest_reg_addr, unsigned &rd_data);
|
||||
int read_glx_periph_reg(unsigned dest_id, unsigned periph_addr, unsigned dest_reg_addr, unsigned bad_format, unsigned data_size, char buf[]);
|
||||
int write_glx_periph_reg(unsigned dest_id, unsigned periph_addr, unsigned dest_reg_addr, unsigned bad_packet, unsigned data_size, char buf[]);
|
||||
void read_sswitch_reg_verify(unsigned coreid, unsigned reg, unsigned &data, unsigned failval);
|
||||
void write_sswitch_reg_verify(unsigned coreid, unsigned reg, unsigned data, unsigned failval);
|
||||
|
||||
#define XS1_GLX_PERIPH_SCTH_ID 0x3
|
||||
|
||||
|
||||
/* Windows does not have a built in DFU driver (windows will prompt), so warn that DFU will not be functional in Audio 1.0 mode.Udi
|
||||
* Of course, OSX is unaffected.
|
||||
*/
|
||||
@@ -267,6 +281,24 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
VendorAudioRequestsInit(c_audioControl, c_mix_ctl, c_clk_ctl);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
{
|
||||
char rdata[1];
|
||||
char wdata[1];
|
||||
|
||||
//wdata[0] = 77;
|
||||
//write_glx_periph_reg(GLXID, XS1_GLX_PERIPH_SCTH_ID, 0x0, 0, 1, wdata);
|
||||
|
||||
|
||||
read_glx_periph_reg(GLXID, XS1_GLX_PERIPH_SCTH_ID, 0x1, 0, 1, rdata);
|
||||
|
||||
if(rdata[0] != 0)
|
||||
{
|
||||
while(1);
|
||||
}
|
||||
// printintln(rdata[0]);
|
||||
#endif
|
||||
|
||||
#ifdef DFU
|
||||
/* Check if device has started in DFU mode */
|
||||
if (DFUReportResetState(null))
|
||||
@@ -867,6 +899,13 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
||||
// Restart audio
|
||||
//outuint(c_audioControl, AUDIO_START_FROM_DFU);
|
||||
DFU_mode_active = 0;
|
||||
|
||||
{
|
||||
unsigned char wdata[1];
|
||||
wdata[0] = 77;
|
||||
write_glx_periph_reg(GLXID, XS1_GLX_PERIPH_SCTH_ID, 0x0, 0, 1, wdata);
|
||||
}
|
||||
|
||||
// Send reboot command
|
||||
//outuint(c_audioControl, SET_SAMPLE_FREQ);
|
||||
//outuint(c_audioControl, AUDIO_REBOOT_FROM_DFU);
|
||||
|
||||
@@ -1,11 +1,63 @@
|
||||
#include <xs1.h>
|
||||
#include <print.h>
|
||||
#define GLXID 0x0001
|
||||
#define XS1_GLX_PERIPH_USB_ID 0x1
|
||||
#define XS1_GLX_CFG_RST_MISC_ADRS 0x50
|
||||
#define XS1_UIFM_PHY_CONTROL_REG 0x3c
|
||||
#define XS1_UIFM_PHY_CONTROL_FORCERESET 0x0
|
||||
#define XS1_GLX_CFG_USB_CLK_EN_BASE 0x3
|
||||
#define XS1_GLX_CFG_USB_EN_BASE 0x2
|
||||
#define XS1_GLX_PERIPH_SCTH_ID 0x3
|
||||
|
||||
|
||||
#define XS1_UIFM_FUNC_CONTROL_REG 0xc
|
||||
#define XS1_UIFM_FUNC_CONTROL_XCVRSELECT 0x0
|
||||
#define XS1_UIFM_FUNC_CONTROL_TERMSELECT 0x1
|
||||
int write_sswitch_reg_blind(unsigned coreid, unsigned reg, unsigned data);
|
||||
void write_sswitch_reg_verify(unsigned coreid, unsigned reg, unsigned data, unsigned failval);
|
||||
int write_glx_periph_word(unsigned destId, unsigned periphAddress, unsigned destRegAddr, unsigned data);
|
||||
int write_glx_periph_reg(unsigned dest_id, unsigned periph_addr, unsigned dest_reg_addr, unsigned bad_packet, unsigned data_size, char buf[]);
|
||||
void read_sswitch_reg_verify(unsigned coreid, unsigned reg, unsigned &data, unsigned failval);
|
||||
|
||||
/* Reboots XMOS device by writing to the PLL config register */
|
||||
void device_reboot_implementation(chanend spare)
|
||||
{
|
||||
//#ifdef ARCH_S
|
||||
#if 1
|
||||
|
||||
unsigned wdata;
|
||||
char wdatac[1];
|
||||
|
||||
write_glx_periph_word(GLXID, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_FUNC_CONTROL_REG, 4);
|
||||
// (0<<XS1_UIFM_FUNC_CONTROL_XCVRSELECT)
|
||||
// | (0<<XS1_UIFM_FUNC_CONTROL_TERMSELECT));
|
||||
|
||||
// Turn off All term resistors and d+ pullup
|
||||
// Term select and opmode
|
||||
|
||||
#if 0
|
||||
/* Write to glx scratch reg so we know rebooting into DFU mode */
|
||||
wdatac[0] = 0x77;
|
||||
write_glx_periph_reg(GLXID, XS1_GLX_PERIPH_SCTH_ID, 0x1, 0, 1, wdatac);
|
||||
|
||||
// Issue soft boot
|
||||
wdata = 0x000c0001;
|
||||
write_sswitch_reg_verify(GLXID, XS1_GLX_CFG_RST_MISC_ADRS, wdata, 2);
|
||||
|
||||
while(1); // Should reset before it executes this.
|
||||
#endif
|
||||
/* Keep usb clock active, enter active mode */
|
||||
//rite_sswitch_reg(GLXID, XS1_GLX_CFG_RST_MISC_ADRS, (0 << XS1_GLX_CFG_USB_CLK_EN_BASE) | (0<<XS1_GLX_CFG_USB_EN_BASE) );
|
||||
|
||||
/* Now reset the phy */
|
||||
// write_glx_periph_word(GLXID, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, (1<<XS1_UIFM_PHY_CONTROL_FORCERESET));
|
||||
|
||||
|
||||
/* Enable the USB clock */
|
||||
//write_sswitch_reg(GLXID, XS1_GLX_CFG_RST_MISC_ADRS, ( ( 0 << XS1_GLX_CFG_USB_CLK_EN_BASE ) ) );
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
outct(spare, XS1_CT_END); // have to do this before freeing the chanend
|
||||
inct(spare); // Receive end ct from usb_buffer to close down in both directions
|
||||
// Need a spare chanend so we can talk to the pll register
|
||||
@@ -17,4 +69,7 @@ void device_reboot_implementation(chanend spare)
|
||||
write_sswitch_reg_blind(core_id^0x8000, 6, pllVal);
|
||||
write_sswitch_reg_blind(core_id, 6, pllVal);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user