Added hid controls
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
#include "clockcmds.h"
|
||||
#include "xud.h"
|
||||
#include "usb.h"
|
||||
#ifdef HID_CONTROLS
|
||||
#include "vendor_hid.h"
|
||||
#endif
|
||||
|
||||
/* This function changes the buffer staged for an IN transaction.
|
||||
* **It can only be used if you know that the IN transaction will not occur**
|
||||
@@ -200,6 +203,13 @@ unsigned int g_iap_to_host_buffer_A[MAX_IAP_PACKET_SIZE/4+4];
|
||||
unsigned int g_iap_to_host_buffer_B[MAX_IAP_PACKET_SIZE/4+4];
|
||||
int g_iap_from_host_buffer[MAX_IAP_PACKET_SIZE/4+4];
|
||||
unsigned g_zero_buffer[1];
|
||||
#endif
|
||||
#ifdef HID_CONTROLS
|
||||
extern in port p_but;
|
||||
unsigned char g_hidData[16] = {0};
|
||||
unsigned char g_hidFlag = 0;
|
||||
unsigned g_ep_hid = 0;
|
||||
|
||||
#endif
|
||||
|
||||
// shared global aud buffering variables
|
||||
@@ -821,16 +831,32 @@ void decouple(chanend c_mix_out,
|
||||
|
||||
while(1)
|
||||
{
|
||||
int tmp;
|
||||
if (!isnull(c_clk_int))
|
||||
{
|
||||
check_for_interrupt(c_clk_int);
|
||||
check_for_interrupt(c_clk_int);
|
||||
}
|
||||
|
||||
asm("#decouple-default");
|
||||
|
||||
/* Check for freq change or other update */
|
||||
|
||||
{
|
||||
int tmp;
|
||||
p_but :> tmp;
|
||||
tmp = ~tmp;
|
||||
tmp &=3;
|
||||
g_hidData[0] = tmp;
|
||||
|
||||
#ifdef HID_CONTROLS
|
||||
Vendor_ReadHIDButtons(g_hidData);
|
||||
|
||||
asm("ldaw %0, dp[g_hidData]":"=r"(tmp));
|
||||
if(g_hidFlag==0)
|
||||
{
|
||||
XUD_SetReady_In(g_ep_hid, 0, tmp, 1);
|
||||
g_hidFlag = 1;
|
||||
}
|
||||
#endif
|
||||
asm("#decouple-default");
|
||||
|
||||
/* Check for freq change or other update */
|
||||
|
||||
GET_SHARED_GLOBAL(tmp, g_freqChange_flag);
|
||||
if (tmp == SET_SAMPLE_FREQ)
|
||||
{
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
* \param c_aud_ctl Audio control channel connected to Endpoint0()
|
||||
* \param p_off_mclk A port that is clocked of the MCLK input (not the MCLK input itself)
|
||||
*/
|
||||
void buffer(chanend c_aud_out, chanend c_aud_in, chanend c_aud_fb,
|
||||
void buffer(chanend c_aud_out, chanend c_aud_in, chanend c_aud_fb,
|
||||
#ifdef MIDI
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
@@ -27,7 +29,9 @@ void buffer(chanend c_aud_out, chanend c_aud_in, chanend c_aud_fb,
|
||||
chanend? c_int,
|
||||
chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk);
|
||||
|
||||
|
||||
in port p_off_mclk
|
||||
#ifdef HID_CONTROLS
|
||||
,chanend c_hid
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
#include "xud.h"
|
||||
#include "testct_byref.h"
|
||||
|
||||
//typedef unsigned int XUD_ep;
|
||||
|
||||
//int XUD_GetData_NoReq(chanend c, xc_ptr buffer);
|
||||
//int XUD_SetData_NoReq(chanend c, xc_ptr buffer, unsigned datalength, unsigned startIndex);
|
||||
XUD_ep XUD_Init_Ep(chanend c_ep);
|
||||
|
||||
|
||||
|
||||
inline void XUD_SetNotReady(XUD_ep e)
|
||||
{
|
||||
int chan_array_ptr;
|
||||
@@ -73,9 +71,11 @@ extern unsigned g_numUsbChanIn;
|
||||
* @param c_aud_fb chanend for feeback to xud
|
||||
* @return void
|
||||
*/
|
||||
void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud_fb,
|
||||
void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud_fb,
|
||||
#ifdef MIDI
|
||||
chanend c_midi_from_host,
|
||||
chanend c_midi_to_host,
|
||||
#endif
|
||||
#ifdef IAP
|
||||
chanend c_iap_from_host,
|
||||
chanend c_iap_to_host,
|
||||
@@ -84,6 +84,9 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
chanend ?c_int, chanend c_sof,
|
||||
chanend c_aud_ctl,
|
||||
in port p_off_mclk
|
||||
#ifdef HID_CONTROLS
|
||||
,chanend c_hid
|
||||
#endif
|
||||
)
|
||||
{
|
||||
XUD_ep ep_aud_out = XUD_Init_Ep(c_aud_out);
|
||||
@@ -101,6 +104,10 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
#if defined(SPDIF_RX) || defined(ADAT_RX)
|
||||
XUD_ep ep_int = XUD_Init_Ep(c_int);
|
||||
#endif
|
||||
|
||||
#ifdef HID_CONTROLS
|
||||
XUD_ep ep_hid = XUD_Init_Ep(c_hid);
|
||||
#endif
|
||||
|
||||
unsigned datalength;
|
||||
unsigned tmp;
|
||||
@@ -149,6 +156,7 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
#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[g_ep_hid]"::"r"(ep_hid));
|
||||
asm("stw %0, dp[buffer_aud_ctl_chan]"::"r"(c_aud_ctl));
|
||||
|
||||
/* Wait for USB connect then setup our first packet */
|
||||
@@ -215,7 +223,6 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
|
||||
(fb_clocks, unsigned[])[0] = 0;
|
||||
|
||||
|
||||
{
|
||||
int usb_speed;
|
||||
int x;
|
||||
@@ -661,6 +668,20 @@ void buffer(register chanend c_aud_out, register chanend c_aud_in, chanend c_aud
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef HID_CONTROLS
|
||||
/* HID Report Data */
|
||||
case inuint_byref(c_hid, tmp):
|
||||
{
|
||||
XUD_SetData_Inline(ep_hid, c_hid);
|
||||
|
||||
asm("stw %0, dp[g_hidFlag]" :: "r" (0) );
|
||||
|
||||
XUD_SetNotReady(ep_hid);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user