forked from PAWPAW-Mirror/lib_xua
添加EQ_HID
This commit is contained in:
@@ -52,6 +52,10 @@ void XUA_Buffer(
|
||||
#if (HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#if PAWPAW_INOUTHID
|
||||
, chanend c_hid
|
||||
, chanend c_hid_out
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || defined(__DOYXGEN__)
|
||||
, chanend c_audio_rate_change
|
||||
@@ -86,6 +90,10 @@ void XUA_Buffer_Ep(chanend c_aud_out,
|
||||
#if (HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#if PAWPAW_INOUTHID
|
||||
, chanend c_hid
|
||||
, chanend c_hid_out
|
||||
#endif //#if PAWPAW_INOUTHID
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
unsigned char g_hidData[HID_MAX_DATA_BYTES] = {0U};
|
||||
#endif
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
#include "stdio.h"
|
||||
#include "pp_hid_exchange.h"
|
||||
unsigned char g_hidData_in[PAWPAW_CFG_HID_IN_BUFSIZE+8] = {0};
|
||||
unsigned char g_hidData_out[PAWPAW_CFG_HID_OUT_BUFSIZE+8] = {0};
|
||||
extern int set_hid_up_size;
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
|
||||
void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max);
|
||||
#define BUFFER_SIZE_OUT (1028 >> 2)
|
||||
#define BUFFER_SIZE_IN (1028 >> 2)
|
||||
@@ -103,6 +111,10 @@ void XUA_Buffer(
|
||||
#if (HID_CONTROLS )
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#if PAWPAW_INOUTHID
|
||||
, chanend c_hid
|
||||
, chanend c_hid_out
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
, chanend c_aud
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, chanend c_audio_rate_change
|
||||
@@ -142,6 +154,11 @@ void XUA_Buffer(
|
||||
#if XUA_HID_ENABLED
|
||||
, c_hid
|
||||
#endif
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
, c_hid
|
||||
, c_hid_out
|
||||
#endif //#if PAWPAW_INOUTHID
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, c_buff_ctrl
|
||||
#endif
|
||||
@@ -197,6 +214,11 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#if(HID_CONTROLS)
|
||||
, chanend c_hid
|
||||
#endif
|
||||
#if PAWPAW_INOUTHID
|
||||
, chanend c_hid
|
||||
, chanend c_hid_out
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
|
||||
#ifdef CHAN_BUFF_CTRL
|
||||
, chanend c_buff_ctrl
|
||||
#endif
|
||||
@@ -242,6 +264,12 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
#if XUA_HID_ENABLED
|
||||
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
||||
#endif
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
||||
XUD_ep ep_hid_out = XUD_InitEp(c_hid_out);//dwj+
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
|
||||
unsigned u_tmp;
|
||||
unsigned sampleFreq = DEFAULT_FREQ;
|
||||
unsigned masterClockFreq = DEFAULT_MCLK_FREQ;
|
||||
@@ -399,6 +427,11 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
|
||||
#endif /* (XUA_SYNCMODE == XUA_SYNCMODE_SYNC) */
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
XUD_SetReady_In(ep_hid, g_hidData_in, PAWPAW_CFG_HID_IN_BUFSIZE);// 上行
|
||||
XUD_SetReady_Out(ep_hid_out,g_hidData_out);// 下行
|
||||
#endif //#if PAWPAW_INOUTHID
|
||||
|
||||
while(1)
|
||||
{
|
||||
XUD_Result_t result;
|
||||
@@ -839,7 +872,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
if (midi_data_remaining_to_device)
|
||||
{
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
midi_send_data(c_midi, datum);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
}
|
||||
@@ -975,6 +1008,31 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||
{
|
||||
/* 通过HID上报DATA给PC端 */
|
||||
hid_to_host_buf(g_hidData_in);
|
||||
|
||||
XUD_SetReady_In(ep_hid, g_hidData_in, set_hid_up_size);
|
||||
}
|
||||
break;
|
||||
|
||||
#if (HID_OUT_REQUIRED)
|
||||
case XUD_GetData_Select(c_hid_out, ep_hid_out,length, result):
|
||||
{
|
||||
XUD_SetReady_Out(ep_hid_out,g_hidData_out);
|
||||
|
||||
/* 从PC端,HID获取数据给到XMOS */
|
||||
hid_from_host_buf(g_hidData_out);
|
||||
|
||||
}
|
||||
break;
|
||||
#endif //#if (HID_OUT_REQUIRED)
|
||||
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
|
||||
#ifdef MIDI
|
||||
/* Received word from MIDI thread - Check for ACK or Data */
|
||||
case midi_get_ack_or_data(c_midi, is_ack, datum):
|
||||
@@ -992,7 +1050,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
||||
{
|
||||
/* Read another word from the fifo and output it to MIDI thread */
|
||||
read_via_xc_ptr(datum, midi_from_host_rdptr);
|
||||
midi_send_data(c_midi, datum);
|
||||
outuint(c_midi, datum);
|
||||
midi_from_host_rdptr += 4;
|
||||
midi_data_remaining_to_device -= 4;
|
||||
}
|
||||
|
||||
@@ -457,6 +457,90 @@ static unsigned char hidReportDescriptorPtr[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
#define hidReportDescriptorLength (sizeof(hidReportDescriptorPtr))
|
||||
static unsigned char hidReportDescriptorPtr[] = {
|
||||
|
||||
0x05, 0x0c, // HID_USAGE_PAGE (Vendor Defined)
|
||||
0x09, 0x01, // USAGE (Undefined)
|
||||
0xa1, 0x01, // COLLECTION (Application)
|
||||
// Report ID if any
|
||||
// 0x85, 0x01, // REPORT_ID (1) 为这个报告集合指定Report ID为1
|
||||
0x09, 0x02, // USAGE (Undefined)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x95, PAWPAW_CFG_HID_IN_BUFSIZE, // REPORT_COUNT (report_size)
|
||||
0x81, 0x02, // INPUT (Data,Var,Abs)
|
||||
// Output
|
||||
0x09, 0x03, // USAGE (Undefined)
|
||||
0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
0x75, 0x08, // REPORT_SIZE (8)
|
||||
0x95, PAWPAW_CFG_HID_OUT_BUFSIZE, // REPORT_COUNT (report_size)
|
||||
0x91, 0x02, // OUTPUT (Data,Var,Abs)
|
||||
0xc0 // END_COLLECTION
|
||||
|
||||
// 0x05, 0x0c, // HID_USAGE_PAGE (Vendor Defined)
|
||||
// 0x09, 0x01, // USAGE (Undefined)
|
||||
// 0xa1, 0x01, // COLLECTION (Application)
|
||||
// 0x85, 0x01, // REPORT_ID (1) 为这个报告集合指定Report ID为1
|
||||
// 0x09, 0x02, // USAGE (Undefined)
|
||||
// 0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
// 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
// 0x75, 0x08, // REPORT_SIZE (8)
|
||||
// 0x95, (PAWPAW_CFG_HID_IN_BUFSIZE-1), // REPORT_COUNT (report_size)
|
||||
// 0x81, 0x02, // INPUT (Data,Var,Abs)
|
||||
// // Output
|
||||
// 0x09, 0x03, // USAGE (Undefined)
|
||||
// 0x15, 0x00, // LOGICAL_MINIMUM (0)
|
||||
// 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
|
||||
// 0x75, 0x08, // REPORT_SIZE (8)
|
||||
// 0x95, (PAWPAW_CFG_HID_OUT_BUFSIZE-1), // REPORT_COUNT (report_size)
|
||||
// 0x91, 0x02, // OUTPUT (Data,Var,Abs)
|
||||
// 0xc0, // END_COLLECTION
|
||||
|
||||
// 0x05, 0x0B, // Usage Page (Telephony)
|
||||
// 0x09, 0x05, // Usage (Keypad)
|
||||
// 0xA1, 0x01, // Collection (Application)
|
||||
// 0x85, 0x02, // Report ID (2)
|
||||
// 0x15, 0x00, // Logical Minimum (0)
|
||||
// 0x25, 0x01, // Logical Maximum (1)
|
||||
// 0x95, 0x01, // Report Count (1)
|
||||
// 0x75, 0x01, // Report Size (1 bit)
|
||||
// 0x09, 0x20, // Usage (Hook Switch)
|
||||
// 0x81, 0x02, // Input (Data, Var, Abs)
|
||||
// 0x09, 0x2F, // Usage (Phone Mute)
|
||||
// 0x81, 0x06, // Input (Data, Var, Rel)
|
||||
// 0x09, 0x21, // Usage (Flash)
|
||||
// 0x81, 0x02, // Input (Data, Var, Abs)
|
||||
// 0x09, 0x24, // Usage (Redial)
|
||||
// 0x81, 0x02, // Input (Data, Var, Abs)
|
||||
// 0x95, 0x01, // Report Count (1)
|
||||
// 0x75, 0x04, // Report Size (4 bits)
|
||||
// 0x81, 0x01, // Input (Const)
|
||||
// 0x05, 0x08, // Usage Page (LEDs)
|
||||
// 0x09, 0x17, // Usage (Off-Hook)
|
||||
// 0x15, 0x00, // Logical Minimum (0)
|
||||
// 0x25, 0x01, // Logical Maximum (1)
|
||||
// 0x95, 0x01, // Report Count (1)
|
||||
// 0x75, 0x01, // Report Size (1 bit)
|
||||
// 0x91, 0x02, // Output (Data, Var, Abs)
|
||||
// 0x09, 0x09, // Usage (Message Waiting)
|
||||
// 0x91, 0x02, // Output (Data, Var, Abs)
|
||||
// 0x09, 0x18, // Usage (Ring)
|
||||
// 0x91, 0x02, // Output (Data, Var, Abs)
|
||||
// 0x09, 0x20, // Usage (Hook Switch)
|
||||
// 0x91, 0x02, // Output (Data, Var, Abs)
|
||||
// 0x95, 0x01, // Report Count (1)
|
||||
// 0x75, 0x04, // Report Size (4 bits)
|
||||
// 0x91, 0x01, // Output (Const)
|
||||
// 0xC0, // End Collection
|
||||
|
||||
|
||||
};
|
||||
#endif //#if PAWPAW_INOUTHID
|
||||
|
||||
|
||||
|
||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||
@@ -893,6 +977,16 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
||||
result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if PAWPAW_INOUTHID
|
||||
if (interfaceNum == INTERFACE_NUMBER_HID)
|
||||
{
|
||||
debug_printf("INTERFACE_NUMBER_HID");
|
||||
extern XUD_Result_t HidInterfaceClassRequests_PAWPAW(XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t sp);
|
||||
HidInterfaceClassRequests_PAWPAW(ep0_out, ep0_in, sp);
|
||||
}
|
||||
#endif//#if PAWPAW_INOUTHID
|
||||
|
||||
/* Check for: - Audio CONTROL interface request - always 0, note we check for DFU first
|
||||
* - Audio STREAMING interface request (In or Out)
|
||||
* - Audio endpoint request (Audio 1.0 Sampling freq requests are sent to the endpoint)
|
||||
|
||||
@@ -593,6 +593,10 @@ int main()
|
||||
#if (XUA_HID_ENABLED)
|
||||
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
||||
#endif
|
||||
#if PAWPAW_INOUTHID
|
||||
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
||||
, c_xud_out[ENDPOINT_NUMBER_OUT_HID]
|
||||
#endif //#if PAWPAW_INOUTHID
|
||||
, c_mix_out
|
||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||
, c_audio_rate_change
|
||||
@@ -602,10 +606,11 @@ int main()
|
||||
, c_sw_pll
|
||||
#endif
|
||||
#endif
|
||||
|
||||
);
|
||||
//:
|
||||
}
|
||||
|
||||
XUD_UNSAFE_RESRC
|
||||
/* Endpoint 0 Core */
|
||||
{
|
||||
thread_speed();
|
||||
@@ -621,7 +626,7 @@ int main()
|
||||
|
||||
on tile[AUDIO_IO_TILE]:
|
||||
{
|
||||
|
||||
AUDIO_UNSAFE_RESRC
|
||||
/* Audio I/O task, includes mixing etc */
|
||||
usb_audio_io(c_mix_out
|
||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||
|
||||
Reference in New Issue
Block a user