Fixed some build warnings, EP num shuffle after Int EP removal

This commit is contained in:
Ross Owen
2012-11-21 18:12:24 +00:00
parent 268018abd6
commit 3b5605dd02
7 changed files with 64 additions and 73 deletions

View File

@@ -360,7 +360,6 @@ int DFUReportResetState(chanend ?c_user_cmd)
int XMOS_DFU_RevertFactory(chanend ?c_user_cmd)
{
unsigned int cmd_data[16];
unsigned s = 0;
DFU_OpenFlash(c_user_cmd);

View File

@@ -74,7 +74,9 @@ unsigned deliver(chanend c_out, chanend ?c_spd_out, unsigned divide, chanend ?c_
unsigned samplesInPrev[NUM_USB_CHAN_IN];
#endif
unsigned tmp;
#if (I2S_CHANS_ADC != 0)
unsigned index;
#endif
#ifdef RAMP_CHECK
unsigned prev=0;
int started = 0;

View File

@@ -185,17 +185,17 @@
#define OUTPUT_INTERFACES (0)
#endif
#define NUM_EP_OUT_AUD (OUTPUT_INTERFACES)
#define NUM_EP_IN_AUD (OUTPUT_INTERFACES + INPUT_INTERFACES)
#define EP_CNT_OUT_AUD (OUTPUT_INTERFACES)
#define EP_CNT_IN_AUD (OUTPUT_INTERFACES + INPUT_INTERFACES)
#if defined(MIDI)
#define MIDI_INTERFACES (2)
#define NUM_EP_OUT_MIDI (1)
#define NUM_EP_IN_MIDI (1)
#define EP_CNT_OUT_MIDI (1)
#define EP_CNT_IN_MIDI (1)
#else
#define MIDI_INTERFACES (0)
#define NUM_EP_OUT_MIDI (0)
#define NUM_EP_IN_MIDI (0)
#define EP_CNT_OUT_MIDI (0)
#define EP_CNT_IN_MIDI (0)
#endif
#if defined(IAP)
@@ -210,15 +210,20 @@
#define HID_INTERFACES (0)
#endif
#define NUM_EP_OUT_IAP (IAP_INTERFACES)
#define NUM_EP_IN_IAP (IAP_INTERFACES * 2)
#define EP_CNT_OUT_IAP (IAP_INTERFACES)
#define EP_CNT_IN_IAP (IAP_INTERFACES * 2)
#define NUM_EP_OUT_HID (0)
#define NUM_EP_IN_HID (HID_INTERFACES)
#define EP_CNT_OUT_HID (0)
#define EP_CNT_IN_HID (HID_INTERFACES)
#if defined(SPDIF_RX) || defined(ADAT_RX)
#define EP_CNT_IN_AUD_INT (1)
#else
#define EP_CNT_IN_AUD_INT (0)
#endif
/* Define for number of audio interfaces (+1 for mandatory control interface) */
#define AUDIO_INTERFACES (INPUT_INTERFACES + OUTPUT_INTERFACES + 1)
#define AUDIO_INTERFACES (INPUT_INTERFACES + OUTPUT_INTERFACES + 1)
/* Interface number defines */
#define INTERFACE_NUM_IAP (INPUT_INTERFACES+OUTPUT_INTERFACES+MIDI_INTERFACES+DFU_INTERFACES+1)
@@ -226,16 +231,16 @@
/* Endpoint Number Defines */
#define EP_NUM_IN_FB (1) /* Always 1 */
#define EP_NUM_IN_AUD (2) /* Always 2 */
#define EP_NUM_IN_AUD_INT (3) /* Audio interrupt/status EP */
#define EP_NUM_IN_MIDI ((EP_NUM_IN_AUD_INT + 1))
#define EP_NUM_IN_HID ((EP_NUM_IN_AUD_INT + NUM_EP_IN_MIDI + 1))
#define EP_NUM_IN_IAP ((EP_NUM_IN_AUD_INT + NUM_EP_IN_MIDI + NUM_EP_IN_HID + 1)) /* iAP Bulk */
#define EP_NUM_IN_IAP_INT ((EP_NUM_IN_AUD_INT + NUM_EP_IN_MIDI + NUM_EP_IN_HID + 2)) /* iAP interrupt */
#define EP_NUM_IN_AUD (2) /* Always 2 */
#define EP_NUM_IN_AUD_INT (EP_NUM_IN_AUD + EP_CNT_IN_AUD_INT) /* Audio interrupt/status EP */
#define EP_NUM_IN_MIDI (EP_NUM_IN_AUD_INT + 1)
#define EP_NUM_IN_HID (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + 1)
#define EP_NUM_IN_IAP (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 1) /* iAP Bulk */
#define EP_NUM_IN_IAP_INT (EP_NUM_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_HID + 2) /* iAP interrupt */
#define EP_NUM_OUT_AUD 1 /* Always 1 */
#define EP_NUM_OUT_MIDI 2 /* Always 2 */
#define EP_NUM_OUT_IAP 3 /* Always 3 */
#define EP_NUM_OUT_AUD (1) /* Always 1 */
#define EP_NUM_OUT_MIDI (2) /* Always 2 */
#define EP_NUM_OUT_IAP (3) /* Always 3 */
/* Endpoint Address Defines */
#define EP_ADR_IN_FB (EP_NUM_IN_FB | 0x80)
@@ -251,8 +256,8 @@
#define EP_ADR_OUT_IAP EP_NUM_OUT_IAP
/* Endpoint count totals */
#define NUM_EP_OUT (1 + 1 /*NUM_EP_OUT_AUD*/ + NUM_EP_OUT_MIDI + NUM_EP_OUT_IAP) /* +1 due to EP0 */
#define NUM_EP_IN (2 + 2 /*NUM_EP_IN_AUD*/ + NUM_EP_IN_MIDI + NUM_EP_IN_IAP + NUM_EP_IN_HID) /* +1 due to EP0 and Int EP */
#define EP_CNT_OUT (1 + 1 /*NUM_EP_OUT_AUD*/ + EP_CNT_OUT_MIDI + EP_CNT_OUT_IAP) /* +1 due to EP0 */
#define EP_CNT_IN (1 + 2 /*NUM_EP_IN_AUD*/ + EP_CNT_IN_AUD_INT + EP_CNT_IN_MIDI + EP_CNT_IN_IAP + EP_CNT_IN_HID) /* +1 due to EP0 */
#define AUDIO_STOP_FOR_DFU (0x12345678)
#define AUDIO_START_FROM_DFU (0x87654321)
@@ -263,11 +268,11 @@
/* Length of clock unit/clock-selector units */
#if defined(SPDIF_RX) && defined(ADAT_RX)
#define NUM_CLOCKS 3
#define NUM_CLOCKS (3)
#elif defined(SPDIF_RX) || defined(ADAT_RX)
#define NUM_CLOCKS 2
#define NUM_CLOCKS (2)
#else
#define NUM_CLOCKS 1
#define NUM_CLOCKS (1)
#endif
@@ -275,7 +280,7 @@
#define NUM_INTERFACES INPUT_INTERFACES + OUTPUT_INTERFACES + DFU_INTERFACES + MIDI_INTERFACES + IAP_INTERFACES + 1 + HID_INTERFACES
/* Number of interfaces for Audio 1.0 */
#define NUM_INTERFACES_A1 (1+INPUT_INTERFACES+OUTPUT_INTERFACES)
#define NUM_INTERFACES_A1 (1+INPUT_INTERFACES+OUTPUT_INTERFACES)
/* Audio Unit ID defines */
@@ -289,16 +294,16 @@
#define ID_CLKSEL 40 /* Clock selector ID */
#define ID_CLKSRC_INT 41 /* Clock source ID (internal) */
#define ID_CLKSRC_EXT 42 /* Clock source ID (external) */
#define ID_CLKSRC_ADAT 43 /* Clock source ID (external) */
#define ID_CLKSRC_ADAT 43 /* Clock source ID (external) */
#define ID_XU_MIXSEL 50
#define ID_XU_OUT 51
#define ID_XU_IN 52
#define ID_XU_MIXSEL 50
#define ID_XU_OUT 51
#define ID_XU_IN 52
#define ID_MIXER_1 60
#define ID_MIXER_1 60
#define MANUFACTURER_STR_INDEX 0x01
#define PRODUCT_STR_INDEX 0x02
#define MANUFACTURER_STR_INDEX 0x01
#define PRODUCT_STR_INDEX 0x02
/* Mixer defines */
#ifndef MIX_INPUTS

View File

@@ -91,8 +91,8 @@ int interfaceAlt[NUM_INTERFACES] = {0, 0, 0, 0};
unsigned g_config = 0;
/* Global endpoint status arrays */
unsigned g_epStatusOut[NUM_EP_OUT];
unsigned g_epStatusIn[NUM_EP_IN];
unsigned g_epStatusOut[EP_CNT_OUT];
unsigned g_epStatusIn[EP_CNT_IN];
/* Global variable for current USB bus speed (i.e. FS/HS) */
unsigned g_curUsbSpeed = 0;
@@ -115,14 +115,14 @@ void SetEndpointStatus(unsigned epNum, unsigned status)
epNum &= 0x7f;
/* Range check */
if(epNum < NUM_EP_IN)
if(epNum < EP_CNT_IN)
{
g_epStatusIn[ epNum & 0x7F ] = status;
}
}
else
{
if(epNum < NUM_EP_OUT)
if(epNum < EP_CNT_OUT)
{
g_epStatusOut[ epNum ] = status;
}
@@ -153,10 +153,10 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
XUD_ep ep0_in = XUD_Init_Ep(c_ep0_in);
/* Init endpoint status tables */
for (int i = 0; i++; i < NUM_EP_OUT)
for (int i = 0; i++; i < EP_CNT_OUT)
g_epStatusOut[i] = 0;
for (int i = 0; i++; i < NUM_EP_IN)
for (int i = 0; i++; i < EP_CNT_IN)
g_epStatusIn[i] = 0;
/* Init tables for volumes (+ 1 for master) */
@@ -713,7 +713,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
if( sp.wIndex & 0x80 )
{
/* IN Endpoint */
if((sp.wIndex&0x7f) < NUM_EP_IN)
if((sp.wIndex&0x7f) < EP_CNT_IN)
{
buffer[0] = ( g_epStatusIn[ sp.wIndex & 0x7F ] & 0xff );
buffer[1] = ( g_epStatusIn[ sp.wIndex & 0x7F ] >> 8 );
@@ -722,7 +722,7 @@ void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
else
{
/* OUT Endpoint */
if(sp.wIndex < NUM_EP_OUT)
if(sp.wIndex < EP_CNT_OUT)
{
buffer[0] = ( g_epStatusOut[ sp.wIndex ] & 0xff );
buffer[1] = ( g_epStatusOut[ sp.wIndex ] >> 8 );

View File

@@ -131,17 +131,19 @@ clock clk = XS1_CLKBLK_4;
#endif
/* Endpoint type tables for XUD */
XUD_EpType epTypeTableOut[NUM_EP_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EpType epTypeTableOut[EP_CNT_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EPTYPE_ISO, /* Audio */
#ifdef MIDI
XUD_EPTYPE_BUL /* MIDI */
#endif
};
XUD_EpType epTypeTableIn[NUM_EP_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EpType epTypeTableIn[EP_CNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENABLE,
XUD_EPTYPE_ISO,
XUD_EPTYPE_ISO,
#if defined (SPDIF_RX) || defined (ADAT_RX)
XUD_EPTYPE_BUL,
#endif
#ifdef MIDI
XUD_EPTYPE_BUL,
#endif
@@ -172,8 +174,8 @@ void xscope_user_init()
int main()
{
chan c_sof;
chan c_xud_out[NUM_EP_OUT]; /* Endpoint channels for XUD */
chan c_xud_in[NUM_EP_IN];
chan c_xud_out[EP_CNT_OUT]; /* Endpoint channels for XUD */
chan c_xud_in[EP_CNT_IN];
chan c_aud_ctl;
chan c_mix_out;
#ifdef MIDI
@@ -202,11 +204,11 @@ int main()
/* USB Interface */
#if (AUDIO_CLASS==2)
on stdcore[0]: XUD_Manager(c_xud_out, NUM_EP_OUT, c_xud_in, NUM_EP_IN,
on stdcore[0]: XUD_Manager(c_xud_out, EP_CNT_OUT, c_xud_in, EP_CNT_IN,
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
clk, 1, XUD_SPEED_HS, c_usb_test);
#else
on stdcore[0]:XUD_Manager(c_xud_out, NUM_EP_OUT, c_xud_in, NUM_EP_IN,
on stdcore[0]:XUD_Manager(c_xud_out, EP_CNT_OUT, c_xud_in, EP_CNT_IN,
c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst,
clk, 1, XUD_SPEED_FS, c_usb_test);
#endif

View File

@@ -559,30 +559,13 @@ void decouple(chanend c_mix_out,
)
{
unsigned sampFreq = DEFAULT_FREQ;
#ifdef OUTPUT
int aud_from_host_flag=0;
int aud_to_host_flag=0;
xc_ptr released_buffer;
#if 0
//#ifdef IAP
xc_ptr iap_from_host_rdptr;
xc_ptr iap_from_host_buffer;
xc_ptr iap_to_host_buffer_being_sent = array_to_xc_ptr(g_iap_to_host_buffer_A);
xc_ptr iap_to_host_buffer_being_collected = array_to_xc_ptr(g_iap_to_host_buffer_B);
xc_ptr zero_buffer = array_to_xc_ptr(g_zero_buffer);
int is_ack_iap;
int is_reset;
int iap_reset;
unsigned int datum_iap;
int iap_data_remaining_to_device = 0;
int iap_data_collected_from_device = 0;
int iap_waiting_on_send_to_host = 0;
int iap_to_host_flag = 0;
int iap_from_host_flag = 0;
int iap_expecting_length = 1;
int iap_expecting_data_length = 0;
#endif
#ifdef INPUT
int aud_to_host_flag = 0;
#endif
int t = array_to_xc_ptr(outAudioBuff);
int aud_in_ready = 0;

View File

@@ -126,12 +126,12 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
unsigned clocks = 0;
#ifdef INPUT
unsigned bufferIn = 1;
#endif
unsigned remnant = 0, cycles;
unsigned sofCount = 0;
unsigned freqChange = 0;
//unsigned expected = (DEFAULT_FREQ/8000)<<16;
#ifdef FB_TOLERANCE_TEST
unsigned expected_fb = 0;
@@ -470,8 +470,8 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
{
/* Inform stream that buffer sent */
SET_SHARED_GLOBAL(g_aud_to_host_flag, bufferIn+1);
}
break;
}
break;
#endif