forked from PAWPAW-Mirror/lib_xua
xpd: Cleaned up whitespace
This commit is contained in:
@@ -704,7 +704,7 @@ unsigned static deliver(chanend c_out, chanend ?c_spd_out,
|
|||||||
/* Manual IN instruction since compiler generates an extra setc per IN (bug #15256) */
|
/* Manual IN instruction since compiler generates an extra setc per IN (bug #15256) */
|
||||||
unsigned sample;
|
unsigned sample;
|
||||||
asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++]));
|
asm volatile("in %0, res[%1]" : "=r"(sample) : "r"(p_i2s_adc[index++]));
|
||||||
|
|
||||||
if(buffIndex)
|
if(buffIndex)
|
||||||
samplesIn_1[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line.
|
samplesIn_1[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line.
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1417,10 +1417,10 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
/* Type 1 Format Type Descriptor */
|
/* Type 1 Format Type Descriptor */
|
||||||
.Audio_Out_Format =
|
.Audio_Out_Format =
|
||||||
{
|
{
|
||||||
.bLength = 0x06,
|
.bLength = 0x06,
|
||||||
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
|
.bDescriptorType = UAC_CS_DESCTYPE_INTERFACE,
|
||||||
.bDescriptorSubtype = UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE,
|
.bDescriptorSubtype = UAC_CS_AS_INTERFACE_SUBTYPE_FORMAT_TYPE,
|
||||||
.bFormatType = UAC_FORMAT_TYPE_I,
|
.bFormatType = UAC_FORMAT_TYPE_I,
|
||||||
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
|
.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES,
|
||||||
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS,
|
.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS,
|
||||||
},
|
},
|
||||||
@@ -1430,7 +1430,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
{
|
{
|
||||||
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||||
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
|
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO,
|
||||||
.bmAttributes = 0x05, /* (bitmap) */
|
.bmAttributes = 0x05, /* (bitmap) */
|
||||||
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
|
.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE,
|
||||||
.bInterval = 1,
|
.bInterval = 1,
|
||||||
@@ -1451,11 +1451,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||||
.Audio_Out_Fb_Endpoint =
|
.Audio_Out_Fb_Endpoint =
|
||||||
{
|
{
|
||||||
.bLength = 0x07,
|
.bLength = 0x07,
|
||||||
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
.bDescriptorType = USB_DESCTYPE_ENDPOINT,
|
||||||
.bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
|
.bEndpointAddress = ENDPOINT_ADDRESS_IN_FEEDBACK,
|
||||||
.bmAttributes = 17, /* (bitmap) */
|
.bmAttributes = 17, /* (bitmap) */
|
||||||
.wMaxPacketSize = 0x0004,
|
.wMaxPacketSize = 0x0004,
|
||||||
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
|
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
@@ -1616,7 +1616,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
.wMaxPacketSize = 0x0004,
|
.wMaxPacketSize = 0x0004,
|
||||||
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
|
.bInterval = 4, /* Only values <= 1 frame (4) supported by MS */
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#endif /* OUTPUT_FORMAT_COUNT > 2 */
|
#endif /* OUTPUT_FORMAT_COUNT > 2 */
|
||||||
#endif /* OUTPUT */
|
#endif /* OUTPUT */
|
||||||
#if (NUM_USB_CHAN_IN > 0)
|
#if (NUM_USB_CHAN_IN > 0)
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl,
|
|||||||
* - Audio STREAMING interface request (In or Out)
|
* - Audio STREAMING interface request (In or Out)
|
||||||
* - 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))
|
||||||
#ifdef DFU
|
#ifdef DFU
|
||||||
&& !DFU_mode_active
|
&& !DFU_mode_active
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -362,10 +362,10 @@ static void mixer1(chanend c_host, chanend c_mix_ctl, chanend c_mixer2)
|
|||||||
/* Request from audio()/mixer2() */
|
/* Request from audio()/mixer2() */
|
||||||
request = inuint(c_mixer2);
|
request = inuint(c_mixer2);
|
||||||
|
|
||||||
|
|
||||||
/* Forward on Request for data to decouple thread */
|
/* Forward on Request for data to decouple thread */
|
||||||
outuint(c_host, request);
|
outuint(c_host, request);
|
||||||
|
|
||||||
/* Between request to decouple and respose ~ 400nS latency for interrupt to fire */
|
/* Between request to decouple and respose ~ 400nS latency for interrupt to fire */
|
||||||
select
|
select
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ xc_ptr g_aud_to_host_dptr;
|
|||||||
xc_ptr g_aud_to_host_rdptr;
|
xc_ptr g_aud_to_host_rdptr;
|
||||||
xc_ptr g_aud_to_host_zeros;
|
xc_ptr g_aud_to_host_zeros;
|
||||||
int sampsToWrite = DEFAULT_FREQ/8000; /* HS assumed here. Expect to be junked during a overflow before stream start */
|
int sampsToWrite = DEFAULT_FREQ/8000; /* HS assumed here. Expect to be junked during a overflow before stream start */
|
||||||
int totalSampsToWrite = DEFAULT_FREQ/8000;
|
int totalSampsToWrite = DEFAULT_FREQ/8000;
|
||||||
int aud_data_remaining_to_device = 0;
|
int aud_data_remaining_to_device = 0;
|
||||||
|
|
||||||
/* Audio over/under flow flags */
|
/* Audio over/under flow flags */
|
||||||
@@ -436,7 +436,7 @@ __builtin_unreachable();
|
|||||||
|
|
||||||
/* Round up to nearest word - note, not needed for slotsize == 4! */
|
/* Round up to nearest word - note, not needed for slotsize == 4! */
|
||||||
datasize = (datasize+3) & (~0x3);
|
datasize = (datasize+3) & (~0x3);
|
||||||
|
|
||||||
/* Move wr ptr on by old packet length */
|
/* Move wr ptr on by old packet length */
|
||||||
g_aud_to_host_wrptr += 4+datasize;
|
g_aud_to_host_wrptr += 4+datasize;
|
||||||
|
|
||||||
@@ -447,10 +447,10 @@ __builtin_unreachable();
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_aud_to_host_dptr = g_aud_to_host_wrptr + 4;
|
g_aud_to_host_dptr = g_aud_to_host_wrptr + 4;
|
||||||
|
|
||||||
/* Now calculate new packet length...
|
/* Now calculate new packet length...
|
||||||
* First get feedback val (ideally this would be syncronised)
|
* First get feedback val (ideally this would be syncronised)
|
||||||
* Note, if customer hasn't applied a valid MCLK this could go to 0
|
* Note, if customer hasn't applied a valid MCLK this could go to 0
|
||||||
* we need to handle this gracefully */
|
* we need to handle this gracefully */
|
||||||
asm volatile("ldw %0, dp[g_speed]" : "=r" (speed) :);
|
asm volatile("ldw %0, dp[g_speed]" : "=r" (speed) :);
|
||||||
|
|
||||||
@@ -475,36 +475,36 @@ __builtin_unreachable();
|
|||||||
space_left = aud_to_host_fifo_end - g_aud_to_host_wrptr;
|
space_left = aud_to_host_fifo_end - g_aud_to_host_wrptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if((space_left > 0) && (space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4)))
|
//if((space_left > 0) && (space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4)))
|
||||||
if((space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4)))
|
if((space_left < (totalSampsToWrite * g_numUsbChan_In * g_curSubSlot_In + 4)))
|
||||||
{
|
{
|
||||||
/* In pipe has filled its buffer - we need to overflow
|
/* In pipe has filled its buffer - we need to overflow
|
||||||
* Accept the packet, and throw away the oldest in the buffer */
|
* Accept the packet, and throw away the oldest in the buffer */
|
||||||
|
|
||||||
/* Keep throwing away packets until buffer is at a nice level.. */
|
/* Keep throwing away packets until buffer is at a nice level.. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
unsigned rdPtr;
|
unsigned rdPtr;
|
||||||
|
|
||||||
/* Read length of packet in buffer at read pointer */
|
/* Read length of packet in buffer at read pointer */
|
||||||
unsigned datalength;
|
unsigned datalength;
|
||||||
|
|
||||||
GET_SHARED_GLOBAL(rdPtr, g_aud_to_host_rdptr);
|
GET_SHARED_GLOBAL(rdPtr, g_aud_to_host_rdptr);
|
||||||
asm volatile("ldw %0, %1[0]":"=r"(datalength):"r"(rdPtr));
|
asm volatile("ldw %0, %1[0]":"=r"(datalength):"r"(rdPtr));
|
||||||
|
|
||||||
/* Round up datalength */
|
/* Round up datalength */
|
||||||
datalength = ((datalength+3) & ~0x3) + 4;
|
datalength = ((datalength+3) & ~0x3) + 4;
|
||||||
|
|
||||||
/* Move read pointer on by length */
|
/* Move read pointer on by length */
|
||||||
rdPtr += datalength;
|
rdPtr += datalength;
|
||||||
if (rdPtr >= aud_to_host_fifo_end)
|
if (rdPtr >= aud_to_host_fifo_end)
|
||||||
{
|
{
|
||||||
rdPtr = aud_to_host_fifo_start;
|
rdPtr = aud_to_host_fifo_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
space_left += datalength;
|
space_left += datalength;
|
||||||
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, rdPtr);
|
SET_SHARED_GLOBAL(g_aud_to_host_rdptr, rdPtr);
|
||||||
|
|
||||||
} while(space_left < (BUFF_SIZE_IN*4/2));
|
} while(space_left < (BUFF_SIZE_IN*4/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +556,7 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
|
|||||||
/* Set IN stream packet size to something sensible. We expect the buffer to
|
/* Set IN stream packet size to something sensible. We expect the buffer to
|
||||||
* over flow and this to be reset */
|
* over flow and this to be reset */
|
||||||
SET_SHARED_GLOBAL(sampsToWrite, 0);
|
SET_SHARED_GLOBAL(sampsToWrite, 0);
|
||||||
SET_SHARED_GLOBAL(totalSampsToWrite, 0);
|
SET_SHARED_GLOBAL(totalSampsToWrite, 0);
|
||||||
|
|
||||||
mid *= g_numUsbChan_In * slotSize;
|
mid *= g_numUsbChan_In * slotSize;
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ static inline void SetupZerosSendBuffer(XUD_ep aud_to_host_usb_ep, unsigned samp
|
|||||||
|
|
||||||
/* Mark EP ready with the zero buffer. Note this will simply update the packet size
|
/* Mark EP ready with the zero buffer. Note this will simply update the packet size
|
||||||
* if it is already ready */
|
* if it is already ready */
|
||||||
|
|
||||||
/* g_aud_to_host_buffer is already set to g_aud_to_host_zeros */
|
/* g_aud_to_host_buffer is already set to g_aud_to_host_zeros */
|
||||||
|
|
||||||
GET_SHARED_GLOBAL(p, g_aud_to_host_buffer);
|
GET_SHARED_GLOBAL(p, g_aud_to_host_buffer);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ unsigned char fb_clocks[16];
|
|||||||
* @param c_aud_fb chanend for feeback to xud
|
* @param c_aud_fb chanend for feeback to xud
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
void buffer(register chanend c_aud_out, register chanend c_aud_in,
|
void buffer(register chanend c_aud_out, register chanend c_aud_in,
|
||||||
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
#if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP)
|
||||||
chanend c_aud_fb,
|
chanend c_aud_fb,
|
||||||
#endif
|
#endif
|
||||||
@@ -322,7 +322,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in,
|
|||||||
int min, mid, max;
|
int min, mid, max;
|
||||||
GetADCCounts(sampleFreq, min, mid, max);
|
GetADCCounts(sampleFreq, min, mid, max);
|
||||||
g_speed = mid<<16;
|
g_speed = mid<<16;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Ideally we want to wait for handshake (and pass back up) here. But we cannot keep this
|
/* Ideally we want to wait for handshake (and pass back up) here. But we cannot keep this
|
||||||
|
|||||||
Reference in New Issue
Block a user