Copy across from apps_usb_aud_shared
This commit is contained in:
@@ -1,24 +1,6 @@
|
||||
/**
|
||||
* Module: module_usb_aud_shared
|
||||
* Version: 2v3
|
||||
* Build: 920238b18f6b0967226369682640e1b063865f02
|
||||
* File: decouple.xc
|
||||
*
|
||||
* The copyrights, all other intellectual and industrial
|
||||
* property rights are retained by XMOS and/or its licensors.
|
||||
* Terms and conditions covering the use of this code can
|
||||
* be found in the Xmos End User License Agreement.
|
||||
*
|
||||
* Copyright XMOS Ltd 2010
|
||||
*
|
||||
* In the case where this code is a modification of existing code
|
||||
* under a separate license, the separate license terms are shown
|
||||
* below. The modifications to the code are still covered by the
|
||||
* copyright notice above.
|
||||
*
|
||||
**/
|
||||
#include <xs1.h>
|
||||
#include <print.h>
|
||||
#include <assert.h>
|
||||
#include "xc_ptr.h"
|
||||
#define NO_INLINE_MIDI_SELECT_HANDLER 1
|
||||
#include "usb_midi.h"
|
||||
@@ -175,7 +157,7 @@ int int_usb_ep = 0;
|
||||
|
||||
unsigned int g_midi_to_host_buffer_A[MAX_USB_MIDI_PACKET_SIZE/4+4];
|
||||
unsigned int g_midi_to_host_buffer_B[MAX_USB_MIDI_PACKET_SIZE/4+4];
|
||||
int g_midi_from_host_buffer[MAX_USB_MIDI_PACKET_SIZE+4];
|
||||
int g_midi_from_host_buffer[MAX_USB_MIDI_PACKET_SIZE/4+4];
|
||||
|
||||
// shared global aud buffering variables
|
||||
|
||||
@@ -805,18 +787,12 @@ void decouple(chanend c_mix_out,
|
||||
}
|
||||
|
||||
/* Reset OUT buffer state */
|
||||
outOverflow = 0;
|
||||
outUnderflow = 1;
|
||||
SET_SHARED_GLOBAL(g_aud_from_host_rdptr, aud_from_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(g_aud_from_host_wrptr, aud_from_host_fifo_start);
|
||||
SET_SHARED_GLOBAL(aud_data_remaining_to_device, 0);
|
||||
|
||||
if(outOverflow)
|
||||
{
|
||||
XUD_SetReady(aud_from_host_usb_ep, 1);
|
||||
outOverflow = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Wait for handshake back and pass back up */
|
||||
chkct(c_mix_out, XS1_CT_END);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
void buffer(chanend c_aud_out, chanend c_aud_in, chanend c_aud_fb,
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_int,
|
||||
chanend? c_int,
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk);
|
||||
|
||||
@@ -73,7 +73,7 @@ extern unsigned g_numUsbChanIn;
|
||||
void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud_fb,
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
chanend c_int, chanend c_sof,
|
||||
chanend ?c_int, chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
)
|
||||
@@ -85,7 +85,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
XUD_ep ep_midi_from_host = XUD_Init_Ep(c_midi_from_host);
|
||||
XUD_ep ep_midi_to_host = XUD_Init_Ep(c_midi_to_host);
|
||||
#endif
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
XUD_ep ep_int = XUD_Init_Ep(c_int);
|
||||
#endif
|
||||
|
||||
unsigned datalength;
|
||||
unsigned tmp;
|
||||
@@ -116,7 +118,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
set_thread_fast_mode_on();
|
||||
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
asm("stw %0, dp[int_usb_ep]"::"r"(ep_int));
|
||||
#endif
|
||||
asm("stw %0, dp[aud_from_host_usb_ep]"::"r"(ep_aud_out));
|
||||
asm("stw %0, dp[aud_to_host_usb_ep]"::"r"(ep_aud_in));
|
||||
asm("stw %0, dp[buffer_aud_ctl_chan]"::"r"(c_aud_ctl));
|
||||
@@ -195,6 +199,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
/* Wait for response from XUD and service relevant EP */
|
||||
select
|
||||
{
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
/* Interrupt EP, send back interrupt data. Note, request made from decouple */
|
||||
case inuint_byref(c_int, tmp):
|
||||
{
|
||||
@@ -221,6 +226,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
XUD_SetNotReady(ep_int);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Sample Freq our chan count update from ep 0 */
|
||||
case inuint_byref(c_aud_ctl, tmp):
|
||||
|
||||
Reference in New Issue
Block a user