forked from PAWPAW-Mirror/lib_xua
Compare commits
34 Commits
feat/dummy
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a485ffe41a | ||
|
|
f25a9eeade | ||
|
|
dff72573f8 | ||
|
|
f7331a1ed3 | ||
|
|
aaaf1e9652 | ||
|
|
d6b23cf960 | ||
|
|
fa8329edaa | ||
|
|
83d86e885f | ||
|
|
15036f2bcc | ||
|
|
fa5723947f | ||
|
|
b1b28f1005 | ||
|
|
6d41cfcbea | ||
|
|
5404127dbf | ||
|
|
e5a270347a | ||
|
|
f509a12e7d | ||
|
|
4528bed740 | ||
|
|
e812ca3e8b | ||
|
|
2accc0429f | ||
|
|
36d5201365 | ||
|
|
cea580ba48 | ||
|
|
6815f12a90 | ||
|
|
799ad7ba86 | ||
|
|
3d7e66bdc0 | ||
|
|
a6387d5fef | ||
|
|
5ca0738b02 | ||
|
|
b0e732110d | ||
|
|
1702078e7c | ||
|
|
136ec2506c | ||
|
|
45e5ef7702 | ||
|
|
b1fe49aff3 | ||
|
|
9b104af8cf | ||
|
|
c469dd6cde | ||
|
|
b238196f74 | ||
|
|
e9586b59d3 |
@@ -1,14 +1,35 @@
|
|||||||
lib_xua Change Log
|
lib_xua Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
UNRELEASED
|
3.5.1
|
||||||
----------
|
-----
|
||||||
|
|
||||||
|
* FIXED: Respect I2S_CHANS_PER_FRAME when calculating bit-clock rates
|
||||||
|
|
||||||
|
* Changes to dependencies:
|
||||||
|
|
||||||
|
- lib_spdif: 5.0.0 -> 5.0.1
|
||||||
|
|
||||||
|
3.5.0
|
||||||
|
-----
|
||||||
|
|
||||||
* ADDED: Configurable word-length for I2S/TDM via XUA_I2S_N_BITS
|
* ADDED: Configurable word-length for I2S/TDM via XUA_I2S_N_BITS
|
||||||
* FIXED: Memory corruption due to erroneous initialisation of mixer weights when not in use (#152)
|
* ADDED: Support for statically defined custom HID descriptor
|
||||||
|
* CHANGED: Rearranged main() such that adding custom code that uses lib_xud
|
||||||
|
is possible
|
||||||
|
* CHANGED: bNumConfigurations changed from 2 to 1, removing a work-around to
|
||||||
|
stop old Windows versions loading the composite driver
|
||||||
|
* FIXED: Memory corruption due to erroneous initialisation of mixer
|
||||||
|
weights when not in use (#152)
|
||||||
* FIXED: UserHostActive() not being called as expected (#326)
|
* FIXED: UserHostActive() not being called as expected (#326)
|
||||||
* FIXED: Exception when entering DSD mode (#327)
|
* FIXED: Exception when entering DSD mode (#327)
|
||||||
|
|
||||||
|
* Changes to dependencies:
|
||||||
|
|
||||||
|
- lib_spdif: 4.2.1 -> 5.0.0
|
||||||
|
|
||||||
|
- lib_xud: 2.2.2 -> 2.2.3
|
||||||
|
|
||||||
3.4.0
|
3.4.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
lib_xua
|
lib_xua
|
||||||
#######
|
#######
|
||||||
|
|
||||||
:Version: 3.4.0
|
:Version: 3.5.1
|
||||||
:Vendor: XMOS
|
:Vendor: XMOS
|
||||||
|
|
||||||
|
|
||||||
@@ -41,9 +41,9 @@ Key features of the various components in this repository are as follows
|
|||||||
|
|
||||||
- Synchronisation to external digital streams i.e. S/PDIF or ADAT (when in asynchronous mode)
|
- Synchronisation to external digital streams i.e. S/PDIF or ADAT (when in asynchronous mode)
|
||||||
|
|
||||||
- I2S slave & master modes
|
- I2S (slave/master modes with configurable word-length)
|
||||||
|
|
||||||
- TDM slave & master modes
|
- TDM (slave/master modes with configurable word-length)
|
||||||
|
|
||||||
- MIDI input/output (Compliant to USB Class Specification for MIDI devices)
|
- MIDI input/output (Compliant to USB Class Specification for MIDI devices)
|
||||||
|
|
||||||
@@ -53,6 +53,8 @@ Key features of the various components in this repository are as follows
|
|||||||
|
|
||||||
- Simple playback controls via USB Human Interface Device (HID) Class
|
- Simple playback controls via USB Human Interface Device (HID) Class
|
||||||
|
|
||||||
|
- Support for adding custom HID interfaces
|
||||||
|
|
||||||
Note, not all features may be supported at all sample frequencies, simultaneously or on all devices.
|
Note, not all features may be supported at all sample frequencies, simultaneously or on all devices.
|
||||||
Some features may also require specific host driver support.
|
Some features may also require specific host driver support.
|
||||||
|
|
||||||
|
|||||||
@@ -448,6 +448,40 @@
|
|||||||
#define HID_CONTROLS (0)
|
#define HID_CONTROLS (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HID may be required in two forms: the built-in XUA-HID reports, or a
|
||||||
|
* user-provided static HID. Some sections of code are always needed, they
|
||||||
|
* are enclosed in XUA_OR_STATIC_HID_ENABLED; code specific to XUA-HID
|
||||||
|
* reports are enclosed in XUA_HID_ENABLED.
|
||||||
|
*
|
||||||
|
* HID_CONTROLS implies that the XUA_HID is used, and hence defines both.
|
||||||
|
* In order to roll your own, do not enable HID_CONTROLS, but instead
|
||||||
|
* create a file static_hid_report.h that contains the static descriptor.
|
||||||
|
*
|
||||||
|
* You must also supply your own function to deal with the HID endpoint(s)
|
||||||
|
* in this case.
|
||||||
|
*/
|
||||||
|
#if( 0 < HID_CONTROLS )
|
||||||
|
#define XUA_HID_ENABLED (1)
|
||||||
|
#define XUA_OR_STATIC_HID_ENABLED (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__static_hid_report_h_exists__)
|
||||||
|
#define XUA_OR_STATIC_HID_ENABLED (1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enable a HID OUT endpoint. Only use this if you supply your own HID control.
|
||||||
|
*
|
||||||
|
* 1 for enabled, 0 for disabled.
|
||||||
|
*
|
||||||
|
* Default 0 (Disabled)
|
||||||
|
*/
|
||||||
|
#ifndef HID_OUT_REQUIRED
|
||||||
|
#define HID_OUT_REQUIRED (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks)
|
||||||
*
|
*
|
||||||
@@ -1163,7 +1197,7 @@ enum USBEndpointNumber_In
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
ENDPOINT_NUMBER_IN_MIDI,
|
ENDPOINT_NUMBER_IN_MIDI,
|
||||||
#endif
|
#endif
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
ENDPOINT_NUMBER_IN_HID,
|
ENDPOINT_NUMBER_IN_HID,
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
@@ -1190,6 +1224,9 @@ enum USBEndpointNumber_Out
|
|||||||
#ifdef IAP_EA_NATIVE_TRANS
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS,
|
ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS,
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if XUA_OR_STATIC_HID_ENABLED && HID_OUT_REQUIRED
|
||||||
|
ENDPOINT_NUMBER_OUT_HID,
|
||||||
#endif
|
#endif
|
||||||
XUA_ENDPOINT_COUNT_OUT /* End marker */
|
XUA_ENDPOINT_COUNT_OUT /* End marker */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
VERSION = 3.4.0
|
VERSION = 3.5.1
|
||||||
|
|
||||||
DEBUG ?= 0
|
DEBUG ?= 0
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ XCC_FLAGS_dfu.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
|||||||
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
XCC_FLAGS_flash_interface.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||||
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
XCC_FLAGS_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue
|
||||||
|
|
||||||
OPTIONAL_HEADERS += xua_conf.h
|
OPTIONAL_HEADERS += xua_conf.h static_hid_report.h
|
||||||
|
|
||||||
EXPORT_INCLUDE_DIRS = api \
|
EXPORT_INCLUDE_DIRS = api \
|
||||||
src/core \
|
src/core \
|
||||||
|
|||||||
@@ -715,13 +715,7 @@ void XUA_AudioHub(chanend ?c_aud, clock ?clk_audio_mclk, clock ?clk_audio_bclk,
|
|||||||
/* Calculate master clock to bit clock (or DSD clock) divide for current sample freq
|
/* Calculate master clock to bit clock (or DSD clock) divide for current sample freq
|
||||||
* e.g. 11.289600 / (176400 * 64) = 1 */
|
* e.g. 11.289600 / (176400 * 64) = 1 */
|
||||||
{
|
{
|
||||||
unsigned numBits = XUA_I2S_N_BITS * 2;
|
unsigned numBits = XUA_I2S_N_BITS * I2S_CHANS_PER_FRAME;
|
||||||
|
|
||||||
if(XUA_PCM_FORMAT == XUA_PCM_FORMAT_TDM)
|
|
||||||
{
|
|
||||||
/* TDM has 8 channels */
|
|
||||||
numBits *= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if (DSD_CHANS_DAC > 0)
|
#if (DSD_CHANS_DAC > 0)
|
||||||
if(dsdMode == DSD_MODE_DOP)
|
if(dsdMode == DSD_MODE_DOP)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2011-2022 XMOS LIMITED.
|
// Copyright 2011-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include "xua.h"
|
#include "xua.h"
|
||||||
#if XUA_USB_EN
|
#if XUA_USB_EN
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "xud.h"
|
#include "xud.h"
|
||||||
#include "testct_byref.h"
|
#include "testct_byref.h"
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
#include "xua_hid_report.h"
|
#include "xua_hid_report.h"
|
||||||
#include "user_hid.h"
|
#include "user_hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
@@ -134,7 +134,7 @@ void XUA_Buffer(
|
|||||||
c_clk_int,
|
c_clk_int,
|
||||||
#endif
|
#endif
|
||||||
c_sof, c_aud_ctl, p_off_mclk
|
c_sof, c_aud_ctl, p_off_mclk
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
, c_hid
|
, c_hid
|
||||||
#endif
|
#endif
|
||||||
#ifdef CHAN_BUFF_CTRL
|
#ifdef CHAN_BUFF_CTRL
|
||||||
@@ -224,7 +224,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
XUD_ep ep_int = XUD_InitEp(c_ep_int);
|
XUD_ep ep_int = XUD_InitEp(c_ep_int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
XUD_ep ep_hid = XUD_InitEp(c_hid);
|
||||||
#endif
|
#endif
|
||||||
unsigned u_tmp;
|
unsigned u_tmp;
|
||||||
@@ -332,7 +332,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
|
|
||||||
while (!hidIsReportDescriptorPrepared())
|
while (!hidIsReportDescriptorPrepared())
|
||||||
;
|
;
|
||||||
@@ -897,7 +897,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out,
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
/* HID Report Data */
|
/* HID Report Data */
|
||||||
case XUD_SetData_Select(c_hid, ep_hid, result):
|
case XUD_SetData_Select(c_hid, ep_hid, result):
|
||||||
hid_ready_flag = 0U;
|
hid_ready_flag = 0U;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2015-2021 XMOS LIMITED.
|
// Copyright 2015-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
#ifndef __DESCRIPTOR_DEFS_H__
|
#ifndef __DESCRIPTOR_DEFS_H__
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI)
|
#define ENDPOINT_ADDRESS_OUT_MIDI (ENDPOINT_NUMBER_OUT_MIDI)
|
||||||
#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP)
|
#define ENDPOINT_ADDRESS_OUT_IAP (ENDPOINT_NUMBER_OUT_IAP)
|
||||||
#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS)
|
#define ENDPOINT_ADDRESS_OUT_IAP_EA_NATIVE_TRANS (ENDPOINT_NUMBER_OUT_IAP_EA_NATIVE_TRANS)
|
||||||
|
#define ENDPOINT_ADDRESS_OUT_HID (ENDPOINT_NUMBER_OUT_HID)
|
||||||
|
|
||||||
/* Interface numbers enum */
|
/* Interface numbers enum */
|
||||||
enum USBInterfaceNumber
|
enum USBInterfaceNumber
|
||||||
@@ -60,7 +61,7 @@ enum USBInterfaceNumber
|
|||||||
INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS,
|
INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
INTERFACE_NUMBER_HID,
|
INTERFACE_NUMBER_HID,
|
||||||
#endif
|
#endif
|
||||||
INTERFACE_COUNT /* End marker */
|
INTERFACE_COUNT /* End marker */
|
||||||
@@ -70,4 +71,8 @@ enum USBInterfaceNumber
|
|||||||
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
#define ENDPOINT_INT_INTERVAL_IN_HID 0x08
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENDPOINT_INT_INTERVAL_OUT_HID
|
||||||
|
#define ENDPOINT_INT_INTERVAL_OUT_HID 0x08
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "xc_ptr.h"
|
#include "xc_ptr.h"
|
||||||
#include "xua_ep0_uacreqs.h"
|
#include "xua_ep0_uacreqs.h"
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
#include "xua_hid.h"
|
#include "xua_hid.h"
|
||||||
#include "xua_hid_report.h"
|
#include "xua_hid_report.h"
|
||||||
@@ -442,6 +442,15 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcd) {
|
|||||||
#endif // AUDIO_CLASS == 1}
|
#endif // AUDIO_CLASS == 1}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__static_hid_report_h_exists__)
|
||||||
|
#define hidReportDescriptorLength (sizeof(hidReportDescriptorPtr))
|
||||||
|
static unsigned char hidReportDescriptorPtr[] = {
|
||||||
|
#include "static_hid_report.h"
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(chanend, c_audioControl),
|
||||||
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
|
||||||
{
|
{
|
||||||
@@ -513,11 +522,13 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
|||||||
|
|
||||||
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
#endif // XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
|
#if XUA_HID_ENABLED
|
||||||
hidReportInit();
|
hidReportInit();
|
||||||
hidPrepareReportDescriptor();
|
hidPrepareReportDescriptor();
|
||||||
|
|
||||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||||
|
#endif
|
||||||
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
unsigned char hidReportDescriptorLengthLo = hidReportDescriptorLength & 0xFF;
|
||||||
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
unsigned char hidReportDescriptorLengthHi = (hidReportDescriptorLength & 0xFF00) >> 8;
|
||||||
|
|
||||||
@@ -528,6 +539,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, NULLABLE_RESOURCE(c
|
|||||||
|
|
||||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET ] = hidReportDescriptorLengthLo;
|
||||||
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
hidDescriptor[HID_DESCRIPTOR_LENGTH_FIELD_OFFSET + 1] = hidReportDescriptorLengthHi;
|
||||||
|
|
||||||
#endif // 0 < HID_CONTROLS
|
#endif // 0 < HID_CONTROLS
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -731,7 +743,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
|
|
||||||
switch(sp.bRequest)
|
switch(sp.bRequest)
|
||||||
{
|
{
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
case USB_GET_DESCRIPTOR:
|
case USB_GET_DESCRIPTOR:
|
||||||
|
|
||||||
/* Check what inteface request is for */
|
/* Check what inteface request is for */
|
||||||
@@ -746,15 +758,17 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
{
|
{
|
||||||
/* Return HID Descriptor */
|
/* Return HID Descriptor */
|
||||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor,
|
||||||
sizeof(hidDescriptor), sp.wLength);
|
hidDescriptor[0], sp.wLength);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HID_REPORT:
|
case HID_REPORT:
|
||||||
{
|
{
|
||||||
/* Return HID report descriptor */
|
/* Return HID report descriptor */
|
||||||
|
#if XUA_HID_ENABLED
|
||||||
unsigned char* hidReportDescriptorPtr;
|
unsigned char* hidReportDescriptorPtr;
|
||||||
hidReportDescriptorPtr = hidGetReportDescriptor();
|
hidReportDescriptorPtr = hidGetReportDescriptor();
|
||||||
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
size_t hidReportDescriptorLength = hidGetReportDescriptorLength();
|
||||||
|
#endif
|
||||||
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptorPtr,
|
||||||
hidReportDescriptorLength, sp.wLength);
|
hidReportDescriptorLength, sp.wLength);
|
||||||
}
|
}
|
||||||
@@ -858,7 +872,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
if (interfaceNum == INTERFACE_NUMBER_HID)
|
if (interfaceNum == INTERFACE_NUMBER_HID)
|
||||||
{
|
{
|
||||||
result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp);
|
result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp);
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ USB_Descriptor_Device_t devDesc_Audio2 =
|
|||||||
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
.iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *),
|
||||||
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
.iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *),
|
||||||
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
.iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *),
|
||||||
.bNumConfigurations = 0x02 /* Set to 2 such that windows does not load composite driver */
|
.bNumConfigurations = 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Device Descriptor for Null Device */
|
/* Device Descriptor for Null Device */
|
||||||
@@ -787,10 +787,13 @@ typedef struct
|
|||||||
#endif
|
#endif
|
||||||
#endif // IAP
|
#endif // IAP
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
USB_Descriptor_Interface_t HID_Interface;
|
USB_Descriptor_Interface_t HID_Interface;
|
||||||
USB_HID_Descriptor_t HID_Descriptor;
|
USB_HID_Descriptor_t HID_Descriptor;
|
||||||
USB_Descriptor_Endpoint_t HID_In_Endpoint;
|
USB_Descriptor_Endpoint_t HID_In_Endpoint;
|
||||||
|
#if HID_OUT_REQUIRED
|
||||||
|
USB_Descriptor_Endpoint_t HID_Out_Endpoint;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}__attribute__((packed)) USB_Config_Descriptor_Audio2_t;
|
}__attribute__((packed)) USB_Config_Descriptor_Audio2_t;
|
||||||
@@ -2208,14 +2211,14 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2=
|
|||||||
#endif
|
#endif
|
||||||
#endif /* IAP */
|
#endif /* IAP */
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
#include "xua_hid_descriptors.h"
|
#include "xua_hid_descriptors.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif /* (AUDIO_CLASS == 2) */
|
#endif /* (AUDIO_CLASS == 2) */
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
#if (AUDIO_CLASS ==1 )
|
#if (AUDIO_CLASS ==1 )
|
||||||
unsigned char hidDescriptor[] =
|
unsigned char hidDescriptor[] =
|
||||||
{
|
{
|
||||||
@@ -2330,14 +2333,14 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
|||||||
#define DFU_INTERFACES_A1 0
|
#define DFU_INTERFACES_A1 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
/*
|
/*
|
||||||
* The value of HID_INTERFACE_BYTES must match the length of the descriptors defined in
|
* The value of HID_INTERFACE_BYTES must match the length of the descriptors defined in
|
||||||
* - xua_hid_descriptor_contents.h
|
* - xua_hid_descriptor_contents.h
|
||||||
* - xua_hid_endpoint_descriptor_contents.h and
|
* - xua_hid_endpoint_descriptor_contents.h and
|
||||||
* - xua_hid_interface_descriptor_contents.h
|
* - xua_hid_interface_descriptor_contents.h
|
||||||
*/
|
*/
|
||||||
#define HID_INTERFACE_BYTES ( 9 + 9 + 7 )
|
#define HID_INTERFACE_BYTES ( 9 + 9 + (7 * (1 + HID_OUT_REQUIRED))) // always IN
|
||||||
#define HID_INTERFACES_A1 1
|
#define HID_INTERFACES_A1 1
|
||||||
#else
|
#else
|
||||||
#define HID_INTERFACE_BYTES 0
|
#define HID_INTERFACE_BYTES 0
|
||||||
@@ -2379,7 +2382,7 @@ const unsigned num_freqs_a1 = MAX(3, (0
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
#define USB_HID_DESCRIPTOR_OFFSET (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + INTERFACE_DESCRIPTOR_BYTES)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2893,7 +2896,7 @@ unsigned char cfgDesc_Audio1[] =
|
|||||||
offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */
|
offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
#include "xua_hid_descriptors.h"
|
#include "xua_hid_descriptors.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ XUD_EpType epTypeTableOut[ENDPOINT_COUNT_OUT] = { XUD_EPTYPE_CTL | XUD_STATUS_EN
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
XUD_EPTYPE_BUL, /* MIDI */
|
XUD_EPTYPE_BUL, /* MIDI */
|
||||||
#endif
|
#endif
|
||||||
|
#if HID_OUT_REQUIRED
|
||||||
|
XUD_EPTYPE_INT,
|
||||||
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
XUD_EPTYPE_BUL, /* iAP */
|
XUD_EPTYPE_BUL, /* iAP */
|
||||||
#ifdef IAP_EA_NATIVE_TRANS
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
@@ -233,7 +236,7 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB
|
|||||||
#ifdef MIDI
|
#ifdef MIDI
|
||||||
XUD_EPTYPE_BUL,
|
XUD_EPTYPE_BUL,
|
||||||
#endif
|
#endif
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_OR_STATIC_HID_ENABLED
|
||||||
XUD_EPTYPE_INT,
|
XUD_EPTYPE_INT,
|
||||||
#endif
|
#endif
|
||||||
#ifdef IAP
|
#ifdef IAP
|
||||||
@@ -267,115 +270,6 @@ void xscope_user_init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XUA_USB_EN
|
|
||||||
/* Core USB Audio functions - must be called on the Tile connected to the USB Phy */
|
|
||||||
void usb_audio_core(chanend c_mix_out
|
|
||||||
#ifdef MIDI
|
|
||||||
, chanend c_midi
|
|
||||||
#endif
|
|
||||||
#if (MIXER)
|
|
||||||
, chanend c_mix_ctl
|
|
||||||
#endif
|
|
||||||
, chanend ?c_clk_int
|
|
||||||
, chanend ?c_clk_ctl
|
|
||||||
, client interface i_dfu ?dfuInterface
|
|
||||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
|
||||||
, client interface pll_ref_if i_pll_ref
|
|
||||||
#endif
|
|
||||||
VENDOR_REQUESTS_PARAMS_DEC_
|
|
||||||
)
|
|
||||||
{
|
|
||||||
chan c_sof;
|
|
||||||
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
|
|
||||||
chan c_xud_in[ENDPOINT_COUNT_IN];
|
|
||||||
chan c_aud_ctl;
|
|
||||||
|
|
||||||
#if (!MIXER)
|
|
||||||
#define c_mix_ctl null
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IAP_EA_NATIVE_TRANS
|
|
||||||
chan c_EANativeTransport_ctrl;
|
|
||||||
#else
|
|
||||||
#define c_EANativeTransport_ctrl null
|
|
||||||
#endif
|
|
||||||
|
|
||||||
par
|
|
||||||
{
|
|
||||||
{
|
|
||||||
#ifdef XUD_PRIORITY_HIGH
|
|
||||||
set_core_high_priority_on();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
|
|
||||||
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
|
|
||||||
|
|
||||||
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
|
|
||||||
|
|
||||||
/* USB interface core */
|
|
||||||
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
|
||||||
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
unsigned x;
|
|
||||||
thread_speed();
|
|
||||||
|
|
||||||
/* Attach mclk count port to mclk clock-block (for feedback) */
|
|
||||||
//set_port_clock(p_for_mclk_count, clk_audio_mclk);
|
|
||||||
#if(AUDIO_IO_TILE != XUD_TILE)
|
|
||||||
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb);
|
|
||||||
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb);
|
|
||||||
start_clock(clk_audio_mclk_usb);
|
|
||||||
#else
|
|
||||||
/* Clock port from same clock-block as I2S */
|
|
||||||
/* TODO remove asm() */
|
|
||||||
asm("ldw %0, dp[clk_audio_mclk]":"=r"(x));
|
|
||||||
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
|
|
||||||
#endif
|
|
||||||
/* Endpoint & audio buffering cores */
|
|
||||||
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
|
|
||||||
#if (NUM_USB_CHAN_IN > 0)
|
|
||||||
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
|
|
||||||
#endif
|
|
||||||
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
|
|
||||||
#endif
|
|
||||||
#ifdef MIDI
|
|
||||||
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
|
|
||||||
c_midi,
|
|
||||||
#endif
|
|
||||||
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
|
||||||
/* Audio Interrupt - only used for interrupts on external clock change */
|
|
||||||
c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT],
|
|
||||||
c_clk_int,
|
|
||||||
#endif
|
|
||||||
c_sof, c_aud_ctl, p_for_mclk_count
|
|
||||||
#if (HID_CONTROLS)
|
|
||||||
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
|
||||||
#endif
|
|
||||||
, c_mix_out
|
|
||||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
|
||||||
, i_pll_ref
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
//:
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Endpoint 0 Core */
|
|
||||||
{
|
|
||||||
thread_speed();
|
|
||||||
XUA_Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl, dfuInterface VENDOR_REQUESTS_PARAMS_);
|
|
||||||
}
|
|
||||||
|
|
||||||
//:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* XUA_USB_EN */
|
|
||||||
|
|
||||||
|
|
||||||
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
#if (XUA_SPDIF_TX_EN) && (SPDIF_TX_TILE != AUDIO_IO_TILE)
|
||||||
void SpdifTxWrapper(chanend c_spdif_tx)
|
void SpdifTxWrapper(chanend c_spdif_tx)
|
||||||
{
|
{
|
||||||
@@ -575,6 +469,20 @@ int main()
|
|||||||
|
|
||||||
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
#if ((XUA_SYNCMODE == XUA_SYNCMODE_SYNC) || XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
interface pll_ref_if i_pll_ref;
|
interface pll_ref_if i_pll_ref;
|
||||||
|
#endif
|
||||||
|
chan c_sof;
|
||||||
|
chan c_xud_out[ENDPOINT_COUNT_OUT]; /* Endpoint channels for XUD */
|
||||||
|
chan c_xud_in[ENDPOINT_COUNT_IN];
|
||||||
|
chan c_aud_ctl;
|
||||||
|
|
||||||
|
#if (!MIXER)
|
||||||
|
#define c_mix_ctl null
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef IAP_EA_NATIVE_TRANS
|
||||||
|
chan c_EANativeTransport_ctrl;
|
||||||
|
#else
|
||||||
|
#define c_EANativeTransport_ctrl null
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
USER_MAIN_DECLARATIONS
|
USER_MAIN_DECLARATIONS
|
||||||
@@ -597,27 +505,77 @@ int main()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if XUA_USB_EN
|
#if XUA_USB_EN
|
||||||
/* Core USB audio task, buffering, USB etc */
|
|
||||||
usb_audio_core(c_mix_out
|
|
||||||
#ifdef MIDI
|
|
||||||
, c_midi
|
|
||||||
#endif
|
|
||||||
#ifdef IAP
|
|
||||||
, c_iap
|
|
||||||
#ifdef IAP_EA_NATIVE_TRANS
|
|
||||||
, c_ea_data
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#if (MIXER)
|
|
||||||
, c_mix_ctl
|
|
||||||
#endif
|
|
||||||
, c_clk_int, c_clk_ctl, dfuInterface
|
|
||||||
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
|
||||||
, i_pll_ref
|
|
||||||
#endif
|
|
||||||
VENDOR_REQUESTS_PARAMS_
|
|
||||||
|
|
||||||
);
|
/* Core USB task, buffering, USB etc */
|
||||||
|
{
|
||||||
|
#ifdef XUD_PRIORITY_HIGH
|
||||||
|
set_core_high_priority_on();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Run UAC2.0 at high-speed, UAC1.0 at full-speed */
|
||||||
|
unsigned usbSpeed = (AUDIO_CLASS == 2) ? XUD_SPEED_HS : XUD_SPEED_FS;
|
||||||
|
|
||||||
|
unsigned xudPwrCfg = (XUA_POWERMODE == XUA_POWERMODE_SELF) ? XUD_PWR_SELF : XUD_PWR_BUS;
|
||||||
|
|
||||||
|
/* USB interface core */
|
||||||
|
XUD_Main(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN,
|
||||||
|
c_sof, epTypeTableOut, epTypeTableIn, usbSpeed, xudPwrCfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Core USB audio task, buffering, USB etc */
|
||||||
|
{
|
||||||
|
unsigned x;
|
||||||
|
thread_speed();
|
||||||
|
|
||||||
|
/* Attach mclk count port to mclk clock-block (for feedback) */
|
||||||
|
//set_port_clock(p_for_mclk_count, clk_audio_mclk);
|
||||||
|
#if(AUDIO_IO_TILE != XUD_TILE)
|
||||||
|
set_clock_src(clk_audio_mclk_usb, p_mclk_in_usb);
|
||||||
|
set_port_clock(p_for_mclk_count, clk_audio_mclk_usb);
|
||||||
|
start_clock(clk_audio_mclk_usb);
|
||||||
|
#else
|
||||||
|
/* Clock port from same clock-block as I2S */
|
||||||
|
/* TODO remove asm() */
|
||||||
|
asm("ldw %0, dp[clk_audio_mclk]":"=r"(x));
|
||||||
|
asm("setclk res[%0], %1"::"r"(p_for_mclk_count), "r"(x));
|
||||||
|
#endif
|
||||||
|
/* Endpoint & audio buffering cores */
|
||||||
|
XUA_Buffer(c_xud_out[ENDPOINT_NUMBER_OUT_AUDIO],/* Audio Out*/
|
||||||
|
#if (NUM_USB_CHAN_IN > 0)
|
||||||
|
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_AUDIO], /* Audio In */
|
||||||
|
#endif
|
||||||
|
#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_FEEDBACK], /* Audio FB */
|
||||||
|
#endif
|
||||||
|
#ifdef MIDI
|
||||||
|
c_xud_out[ENDPOINT_NUMBER_OUT_MIDI], /* MIDI Out */ // 2
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_MIDI], /* MIDI In */ // 4
|
||||||
|
c_midi,
|
||||||
|
#endif
|
||||||
|
#if (XUA_SPDIF_RX_EN || XUA_ADAT_RX_EN)
|
||||||
|
/* Audio Interrupt - only used for interrupts on external clock change */
|
||||||
|
c_xud_in[ENDPOINT_NUMBER_IN_INTERRUPT],
|
||||||
|
c_clk_int,
|
||||||
|
#endif
|
||||||
|
c_sof, c_aud_ctl, p_for_mclk_count
|
||||||
|
#if (XUA_HID_ENABLED)
|
||||||
|
, c_xud_in[ENDPOINT_NUMBER_IN_HID]
|
||||||
|
#endif
|
||||||
|
, c_mix_out
|
||||||
|
#if (XUA_SYNCMODE == XUA_SYNCMODE_SYNC)
|
||||||
|
, i_pll_ref
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
//:
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Endpoint 0 Core */
|
||||||
|
{
|
||||||
|
thread_speed();
|
||||||
|
XUA_Endpoint0( c_xud_out[0], c_xud_in[0], c_aud_ctl, c_mix_ctl, c_clk_ctl, c_EANativeTransport_ctrl, dfuInterface VENDOR_REQUESTS_PARAMS_);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* XUA_USB_EN */
|
#endif /* XUA_USB_EN */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2013-2021 XMOS LIMITED.
|
// Copyright 2013-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ typedef struct hidEvent_t {
|
|||||||
#define HID_MAX_DATA_BYTES ( 4 )
|
#define HID_MAX_DATA_BYTES ( 4 )
|
||||||
#define HID_EVENT_INVALID_ID ( 0x100 )
|
#define HID_EVENT_INVALID_ID ( 0x100 )
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the data for the next HID Report
|
* \brief Get the data for the next HID Report
|
||||||
@@ -61,21 +61,5 @@ size_t UserHIDGetData( const unsigned id, unsigned char hidData[ HID_MAX_DATA_BY
|
|||||||
*/
|
*/
|
||||||
void UserHIDInit( void );
|
void UserHIDInit( void );
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Record that a HID event has occurred
|
|
||||||
*
|
|
||||||
* \param[in] hidEvent A list of events which have occurred.
|
|
||||||
* Each element specifies a HID Report ID, a bit and byte
|
|
||||||
* within the HID Report and the value for it.
|
|
||||||
* Set the Report ID to zero if not using Report IDs
|
|
||||||
* (see 5.6, 6.2.2.7, 8.1 and 8.2).
|
|
||||||
* \param[in] hidEventCnt The length of the \a hidEvent list.
|
|
||||||
*
|
|
||||||
* \returns The index of the first unrecorded event in \a hidEvent
|
|
||||||
* \retval Zero indicates no events were recorded
|
|
||||||
* \retval \a hidEventCnt indicates all events were recorded
|
|
||||||
*/
|
|
||||||
size_t UserHIDRecordEvent( const hidEvent_t hidEvent[], const size_t hidEventCnt );
|
|
||||||
|
|
||||||
#endif /* ( 0 < HID_CONTROLS ) */
|
#endif /* ( 0 < HID_CONTROLS ) */
|
||||||
#endif /* __USER_HID_H__ */
|
#endif /* __USER_HID_H__ */
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2019-2022 XMOS LIMITED.
|
// Copyright 2019-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <xs1.h>
|
#include <xs1.h>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
#define DEBUG_PRINT_ENABLE_HID_XC 0
|
#define DEBUG_PRINT_ENABLE_HID_XC 0
|
||||||
#include "debug_print.h"
|
#include "debug_print.h"
|
||||||
|
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod );
|
||||||
static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime );
|
static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime );
|
||||||
static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod );
|
static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod );
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 2021-2022 XMOS LIMITED.
|
// Copyright 2021-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
#include "xua_conf_full.h"
|
#include "xua_conf_full.h"
|
||||||
#if( 0 < HID_CONTROLS )
|
#if XUA_HID_ENABLED
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 XMOS LIMITED.
|
// Copyright 2021-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,6 +31,19 @@
|
|||||||
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||||
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */
|
||||||
|
|
||||||
|
#if (HID_OUT_REQUIRED)
|
||||||
|
|
||||||
|
/* HID Endpoint descriptor (OUT) */
|
||||||
|
HID_ENDPOINT_DESCRIPTOR_LENGTH, /* 0 bLength */
|
||||||
|
HID_ENDPOINT_DESCRIPTOR_TYPE, /* 1 bDescriptorType */
|
||||||
|
ENDPOINT_ADDRESS_OUT_HID, /* 2 bEndpointAddress */
|
||||||
|
HID_ENDPOINT_ATTRIBUTES, /* 3 bmAttributes (INTERRUPT) */
|
||||||
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO, /* 4 wMaxPacketSize */
|
||||||
|
HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_HI, /* 5 wMaxPacketSize */
|
||||||
|
ENDPOINT_INT_INTERVAL_OUT_HID, /* 6 bInterval */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#elif (AUDIO_CLASS == 2)
|
#elif (AUDIO_CLASS == 2)
|
||||||
|
|
||||||
.HID_In_Endpoint =
|
.HID_In_Endpoint =
|
||||||
@@ -44,6 +57,21 @@
|
|||||||
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
.bInterval = ENDPOINT_INT_INTERVAL_IN_HID,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
#if (HID_OUT_REQUIRED)
|
||||||
|
|
||||||
|
.HID_Out_Endpoint =
|
||||||
|
{
|
||||||
|
/* Endpoint descriptor (OUT) */
|
||||||
|
.bLength = sizeof(USB_Descriptor_Endpoint_t),
|
||||||
|
.bDescriptorType = HID_ENDPOINT_DESCRIPTOR_TYPE,
|
||||||
|
.bEndpointAddress = ENDPOINT_ADDRESS_OUT_HID,
|
||||||
|
.bmAttributes = HID_ENDPOINT_ATTRIBUTES,
|
||||||
|
.wMaxPacketSize = HID_ENDPOINT_DESCRIPTOR_PACKET_SIZE_LO,
|
||||||
|
.bInterval = ENDPOINT_INT_INTERVAL_OUT_HID,
|
||||||
|
},
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "Unknown Audio Class"
|
#error "Unknown Audio Class"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2021 XMOS LIMITED.
|
// Copyright 2021-2023 XMOS LIMITED.
|
||||||
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
#define HID_INTERFACE_DESCRIPTOR_LENGTH ( 0x09 ) /* Size of descriptor in Bytes */
|
#define HID_INTERFACE_DESCRIPTOR_LENGTH ( 0x09 ) /* Size of descriptor in Bytes */
|
||||||
#define HID_INTERFACE_DESCRIPTOR_TYPE ( 0x04 ) /* Interface 0x04 */
|
#define HID_INTERFACE_DESCRIPTOR_TYPE ( 0x04 ) /* Interface 0x04 */
|
||||||
#define HID_INTERFACE_ALTERNATE_SETTING ( 0x00 ) /* Value used alternate interfaces using SetInterface Request */
|
#define HID_INTERFACE_ALTERNATE_SETTING ( 0x00 ) /* Value used alternate interfaces using SetInterface Request */
|
||||||
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS ( 0x01 ) /* Number of endpoitns for this interface (excluding 0) */
|
#define HID_INTERFACE_NUMBER_OF_ENDPOINTS ( 0x01 + HID_OUT_REQUIRED )
|
||||||
|
/* Number of endpoints for this interface (excluding 0) */
|
||||||
#define HID_INTERFACE_CLASS ( 0x03 )
|
#define HID_INTERFACE_CLASS ( 0x03 )
|
||||||
#define HID_INTERFACE_SUBCLASS ( 0x00 ) /* No boot device */
|
#define HID_INTERFACE_SUBCLASS ( 0x00 ) /* No boot device */
|
||||||
#define HID_INTERFACE_PROTOCOL ( 0x00 )
|
#define HID_INTERFACE_PROTOCOL ( 0x00 )
|
||||||
|
|||||||
Reference in New Issue
Block a user