From 4ff0713e5980cb10b10083737e2dc9e9694c196b Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Wed, 12 Dec 2018 15:37:31 +0000 Subject: [PATCH 001/233] Add Windows support to xmosdfu Needs WinUSB drivers installed on interface 0. --- lib_xua/host/xmosdfu/Makefile.Win32 | 28 + lib_xua/host/xmosdfu/libusb-1.0.dll | Bin 0 -> 125440 bytes .../host/xmosdfu/libusb/Win32/libusb-1.0.lib | Bin 0 -> 49464 bytes lib_xua/host/xmosdfu/libusb/Win32/libusb.h | 2039 +++++++++++++++++ lib_xua/host/xmosdfu/xmosdfu.cpp | 14 +- 5 files changed, 2079 insertions(+), 2 deletions(-) create mode 100644 lib_xua/host/xmosdfu/Makefile.Win32 create mode 100644 lib_xua/host/xmosdfu/libusb-1.0.dll create mode 100644 lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib create mode 100644 lib_xua/host/xmosdfu/libusb/Win32/libusb.h diff --git a/lib_xua/host/xmosdfu/Makefile.Win32 b/lib_xua/host/xmosdfu/Makefile.Win32 new file mode 100644 index 00000000..9ab2fc40 --- /dev/null +++ b/lib_xua/host/xmosdfu/Makefile.Win32 @@ -0,0 +1,28 @@ +# Build tested with Visual Studio 2017 command prompt +# +# Run: nmake /f Makefile.Win32 + +COMMON_FLAGS = \ + /D BECLEAR_HOST=1 \ + /I libusb\Win32 \ + /nologo \ + /W4 \ + /WX- \ + /O2 \ + /EHa \ + /D _CRT_SECURE_NO_WARNINGS \ + xmosdfu.cpp \ + +all: xmosdfu + +xmosdfu: + if not exist bin mkdir bin + CL.exe \ + $(COMMON_FLAGS) \ + /Fe"bin\xmosdfu.exe" \ + /link "libusb\Win32\libusb-1.0.lib"" + copy libusb-1.0.dll bin + del *.obj + +clean: + rmdir /s /q bin diff --git a/lib_xua/host/xmosdfu/libusb-1.0.dll b/lib_xua/host/xmosdfu/libusb-1.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..d58c4be3268a6eaf83239232bd868e143a68bba1 GIT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zWMsu`g!`F!P&^ZdIxyhI(-B9+Y6B0-h;He6BgH_!@1!p;ThqLkjDNM z?h`pCVnm$C3DB%pM4pLki@XO5%KnfNW*Y-R?F%7my=J}#*?u3$^hKcKN~_Uo>`2`Vu*3D`@v zVr}?E*;hSK?V}#6YS42F)f3bbb*ef;twfJEf|o1+CplkT3aNPobl+RmJ0Ukeq;7x> z@L8-I+reLUsGq1`aLMa8wTpIu)&pbE7gF?K=*605X(O~zkff(U>LP#IrJ$qb@)r3? zd3E&e==$ge$U{%U+WbPa9k#MJpn2}Vs`(kX{I2Nt(Vt=cV|EvNKl?zthuzaY-0ll| z^Z%|Jl z7OU)A?bY^L`$2oXy}^DGbN>aq9kz@&?6>V5_DA+-_7~s;-$Rc&9J)vd`tC4K9~tMA zIAzXs=)Nvq8U_ZjRXyPWTxpP@A~w~M=nAtD~yeajpMrB%vd$I8k5arU`92F(lu-5Yu{tloD+etW@ahf~7;{QaNnf&T?0Vd$;^ literal 0 HcmV?d00001 diff --git a/lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib b/lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib new file mode 100644 index 0000000000000000000000000000000000000000..760f13d190da2accdde27fc72e5999a13043ad57 GIT binary patch literal 49464 zcmeHQS+HG2)m{lP#{7s8F(RUdh)hDrbO#*b1p_jKfMF0LdN}vqb8`eZ{~?wupPSZ|MvuUmZLGWX93tK8q|ua)*6tJbVqxjOmxC5wsX)riLaO4K}@ z=+X;`TFWi%!xJ>I)Y4u&L6eIt?ZFc?wb0Vlcp7@QOVb^qg#Lji=(0;K0qZhQd$XnA z;|ZD>vh)U?pw0?QFX0KAJQ**O$S-phbQRfrIw)UX3#B%S$Yaj(5;7Bg6>;Edly@R{d+;TEwXeIo}k+o zSOWI#hTiSc9q@lb$jcp|JFm0^{+*z^c3S!;o}jx?J_-E=PtZM^Ey0)ffbKor(y#CY z-M7xtPw@oZKWOPSJV6f}Z|UcFg7$5+^k+Ol55m5L{(~p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r+R5CdQr1tI|C!0CDDxm z88DU0W-u@=TZgh4t!9f7DsGV#$8T&DG3Hs5UA6Zjp?aSh8$~oisJP(o=B~H6;|$li z8{dn5Jg^FE&Nyxf?;6b!=rM%$7X`fG8V{5L1i0aYfr794dxDf z@&N}g?A)Klbu6|Av9%CgX1_9iV5VT!z9xeB+2fL{%@u_5&}A;K~NED)K;Jd~dFR z&T!<|S4sTrSN8irU}b6mR&>f*(TjQ!7>k&TuGKGp_b?%;(!eB))fvVUXa zfSqM5kWQ#BQ-CeQ-ZiG!^RYSJbt<~~ zI*W_a+qu@YA=F;r238Ku4Uq3JT>H%`FPrYq621-epv!=^TcFK7ies(l9uF_@HLW?9 zY;1Mu`f@fXgV(B_kM(FbGAn|g1Dm@a0<(H^w(Ev67W5+811*cWd3_VJ!TFAo>uS#r zC1O6%lA9ZS-wj~Othz=NqsI1OZgEh>C)vClR&UE<$MW3xs$S-?)$7~J+tGvak465So+bXr{^sh1SmfUk z$L>MSW8WjX%R^5;Ryfxj$3{zc>zF;r=|Er{VP@j@dZ?lADEiHu>xtqPHdgcQDQSb! zu~%>J0weY1@Wp-jre69blki8Vs^&a)R_A^%=gOxheaBbMaqMR41I75t7Fksf#A@1u zt_9hbG+m79Eo`i&?b9)3_fpx{eUa#Tn4{)j0`)TL{w%Inu`@{zsfaS0RWW1dWgg*} z{?|(99LurZ>d_do%yi|ljqS8N&al%}9q}Dj*Ug?Uic30Hj~^?6FJ0goRBS=a15aue zm`0R;Mb-uEsRy1YfiJsK*Ps#}2+YdNUh7ki1>To#y}VX$&tj4PbPQP*d-cc<%md8| z)3Xele`~jg>sx^tp;_5{rVw3bziOGs&J#Qz!0*KxSFDwNE{rQPT)DhsbHW!L + * Copyright © 2007-2008 Daniel Drake + * Copyright © 2012 Pete Batard + * Copyright © 2012 Nathan Hjelm + * For more information, please visit: http://libusb.info + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LIBUSB_H +#define LIBUSB_H + +#ifdef _MSC_VER +/* on MS environments, the inline keyword is available in C++ only */ +#if !defined(__cplusplus) +#define inline __inline +#endif +/* ssize_t is also not available (copy/paste from MinGW) */ +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 + typedef __int64 ssize_t; +#else + typedef int ssize_t; +#endif /* _WIN64 */ +#endif /* _SSIZE_T_DEFINED */ +#endif /* _MSC_VER */ + +/* stdint.h is not available on older MSVC */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) && (!defined(_STDINT)) && (!defined(_STDINT_H)) +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +#else +#include +#endif + +#if !defined(_WIN32_WCE) +#include +#endif + +#if defined(__linux__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__HAIKU__) +#include +#endif + +#include +#include + +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#define ZERO_SIZED_ARRAY /* [] - valid C99 code */ +#else +#define ZERO_SIZED_ARRAY 0 /* [0] - non-standard, but usually working code */ +#endif + +/* 'interface' might be defined as a macro on Windows, so we need to + * undefine it so as not to break the current libusb API, because + * libusb_config_descriptor has an 'interface' member + * As this can be problematic if you include windows.h after libusb.h + * in your sources, we force windows.h to be included first. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +#include +#if defined(interface) +#undef interface +#endif +#if !defined(__CYGWIN__) +#include +#endif +#endif + +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +#define LIBUSB_DEPRECATED_FOR(f) \ + __attribute__((deprecated("Use " #f " instead"))) +#elif __GNUC__ >= 3 +#define LIBUSB_DEPRECATED_FOR(f) __attribute__((deprecated)) +#else +#define LIBUSB_DEPRECATED_FOR(f) +#endif /* __GNUC__ */ + +/** \def LIBUSB_CALL + * \ingroup libusb_misc + * libusb's Windows calling convention. + * + * Under Windows, the selection of available compilers and configurations + * means that, unlike other platforms, there is not one true calling + * convention (calling convention: the manner in which parameters are + * passed to functions in the generated assembly code). + * + * Matching the Windows API itself, libusb uses the WINAPI convention (which + * translates to the stdcall convention) and guarantees that the + * library is compiled in this way. The public header file also includes + * appropriate annotations so that your own software will use the right + * convention, even if another convention is being used by default within + * your codebase. + * + * The one consideration that you must apply in your software is to mark + * all functions which you use as libusb callbacks with this LIBUSB_CALL + * annotation, so that they too get compiled for the correct calling + * convention. + * + * On non-Windows operating systems, this macro is defined as nothing. This + * means that you can apply it to your code without worrying about + * cross-platform compatibility. + */ +/* LIBUSB_CALL must be defined on both definition and declaration of libusb + * functions. You'd think that declaration would be enough, but cygwin will + * complain about conflicting types unless both are marked this way. + * The placement of this macro is important too; it must appear after the + * return type, before the function name. See internal documentation for + * API_EXPORTED. + */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +#define LIBUSB_CALL WINAPI +#else +#define LIBUSB_CALL +#endif + +/** \def LIBUSB_API_VERSION + * \ingroup libusb_misc + * libusb's API version. + * + * Since version 1.0.13, to help with feature detection, libusb defines + * a LIBUSB_API_VERSION macro that gets increased every time there is a + * significant change to the API, such as the introduction of a new call, + * the definition of a new macro/enum member, or any other element that + * libusb applications may want to detect at compilation time. + * + * The macro is typically used in an application as follows: + * \code + * #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01001234) + * // Use one of the newer features from the libusb API + * #endif + * \endcode + * + * Internally, LIBUSB_API_VERSION is defined as follows: + * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental) + */ +#define LIBUSB_API_VERSION 0x01000106 + +/* The following is kept for compatibility, but will be deprecated in the future */ +#define LIBUSBX_API_VERSION LIBUSB_API_VERSION + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \ingroup libusb_misc + * Convert a 16-bit value from host-endian to little-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the host-endian value to convert + * \returns the value in little-endian byte order + */ +static inline uint16_t libusb_cpu_to_le16(const uint16_t x) +{ + union { + uint8_t b8[2]; + uint16_t b16; + } _tmp; + _tmp.b8[1] = (uint8_t) (x >> 8); + _tmp.b8[0] = (uint8_t) (x & 0xff); + return _tmp.b16; +} + +/** \def libusb_le16_to_cpu + * \ingroup libusb_misc + * Convert a 16-bit value from little-endian to host-endian format. On + * little endian systems, this function does nothing. On big endian systems, + * the bytes are swapped. + * \param x the little-endian value to convert + * \returns the value in host-endian byte order + */ +#define libusb_le16_to_cpu libusb_cpu_to_le16 + +/* standard USB stuff */ + +/** \ingroup libusb_desc + * Device and/or Interface Class codes */ +enum libusb_class_code { + /** In the context of a \ref libusb_device_descriptor "device descriptor", + * this bDeviceClass value indicates that each interface specifies its + * own class information and all interfaces operate independently. + */ + LIBUSB_CLASS_PER_INTERFACE = 0, + + /** Audio class */ + LIBUSB_CLASS_AUDIO = 1, + + /** Communications class */ + LIBUSB_CLASS_COMM = 2, + + /** Human Interface Device class */ + LIBUSB_CLASS_HID = 3, + + /** Physical */ + LIBUSB_CLASS_PHYSICAL = 5, + + /** Printer class */ + LIBUSB_CLASS_PRINTER = 7, + + /** Image class */ + LIBUSB_CLASS_PTP = 6, /* legacy name from libusb-0.1 usb.h */ + LIBUSB_CLASS_IMAGE = 6, + + /** Mass storage class */ + LIBUSB_CLASS_MASS_STORAGE = 8, + + /** Hub class */ + LIBUSB_CLASS_HUB = 9, + + /** Data class */ + LIBUSB_CLASS_DATA = 10, + + /** Smart Card */ + LIBUSB_CLASS_SMART_CARD = 0x0b, + + /** Content Security */ + LIBUSB_CLASS_CONTENT_SECURITY = 0x0d, + + /** Video */ + LIBUSB_CLASS_VIDEO = 0x0e, + + /** Personal Healthcare */ + LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f, + + /** Diagnostic Device */ + LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc, + + /** Wireless class */ + LIBUSB_CLASS_WIRELESS = 0xe0, + + /** Application class */ + LIBUSB_CLASS_APPLICATION = 0xfe, + + /** Class is vendor-specific */ + LIBUSB_CLASS_VENDOR_SPEC = 0xff +}; + +/** \ingroup libusb_desc + * Descriptor types as defined by the USB specification. */ +enum libusb_descriptor_type { + /** Device descriptor. See libusb_device_descriptor. */ + LIBUSB_DT_DEVICE = 0x01, + + /** Configuration descriptor. See libusb_config_descriptor. */ + LIBUSB_DT_CONFIG = 0x02, + + /** String descriptor */ + LIBUSB_DT_STRING = 0x03, + + /** Interface descriptor. See libusb_interface_descriptor. */ + LIBUSB_DT_INTERFACE = 0x04, + + /** Endpoint descriptor. See libusb_endpoint_descriptor. */ + LIBUSB_DT_ENDPOINT = 0x05, + + /** BOS descriptor */ + LIBUSB_DT_BOS = 0x0f, + + /** Device Capability descriptor */ + LIBUSB_DT_DEVICE_CAPABILITY = 0x10, + + /** HID descriptor */ + LIBUSB_DT_HID = 0x21, + + /** HID report descriptor */ + LIBUSB_DT_REPORT = 0x22, + + /** Physical descriptor */ + LIBUSB_DT_PHYSICAL = 0x23, + + /** Hub descriptor */ + LIBUSB_DT_HUB = 0x29, + + /** SuperSpeed Hub descriptor */ + LIBUSB_DT_SUPERSPEED_HUB = 0x2a, + + /** SuperSpeed Endpoint Companion descriptor */ + LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30 +}; + +/* Descriptor sizes per descriptor type */ +#define LIBUSB_DT_DEVICE_SIZE 18 +#define LIBUSB_DT_CONFIG_SIZE 9 +#define LIBUSB_DT_INTERFACE_SIZE 9 +#define LIBUSB_DT_ENDPOINT_SIZE 7 +#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define LIBUSB_DT_HUB_NONVAR_SIZE 7 +#define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 +#define LIBUSB_DT_BOS_SIZE 5 +#define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3 + +/* BOS descriptor sizes */ +#define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7 +#define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10 +#define LIBUSB_BT_CONTAINER_ID_SIZE 20 + +/* We unwrap the BOS => define its max size */ +#define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) +\ + (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) +\ + (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) +\ + (LIBUSB_BT_CONTAINER_ID_SIZE)) + +#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define LIBUSB_ENDPOINT_DIR_MASK 0x80 + +/** \ingroup libusb_desc + * Endpoint direction. Values for bit 7 of the + * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. + */ +enum libusb_endpoint_direction { + /** In: device-to-host */ + LIBUSB_ENDPOINT_IN = 0x80, + + /** Out: host-to-device */ + LIBUSB_ENDPOINT_OUT = 0x00 +}; + +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 /* in bmAttributes */ + +/** \ingroup libusb_desc + * Endpoint transfer type. Values for bits 0:1 of the + * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. + */ +enum libusb_transfer_type { + /** Control endpoint */ + LIBUSB_TRANSFER_TYPE_CONTROL = 0, + + /** Isochronous endpoint */ + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, + + /** Bulk endpoint */ + LIBUSB_TRANSFER_TYPE_BULK = 2, + + /** Interrupt endpoint */ + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3, + + /** Stream endpoint */ + LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4, +}; + +/** \ingroup libusb_misc + * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ +enum libusb_standard_request { + /** Request status of the specific recipient */ + LIBUSB_REQUEST_GET_STATUS = 0x00, + + /** Clear or disable a specific feature */ + LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, + + /* 0x02 is reserved */ + + /** Set or enable a specific feature */ + LIBUSB_REQUEST_SET_FEATURE = 0x03, + + /* 0x04 is reserved */ + + /** Set device address for all future accesses */ + LIBUSB_REQUEST_SET_ADDRESS = 0x05, + + /** Get the specified descriptor */ + LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06, + + /** Used to update existing descriptors or add new descriptors */ + LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07, + + /** Get the current device configuration value */ + LIBUSB_REQUEST_GET_CONFIGURATION = 0x08, + + /** Set device configuration */ + LIBUSB_REQUEST_SET_CONFIGURATION = 0x09, + + /** Return the selected alternate setting for the specified interface */ + LIBUSB_REQUEST_GET_INTERFACE = 0x0A, + + /** Select an alternate interface for the specified interface */ + LIBUSB_REQUEST_SET_INTERFACE = 0x0B, + + /** Set then report an endpoint's synchronization frame */ + LIBUSB_REQUEST_SYNCH_FRAME = 0x0C, + + /** Sets both the U1 and U2 Exit Latency */ + LIBUSB_REQUEST_SET_SEL = 0x30, + + /** Delay from the time a host transmits a packet to the time it is + * received by the device. */ + LIBUSB_SET_ISOCH_DELAY = 0x31, +}; + +/** \ingroup libusb_misc + * Request type bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. */ +enum libusb_request_type { + /** Standard */ + LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5), + + /** Class */ + LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5), + + /** Vendor */ + LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5), + + /** Reserved */ + LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5) +}; + +/** \ingroup libusb_misc + * Recipient bits of the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control + * transfers. Values 4 through 31 are reserved. */ +enum libusb_request_recipient { + /** Device */ + LIBUSB_RECIPIENT_DEVICE = 0x00, + + /** Interface */ + LIBUSB_RECIPIENT_INTERFACE = 0x01, + + /** Endpoint */ + LIBUSB_RECIPIENT_ENDPOINT = 0x02, + + /** Other */ + LIBUSB_RECIPIENT_OTHER = 0x03, +}; + +#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C + +/** \ingroup libusb_desc + * Synchronization type for isochronous endpoints. Values for bits 2:3 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_sync_type { + /** No synchronization */ + LIBUSB_ISO_SYNC_TYPE_NONE = 0, + + /** Asynchronous */ + LIBUSB_ISO_SYNC_TYPE_ASYNC = 1, + + /** Adaptive */ + LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2, + + /** Synchronous */ + LIBUSB_ISO_SYNC_TYPE_SYNC = 3 +}; + +#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 + +/** \ingroup libusb_desc + * Usage type for isochronous endpoints. Values for bits 4:5 of the + * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in + * libusb_endpoint_descriptor. + */ +enum libusb_iso_usage_type { + /** Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_DATA = 0, + + /** Feedback endpoint */ + LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1, + + /** Implicit feedback Data endpoint */ + LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2, +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB device descriptor. This + * descriptor is documented in section 9.6.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_device_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this + * context. */ + uint8_t bDescriptorType; + + /** USB specification release number in binary-coded decimal. A value of + * 0x0200 indicates USB 2.0, 0x0110 indicates USB 1.1, etc. */ + uint16_t bcdUSB; + + /** USB-IF class code for the device. See \ref libusb_class_code. */ + uint8_t bDeviceClass; + + /** USB-IF subclass code for the device, qualified by the bDeviceClass + * value */ + uint8_t bDeviceSubClass; + + /** USB-IF protocol code for the device, qualified by the bDeviceClass and + * bDeviceSubClass values */ + uint8_t bDeviceProtocol; + + /** Maximum packet size for endpoint 0 */ + uint8_t bMaxPacketSize0; + + /** USB-IF vendor ID */ + uint16_t idVendor; + + /** USB-IF product ID */ + uint16_t idProduct; + + /** Device release number in binary-coded decimal */ + uint16_t bcdDevice; + + /** Index of string descriptor describing manufacturer */ + uint8_t iManufacturer; + + /** Index of string descriptor describing product */ + uint8_t iProduct; + + /** Index of string descriptor containing device serial number */ + uint8_t iSerialNumber; + + /** Number of possible configurations */ + uint8_t bNumConfigurations; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB endpoint descriptor. This + * descriptor is documented in section 9.6.6 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_endpoint_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_ENDPOINT LIBUSB_DT_ENDPOINT in + * this context. */ + uint8_t bDescriptorType; + + /** The address of the endpoint described by this descriptor. Bits 0:3 are + * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, + * see \ref libusb_endpoint_direction. + */ + uint8_t bEndpointAddress; + + /** Attributes which apply to the endpoint when it is configured using + * the bConfigurationValue. Bits 0:1 determine the transfer type and + * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for + * isochronous endpoints and correspond to \ref libusb_iso_sync_type. + * Bits 4:5 are also only used for isochronous endpoints and correspond to + * \ref libusb_iso_usage_type. Bits 6:7 are reserved. + */ + uint8_t bmAttributes; + + /** Maximum packet size this endpoint is capable of sending/receiving. */ + uint16_t wMaxPacketSize; + + /** Interval for polling endpoint for data transfers. */ + uint8_t bInterval; + + /** For audio devices only: the rate at which synchronization feedback + * is provided. */ + uint8_t bRefresh; + + /** For audio devices only: the address if the synch endpoint */ + uint8_t bSynchAddress; + + /** Extra descriptors. If libusb encounters unknown endpoint descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB interface descriptor. This + * descriptor is documented in section 9.6.5 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_interface_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE + * in this context. */ + uint8_t bDescriptorType; + + /** Number of this interface */ + uint8_t bInterfaceNumber; + + /** Value used to select this alternate setting for this interface */ + uint8_t bAlternateSetting; + + /** Number of endpoints used by this interface (excluding the control + * endpoint). */ + uint8_t bNumEndpoints; + + /** USB-IF class code for this interface. See \ref libusb_class_code. */ + uint8_t bInterfaceClass; + + /** USB-IF subclass code for this interface, qualified by the + * bInterfaceClass value */ + uint8_t bInterfaceSubClass; + + /** USB-IF protocol code for this interface, qualified by the + * bInterfaceClass and bInterfaceSubClass values */ + uint8_t bInterfaceProtocol; + + /** Index of string descriptor describing this interface */ + uint8_t iInterface; + + /** Array of endpoint descriptors. This length of this array is determined + * by the bNumEndpoints field. */ + const struct libusb_endpoint_descriptor *endpoint; + + /** Extra descriptors. If libusb encounters unknown interface descriptors, + * it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A collection of alternate settings for a particular USB interface. + */ +struct libusb_interface { + /** Array of interface descriptors. The length of this array is determined + * by the num_altsetting field. */ + const struct libusb_interface_descriptor *altsetting; + + /** The number of alternate settings that belong to this interface */ + int num_altsetting; +}; + +/** \ingroup libusb_desc + * A structure representing the standard USB configuration descriptor. This + * descriptor is documented in section 9.6.3 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_config_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_CONFIG LIBUSB_DT_CONFIG + * in this context. */ + uint8_t bDescriptorType; + + /** Total length of data returned for this configuration */ + uint16_t wTotalLength; + + /** Number of interfaces supported by this configuration */ + uint8_t bNumInterfaces; + + /** Identifier value for this configuration */ + uint8_t bConfigurationValue; + + /** Index of string descriptor describing this configuration */ + uint8_t iConfiguration; + + /** Configuration characteristics */ + uint8_t bmAttributes; + + /** Maximum power consumption of the USB device from this bus in this + * configuration when the device is fully operation. Expressed in units + * of 2 mA when the device is operating in high-speed mode and in units + * of 8 mA when the device is operating in super-speed mode. */ + uint8_t MaxPower; + + /** Array of interfaces supported by this configuration. The length of + * this array is determined by the bNumInterfaces field. */ + const struct libusb_interface *interface; + + /** Extra descriptors. If libusb encounters unknown configuration + * descriptors, it will store them here, should you wish to parse them. */ + const unsigned char *extra; + + /** Length of the extra descriptors, in bytes. */ + int extra_length; +}; + +/** \ingroup libusb_desc + * A structure representing the superspeed endpoint companion + * descriptor. This descriptor is documented in section 9.6.7 of + * the USB 3.0 specification. All multiple-byte fields are represented in + * host-endian format. + */ +struct libusb_ss_endpoint_companion_descriptor { + + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in + * this context. */ + uint8_t bDescriptorType; + + + /** The maximum number of packets the endpoint can send or + * receive as part of a burst. */ + uint8_t bMaxBurst; + + /** In bulk EP: bits 4:0 represents the maximum number of + * streams the EP supports. In isochronous EP: bits 1:0 + * represents the Mult - a zero based value that determines + * the maximum number of packets within a service interval */ + uint8_t bmAttributes; + + /** The total number of bytes this EP will transfer every + * service interval. valid only for periodic EPs. */ + uint16_t wBytesPerInterval; +}; + +/** \ingroup libusb_desc + * A generic representation of a BOS Device Capability descriptor. It is + * advised to check bDevCapabilityType and call the matching + * libusb_get_*_descriptor function to get a structure fully matching the type. + */ +struct libusb_bos_dev_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + /** Device Capability type */ + uint8_t bDevCapabilityType; + /** Device Capability data (bLength - 3 bytes) */ + uint8_t dev_capability_data[ZERO_SIZED_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the Binary Device Object Store (BOS) descriptor. + * This descriptor is documented in section 9.6.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_bos_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS + * in this context. */ + uint8_t bDescriptorType; + + /** Length of this descriptor and all of its sub descriptors */ + uint16_t wTotalLength; + + /** The number of separate device capability descriptors in + * the BOS */ + uint8_t bNumDeviceCaps; + + /** bNumDeviceCap Device Capability Descriptors */ + struct libusb_bos_dev_capability_descriptor *dev_capability[ZERO_SIZED_ARRAY]; +}; + +/** \ingroup libusb_desc + * A structure representing the USB 2.0 Extension descriptor + * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_usb_2_0_extension_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION + * LIBUSB_BT_USB_2_0_EXTENSION in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_usb_2_0_extension_attributes. */ + uint32_t bmAttributes; +}; + +/** \ingroup libusb_desc + * A structure representing the SuperSpeed USB Device Capability descriptor + * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification. + * All multiple-byte fields are represented in host-endian format. + */ +struct libusb_ss_usb_device_capability_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY + * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. */ + uint8_t bDevCapabilityType; + + /** Bitmap encoding of supported device level features. + * A value of one in a bit location indicates a feature is + * supported; a value of zero indicates it is not supported. + * See \ref libusb_ss_usb_device_capability_attributes. */ + uint8_t bmAttributes; + + /** Bitmap encoding of the speed supported by this device when + * operating in SuperSpeed mode. See \ref libusb_supported_speed. */ + uint16_t wSpeedSupported; + + /** The lowest speed at which all the functionality supported + * by the device is available to the user. For example if the + * device supports all its functionality when connected at + * full speed and above then it sets this value to 1. */ + uint8_t bFunctionalitySupport; + + /** U1 Device Exit Latency. */ + uint8_t bU1DevExitLat; + + /** U2 Device Exit Latency. */ + uint16_t bU2DevExitLat; +}; + +/** \ingroup libusb_desc + * A structure representing the Container ID descriptor. + * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification. + * All multiple-byte fields, except UUIDs, are represented in host-endian format. + */ +struct libusb_container_id_descriptor { + /** Size of this descriptor (in bytes) */ + uint8_t bLength; + + /** Descriptor type. Will have value + * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY + * LIBUSB_DT_DEVICE_CAPABILITY in this context. */ + uint8_t bDescriptorType; + + /** Capability type. Will have value + * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID + * LIBUSB_BT_CONTAINER_ID in this context. */ + uint8_t bDevCapabilityType; + + /** Reserved field */ + uint8_t bReserved; + + /** 128 bit UUID */ + uint8_t ContainerID[16]; +}; + +/** \ingroup libusb_asyncio + * Setup packet for control transfers. */ +struct libusb_control_setup { + /** Request type. Bits 0:4 determine recipient, see + * \ref libusb_request_recipient. Bits 5:6 determine type, see + * \ref libusb_request_type. Bit 7 determines data transfer direction, see + * \ref libusb_endpoint_direction. + */ + uint8_t bmRequestType; + + /** Request. If the type bits of bmRequestType are equal to + * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD + * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to + * \ref libusb_standard_request. For other cases, use of this field is + * application-specific. */ + uint8_t bRequest; + + /** Value. Varies according to request */ + uint16_t wValue; + + /** Index. Varies according to request, typically used to pass an index + * or offset */ + uint16_t wIndex; + + /** Number of bytes to transfer */ + uint16_t wLength; +}; + +#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) + +/* libusb */ + +struct libusb_context; +struct libusb_device; +struct libusb_device_handle; + +/** \ingroup libusb_lib + * Structure providing the version of the libusb runtime + */ +struct libusb_version { + /** Library major version. */ + const uint16_t major; + + /** Library minor version. */ + const uint16_t minor; + + /** Library micro version. */ + const uint16_t micro; + + /** Library nano version. */ + const uint16_t nano; + + /** Library release candidate suffix string, e.g. "-rc4". */ + const char *rc; + + /** For ABI compatibility only. */ + const char* describe; +}; + +/** \ingroup libusb_lib + * Structure representing a libusb session. The concept of individual libusb + * sessions allows for your program to use two libraries (or dynamically + * load two modules) which both independently use libusb. This will prevent + * interference between the individual libusb users - for example + * libusb_set_option() will not affect the other user of the library, and + * libusb_exit() will not destroy resources that the other user is still + * using. + * + * Sessions are created by libusb_init() and destroyed through libusb_exit(). + * If your application is guaranteed to only ever include a single libusb + * user (i.e. you), you do not have to worry about contexts: pass NULL in + * every function call where a context is required. The default context + * will be used. + * + * For more information, see \ref libusb_contexts. + */ +typedef struct libusb_context libusb_context; + +/** \ingroup libusb_dev + * Structure representing a USB device detected on the system. This is an + * opaque type for which you are only ever provided with a pointer, usually + * originating from libusb_get_device_list(). + * + * Certain operations can be performed on a device, but in order to do any + * I/O you will have to first obtain a device handle using libusb_open(). + * + * Devices are reference counted with libusb_ref_device() and + * libusb_unref_device(), and are freed when the reference count reaches 0. + * New devices presented by libusb_get_device_list() have a reference count of + * 1, and libusb_free_device_list() can optionally decrease the reference count + * on all devices in the list. libusb_open() adds another reference which is + * later destroyed by libusb_close(). + */ +typedef struct libusb_device libusb_device; + + +/** \ingroup libusb_dev + * Structure representing a handle on a USB device. This is an opaque type for + * which you are only ever provided with a pointer, usually originating from + * libusb_open(). + * + * A device handle is used to perform I/O and other operations. When finished + * with a device handle, you should call libusb_close(). + */ +typedef struct libusb_device_handle libusb_device_handle; + +/** \ingroup libusb_dev + * Speed codes. Indicates the speed at which the device is operating. + */ +enum libusb_speed { + /** The OS doesn't report or know the device speed. */ + LIBUSB_SPEED_UNKNOWN = 0, + + /** The device is operating at low speed (1.5MBit/s). */ + LIBUSB_SPEED_LOW = 1, + + /** The device is operating at full speed (12MBit/s). */ + LIBUSB_SPEED_FULL = 2, + + /** The device is operating at high speed (480MBit/s). */ + LIBUSB_SPEED_HIGH = 3, + + /** The device is operating at super speed (5000MBit/s). */ + LIBUSB_SPEED_SUPER = 4, + + /** The device is operating at super speed plus (10000MBit/s). */ + LIBUSB_SPEED_SUPER_PLUS = 5, +}; + +/** \ingroup libusb_dev + * Supported speeds (wSpeedSupported) bitfield. Indicates what + * speeds the device supports. + */ +enum libusb_supported_speed { + /** Low speed operation supported (1.5MBit/s). */ + LIBUSB_LOW_SPEED_OPERATION = 1, + + /** Full speed operation supported (12MBit/s). */ + LIBUSB_FULL_SPEED_OPERATION = 2, + + /** High speed operation supported (480MBit/s). */ + LIBUSB_HIGH_SPEED_OPERATION = 4, + + /** Superspeed operation supported (5000MBit/s). */ + LIBUSB_SUPER_SPEED_OPERATION = 8, +}; + +/** \ingroup libusb_dev + * Masks for the bits of the + * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field + * of the USB 2.0 Extension descriptor. + */ +enum libusb_usb_2_0_extension_attributes { + /** Supports Link Power Management (LPM) */ + LIBUSB_BM_LPM_SUPPORT = 2, +}; + +/** \ingroup libusb_dev + * Masks for the bits of the + * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field + * field of the SuperSpeed USB Device Capability descriptor. + */ +enum libusb_ss_usb_device_capability_attributes { + /** Supports Latency Tolerance Messages (LTM) */ + LIBUSB_BM_LTM_SUPPORT = 2, +}; + +/** \ingroup libusb_dev + * USB capability types + */ +enum libusb_bos_type { + /** Wireless USB device capability */ + LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1, + + /** USB 2.0 extensions */ + LIBUSB_BT_USB_2_0_EXTENSION = 2, + + /** SuperSpeed USB device capability */ + LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3, + + /** Container ID type */ + LIBUSB_BT_CONTAINER_ID = 4, +}; + +/** \ingroup libusb_misc + * Error codes. Most libusb functions return 0 on success or one of these + * codes on failure. + * You can call libusb_error_name() to retrieve a string representation of an + * error code or libusb_strerror() to get an end-user suitable description of + * an error code. + */ +enum libusb_error { + /** Success (no error) */ + LIBUSB_SUCCESS = 0, + + /** Input/output error */ + LIBUSB_ERROR_IO = -1, + + /** Invalid parameter */ + LIBUSB_ERROR_INVALID_PARAM = -2, + + /** Access denied (insufficient permissions) */ + LIBUSB_ERROR_ACCESS = -3, + + /** No such device (it may have been disconnected) */ + LIBUSB_ERROR_NO_DEVICE = -4, + + /** Entity not found */ + LIBUSB_ERROR_NOT_FOUND = -5, + + /** Resource busy */ + LIBUSB_ERROR_BUSY = -6, + + /** Operation timed out */ + LIBUSB_ERROR_TIMEOUT = -7, + + /** Overflow */ + LIBUSB_ERROR_OVERFLOW = -8, + + /** Pipe error */ + LIBUSB_ERROR_PIPE = -9, + + /** System call interrupted (perhaps due to signal) */ + LIBUSB_ERROR_INTERRUPTED = -10, + + /** Insufficient memory */ + LIBUSB_ERROR_NO_MEM = -11, + + /** Operation not supported or unimplemented on this platform */ + LIBUSB_ERROR_NOT_SUPPORTED = -12, + + /* NB: Remember to update LIBUSB_ERROR_COUNT below as well as the + message strings in strerror.c when adding new error codes here. */ + + /** Other error */ + LIBUSB_ERROR_OTHER = -99, +}; + +/* Total number of error codes in enum libusb_error */ +#define LIBUSB_ERROR_COUNT 14 + +/** \ingroup libusb_asyncio + * Transfer status codes */ +enum libusb_transfer_status { + /** Transfer completed without error. Note that this does not indicate + * that the entire amount of requested data was transferred. */ + LIBUSB_TRANSFER_COMPLETED, + + /** Transfer failed */ + LIBUSB_TRANSFER_ERROR, + + /** Transfer timed out */ + LIBUSB_TRANSFER_TIMED_OUT, + + /** Transfer was cancelled */ + LIBUSB_TRANSFER_CANCELLED, + + /** For bulk/interrupt endpoints: halt condition detected (endpoint + * stalled). For control endpoints: control request not supported. */ + LIBUSB_TRANSFER_STALL, + + /** Device was disconnected */ + LIBUSB_TRANSFER_NO_DEVICE, + + /** Device sent more data than requested */ + LIBUSB_TRANSFER_OVERFLOW, + + /* NB! Remember to update libusb_error_name() + when adding new status codes here. */ +}; + +/** \ingroup libusb_asyncio + * libusb_transfer.flags values */ +enum libusb_transfer_flags { + /** Report short frames as errors */ + LIBUSB_TRANSFER_SHORT_NOT_OK = 1<<0, + + /** Automatically free() transfer buffer during libusb_free_transfer(). + * Note that buffers allocated with libusb_dev_mem_alloc() should not + * be attempted freed in this way, since free() is not an appropriate + * way to release such memory. */ + LIBUSB_TRANSFER_FREE_BUFFER = 1<<1, + + /** Automatically call libusb_free_transfer() after callback returns. + * If this flag is set, it is illegal to call libusb_free_transfer() + * from your transfer callback, as this will result in a double-free + * when this flag is acted upon. */ + LIBUSB_TRANSFER_FREE_TRANSFER = 1<<2, + + /** Terminate transfers that are a multiple of the endpoint's + * wMaxPacketSize with an extra zero length packet. This is useful + * when a device protocol mandates that each logical request is + * terminated by an incomplete packet (i.e. the logical requests are + * not separated by other means). + * + * This flag only affects host-to-device transfers to bulk and interrupt + * endpoints. In other situations, it is ignored. + * + * This flag only affects transfers with a length that is a multiple of + * the endpoint's wMaxPacketSize. On transfers of other lengths, this + * flag has no effect. Therefore, if you are working with a device that + * needs a ZLP whenever the end of the logical request falls on a packet + * boundary, then it is sensible to set this flag on every + * transfer (you do not have to worry about only setting it on transfers + * that end on the boundary). + * + * This flag is currently only supported on Linux. + * On other systems, libusb_submit_transfer() will return + * LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this flag is set. + * + * Available since libusb-1.0.9. + */ + LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1 << 3, +}; + +/** \ingroup libusb_asyncio + * Isochronous packet descriptor. */ +struct libusb_iso_packet_descriptor { + /** Length of data to request in this packet */ + unsigned int length; + + /** Amount of data that was actually transferred */ + unsigned int actual_length; + + /** Status code for this packet */ + enum libusb_transfer_status status; +}; + +struct libusb_transfer; + +/** \ingroup libusb_asyncio + * Asynchronous transfer callback function type. When submitting asynchronous + * transfers, you pass a pointer to a callback function of this type via the + * \ref libusb_transfer::callback "callback" member of the libusb_transfer + * structure. libusb will call this function later, when the transfer has + * completed or failed. See \ref libusb_asyncio for more information. + * \param transfer The libusb_transfer struct the callback function is being + * notified about. + */ +typedef void (LIBUSB_CALL *libusb_transfer_cb_fn)(struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * The generic USB transfer structure. The user populates this structure and + * then submits it in order to request a transfer. After the transfer has + * completed, the library populates the transfer with the results and passes + * it back to the user. + */ +struct libusb_transfer { + /** Handle of the device that this transfer will be submitted to */ + libusb_device_handle *dev_handle; + + /** A bitwise OR combination of \ref libusb_transfer_flags. */ + uint8_t flags; + + /** Address of the endpoint where this transfer will be sent. */ + unsigned char endpoint; + + /** Type of the endpoint from \ref libusb_transfer_type */ + unsigned char type; + + /** Timeout for this transfer in milliseconds. A value of 0 indicates no + * timeout. */ + unsigned int timeout; + + /** The status of the transfer. Read-only, and only for use within + * transfer callback function. + * + * If this is an isochronous transfer, this field may read COMPLETED even + * if there were errors in the frames. Use the + * \ref libusb_iso_packet_descriptor::status "status" field in each packet + * to determine if errors occurred. */ + enum libusb_transfer_status status; + + /** Length of the data buffer */ + int length; + + /** Actual length of data that was transferred. Read-only, and only for + * use within transfer callback function. Not valid for isochronous + * endpoint transfers. */ + int actual_length; + + /** Callback function. This will be invoked when the transfer completes, + * fails, or is cancelled. */ + libusb_transfer_cb_fn callback; + + /** User context data to pass to the callback function. */ + void *user_data; + + /** Data buffer */ + unsigned char *buffer; + + /** Number of isochronous packets. Only used for I/O with isochronous + * endpoints. */ + int num_iso_packets; + + /** Isochronous packet descriptors, for isochronous transfers only. */ + struct libusb_iso_packet_descriptor iso_packet_desc[ZERO_SIZED_ARRAY]; +}; + +/** \ingroup libusb_misc + * Capabilities supported by an instance of libusb on the current running + * platform. Test if the loaded library supports a given capability by calling + * \ref libusb_has_capability(). + */ +enum libusb_capability { + /** The libusb_has_capability() API is available. */ + LIBUSB_CAP_HAS_CAPABILITY = 0x0000, + /** Hotplug support is available on this platform. */ + LIBUSB_CAP_HAS_HOTPLUG = 0x0001, + /** The library can access HID devices without requiring user intervention. + * Note that before being able to actually access an HID device, you may + * still have to call additional libusb functions such as + * \ref libusb_detach_kernel_driver(). */ + LIBUSB_CAP_HAS_HID_ACCESS = 0x0100, + /** The library supports detaching of the default USB driver, using + * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel */ + LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = 0x0101 +}; + +/** \ingroup libusb_lib + * Log message levels. + * - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default) + * - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr + * - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr + * - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stderr + * - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stderr + */ +enum libusb_log_level { + LIBUSB_LOG_LEVEL_NONE = 0, + LIBUSB_LOG_LEVEL_ERROR = 1, + LIBUSB_LOG_LEVEL_WARNING = 2, + LIBUSB_LOG_LEVEL_INFO = 3, + LIBUSB_LOG_LEVEL_DEBUG = 4, +}; + +int LIBUSB_CALL libusb_init(libusb_context **ctx); +void LIBUSB_CALL libusb_exit(libusb_context *ctx); +LIBUSB_DEPRECATED_FOR(libusb_set_option) +void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level); +const struct libusb_version * LIBUSB_CALL libusb_get_version(void); +int LIBUSB_CALL libusb_has_capability(uint32_t capability); +const char * LIBUSB_CALL libusb_error_name(int errcode); +int LIBUSB_CALL libusb_setlocale(const char *locale); +const char * LIBUSB_CALL libusb_strerror(enum libusb_error errcode); + +ssize_t LIBUSB_CALL libusb_get_device_list(libusb_context *ctx, + libusb_device ***list); +void LIBUSB_CALL libusb_free_device_list(libusb_device **list, + int unref_devices); +libusb_device * LIBUSB_CALL libusb_ref_device(libusb_device *dev); +void LIBUSB_CALL libusb_unref_device(libusb_device *dev); + +int LIBUSB_CALL libusb_get_configuration(libusb_device_handle *dev, + int *config); +int LIBUSB_CALL libusb_get_device_descriptor(libusb_device *dev, + struct libusb_device_descriptor *desc); +int LIBUSB_CALL libusb_get_active_config_descriptor(libusb_device *dev, + struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor(libusb_device *dev, + uint8_t config_index, struct libusb_config_descriptor **config); +int LIBUSB_CALL libusb_get_config_descriptor_by_value(libusb_device *dev, + uint8_t bConfigurationValue, struct libusb_config_descriptor **config); +void LIBUSB_CALL libusb_free_config_descriptor( + struct libusb_config_descriptor *config); +int LIBUSB_CALL libusb_get_ss_endpoint_companion_descriptor( + struct libusb_context *ctx, + const struct libusb_endpoint_descriptor *endpoint, + struct libusb_ss_endpoint_companion_descriptor **ep_comp); +void LIBUSB_CALL libusb_free_ss_endpoint_companion_descriptor( + struct libusb_ss_endpoint_companion_descriptor *ep_comp); +int LIBUSB_CALL libusb_get_bos_descriptor(libusb_device_handle *dev_handle, + struct libusb_bos_descriptor **bos); +void LIBUSB_CALL libusb_free_bos_descriptor(struct libusb_bos_descriptor *bos); +int LIBUSB_CALL libusb_get_usb_2_0_extension_descriptor( + struct libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_usb_2_0_extension_descriptor **usb_2_0_extension); +void LIBUSB_CALL libusb_free_usb_2_0_extension_descriptor( + struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension); +int LIBUSB_CALL libusb_get_ss_usb_device_capability_descriptor( + struct libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_ss_usb_device_capability_descriptor **ss_usb_device_cap); +void LIBUSB_CALL libusb_free_ss_usb_device_capability_descriptor( + struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap); +int LIBUSB_CALL libusb_get_container_id_descriptor(struct libusb_context *ctx, + struct libusb_bos_dev_capability_descriptor *dev_cap, + struct libusb_container_id_descriptor **container_id); +void LIBUSB_CALL libusb_free_container_id_descriptor( + struct libusb_container_id_descriptor *container_id); +uint8_t LIBUSB_CALL libusb_get_bus_number(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_port_number(libusb_device *dev); +int LIBUSB_CALL libusb_get_port_numbers(libusb_device *dev, uint8_t* port_numbers, int port_numbers_len); +LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers) +int LIBUSB_CALL libusb_get_port_path(libusb_context *ctx, libusb_device *dev, uint8_t* path, uint8_t path_length); +libusb_device * LIBUSB_CALL libusb_get_parent(libusb_device *dev); +uint8_t LIBUSB_CALL libusb_get_device_address(libusb_device *dev); +int LIBUSB_CALL libusb_get_device_speed(libusb_device *dev); +int LIBUSB_CALL libusb_get_max_packet_size(libusb_device *dev, + unsigned char endpoint); +int LIBUSB_CALL libusb_get_max_iso_packet_size(libusb_device *dev, + unsigned char endpoint); + +int LIBUSB_CALL libusb_open(libusb_device *dev, libusb_device_handle **dev_handle); +void LIBUSB_CALL libusb_close(libusb_device_handle *dev_handle); +libusb_device * LIBUSB_CALL libusb_get_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_set_configuration(libusb_device_handle *dev_handle, + int configuration); +int LIBUSB_CALL libusb_claim_interface(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_release_interface(libusb_device_handle *dev_handle, + int interface_number); + +libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( + libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); + +int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev_handle, + int interface_number, int alternate_setting); +int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev_handle, + unsigned char endpoint); +int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev_handle); + +int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev_handle, + uint32_t num_streams, unsigned char *endpoints, int num_endpoints); +int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev_handle, + unsigned char *endpoints, int num_endpoints); + +unsigned char * LIBUSB_CALL libusb_dev_mem_alloc(libusb_device_handle *dev_handle, + size_t length); +int LIBUSB_CALL libusb_dev_mem_free(libusb_device_handle *dev_handle, + unsigned char *buffer, size_t length); + +int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev_handle, + int interface_number); +int LIBUSB_CALL libusb_set_auto_detach_kernel_driver( + libusb_device_handle *dev_handle, int enable); + +/* async I/O */ + +/** \ingroup libusb_asyncio + * Get the data section of a control transfer. This convenience function is here + * to remind you that the data does not start until 8 bytes into the actual + * buffer, as the setup packet comes first. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns pointer to the first byte of the data section + */ +static inline unsigned char *libusb_control_transfer_get_data( + struct libusb_transfer *transfer) +{ + return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE; +} + +/** \ingroup libusb_asyncio + * Get the control setup packet of a control transfer. This convenience + * function is here to remind you that the control setup occupies the first + * 8 bytes of the transfer data buffer. + * + * Calling this function only makes sense from a transfer callback function, + * or situations where you have already allocated a suitably sized buffer at + * transfer->buffer. + * + * \param transfer a transfer + * \returns a casted pointer to the start of the transfer data buffer + */ +static inline struct libusb_control_setup *libusb_control_transfer_get_setup( + struct libusb_transfer *transfer) +{ + return (struct libusb_control_setup *)(void *) transfer->buffer; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the setup packet (first 8 bytes of the data + * buffer) for a control transfer. The wIndex, wValue and wLength values should + * be given in host-endian byte order. + * + * \param buffer buffer to output the setup packet into + * This pointer must be aligned to at least 2 bytes boundary. + * \param bmRequestType see the + * \ref libusb_control_setup::bmRequestType "bmRequestType" field of + * \ref libusb_control_setup + * \param bRequest see the + * \ref libusb_control_setup::bRequest "bRequest" field of + * \ref libusb_control_setup + * \param wValue see the + * \ref libusb_control_setup::wValue "wValue" field of + * \ref libusb_control_setup + * \param wIndex see the + * \ref libusb_control_setup::wIndex "wIndex" field of + * \ref libusb_control_setup + * \param wLength see the + * \ref libusb_control_setup::wLength "wLength" field of + * \ref libusb_control_setup + */ +static inline void libusb_fill_control_setup(unsigned char *buffer, + uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + uint16_t wLength) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer; + setup->bmRequestType = bmRequestType; + setup->bRequest = bRequest; + setup->wValue = libusb_cpu_to_le16(wValue); + setup->wIndex = libusb_cpu_to_le16(wIndex); + setup->wLength = libusb_cpu_to_le16(wLength); +} + +struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets); +int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); +int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); +void LIBUSB_CALL libusb_transfer_set_stream_id( + struct libusb_transfer *transfer, uint32_t stream_id); +uint32_t LIBUSB_CALL libusb_transfer_get_stream_id( + struct libusb_transfer *transfer); + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a control transfer. + * + * If you pass a transfer buffer to this function, the first 8 bytes will + * be interpreted as a control setup packet, and the wLength field will be + * used to automatically populate the \ref libusb_transfer::length "length" + * field of the transfer. Therefore the recommended approach is: + * -# Allocate a suitably sized data buffer (including space for control setup) + * -# Call libusb_fill_control_setup() + * -# If this is a host-to-device transfer with a data stage, put the data + * in place after the setup packet + * -# Call this function + * -# Call libusb_submit_transfer() + * + * It is also legal to pass a NULL buffer to this function, in which case this + * function will not attempt to populate the length field. Remember that you + * must then populate the buffer and length fields later. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param buffer data buffer. If provided, this function will interpret the + * first 8 bytes as a setup packet and infer the transfer length from that. + * This pointer must be aligned to at least 2 bytes boundary. + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_control_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char *buffer, libusb_transfer_cb_fn callback, void *user_data, + unsigned int timeout) +{ + struct libusb_control_setup *setup = (struct libusb_control_setup *)(void *) buffer; + transfer->dev_handle = dev_handle; + transfer->endpoint = 0; + transfer->type = LIBUSB_TRANSFER_TYPE_CONTROL; + transfer->timeout = timeout; + transfer->buffer = buffer; + if (setup) + transfer->length = (int) (LIBUSB_CONTROL_SETUP_SIZE + + libusb_le16_to_cpu(setup->wLength)); + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_BULK; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for a bulk transfer using bulk streams. + * + * Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103 + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param stream_id bulk stream id for this transfer + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_bulk_stream_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, uint32_t stream_id, + unsigned char *buffer, int length, libusb_transfer_cb_fn callback, + void *user_data, unsigned int timeout) +{ + libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, + length, callback, user_data, timeout); + transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM; + libusb_transfer_set_stream_id(transfer, stream_id); +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an interrupt transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_interrupt_transfer( + struct libusb_transfer *transfer, libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *buffer, int length, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_INTERRUPT; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Helper function to populate the required \ref libusb_transfer fields + * for an isochronous transfer. + * + * \param transfer the transfer to populate + * \param dev_handle handle of the device that will handle the transfer + * \param endpoint address of the endpoint where this transfer will be sent + * \param buffer data buffer + * \param length length of data buffer + * \param num_iso_packets the number of isochronous packets + * \param callback callback function to be invoked on transfer completion + * \param user_data user data to pass to callback function + * \param timeout timeout for the transfer in milliseconds + */ +static inline void libusb_fill_iso_transfer(struct libusb_transfer *transfer, + libusb_device_handle *dev_handle, unsigned char endpoint, + unsigned char *buffer, int length, int num_iso_packets, + libusb_transfer_cb_fn callback, void *user_data, unsigned int timeout) +{ + transfer->dev_handle = dev_handle; + transfer->endpoint = endpoint; + transfer->type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS; + transfer->timeout = timeout; + transfer->buffer = buffer; + transfer->length = length; + transfer->num_iso_packets = num_iso_packets; + transfer->user_data = user_data; + transfer->callback = callback; +} + +/** \ingroup libusb_asyncio + * Convenience function to set the length of all packets in an isochronous + * transfer, based on the num_iso_packets field in the transfer structure. + * + * \param transfer a transfer + * \param length the length to set in each isochronous packet descriptor + * \see libusb_get_max_packet_size() + */ +static inline void libusb_set_iso_packet_lengths( + struct libusb_transfer *transfer, unsigned int length) +{ + int i; + for (i = 0; i < transfer->num_iso_packets; i++) + transfer->iso_packet_desc[i].length = length; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer. + * + * This is a thorough function which loops through all preceding packets, + * accumulating their lengths to find the position of the specified packet. + * Typically you will assign equal lengths to each packet in the transfer, + * and hence the above method is sub-optimal. You may wish to use + * libusb_get_iso_packet_buffer_simple() instead. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer_simple() + */ +static inline unsigned char *libusb_get_iso_packet_buffer( + struct libusb_transfer *transfer, unsigned int packet) +{ + int i; + size_t offset = 0; + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + for (i = 0; i < _packet; i++) + offset += transfer->iso_packet_desc[i].length; + + return transfer->buffer + offset; +} + +/** \ingroup libusb_asyncio + * Convenience function to locate the position of an isochronous packet + * within the buffer of an isochronous transfer, for transfers where each + * packet is of identical size. + * + * This function relies on the assumption that every packet within the transfer + * is of identical size to the first packet. Calculating the location of + * the packet buffer is then just a simple calculation: + * buffer + (packet_size * packet) + * + * Do not use this function on transfers other than those that have identical + * packet lengths for each packet. + * + * \param transfer a transfer + * \param packet the packet to return the address of + * \returns the base address of the packet buffer inside the transfer buffer, + * or NULL if the packet does not exist. + * \see libusb_get_iso_packet_buffer() + */ +static inline unsigned char *libusb_get_iso_packet_buffer_simple( + struct libusb_transfer *transfer, unsigned int packet) +{ + int _packet; + + /* oops..slight bug in the API. packet is an unsigned int, but we use + * signed integers almost everywhere else. range-check and convert to + * signed to avoid compiler warnings. FIXME for libusb-2. */ + if (packet > INT_MAX) + return NULL; + _packet = (int) packet; + + if (_packet >= transfer->num_iso_packets) + return NULL; + + return transfer->buffer + ((int) transfer->iso_packet_desc[0].length * _packet); +} + +/* sync I/O */ + +int LIBUSB_CALL libusb_control_transfer(libusb_device_handle *dev_handle, + uint8_t request_type, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, + unsigned char *data, uint16_t wLength, unsigned int timeout); + +int LIBUSB_CALL libusb_bulk_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, + unsigned char endpoint, unsigned char *data, int length, + int *actual_length, unsigned int timeout); + +/** \ingroup libusb_desc + * Retrieve a descriptor from the default control pipe. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. + * + * \param dev_handle a device handle + * \param desc_type the descriptor type, see \ref libusb_descriptor_type + * \param desc_index the index of the descriptor to retrieve + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + */ +static inline int libusb_get_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t) ((desc_type << 8) | desc_index), + 0, data, (uint16_t) length, 1000); +} + +/** \ingroup libusb_desc + * Retrieve a descriptor from a device. + * This is a convenience function which formulates the appropriate control + * message to retrieve the descriptor. The string returned is Unicode, as + * detailed in the USB specifications. + * + * \param dev_handle a device handle + * \param desc_index the index of the descriptor to retrieve + * \param langid the language ID for the string descriptor + * \param data output buffer for descriptor + * \param length size of data buffer + * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure + * \see libusb_get_string_descriptor_ascii() + */ +static inline int libusb_get_string_descriptor(libusb_device_handle *dev_handle, + uint8_t desc_index, uint16_t langid, unsigned char *data, int length) +{ + return libusb_control_transfer(dev_handle, LIBUSB_ENDPOINT_IN, + LIBUSB_REQUEST_GET_DESCRIPTOR, (uint16_t)((LIBUSB_DT_STRING << 8) | desc_index), + langid, data, (uint16_t) length, 1000); +} + +int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle, + uint8_t desc_index, unsigned char *data, int length); + +/* polling and timeouts */ + +int LIBUSB_CALL libusb_try_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_events(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_events(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handling_ok(libusb_context *ctx); +int LIBUSB_CALL libusb_event_handler_active(libusb_context *ctx); +void LIBUSB_CALL libusb_interrupt_event_handler(libusb_context *ctx); +void LIBUSB_CALL libusb_lock_event_waiters(libusb_context *ctx); +void LIBUSB_CALL libusb_unlock_event_waiters(libusb_context *ctx); +int LIBUSB_CALL libusb_wait_for_event(libusb_context *ctx, struct timeval *tv); + +int LIBUSB_CALL libusb_handle_events_timeout(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_handle_events_timeout_completed(libusb_context *ctx, + struct timeval *tv, int *completed); +int LIBUSB_CALL libusb_handle_events(libusb_context *ctx); +int LIBUSB_CALL libusb_handle_events_completed(libusb_context *ctx, int *completed); +int LIBUSB_CALL libusb_handle_events_locked(libusb_context *ctx, + struct timeval *tv); +int LIBUSB_CALL libusb_pollfds_handle_timeouts(libusb_context *ctx); +int LIBUSB_CALL libusb_get_next_timeout(libusb_context *ctx, + struct timeval *tv); + +/** \ingroup libusb_poll + * File descriptor for polling + */ +struct libusb_pollfd { + /** Numeric file descriptor */ + int fd; + + /** Event flags to poll for from . POLLIN indicates that you + * should monitor this file descriptor for becoming ready to read from, + * and POLLOUT indicates that you should monitor this file descriptor for + * nonblocking write readiness. */ + short events; +}; + +/** \ingroup libusb_poll + * Callback function, invoked when a new file descriptor should be added + * to the set of file descriptors monitored for events. + * \param fd the new file descriptor + * \param events events to monitor for, see \ref libusb_pollfd for a + * description + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_added_cb)(int fd, short events, + void *user_data); + +/** \ingroup libusb_poll + * Callback function, invoked when a file descriptor should be removed from + * the set of file descriptors being monitored for events. After returning + * from this callback, do not use that file descriptor again. + * \param fd the file descriptor to stop monitoring + * \param user_data User data pointer specified in + * libusb_set_pollfd_notifiers() call + * \see libusb_set_pollfd_notifiers() + */ +typedef void (LIBUSB_CALL *libusb_pollfd_removed_cb)(int fd, void *user_data); + +const struct libusb_pollfd ** LIBUSB_CALL libusb_get_pollfds( + libusb_context *ctx); +void LIBUSB_CALL libusb_free_pollfds(const struct libusb_pollfd **pollfds); +void LIBUSB_CALL libusb_set_pollfd_notifiers(libusb_context *ctx, + libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, + void *user_data); + +/** \ingroup libusb_hotplug + * Callback handle. + * + * Callbacks handles are generated by libusb_hotplug_register_callback() + * and can be used to deregister callbacks. Callback handles are unique + * per libusb_context and it is safe to call libusb_hotplug_deregister_callback() + * on an already deregisted callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * For more information, see \ref libusb_hotplug. + */ +typedef int libusb_hotplug_callback_handle; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Flags for hotplug events */ +typedef enum { + /** Default value when not using any flags. */ + LIBUSB_HOTPLUG_NO_FLAGS = 0, + + /** Arm the callback and fire it for all matching currently attached devices. */ + LIBUSB_HOTPLUG_ENUMERATE = 1<<0, +} libusb_hotplug_flag; + +/** \ingroup libusb_hotplug + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * Hotplug events */ +typedef enum { + /** A device has been plugged in and is ready to use */ + LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = 0x01, + + /** A device has left and is no longer available. + * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. + * It is safe to call libusb_get_device_descriptor on a device that has left */ + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = 0x02, +} libusb_hotplug_event; + +/** \ingroup libusb_hotplug + * Wildcard matching for hotplug events */ +#define LIBUSB_HOTPLUG_MATCH_ANY -1 + +/** \ingroup libusb_hotplug + * Hotplug callback function type. When requesting hotplug event notifications, + * you pass a pointer to a callback function of this type. + * + * This callback may be called by an internal event thread and as such it is + * recommended the callback do minimal processing before returning. + * + * libusb will call this function later, when a matching event had happened on + * a matching device. See \ref libusb_hotplug for more information. + * + * It is safe to call either libusb_hotplug_register_callback() or + * libusb_hotplug_deregister_callback() from within a callback function. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param ctx context of this notification + * \param device libusb_device this event occurred on + * \param event event that occurred + * \param user_data user data provided when this callback was registered + * \returns bool whether this callback is finished processing events. + * returning 1 will cause this callback to be deregistered + */ +typedef int (LIBUSB_CALL *libusb_hotplug_callback_fn)(libusb_context *ctx, + libusb_device *device, + libusb_hotplug_event event, + void *user_data); + +/** \ingroup libusb_hotplug + * Register a hotplug callback function + * + * Register a callback with the libusb_context. The callback will fire + * when a matching event occurs on a matching device. The callback is + * armed until either it is deregistered with libusb_hotplug_deregister_callback() + * or the supplied callback returns 1 to indicate it is finished processing events. + * + * If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be + * called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices + * already plugged into the machine. Note that libusb modifies its internal + * device list from a separate thread, while calling hotplug callbacks from + * libusb_handle_events(), so it is possible for a device to already be present + * on, or removed from, its internal device list, while the hotplug callbacks + * still need to be dispatched. This means that when using \ref + * LIBUSB_HOTPLUG_ENUMERATE, your callback may be called twice for the arrival + * of the same device, once from libusb_hotplug_register_callback() and once + * from libusb_handle_events(); and/or your callback may be called for the + * removal of a device for which an arrived call was never made. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context to register this callback with + * \param[in] events bitwise or of events that will trigger this callback. See \ref + * libusb_hotplug_event + * \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag + * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY + * \param[in] cb_fn the function to be invoked on a matching event/device + * \param[in] user_data user data to pass to the callback function + * \param[out] callback_handle pointer to store the handle of the allocated callback (can be NULL) + * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure + */ +int LIBUSB_CALL libusb_hotplug_register_callback(libusb_context *ctx, + libusb_hotplug_event events, + libusb_hotplug_flag flags, + int vendor_id, int product_id, + int dev_class, + libusb_hotplug_callback_fn cb_fn, + void *user_data, + libusb_hotplug_callback_handle *callback_handle); + +/** \ingroup libusb_hotplug + * Deregisters a hotplug callback. + * + * Deregister a callback from a libusb_context. This function is safe to call from within + * a hotplug callback. + * + * Since version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102 + * + * \param[in] ctx context this callback is registered with + * \param[in] callback_handle the handle of the callback to deregister + */ +void LIBUSB_CALL libusb_hotplug_deregister_callback(libusb_context *ctx, + libusb_hotplug_callback_handle callback_handle); + +/** \ingroup libusb_lib + * Available option values for libusb_set_option(). + */ +enum libusb_option { + /** Set the log message verbosity. + * + * The default level is LIBUSB_LOG_LEVEL_NONE, which means no messages are ever + * printed. If you choose to increase the message verbosity level, ensure + * that your application does not close the stderr file descriptor. + * + * You are advised to use level LIBUSB_LOG_LEVEL_WARNING. libusb is conservative + * with its message logging and most of the time, will only log messages that + * explain error conditions and other oddities. This will help you debug + * your software. + * + * If the LIBUSB_DEBUG environment variable was set when libusb was + * initialized, this function does nothing: the message verbosity is fixed + * to the value in the environment variable. + * + * If libusb was compiled without any message logging, this function does + * nothing: you'll never get any messages. + * + * If libusb was compiled with verbose debug message logging, this function + * does nothing: you'll always get messages from all levels. + */ + LIBUSB_OPTION_LOG_LEVEL, + + /** Use the UsbDk backend for a specific context, if available. + * + * This option should be set immediately after calling libusb_init(), otherwise + * unspecified behavior may occur. + * + * Only valid on Windows. + */ + LIBUSB_OPTION_USE_USBDK, +}; + +int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index a9f86f81..2c33fcd4 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -2,6 +2,16 @@ #include #include #include +#ifdef _WIN32 +#include +#else +#include + +void Sleep(unsigned milliseconds) { + usleep(milliseconds * 1000); +} +#endif + #include "libusb.h" /* the device's vendor and product id */ @@ -501,7 +511,7 @@ int main(int argc, char **argv) printf("Waiting for device to restart and enter DFU mode...\n"); // Wait for device to enter dfu mode and restart - system("sleep 20"); + Sleep(20 * 1000); #endif // NOW IN DFU APPLICATION MODE @@ -556,7 +566,7 @@ int main(int argc, char **argv) printf("... Reverting device to factory image\n"); xmos_dfu_revertfactory(); // Give device time to revert firmware - system("sleep 2"); + Sleep(2 * 1000); xmos_dfu_resetfromdfu(XMOS_DFU_IF); } else From a120d7a83e59d1eab4f4b40adfe41519ea4cd9a9 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Fri, 23 Aug 2019 09:30:05 +0100 Subject: [PATCH 002/233] Added audio stream start/stop callbacks for input/output --- CHANGELOG.rst | 1 + lib_xua/src/core/endpoint0/xua_endpoint0.c | 51 +++++++++++++++---- .../src/core/user/audiostream/audiostream.c | 29 ++++++++++- .../src/core/user/audiostream/audiostream.h | 12 +++++ 4 files changed, 81 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 232e19a7..35975793 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ lib_xua Change Log * ADDED: Initial library documentation * ADDED: Application note AN00247: Using lib_xua with lib_spdif (transmit) + * ADDED: Callbacks for input/output audio stream start/stop * CHANGE: I2S hardware resources no longer used globally and must be passed to XUA_AudioHub() * CHANGE: XUA_AudioHub() no longer pars S/PDIF transmitter task diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index b3ef87a0..5ebdfbd0 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -409,23 +409,48 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, } #if (NUM_USB_CHAN_OUT > 0) && (NUM_USB_CHAN_IN > 0) - if ((sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) || (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT)) + unsigned num_input_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]; + unsigned num_output_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT]; + if (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT) { - /* Check for stream start stop on output and input audio interfaces */ - if(sp.wValue && !g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT] && !g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]) + // in: 0 -> 1 + if (sp.wValue && !num_input_interfaces) { - /* If start and input AND output not currently running */ - UserAudioStreamStart(); + UserAudioInputStreamStart(); + if (!num_output_interfaces) + { + UserAudioStreamStart(); + } } - else if(((sp.wIndex == 1) && (!sp.wValue)) && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT] && (!g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT])) + // in: 1 -> 0 + else if (!sp.wValue && num_input_interfaces) { - /* if output stop and output running and input not running */ - UserAudioStreamStop(); + UserAudioInputStreamStop(); + if (!num_output_interfaces) + { + UserAudioStreamStop(); + } } - else if(((sp.wIndex == 2) && (!sp.wValue)) && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT] && (!g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT])) + } + else if (sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) + { + // out: 0 -> 1 + if (sp.wValue && !num_output_interfaces) { - /* if input stop and input running and output not running */ - UserAudioStreamStop(); + UserAudioOutputStreamStart(); + if (!num_input_interfaces) + { + UserAudioStreamStart(); + } + } + // out: 1 -> 0 + else if (!sp.wValue && num_output_interfaces) + { + UserAudioOutputStreamStop(); + if (!num_input_interfaces) + { + UserAudioStreamStop(); + } } } #elif (NUM_USB_CHAN_OUT > 0) @@ -435,11 +460,13 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, { /* if start and not currently running */ UserAudioStreamStart(); + UserAudioOutputStreamStart(); } else if (!sp.wValue && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT]) { /* if stop and currently running */ UserAudioStreamStop(); + UserAudioOutputStreamStop(); } } #elif (NUM_USB_CHAN_IN > 0) @@ -449,11 +476,13 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, { /* if start and not currently running */ UserAudioStreamStart(); + UserAudioInputStreamStart(); } else if (!sp.wValue && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]) { /* if stop and currently running */ UserAudioStreamStop(); + UserAudioInputStreamStop(); } } #endif diff --git a/lib_xua/src/core/user/audiostream/audiostream.c b/lib_xua/src/core/user/audiostream/audiostream.c index d07491df..de729e39 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.c +++ b/lib_xua/src/core/user/audiostream/audiostream.c @@ -1,6 +1,9 @@ // Copyright (c) 2013-2018, XMOS Ltd, All rights reserved -/* Deafult implementations of AudioStreamStop() and AudioStreamStart(). Both can be over-ridden */ +/* Default implementations of AudioStreamStop() and AudioStreamStart() + * callbacks. + */ + void UserAudioStreamStop() __attribute__ ((weak)); void UserAudioStreamStop() { @@ -12,3 +15,27 @@ void UserAudioStreamStart() { return; } + +void UserAudioInputStreamStop() __attribute__ ((weak)); +void UserAudioInputStreamStop() +{ + return; +} + +void UserAudioInputStreamStart() __attribute__ ((weak)); +void UserAudioInputStreamStart() +{ + return; +} + +void UserAudioOutputStreamStop() __attribute__ ((weak)); +void UserAudioOutputStreamStop() +{ + return; +} + +void UserAudioOutputStreamStart() __attribute__ ((weak)); +void UserAudioOutputStreamStart() +{ + return; +} diff --git a/lib_xua/src/core/user/audiostream/audiostream.h b/lib_xua/src/core/user/audiostream/audiostream.h index 60942914..f1c5060f 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.h +++ b/lib_xua/src/core/user/audiostream/audiostream.h @@ -14,5 +14,17 @@ void UserAudioStreamStart(void); /* Any actions required on stream stop e.g. DAC mute - run every steam stop */ void UserAudioStreamStop(void); +/* Any actions required on input stream start */ +void UserAudioInputStreamStart(void); + +/* Any actions required on input stream stop */ +void UserAudioInputStreamStop(void); + +/* Any actions required on output stream start */ +void UserAudioOutputStreamStart(void); + +/* Any actions required on output stream stop */ +void UserAudioOutputStreamStop(void); + #endif From 3fc2729db853ae4ba8e24c11d25740b09f1130bd Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Fri, 23 Aug 2019 09:52:53 +0100 Subject: [PATCH 003/233] Update Copyright --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- lib_xua/src/core/user/audiostream/audiostream.c | 2 +- lib_xua/src/core/user/audiostream/audiostream.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 5ebdfbd0..a66088f0 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /** * @brief Implements endpoint zero for an USB Audio 1.0/2.0 device * @author Ross Owen, XMOS Semiconductor diff --git a/lib_xua/src/core/user/audiostream/audiostream.c b/lib_xua/src/core/user/audiostream/audiostream.c index de729e39..863bb1a0 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.c +++ b/lib_xua/src/core/user/audiostream/audiostream.c @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved /* Default implementations of AudioStreamStop() and AudioStreamStart() * callbacks. diff --git a/lib_xua/src/core/user/audiostream/audiostream.h b/lib_xua/src/core/user/audiostream/audiostream.h index f1c5060f..bb218fd5 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.h +++ b/lib_xua/src/core/user/audiostream/audiostream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved #ifndef _AUDIOSTREAM_H_ #define _AUDIOSTREAM_H_ From 5b05e4e32e06107b228dd380f169110c9cf3f47e Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 27 Aug 2019 11:06:44 +0100 Subject: [PATCH 004/233] Update CHANGELOG.rst --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 35975793..1f871966 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,7 @@ lib_xua Change Log * ADDED: Initial library documentation * ADDED: Application note AN00247: Using lib_xua with lib_spdif (transmit) - * ADDED: Callbacks for input/output audio stream start/stop + * ADDED: Separate callbacks for input/output audio stream start/stop * CHANGE: I2S hardware resources no longer used globally and must be passed to XUA_AudioHub() * CHANGE: XUA_AudioHub() no longer pars S/PDIF transmitter task From 9d84debefdf6c0a2d972b32e642e155704bc0df7 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 13 Aug 2019 12:44:22 +0100 Subject: [PATCH 005/233] Update to support "xwaf.xcommon" builds --- lib_xua/module_build_info | 87 ++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 2a36dedf..c3221cf1 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,37 +1,66 @@ -# You can set flags specifically for your module by using the MODULE_XCC_FLAGS -# variable. So the following -# -# MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -# -# specifies that everything in the modules should have the application -# build flags with -O3 appended (so the files will build at -# optimization level -O3). -# -# You can also set MODULE_XCC_C_FLAGS, MODULE_XCC_XC_FLAGS etc.. +VERSION = 0.2.0 -MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-asm +DEPENDENT_MODULES = lib_logging(>=2.1.0) \ + lib_xassert(>=2.0.0) \ + lib_xud(>=0.1.0) \ + lib_spdif(>=3.0.0) \ + lib_mic_array(>=3.2.0) + +MODULE_XCC_FLAGS = $(XCC_FLAGS) \ + -O3 \ + -DREF_CLK_FREQ=100 \ + -fasm-linenum \ + -fcomment-asm + +# Core +XCC_FLAGS_xua_endpoint0.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue +XCC_FLAGS_xua_ep0_uacreqs.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue +XCC_FLAGS_dbcalc.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue +XCC_FLAGS_audioports.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue +XCC_FLAGS_audioports.xc = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue + +# DFU +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_flashlib_user.c = $(MODULE_XCC_FLAGS) -Os -mno-dual-issue OPTIONAL_HEADERS += xua_conf.h -VERSION = 0.2.0 +EXPORT_INCLUDE_DIRS = api \ + src/core \ + src/core/audiohub \ + src/core/buffer/ep \ + src/core/endpoint0 \ + src/dfu -DEPENDENT_MODULES = lib_logging(>=2.1.0) lib_xassert(>=2.0.0) lib_xud(>=0.1.0) lib_spdif(>=3.0.0) +INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \ + src/core/buffer/decouple \ + src/core/clocking \ + src/core/mixer \ + src/core/pdm_mics \ + src/core/ports \ + src/core/support \ + src/core/support/powersave \ + src/core/user \ + src/core/user/audiostream \ + src/core/user/hostactive \ + src/midi -INCLUDE_DIRS = api src/* +SOURCE_DIRS = src/core \ + src/core/audiohub \ + src/core/buffer/decouple \ + src/core/buffer/ep \ + src/core/clocking \ + src/core/endpoint0 \ + src/core/mixer \ + src/core/pdm_mics \ + src/core/ports \ + src/core/support \ + src/core/support/powersave \ + src/core/user/audiostream \ + src/core/user/hostactive \ + src/core/xuduser \ + src/dfu \ + src/midi -#ignore host dir -SOURCE_DIRS = src/* - -# The following file specific flags are not automatically kept in sync with the wscript file -# Core EXCLUDE_FILES += descriptors_2.rst -XCC_FLAGS_xua_endpoint0.c = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_xua_ep0_uacreqs.xc = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_dbcalc.xc = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_audioports.c = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_audioports.xc = -Os -mno-dual-issue $(XCC_FLAGS) - -# DFU -XCC_FLAGS_dfu.xc = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_flash_interface.c = -Os -mno-dual-issue $(XCC_FLAGS) -XCC_FLAGS_flashlib_user.c = -Os -mno-dual-issue $(XCC_FLAGS) From f1ba1dace8595dfbb7e20e0fb788336373fd37e6 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 13 Aug 2019 12:46:33 +0100 Subject: [PATCH 006/233] Bump version --- CHANGELOG.rst | 5 ++ lib_xua/module_build_info | 2 +- lib_xua/wscript | 109 -------------------------------------- 3 files changed, 6 insertions(+), 110 deletions(-) delete mode 100644 lib_xua/wscript diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1f871966..75003253 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +0.3.0 +----- + + * CHANGED: Build files updated to support new "xcommon" behaviour in xwaf. + 0.2.0 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index c3221cf1..2935f960 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 0.2.0 +VERSION = 0.3.0 DEPENDENT_MODULES = lib_logging(>=2.1.0) \ lib_xassert(>=2.0.0) \ diff --git a/lib_xua/wscript b/lib_xua/wscript deleted file mode 100644 index 76f039b3..00000000 --- a/lib_xua/wscript +++ /dev/null @@ -1,109 +0,0 @@ -import os.path - - -def create_list_from_make_flag(bld, list_of_flags): - for i, flag in enumerate(list_of_flags): - if flag.startswith('$('): - for f in bld.env[flag.strip('$()')]: - list_of_flags.insert(i, f) - i += 1 - list_of_flags.remove(flag) - return list_of_flags - - -def create_list_of_strings(whitespace_seperated_list): - list_of_strings = whitespace_seperated_list.split(' ') - for item in list_of_strings: - item = "'{}'".format(item) - return list_of_strings - - -def read_module_build_info(bld): - with open(os.path.join(bld.path.abspath(), 'module_build_info')) as file: - module_build_info = {} - for line in file.readlines(): - line = line.strip() - if line and not line.startswith('#'): - key, value = line.split('=', 1) - module_build_info[key.strip(' +')] = value.strip() - - try: - module_build_info['OPTIONAL_HEADERS'] = ( - create_list_of_strings(module_build_info['OPTIONAL_HEADERS'])) - except KeyError: - pass - - try: - module_build_info['DEPENDENT_MODULES'] = ( - create_list_of_strings(module_build_info['DEPENDENT_MODULES'])) - except KeyError: - pass - - try: - module_build_info['MODULE_XCC_FLAGS'] = ( - create_list_from_make_flag(bld, - create_list_of_strings(module_build_info['MODULE_XCC_FLAGS']))) - except KeyError: - pass - - try: - module_build_info['MODULE_XCC_XC_FLAGS'] = ( - create_list_from_make_flag(bld, - create_list_of_strings(module_build_info['MODULE_XCC_XC_FLAGS']))) - except KeyError: - pass - - try: - module_build_info['MODULE_XCC_C_FLAGS'] = ( - create_list_from_make_flag(bld, - create_list_of_strings(module_build_info['MODULE_XCC_C_FLAGS']))) - except KeyError: - pass - - try: - module_build_info['MODULE_XCC_CPP_FLAGS'] = ( - create_list_from_make_flag(bld, - create_list_of_strings(module_build_info['MODULE_XCC_CPP_FLAGS']))) - except KeyError: - pass - - try: - module_build_info['MODULE_XCC_ASM_FLAGS'] = ( - create_list_from_make_flag(bld, - create_list_of_strings(module_build_info['MODULE_XCC_ASM_FLAGS']))) - except KeyError: - pass - - try: - module_build_info['INCLUDE_DIRS'] = ( - create_list_of_strings(module_build_info['INCLUDE_DIRS'])) - except KeyError: - pass - - return module_build_info - - -def use_module(bld): - module_build_info = read_module_build_info(bld) - source = bld.path.ant_glob(['src/**/*.xc', 'src/**/*.c', 'src/**/*.S'], - excl=['**/descriptors_2.rst']) - bld.env.MODULE_XCC_FLAGS = module_build_info['MODULE_XCC_FLAGS'] - - # The following file specific flags are not automatically kept in sync with the module_build_info file - # Core - bld.env['XCC_FLAGS_endpoint0.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_xua_ep0_uacreqs.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_dbcalc.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_audioports.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_audioports.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - # DFU - bld.env['XCC_FLAGS_dfu.xc'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_flash_interface.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - bld.env['XCC_FLAGS_flashlib_user.c'] = bld.env.XCC_FLAGS + ['-Os', '-mno-dual-issue'] - - bld.module( - source=source, - depends_on=module_build_info['DEPENDENT_MODULES'], - includes=module_build_info['INCLUDE_DIRS'], - optional_headers=module_build_info['OPTIONAL_HEADERS'], - version=module_build_info['VERSION']) \ No newline at end of file From 8d3cc039f7896e90bd7c0f60a3b2f176c80bc7c6 Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Tue, 13 Aug 2019 15:04:41 +0100 Subject: [PATCH 007/233] Update dependency requirements --- CHANGELOG.rst | 6 ++++++ lib_xua/module_build_info | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 75003253..5e0532e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,12 @@ lib_xua Change Log * CHANGED: Build files updated to support new "xcommon" behaviour in xwaf. + * Changes to dependencies: + + - lib_dsp: Added dependency 5.0.0 + + - lib_mic_array: Added dependency 4.0.0 + 0.2.0 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 2935f960..2a96c9f5 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,10 +1,10 @@ VERSION = 0.3.0 -DEPENDENT_MODULES = lib_logging(>=2.1.0) \ - lib_xassert(>=2.0.0) \ - lib_xud(>=0.1.0) \ - lib_spdif(>=3.0.0) \ - lib_mic_array(>=3.2.0) +DEPENDENT_MODULES = lib_logging(>=3.0.0) \ + lib_xassert(>=4.0.0) \ + lib_xud(>=0.2.0) \ + lib_spdif(>=4.0.0) \ + lib_mic_array(>=4.0.0) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ From a7a577acad6411f60ffef4331bbfe437b056753e Mon Sep 17 00:00:00 2001 From: Sam Chesney Date: Wed, 21 Aug 2019 18:37:07 +0100 Subject: [PATCH 008/233] Update cleanup call --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5e404793..044d9bfe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,7 +133,7 @@ pipeline { } post { cleanup { - cleanWs() + xcoreCleanSandbox() } } } From 244232d3e1c65b8ac01117883b3a3b77681af9f1 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Thu, 29 Aug 2019 10:01:03 +0100 Subject: [PATCH 009/233] Change view to lib_xua_xwaf_xcommon --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 044d9bfe..85251dcd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,8 @@ pipeline { agent none environment { REPO = 'lib_xua' - VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" + VIEW = 'lib_xua_xwaf_xcommon' + //VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" } triggers { /* Trigger this Pipeline on changes to the repos dependencies From eafcc89a6b9943c15a1bb57ad84a9dfcda5bf192 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Thu, 5 Sep 2019 15:52:51 +0100 Subject: [PATCH 010/233] Change XUA to use new mic array API --- lib_xua/src/core/pdm_mics/pdm_mic.xc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index 2221d1f7..2bb37bff 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -88,7 +88,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio) fir_coefs[6] = g_third_stage_div_12_fir; //dcc = {MIC_ARRAY_MAX_FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor/2], 0, 0, DECIMATOR_NO_FRAME_OVERLAP, 2}; - dcc.frame_size_log2 = MIC_ARRAY_MAX_FRAME_SIZE_LOG2; + dcc.len = MIC_ARRAY_MAX_FRAME_SIZE_LOG2; dcc.apply_dc_offset_removal = 1; dcc.index_bit_reversal = 0; dcc.windowing_function = null; @@ -107,6 +107,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio) dc[0].mic_gain_compensation[2]=0; dc[0].mic_gain_compensation[3]=0; dc[0].channel_count = 4; + dc[0].async_interface_enabled = 0; dc[1].dcc = &dcc; dc[1].data = mic_decimator_fir_data[4]; dc[1].mic_gain_compensation[0]=0; @@ -114,6 +115,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio) dc[1].mic_gain_compensation[2]=0; dc[1].mic_gain_compensation[3]=0; dc[1].channel_count = 4; + dc[0].async_interface_enabled = 0; mic_array_decimator_configure(c_ds_output, decimatorCount, dc); From a682ed7d19438478920f2621f53d4e17a84477be Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Thu, 5 Sep 2019 16:03:31 +0100 Subject: [PATCH 011/233] Update copyright --- lib_xua/src/core/pdm_mics/pdm_mic.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index 2bb37bff..b853f2d0 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved #include "xua.h" From 508c62af000d766fc66268ccb78b130d75ea1460 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Thu, 5 Sep 2019 16:34:59 +0100 Subject: [PATCH 012/233] Keep version on 0.2.0 --- CHANGELOG.rst | 16 +++++----------- lib_xua/module_build_info | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5e0532e6..a113f942 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,17 +1,6 @@ lib_xua Change Log ================== -0.3.0 ------ - - * CHANGED: Build files updated to support new "xcommon" behaviour in xwaf. - - * Changes to dependencies: - - - lib_dsp: Added dependency 5.0.0 - - - lib_mic_array: Added dependency 4.0.0 - 0.2.0 ----- @@ -24,6 +13,7 @@ lib_xua Change Log * CHANGE: Moved to lib_spdif (from module_spdif_tx & module_spdif_rx) * CHANGE: Define NUM_PDM_MICS renamed to XUA_NUM_PDM_MICS * CHANGE: Define NO_USB renamed to XUA_USB_EN + * CHANGE: Build files updated to support new "xcommon" behaviour in xwaf. * RESOLVED: wChannelConfig in UAC1 descriptor set according to output channel count * RESOLVED: Indexing of ADAT channel strings (#18059) @@ -35,6 +25,10 @@ lib_xua Change Log - lib_xassert: Added dependency 3.0.1 + - lib_dsp: Added dependency 5.0.0 + + - lib_mic_array: Added dependency 4.0.0 + 0.1.2 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 2a96c9f5..ce383df3 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 0.3.0 +VERSION = 0.2.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ From eb1ca1eb8d99ea06643766e4235ba5f9391c4d3b Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Fri, 6 Sep 2019 09:13:09 +0100 Subject: [PATCH 013/233] Update CHANGELOG --- CHANGELOG.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a113f942..2a114f45 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,14 +21,14 @@ lib_xua Change Log * Changes to dependencies: - - lib_spdif: Added dependency 3.1.0 - - - lib_xassert: Added dependency 3.0.1 - - lib_dsp: Added dependency 5.0.0 - lib_mic_array: Added dependency 4.0.0 + - lib_spdif: Added dependency 3.1.0 + + - lib_xassert: Added dependency 3.0.1 + 0.1.2 ----- From a1aca010fb95d193506f846ac86c6ce808c37406 Mon Sep 17 00:00:00 2001 From: shuchitak <38428600+shuchitak@users.noreply.github.com> Date: Fri, 13 Sep 2019 10:20:23 +0100 Subject: [PATCH 014/233] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85251dcd..044d9bfe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,8 +6,7 @@ pipeline { agent none environment { REPO = 'lib_xua' - VIEW = 'lib_xua_xwaf_xcommon' - //VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" + VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" } triggers { /* Trigger this Pipeline on changes to the repos dependencies From 8ff44c553c82de73cad845f61c8752adfe702601 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 23 Sep 2019 15:36:35 +0100 Subject: [PATCH 015/233] Add the specific directory that contains user_hid.h. Apparently xwaf doesn't recursively descend directory trees the way xmake does. --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 2a36dedf..f13abe6b 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -17,7 +17,7 @@ VERSION = 0.2.0 DEPENDENT_MODULES = lib_logging(>=2.1.0) lib_xassert(>=2.0.0) lib_xud(>=0.1.0) lib_spdif(>=3.0.0) -INCLUDE_DIRS = api src/* +INCLUDE_DIRS = api src/* src/core/user #ignore host dir SOURCE_DIRS = src/* From bb5757e099b9a71ab54ff0a8c815f1d8914e33ec Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 23 Sep 2019 17:29:39 +0100 Subject: [PATCH 016/233] Initial implementation of HID. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/user_hid.h | 4 +++- lib_xua/src/core/user/user_hid.xc | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 lib_xua/src/core/user/user_hid.xc diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index e510d37a..b9c01d6b 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDButtons(g_hidData); + UserReadHIDData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index b2530d0f..6620c7dd 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -9,5 +9,7 @@ #define HID_CONTROL_VOLDN_SHIFT 0x04 #define HID_CONTROL_MUTE_SHIFT 0x05 -void UserReadHIDButtons(unsigned char hidData[]); +#define HID_DATA_SIZE 1 + +void UserReadHIDData(unsigned char hidData[HID_DATA_SIZE]); diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc new file mode 100644 index 00000000..61466360 --- /dev/null +++ b/lib_xua/src/core/user/user_hid.xc @@ -0,0 +1,12 @@ +// Copyright (c) 2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "user_hid.h" + +void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) +{ + for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { + hidData[ idx ] = 1; + } +} \ No newline at end of file From 017d937ec7e74ae618d8d8540e7bce09d284ffa7 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 11:39:48 +0100 Subject: [PATCH 017/233] Add comments to match #endif directives to their corresponding #if or #ifdef directive. Added to aid reading. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index b3129ac0..ea34ac2b 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1084,7 +1084,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }, 0, /* 60 iFeature */ }, -#endif +#endif /* (OUTPUT_VOLUME_CONTROL == 1) */ /* Output Terminal Descriptor (Audio) */ .Audio_Out_OutputTerminal = @@ -1104,7 +1104,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x0000, /* 9 bmControls */ 0, /* 11 iTerminal */ }, -#endif +#endif /* (NUM_USB_CHAN_OUT > 0) */ @@ -1259,7 +1259,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }, 0, /* 60 iFeature */ }, -#endif +#endif /* (INPUT_VOLUME_CONTROL == 1) */ .Audio_In_OutputTerminal = { @@ -1280,7 +1280,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bmControls = 0x0000, .iTerminal = offsetof(StringDescTable_t, usbOutputTermStr_Audio2)/sizeof(char *) }, -#endif +#endif /* (NUM_USB_CHAN_IN > 0) */ #if defined(MIXER) && (MAX_MIX_COUNT > 0) /* Extension Unit Descriptor (4.7.2.12) */ @@ -1374,7 +1374,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x00, /* bmControls */ 0 /* Mixer unit string descriptor index */ }, -#endif +#endif /* defined(MIXER) && (MAX_MIX_COUNT > 0) */ #if (SPDIF_RX) || (ADAT_RX) /* Standard AS Interrupt Endpoint Descriptor (4.8.2.1): */ @@ -1571,7 +1571,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 4, /* 6 bInterval. Only values <= 1 frame (4) supported by MS */ }, #endif -#endif +#endif /* OUTPUT_FORMAT_COUNT > 1 */ #if (OUTPUT_FORMAT_COUNT > 2) /* Standard AS Interface Descriptor (4.9.1) (Alt) */ .Audio_Out_StreamInterface_Alt3 = @@ -1815,7 +1815,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLockDelayUnits = 0x02, .wLockDelay = 0x0008, }, -#endif +#endif /* (INPUT_FORMAT_COUNT > 1) */ #if (INPUT_FORMAT_COUNT > 2) /* Alternative 3 */ /* Standard AS Interface Descriptor (4.9.1) (Alt) */ @@ -1888,7 +1888,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLockDelayUnits = 0x02, .wLockDelay = 0x0008, }, -#endif +#endif /* (INPUT_FORMAT_COUNT > 2) */ #endif /* #if(NUM_USB_CHAN_IN > 0) */ #ifdef MIDI @@ -2044,7 +2044,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x10, /* 7 bcdDFUVersion */ 0x01}, /* 7 bcdDFUVersion */ #endif -#endif +#endif /* (XUA_DFU_EN == 1) */ #ifdef IAP /* Interface descriptor */ @@ -2192,7 +2192,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= #endif }; -#endif +#endif /* (AUDIO_CLASS == 2) */ #ifdef HID_CONTROLS unsigned char hidDescriptor[] = From 75422de6d18a126af5fe52fc66457f676f0e16f6 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 11:42:59 +0100 Subject: [PATCH 018/233] Replace existing #ifdef HID_CONTROLS with #if( 0 < HID_CONTROLS ) to move to best practice regarding compile-time switches. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index ea34ac2b..0f762d61 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -547,7 +547,7 @@ unsigned char devQualDesc_Null[] = #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) unsigned char hidReportDescriptor[] = { 0x05, 0x0c, /* Usage Page (Consumer Device) */ @@ -769,7 +769,7 @@ typedef struct #endif #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) USB_Descriptor_Interface_t HID_Interface; unsigned char hidDesc[9]; //TODO ideally we would have a struct for this. USB_Descriptor_Endpoint_t HID_In_Endpoint; @@ -2153,7 +2153,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= #endif #endif /* IAP */ -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) .HID_Interface = { 9, /* 0 bLength : Size of descriptor in Bytes */ @@ -2194,7 +2194,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= }; #endif /* (AUDIO_CLASS == 2) */ -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) unsigned char hidDescriptor[] = { 9, /* 0 bLength : Size of descriptor in Bytes */ From 35393d37395bd6d49c3f54236e2dfd81f7b256f5 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 11:44:43 +0100 Subject: [PATCH 019/233] Remove duplicate definitions. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 0f762d61..d6eac320 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2309,18 +2309,6 @@ const unsigned num_freqs_a1 = MAX(3, (0 #define DFU_INTERFACES_A1 0 #endif -/* Total number of bytes returned for the class-specific AudioControl interface descriptor. - * Includes the combined length of this descriptor header and all Unit and Terminal descriptors - * For us this is IT -> FU -> OT * 2 and a header */ -#define AC_TOTAL_LENGTH (AC_LENGTH + \ - (INPUT_INTERFACES_A1 * (12 + ( (8 + NUM_USB_CHAN_IN_FS) * INPUT_VOLUME_CONTROL) + 9)) +\ - (OUTPUT_INTERFACES_A1 * (12 + ( (8 + NUM_USB_CHAN_OUT_FS) * OUTPUT_VOLUME_CONTROL) + 9))) - -#define STREAMING_INTERFACES (INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1) - -//#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) -//#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES) -//#endif /* Total number of bytes returned for the class-specific AudioControl interface descriptor. * Includes the combined length of this descriptor header and all Unit and Terminal descriptors From 958d52b5eb0e0a35eee4f998bf9b3b537c62b8cf Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 11:45:40 +0100 Subject: [PATCH 020/233] Consistently use hex when defining descriptor values. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index d6eac320..3cc81862 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2197,12 +2197,12 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= #if( 0 < HID_CONTROLS ) unsigned char hidDescriptor[] = { - 9, /* 0 bLength : Size of descriptor in Bytes */ + 0x09, /* 0 bLength : Size of descriptor in Bytes */ 0x21, /* 1 bDescriptorType (HID) */ 0x10, /* 2 bcdHID */ 0x01, /* 3 bcdHID */ - 0, /* 4 bCountryCode */ - 1, /* 5 bNumDescriptors */ + 0x00, /* 4 bCountryCode */ + 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */ sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */ From 3131b89a1d9691eb175f3cb51e564ffca5a150dd Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 11:46:16 +0100 Subject: [PATCH 021/233] Add HID descriptors for UAC1. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 3cc81862..61ba05d7 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2309,6 +2309,13 @@ const unsigned num_freqs_a1 = MAX(3, (0 #define DFU_INTERFACES_A1 0 #endif +#if( 0 < HID_CONTROLS ) +#define HID_INTERFACE_BYTES ( 9 + 9 + 7 ) +#define HID_INTERFACES_A1 1 +#else +#define HID_INTERFACE_BYTES 0 +#define HID_INTERFACES_A1 0 +#endif /* Total number of bytes returned for the class-specific AudioControl interface descriptor. * Includes the combined length of this descriptor header and all Unit and Terminal descriptors @@ -2321,12 +2328,12 @@ const unsigned num_freqs_a1 = MAX(3, (0 /* Number of interfaces for Audio 1.0 (+1 for control ) */ /* Note, this is different that INTERFACE_COUNT since we dont support items such as MIDI, iAP etc in UAC1 mode */ -#define NUM_INTERFACES_A1 (1+INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1+NUM_CONTROL_USB_INTERFACES+DFU_INTERFACES_A1) +#define NUM_INTERFACES_A1 (1 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1 + NUM_CONTROL_USB_INTERFACES + DFU_INTERFACES_A1 + HID_INTERFACES_A1) #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) -#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES) +#define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) #else -#define CFG_TOTAL_LENGTH_A1 (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) +#define CFG_TOTAL_LENGTH_A1 (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 + HID_INTERFACE_BYTES) #endif #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) @@ -2828,6 +2835,38 @@ unsigned char cfgDesc_Audio1[] = offsetof(StringDescTable_t, ctrlStr)/sizeof(char *), /* 8 iInterface */ #endif +#if( 0 < HID_CONTROLS ) + /* HID interface descriptor */ + 0x09, /* 0 bLength : Size of descriptor in Bytes */ + 0x04, /* 1 bDescriptorType (Interface: 0x04)*/ + INTERFACE_NUMBER_HID, /* 2 bInterfaceNumber : Number of interface */ + 0x00, /* 3 bAlternateSetting : Value used alternate interfaces using SetInterface Request */ + 0x01, /* 4: bNumEndpoints : Number of endpoitns for this interface (excluding 0) */ + 0x03, /* 5: bInterfaceClass */ + 0x00, /* 6: bInterfaceSubClass - no boot device */ + 0x00, /* 7: bInterfaceProtocol*/ + 0x00, /* 8 iInterface */ + + /* HID descriptor */ + 0x09, /* 0 bLength : Size of descriptor in Bytes */ + 0x21, /* 1 bDescriptorType (HID) */ + 0x10, /* 2 bcdHID */ + 0x01, /* 3 bcdHID */ + 0x00, /* 4 bCountryCode */ + 0x01, /* 5 bNumDescriptors */ + 0x22, /* 6 bDescriptorType[0] (Report) */ + 0x21, /* 7 wDescriptorLength[0] */ + 0x00, /* 8 wDescriptorLength[0] */ + + /* HID Endpoint descriptor (IN) */ + 0x07, /* 0 bLength */ + 0x05, /* 1 bDescriptorType */ + ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */ + 0x03, /* 3 bmAttributes (INTERRUPT) */ + 64, /* 4 wMaxPacketSize */ + 0x08, /* 6 bInterval */ +#endif + }; #endif #endif From 960333ca091b7bd8fa20c82c83c1a700477d8fce Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 14:38:17 +0100 Subject: [PATCH 022/233] Add the missing MSB of the maximum packet size and use hex values instead of decimal. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 61ba05d7..ae7ef76a 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2863,7 +2863,8 @@ unsigned char cfgDesc_Audio1[] = 0x05, /* 1 bDescriptorType */ ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */ 0x03, /* 3 bmAttributes (INTERRUPT) */ - 64, /* 4 wMaxPacketSize */ + 0x40, /* 4 wMaxPacketSize */ + 0x00, /* 5 wMaxPacketSize */ 0x08, /* 6 bInterval */ #endif From d491eb2da91efd9b8b4beafdb218eb4e5e10dac1 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 16:12:59 +0100 Subject: [PATCH 023/233] Change HID Report descriptor to contain one variable bit in the lsb position. This bit reports the interrupt. The remaining seven bits are constant at zero. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index ae7ef76a..bd95078e 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -556,15 +556,10 @@ unsigned char hidReportDescriptor[] = 0x15, 0x00, /* Logical Minimum (0) */ 0x25, 0x01, /* Logical Maximum (1) */ 0x09, 0xb0, /* Usage (Play) */ - 0x09, 0xb5, /* Usage (Scan Next Track) */ - 0x09, 0xb6, /* Usage (Scan Previous Track) */ - 0x09, 0xe9, /* Usage (Volume Up) */ - 0x09, 0xea, /* Usage (Volume Down) */ - 0x09, 0xe2, /* Usage (Mute) */ 0x75, 0x01, /* Report Size (1) */ - 0x95, 0x06, /* Report Count (6) */ + 0x95, 0x01, /* Report Count (1) */ 0x81, 0x02, /* Input (Data, Var, Abs) */ - 0x95, 0x02, /* Report Count (2) */ + 0x95, 0x07, /* Report Count (7) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0 /* End collection */ }; @@ -2855,7 +2850,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x21, /* 7 wDescriptorLength[0] */ + 0x17, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 3c86da7c092c5c0c1a2a3fe16682c9fd3ca9b332 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 25 Sep 2019 16:13:46 +0100 Subject: [PATCH 024/233] Add demo HID code that simulates an interrupt roughly every 10 seconds. --- lib_xua/src/core/user/user_hid.xc | 35 ++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 61466360..d27d6914 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -4,9 +4,38 @@ #include #include "user_hid.h" +#define HID_INTERRUPT_COUNT 1000000000 +#define HID_REPORT_DATA 0x01 + +static unsigned char initialised = 0; + +static unsigned int curr_time = 0; +static unsigned int last_time = 0; +static unsigned int tick_count = 0; + void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) { - for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { - hidData[ idx ] = 1; + timer tmr; + + if( !initialised ) { + tmr :> last_time; + initialised = 1; + } else { + tmr :> curr_time; + tick_count += ( last_time < curr_time ) ? curr_time - last_time : curr_time + ( UINT_MAX - last_time ); + + if( HID_INTERRUPT_COUNT <= tick_count ) { + for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { + hidData[ idx ] = HID_REPORT_DATA; + } + + tick_count = 0; + } else { + for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { + hidData[ idx ] = 0x00; + } + } + + last_time = curr_time; } -} \ No newline at end of file +} From 9472bd7dcef7db405ebf02a3cfa87e180054b9fe Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 26 Sep 2019 14:22:17 +0100 Subject: [PATCH 025/233] Change HID usage from Play On-Off Control (OOC) to Voice Command One-Shot Control (OSC). OSC requires relative data. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index bd95078e..e6c56aa9 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -555,10 +555,10 @@ unsigned char hidReportDescriptor[] = 0xa1, 0x01, /* Collection (Application) */ 0x15, 0x00, /* Logical Minimum (0) */ 0x25, 0x01, /* Logical Maximum (1) */ - 0x09, 0xb0, /* Usage (Play) */ + 0x09, 0xcf, /* Usage (Voice Command), use 0xcd for (Play/Pause OSC) */ 0x75, 0x01, /* Report Size (1) */ 0x95, 0x01, /* Report Count (1) */ - 0x81, 0x02, /* Input (Data, Var, Abs) */ + 0x81, 0x06, /* Input (Data, Var, Rel) */ 0x95, 0x07, /* Report Count (7) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0 /* End collection */ From ba666fb314e96c8655688ca6925fbdf6f30597c7 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 26 Sep 2019 14:27:20 +0100 Subject: [PATCH 026/233] Add a 100 ms assertion period when this demonstration code signals an NDP100 interrupt. When testing with the Play/Pause Usage (0xCD) with a Mac as USB Host, adding in this assertion period produced reliable playing and pausing of the iTunes app every 10 seconds. Without an explicit assertion period, i.e. sending only one report with the lsb set to 1b followed by many reports with the lsb set to 0b, the iTunes app behaved as though it did not see many of the Play/Pause signals. The inclusion of an assertion period may or may not help when reporting Voice Command events on Andriod. --- lib_xua/src/core/user/user_hid.xc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index d27d6914..4319bf43 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -4,6 +4,7 @@ #include #include "user_hid.h" +#define HID_DEASSERT_COUNT 10000000 #define HID_INTERRUPT_COUNT 1000000000 #define HID_REPORT_DATA 0x01 @@ -24,16 +25,18 @@ void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) tmr :> curr_time; tick_count += ( last_time < curr_time ) ? curr_time - last_time : curr_time + ( UINT_MAX - last_time ); - if( HID_INTERRUPT_COUNT <= tick_count ) { + if(( HID_INTERRUPT_COUNT <= tick_count ) && ( tick_count <= ( HID_INTERRUPT_COUNT + HID_DEASSERT_COUNT ))) { for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { hidData[ idx ] = HID_REPORT_DATA; } - - tick_count = 0; } else { for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { hidData[ idx ] = 0x00; - } + } + + if (( HID_INTERRUPT_COUNT + HID_DEASSERT_COUNT ) <= tick_count ) { + tick_count = 0; + } } last_time = curr_time; From 37bbea3726e4bebc2a0ebdb9ef5cd269593cbf9b Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 26 Sep 2019 14:45:17 +0100 Subject: [PATCH 027/233] Use a consistent method to interpret the HID_CONTROLS pre-processor symbol throughout the code base. --- lib_xua/api/xua_buffer.h | 4 ++-- lib_xua/api/xua_conf_default.h | 6 +----- lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/buffer/ep/ep_buffer.xc | 14 +++++++------- lib_xua/src/core/endpoint0/descriptor_defs.h | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 6 +++--- lib_xua/src/core/main.xc | 4 ++-- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index eaaef881..93ca3219 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -58,7 +58,7 @@ void XUA_Buffer( chanend c_sof, chanend c_aud_ctl, in port p_off_mclk -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , chanend c_hid #endif , chanend c_aud @@ -97,7 +97,7 @@ void XUA_Buffer_Ep(chanend c_aud_out, chanend c_sof, chanend c_aud_ctl, in port p_off_mclk -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , chanend c_hid #endif #ifdef CHAN_BUFF_CTRL diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 677fad9e..5e311e9f 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -425,10 +425,6 @@ #define HID_CONTROLS (0) #endif -#if defined(HID_CONTROLS) && (HID_CONTROLS == 0) -#undef HID_CONTROLS -#endif - /* @brief Defines whether XMOS device runs as master (i.e. drives LR and Bit clocks) * * 0: XMOS is I2S master. 1: CODEC is I2s master. @@ -1177,7 +1173,7 @@ enum USBEndpointNumber_In #ifdef MIDI ENDPOINT_NUMBER_IN_MIDI, #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) ENDPOINT_NUMBER_IN_HID, #endif #ifdef IAP diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index e503ab71..8e291aef 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -12,7 +12,7 @@ #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) #include "user_hid.h" #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index b9c01d6b..5916da17 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -19,7 +19,7 @@ #include "xud.h" #include "testct_byref.h" -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) #include "user_hid.h" unsigned char g_hidData[1] = {0}; #endif @@ -120,7 +120,7 @@ void XUA_Buffer( chanend c_sof, chanend c_aud_ctl, in port p_off_mclk -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , chanend c_hid #endif , chanend c_aud @@ -164,7 +164,7 @@ void XUA_Buffer( c_clk_int, #endif c_sof, c_aud_ctl, p_off_mclk -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , c_hid #endif #ifdef CHAN_BUFF_CTRL @@ -223,7 +223,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, chanend c_sof, chanend c_aud_ctl, in port p_off_mclk -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , chanend c_hid #endif #ifdef CHAN_BUFF_CTRL @@ -260,7 +260,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, XUD_ep ep_int = XUD_InitEp(c_ep_int); #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) XUD_ep ep_hid = XUD_InitEp(c_hid); #endif unsigned u_tmp; @@ -364,7 +364,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) XUD_SetReady_In(ep_hid, g_hidData, 1); #endif @@ -875,7 +875,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) /* HID Report Data */ case XUD_SetData_Select(c_hid, ep_hid, result): { diff --git a/lib_xua/src/core/endpoint0/descriptor_defs.h b/lib_xua/src/core/endpoint0/descriptor_defs.h index 1985d910..b348d6f1 100644 --- a/lib_xua/src/core/endpoint0/descriptor_defs.h +++ b/lib_xua/src/core/endpoint0/descriptor_defs.h @@ -54,7 +54,7 @@ enum USBInterfaceNumber INTERFACE_NUMBER_IAP_EA_NATIVE_TRANS, #endif #endif -#if defined(HID_CONTROLS) && (HID_CONTROLS != 0) +#if( 0 < HID_CONTROLS ) INTERFACE_NUMBER_HID, #endif INTERFACE_COUNT /* End marker */ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 11833693..b5d1d8b7 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -21,7 +21,7 @@ #include "vendorrequests.h" #include "xc_ptr.h" #include "xua_ep0_uacreqs.h" -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) #include "hid.h" #endif #if DSD_CHANS_DAC > 0 @@ -492,7 +492,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 switch(sp.bRequest) { -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) case USB_GET_DESCRIPTOR: /* Check what inteface request is for */ @@ -871,7 +871,7 @@ void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend switch(sp.bRequest) { -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) case USB_GET_DESCRIPTOR: /* Check what inteface request is for */ diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index cb9d8af7..5a7aace0 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -259,7 +259,7 @@ XUD_EpType epTypeTableIn[ENDPOINT_COUNT_IN] = { XUD_EPTYPE_CTL | XUD_STATUS_ENAB #ifdef MIDI XUD_EPTYPE_BUL, #endif -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) XUD_EPTYPE_INT, #endif #ifdef IAP @@ -400,7 +400,7 @@ VENDOR_REQUESTS_PARAMS_DEC_ c_clk_int, #endif c_sof, c_aud_ctl, p_for_mclk_count -#ifdef HID_CONTROLS +#if( 0 < HID_CONTROLS ) , c_xud_in[ENDPOINT_NUMBER_IN_HID] #endif #ifdef CHAN_BUFF_CTRL From b68c192ad9f49257aa41f69764b1754be1b89e4d Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 26 Sep 2019 16:29:53 +0100 Subject: [PATCH 028/233] Updated change log --- CHANGELOG.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a5b83a91..35c363bc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +0.2.0_demo +---------- + * ADDED: UAC1 HID support with simulated Voice Command detection reported + every 10 seconds + 0.2.0 ----- From d7be8419d8b213798768f986402b4df2bd75ea81 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 30 Sep 2019 13:52:22 +0100 Subject: [PATCH 029/233] Add a 1b port for receiving the NDP10x interrupt. --- lib_xua/api/xua_buffer.h | 2 ++ lib_xua/src/core/buffer/ep/ep_buffer.xc | 5 ++++- lib_xua/src/core/user/user_hid.h | 2 +- lib_xua/src/core/user/user_hid.xc | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index 93ca3219..5e7f65e4 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -60,6 +60,7 @@ void XUA_Buffer( in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid + , in port p_int #endif , chanend c_aud ); @@ -99,6 +100,7 @@ void XUA_Buffer_Ep(chanend c_aud_out, in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid + , in port p_int #endif #ifdef CHAN_BUFF_CTRL , chanend c_buff_ctrl diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 5916da17..b3c28856 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -122,6 +122,7 @@ void XUA_Buffer( in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid + , in port p_int #endif , chanend c_aud ) @@ -166,6 +167,7 @@ void XUA_Buffer( c_sof, c_aud_ctl, p_off_mclk #if( 0 < HID_CONTROLS ) , c_hid + , p_int #endif #ifdef CHAN_BUFF_CTRL , c_buff_ctrl @@ -225,6 +227,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid + , in port p_int #endif #ifdef CHAN_BUFF_CTRL , chanend c_buff_ctrl @@ -880,7 +883,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDData(g_hidData); + UserReadHIDData(p_int, g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index 6620c7dd..736ab13a 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -11,5 +11,5 @@ #define HID_DATA_SIZE 1 -void UserReadHIDData(unsigned char hidData[HID_DATA_SIZE]); +void UserReadHIDData(in port p_int, unsigned char hidData[HID_DATA_SIZE]); diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 4319bf43..1306a892 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -14,7 +14,7 @@ static unsigned int curr_time = 0; static unsigned int last_time = 0; static unsigned int tick_count = 0; -void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) +void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) { timer tmr; From 660b483d1e129f6e8c587aebe35dd2f9127250bc Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 30 Sep 2019 16:12:16 +0100 Subject: [PATCH 030/233] Clean up whitespace, no functional change. --- lib_xua/src/core/user/user_hid.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index 736ab13a..9c135744 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -2,12 +2,12 @@ /* These defines relate to the HID report desc - do not mod */ -#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 -#define HID_CONTROL_NEXT_SHIFT 0x01 -#define HID_CONTROL_PREV_SHIFT 0x02 -#define HID_CONTROL_VOLUP_SHIFT 0x03 -#define HID_CONTROL_VOLDN_SHIFT 0x04 -#define HID_CONTROL_MUTE_SHIFT 0x05 +#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 +#define HID_CONTROL_NEXT_SHIFT 0x01 +#define HID_CONTROL_PREV_SHIFT 0x02 +#define HID_CONTROL_VOLUP_SHIFT 0x03 +#define HID_CONTROL_VOLDN_SHIFT 0x04 +#define HID_CONTROL_MUTE_SHIFT 0x05 #define HID_DATA_SIZE 1 From e1b72c47bcb43b608bd1914b95783695f9c46755 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 30 Sep 2019 16:14:16 +0100 Subject: [PATCH 031/233] Add a version of UserReadHIDData() which uses a signal on a port to set the Voice Command bit in the HID Report data. This commit preserves the ability to simulate the NDP100 entirely, i.e. without using a port for input. --- lib_xua/src/core/user/user_hid.h | 29 +++++++++++++++++++++++++++++ lib_xua/src/core/user/user_hid.xc | 24 ++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index 9c135744..edf4ebda 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -11,5 +11,34 @@ #define HID_DATA_SIZE 1 +#ifndef HID_SIMULATE_INTERRUPTS +#define HID_SIMULATE_INTERRUPTS 0 +#endif + +#ifndef HID_SIMULATE_NDP10X +#define HID_SIMULATE_NDP10X 0 +#endif + +#ifndef NDP_ASSERT_HIGH +#define NDP_ASSERT_HIGH 0 +#endif + +#if( 0 < HID_CONTROLS ) + +#if( 0 < NDP_ASSERT_HIGH ) +#define NDP100_ASSERT_LEVEL 1 +#define NDP100_DEASSERT_LEVEL 0 +#else +#define NDP100_ASSERT_LEVEL 0 +#define NDP100_DEASSERT_LEVEL 1 +#endif + +#if(( 0 < HID_SIMULATE_INTERRUPTS ) || ( 0 < HID_SIMULATE_NDP10X )) +#define HID_DEASSERT_COUNT 10000000 +#define HID_INTERRUPT_COUNT 1000000000 +#endif + +#endif /* ( 0 < HID_CONTROLS ) */ + void UserReadHIDData(in port p_int, unsigned char hidData[HID_DATA_SIZE]); diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 1306a892..79d4cb76 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -4,8 +4,9 @@ #include #include "user_hid.h" -#define HID_DEASSERT_COUNT 10000000 -#define HID_INTERRUPT_COUNT 1000000000 +#if( 0 < HID_CONTROLS ) +#if( 0 < HID_SIMULATE_NDP10X ) + #define HID_REPORT_DATA 0x01 static unsigned char initialised = 0; @@ -42,3 +43,22 @@ void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) last_time = curr_time; } } +#else /* ( 0 < HID_SIMULATE_NDP10X ) */ + +#define HID_REPORT_INTERRUPT_ASSERTED 0x01 +#define HID_REPORT_INTERRUPT_DEASSERTED 0x00 + +void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) +{ + unsigned curr_val; + + p_int :> curr_val; + hidData[ 0 ] = ( curr_val == NDP100_ASSERT_LEVEL ) ? HID_REPORT_INTERRUPT_ASSERTED : HID_REPORT_INTERRUPT_DEASSERTED; + + for( unsigned idx = 1; idx < HID_DATA_SIZE; ++idx ) { + hidData[ idx ] = 0U; + } +} + +#endif /* ( 0 < HID_SIMULATE_NDP10X ) */ +#endif /* ( 0 < HID_CONTROLS ) */ From d32235d0f03901167605ee7c118b7737af500fef Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 1 Oct 2019 11:57:54 +0100 Subject: [PATCH 032/233] Final clean-up of HID -- NDP10x Interrupt integration. --- lib_xua/src/core/user/user_hid.h | 20 ++++++-------- lib_xua/src/core/user/user_hid.xc | 43 +------------------------------ 2 files changed, 9 insertions(+), 54 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index edf4ebda..ca0fcf93 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -15,25 +15,21 @@ #define HID_SIMULATE_INTERRUPTS 0 #endif -#ifndef HID_SIMULATE_NDP10X -#define HID_SIMULATE_NDP10X 0 -#endif - -#ifndef NDP_ASSERT_HIGH -#define NDP_ASSERT_HIGH 0 +#ifndef NDP_ASSERT_LEVEL +#define NDP_ASSERT_LEVEL 0 #endif #if( 0 < HID_CONTROLS ) -#if( 0 < NDP_ASSERT_HIGH ) -#define NDP100_ASSERT_LEVEL 1 -#define NDP100_DEASSERT_LEVEL 0 +#if( 0 < NDP_ASSERT_LEVEL ) +#define NDP10X_ASSERT_LEVEL 1 +#define NDP10X_DEASSERT_LEVEL 0 #else -#define NDP100_ASSERT_LEVEL 0 -#define NDP100_DEASSERT_LEVEL 1 +#define NDP10X_ASSERT_LEVEL 0 +#define NDP10X_DEASSERT_LEVEL 1 #endif -#if(( 0 < HID_SIMULATE_INTERRUPTS ) || ( 0 < HID_SIMULATE_NDP10X )) +#if( 0 < HID_SIMULATE_INTERRUPTS ) #define HID_DEASSERT_COUNT 10000000 #define HID_INTERRUPT_COUNT 1000000000 #endif diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 79d4cb76..d10960cf 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -5,46 +5,6 @@ #include "user_hid.h" #if( 0 < HID_CONTROLS ) -#if( 0 < HID_SIMULATE_NDP10X ) - -#define HID_REPORT_DATA 0x01 - -static unsigned char initialised = 0; - -static unsigned int curr_time = 0; -static unsigned int last_time = 0; -static unsigned int tick_count = 0; - -void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) -{ - timer tmr; - - if( !initialised ) { - tmr :> last_time; - initialised = 1; - } else { - tmr :> curr_time; - tick_count += ( last_time < curr_time ) ? curr_time - last_time : curr_time + ( UINT_MAX - last_time ); - - if(( HID_INTERRUPT_COUNT <= tick_count ) && ( tick_count <= ( HID_INTERRUPT_COUNT + HID_DEASSERT_COUNT ))) { - for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { - hidData[ idx ] = HID_REPORT_DATA; - } - } else { - for( unsigned idx = 0; idx < HID_DATA_SIZE; ++idx ) { - hidData[ idx ] = 0x00; - } - - if (( HID_INTERRUPT_COUNT + HID_DEASSERT_COUNT ) <= tick_count ) { - tick_count = 0; - } - } - - last_time = curr_time; - } -} -#else /* ( 0 < HID_SIMULATE_NDP10X ) */ - #define HID_REPORT_INTERRUPT_ASSERTED 0x01 #define HID_REPORT_INTERRUPT_DEASSERTED 0x00 @@ -53,12 +13,11 @@ void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) unsigned curr_val; p_int :> curr_val; - hidData[ 0 ] = ( curr_val == NDP100_ASSERT_LEVEL ) ? HID_REPORT_INTERRUPT_ASSERTED : HID_REPORT_INTERRUPT_DEASSERTED; + hidData[ 0 ] = ( curr_val == NDP10X_ASSERT_LEVEL ) ? HID_REPORT_INTERRUPT_ASSERTED : HID_REPORT_INTERRUPT_DEASSERTED; for( unsigned idx = 1; idx < HID_DATA_SIZE; ++idx ) { hidData[ idx ] = 0U; } } -#endif /* ( 0 < HID_SIMULATE_NDP10X ) */ #endif /* ( 0 < HID_CONTROLS ) */ From 2fb0bdfcc22494b558b52b4e24732d5924134fb6 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 1 Oct 2019 13:52:08 +0100 Subject: [PATCH 033/233] A slightly different way of saying the same thing. I've changed to an if - else construct to make it easy to add in debugging print statements if needed. --- lib_xua/src/core/user/user_hid.xc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index d10960cf..2c907f16 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -13,7 +13,12 @@ void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) unsigned curr_val; p_int :> curr_val; - hidData[ 0 ] = ( curr_val == NDP10X_ASSERT_LEVEL ) ? HID_REPORT_INTERRUPT_ASSERTED : HID_REPORT_INTERRUPT_DEASSERTED; + + if( curr_val == NDP10X_ASSERT_LEVEL ) { + hidData[ 0 ] = HID_REPORT_INTERRUPT_ASSERTED; + } else { + hidData[ 0 ] = HID_REPORT_INTERRUPT_DEASSERTED; + } for( unsigned idx = 1; idx < HID_DATA_SIZE; ++idx ) { hidData[ idx ] = 0U; From 17317093d588625733c695d298c54ab144215e8a Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 1 Oct 2019 17:04:13 +0100 Subject: [PATCH 034/233] Rework HID data processing. Move port handling up into XUA_Buffer_lite2() to take advantage of its select operator. Add functions to initialise and set the HID data. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/user_hid.h | 9 +++++---- lib_xua/src/core/user/user_hid.xc | 26 ++++++++++++++++--------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index b3c28856..53244092 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -883,7 +883,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDData(p_int, g_hidData); + UserReadHIDData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index ca0fcf93..24699c14 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -30,11 +30,12 @@ #endif #if( 0 < HID_SIMULATE_INTERRUPTS ) -#define HID_DEASSERT_COUNT 10000000 +#define HID_DEASSERT_COUNT 10000 #define HID_INTERRUPT_COUNT 1000000000 #endif +void UserInitHIDData(void); +void UserReadHIDData(unsigned char hidData[ HID_DATA_SIZE ]); +void UserSetHIDData(const unsigned hidData); + #endif /* ( 0 < HID_CONTROLS ) */ - -void UserReadHIDData(in port p_int, unsigned char hidData[HID_DATA_SIZE]); - diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index 2c907f16..dfba7fed 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -8,20 +8,28 @@ #define HID_REPORT_INTERRUPT_ASSERTED 0x01 #define HID_REPORT_INTERRUPT_DEASSERTED 0x00 -void UserReadHIDData( in port p_int, unsigned char hidData[ HID_DATA_SIZE ]) +static unsigned char s_hidData; + +void UserInitHIDData( void ) { - unsigned curr_val; + s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; +} - p_int :> curr_val; +void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) +{ + hidData[ 0 ] = s_hidData; - if( curr_val == NDP10X_ASSERT_LEVEL ) { - hidData[ 0 ] = HID_REPORT_INTERRUPT_ASSERTED; - } else { - hidData[ 0 ] = HID_REPORT_INTERRUPT_DEASSERTED; + for( unsigned i = 1; i < HID_DATA_SIZE; ++i ) { + hidData[ i ] = 0U; } +} - for( unsigned idx = 1; idx < HID_DATA_SIZE; ++idx ) { - hidData[ idx ] = 0U; +void UserSetHIDData( const unsigned hidData ) +{ + if( hidData == NDP10X_ASSERT_LEVEL ) { + s_hidData = HID_REPORT_INTERRUPT_ASSERTED; + } else { + s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; } } From 0440020c2f2de5cf693e5cf5afead62e17b521c3 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 2 Oct 2019 15:24:28 +0100 Subject: [PATCH 035/233] Change pre-processor symbol names to make them generic. --- lib_xua/src/core/user/user_hid.h | 12 ++++++------ lib_xua/src/core/user/user_hid.xc | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index 24699c14..afcbb2e9 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -15,18 +15,18 @@ #define HID_SIMULATE_INTERRUPTS 0 #endif -#ifndef NDP_ASSERT_LEVEL -#define NDP_ASSERT_LEVEL 0 +#ifndef INTERRUPT_ASSERT_LEVEL +#define INTERRUPT_ASSERT_LEVEL 0 #endif #if( 0 < HID_CONTROLS ) #if( 0 < NDP_ASSERT_LEVEL ) -#define NDP10X_ASSERT_LEVEL 1 -#define NDP10X_DEASSERT_LEVEL 0 +#define INT_ASSERT_LEVEL 1 +#define INT_DEASSERT_LEVEL 0 #else -#define NDP10X_ASSERT_LEVEL 0 -#define NDP10X_DEASSERT_LEVEL 1 +#define INT_ASSERT_LEVEL 0 +#define INT_DEASSERT_LEVEL 1 #endif #if( 0 < HID_SIMULATE_INTERRUPTS ) diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc index dfba7fed..75cb8df6 100644 --- a/lib_xua/src/core/user/user_hid.xc +++ b/lib_xua/src/core/user/user_hid.xc @@ -26,7 +26,7 @@ void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) void UserSetHIDData( const unsigned hidData ) { - if( hidData == NDP10X_ASSERT_LEVEL ) { + if( hidData == INT_ASSERT_LEVEL ) { s_hidData = HID_REPORT_INTERRUPT_ASSERTED; } else { s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; From ce24c73dc0b85a35e84c45aa960e339c59d0936f Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 2 Oct 2019 16:51:46 +0100 Subject: [PATCH 036/233] Change pre-processor symbol names to make them generic. --- lib_xua/src/core/user/user_hid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index afcbb2e9..f0894d65 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) -#if( 0 < NDP_ASSERT_LEVEL ) +#if( 0 < INTERRUPT_ASSERT_LEVEL ) #define INT_ASSERT_LEVEL 1 #define INT_DEASSERT_LEVEL 0 #else From e7e8b58275f37337e01b31655c4a94fc4d79ac67 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 2 Oct 2019 16:54:38 +0100 Subject: [PATCH 037/233] Move user_hid.xc from lib_xua to the application (sw_xvf3510). --- lib_xua/src/core/user/user_hid.xc | 36 ------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 lib_xua/src/core/user/user_hid.xc diff --git a/lib_xua/src/core/user/user_hid.xc b/lib_xua/src/core/user/user_hid.xc deleted file mode 100644 index 75cb8df6..00000000 --- a/lib_xua/src/core/user/user_hid.xc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2019, XMOS Ltd, All rights reserved -#include -#include -#include -#include "user_hid.h" - -#if( 0 < HID_CONTROLS ) -#define HID_REPORT_INTERRUPT_ASSERTED 0x01 -#define HID_REPORT_INTERRUPT_DEASSERTED 0x00 - -static unsigned char s_hidData; - -void UserInitHIDData( void ) -{ - s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; -} - -void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]) -{ - hidData[ 0 ] = s_hidData; - - for( unsigned i = 1; i < HID_DATA_SIZE; ++i ) { - hidData[ i ] = 0U; - } -} - -void UserSetHIDData( const unsigned hidData ) -{ - if( hidData == INT_ASSERT_LEVEL ) { - s_hidData = HID_REPORT_INTERRUPT_ASSERTED; - } else { - s_hidData = HID_REPORT_INTERRUPT_DEASSERTED; - } -} - -#endif /* ( 0 < HID_CONTROLS ) */ From 74564edde86f186858f5f2d1633183d277d0b075 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 2 Oct 2019 16:55:42 +0100 Subject: [PATCH 038/233] Add HID trigger function. --- lib_xua/src/core/user/user_hid.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index f0894d65..687b2445 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -34,8 +34,9 @@ #define HID_INTERRUPT_COUNT 1000000000 #endif -void UserInitHIDData(void); -void UserReadHIDData(unsigned char hidData[ HID_DATA_SIZE ]); -void UserSetHIDData(const unsigned hidData); +select UserHIDTrigger( unsigned* hidValueLatched ); +void UserInitHIDData( void ); +void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); +void UserSetHIDData( const unsigned hidData ); #endif /* ( 0 < HID_CONTROLS ) */ From 211a49f26fcbcf9c472ff35334fe85b043cca7f8 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 2 Oct 2019 16:57:42 +0100 Subject: [PATCH 039/233] Remove unnecessary port parameters passed through XUA Buffer (whether the traditional one or the Lite version). --- lib_xua/api/xua_buffer.h | 2 -- lib_xua/src/core/buffer/ep/ep_buffer.xc | 3 --- 2 files changed, 5 deletions(-) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index 5e7f65e4..93ca3219 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -60,7 +60,6 @@ void XUA_Buffer( in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid - , in port p_int #endif , chanend c_aud ); @@ -100,7 +99,6 @@ void XUA_Buffer_Ep(chanend c_aud_out, in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid - , in port p_int #endif #ifdef CHAN_BUFF_CTRL , chanend c_buff_ctrl diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 53244092..5916da17 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -122,7 +122,6 @@ void XUA_Buffer( in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid - , in port p_int #endif , chanend c_aud ) @@ -167,7 +166,6 @@ void XUA_Buffer( c_sof, c_aud_ctl, p_off_mclk #if( 0 < HID_CONTROLS ) , c_hid - , p_int #endif #ifdef CHAN_BUFF_CTRL , c_buff_ctrl @@ -227,7 +225,6 @@ void XUA_Buffer_Ep(register chanend c_aud_out, in port p_off_mclk #if( 0 < HID_CONTROLS ) , chanend c_hid - , in port p_int #endif #ifdef CHAN_BUFF_CTRL , chanend c_buff_ctrl From 5b87efb5a770a4122d61a24f1f3b2b769b0d49b9 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 7 Oct 2019 12:35:23 +0100 Subject: [PATCH 040/233] Change the HID Report Descriptor to use the AC Search Usage instead of Voice Command. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index e6c56aa9..976daff8 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -548,6 +548,7 @@ unsigned char devQualDesc_Null[] = #if( 0 < HID_CONTROLS ) +#if 0 unsigned char hidReportDescriptor[] = { 0x05, 0x0c, /* Usage Page (Consumer Device) */ @@ -563,6 +564,26 @@ unsigned char hidReportDescriptor[] = 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0 /* End collection */ }; +#else +unsigned char hidReportDescriptor[] = +{ + 0x15, 0x01, /* Logical Minimum (1) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x75, 0x01, /* Report Size (1) */ + 0x05, 0x0c, /* Usage Page (Consumer Device) */ + 0x09, 0x01, /* Usage (Consumer Control) */ + 0xa1, 0x01, /* Collection (Application) */ + 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ + 0xa1, 0x02, /* Collection (Logical) */ + 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x95, 0x01, /* Report Count (1) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ + 0x95, 0x07, /* Report Count (7) */ + 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ + 0xc0, /* End collection (Logical) */ + 0xc0 /* End collection (Application) */ +}; +#endif #endif /* Max packet sizes: @@ -2850,7 +2871,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x17, /* 7 wDescriptorLength[0] */ + 0x1E, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 34ebbc8509a4f4ae0ef8d167bf34e3f5d0814130 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 7 Oct 2019 12:35:23 +0100 Subject: [PATCH 041/233] Change the HID Report Descriptor to use the AC Search Usage instead of Voice Command. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index e6c56aa9..cf50c8eb 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -548,7 +548,8 @@ unsigned char devQualDesc_Null[] = #if( 0 < HID_CONTROLS ) -unsigned char hidReportDescriptor[] = +#if 0 +unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */ { 0x05, 0x0c, /* Usage Page (Consumer Device) */ 0x09, 0x01, /* Usage (Consumer Control) */ @@ -563,6 +564,26 @@ unsigned char hidReportDescriptor[] = 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0 /* End collection */ }; +#else +unsigned char hidReportDescriptor[] = /* GUI AC Search usage */ +{ + 0x15, 0x01, /* Logical Minimum (1) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x75, 0x01, /* Report Size (1) */ + 0x05, 0x0c, /* Usage Page (Consumer Device) */ + 0x09, 0x01, /* Usage (Consumer Control) */ + 0xa1, 0x01, /* Collection (Application) */ + 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ + 0xa1, 0x02, /* Collection (Logical) */ + 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x95, 0x01, /* Report Count (1) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ + 0x95, 0x07, /* Report Count (7) */ + 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ + 0xc0, /* End collection (Logical) */ + 0xc0 /* End collection (Application) */ +}; +#endif #endif /* Max packet sizes: @@ -2850,7 +2871,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x17, /* 7 wDescriptorLength[0] */ + 0x1E, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 75fea9ed84c5726f9a27b1ffccf5ecc929395a46 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 8 Oct 2019 13:44:04 +0100 Subject: [PATCH 042/233] Change the simulated interrupt pulse width from 100 us to 100 ms. --- lib_xua/src/core/user/user_hid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/user_hid.h index 687b2445..5688c7c6 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/user_hid.h @@ -30,7 +30,7 @@ #endif #if( 0 < HID_SIMULATE_INTERRUPTS ) -#define HID_DEASSERT_COUNT 10000 +#define HID_DEASSERT_COUNT 10000000 #define HID_INTERRUPT_COUNT 1000000000 #endif From 1690c4eff6adbbccdacb7819081d1087e3d9e684 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 8 Oct 2019 13:45:20 +0100 Subject: [PATCH 043/233] Remove the USB HID Report descriptor with the Voice Command Usage. This commit also contains a small amount of whitespace clean-up. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 976daff8..97685679 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -546,25 +546,7 @@ unsigned char devQualDesc_Null[] = #define MIXER_LENGTH (0) #endif - #if( 0 < HID_CONTROLS ) -#if 0 -unsigned char hidReportDescriptor[] = -{ - 0x05, 0x0c, /* Usage Page (Consumer Device) */ - 0x09, 0x01, /* Usage (Consumer Control) */ - 0xa1, 0x01, /* Collection (Application) */ - 0x15, 0x00, /* Logical Minimum (0) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x09, 0xcf, /* Usage (Voice Command), use 0xcd for (Play/Pause OSC) */ - 0x75, 0x01, /* Report Size (1) */ - 0x95, 0x01, /* Report Count (1) */ - 0x81, 0x06, /* Input (Data, Var, Rel) */ - 0x95, 0x07, /* Report Count (7) */ - 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ - 0xc0 /* End collection */ -}; -#else unsigned char hidReportDescriptor[] = { 0x15, 0x01, /* Logical Minimum (1) */ @@ -575,7 +557,7 @@ unsigned char hidReportDescriptor[] = 0xa1, 0x01, /* Collection (Application) */ 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ 0xa1, 0x02, /* Collection (Logical) */ - 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x0a, 0x21, 0x02, /* Usage (AC Search) */ 0x95, 0x01, /* Report Count (1) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x07, /* Report Count (7) */ @@ -584,7 +566,6 @@ unsigned char hidReportDescriptor[] = 0xc0 /* End collection (Application) */ }; #endif -#endif /* Max packet sizes: * Samples per channel. e.g (192000+7999/8000) = 24 From 2a960700c5607a3c605ce1d144889a0ac57d1a5b Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 8 Oct 2019 13:54:16 +0100 Subject: [PATCH 044/233] Remove the duplicate USB HID Report Descriptor that Git, for some unknown reason, produced at the last merge. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 8bd24bb0..0c2c3eb5 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -547,7 +547,6 @@ unsigned char devQualDesc_Null[] = #endif #if( 0 < HID_CONTROLS ) -#if 0 unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */ { 0x15, 0x01, /* Logical Minimum (1) */ @@ -566,26 +565,6 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xc0, /* End collection (Logical) */ 0xc0 /* End collection (Application) */ }; -#else -unsigned char hidReportDescriptor[] = /* GUI AC Search usage */ -{ - 0x15, 0x01, /* Logical Minimum (1) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x75, 0x01, /* Report Size (1) */ - 0x05, 0x0c, /* Usage Page (Consumer Device) */ - 0x09, 0x01, /* Usage (Consumer Control) */ - 0xa1, 0x01, /* Collection (Application) */ - 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ - 0xa1, 0x02, /* Collection (Logical) */ - 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x95, 0x01, /* Report Count (1) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x95, 0x07, /* Report Count (7) */ - 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ - 0xc0, /* End collection (Logical) */ - 0xc0 /* End collection (Application) */ -}; -#endif #endif /* Max packet sizes: From b592c943f8e4a7f7c881ffd0aaa8f05f5d082765 Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Tue, 8 Oct 2019 21:16:33 +0100 Subject: [PATCH 045/233] Set_Idle request handled (incomplete reports sent instead of NAK) --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 12 +++++++++- lib_xua/src/hid/hid.xc | 26 ++++++++++++++++++++++ lib_xua/src/hid/xua_hid.h | 9 ++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 lib_xua/src/hid/hid.xc create mode 100644 lib_xua/src/hid/xua_hid.h diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index b5d1d8b7..c59886c6 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -60,6 +60,10 @@ extern void device_reboot(void); #endif +#if HID_CONTROLS +#include "xua_hid.h" +#endif + unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active /* Global volume and mute tables */ @@ -321,7 +325,6 @@ void XUA_Endpoint0_lite_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audi DFU_mode_active = 1; } #endif - } void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, @@ -989,12 +992,19 @@ void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend device_reboot(); } } +#endif +#if HID_CONTROLS + if (interfaceNum == INTERFACE_NUMBER_HID) + { + result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp); + } #endif /* 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) */ if(((interfaceNum == 0) || (interfaceNum == 1) || (interfaceNum == 2)) + && result == XUD_RES_ERR #if (XUA_DFU_EN == 1) && !DFU_mode_active #endif diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc new file mode 100644 index 00000000..d7cda428 --- /dev/null +++ b/lib_xua/src/hid/hid.xc @@ -0,0 +1,26 @@ +#include +#include "xud.h" +#include "hid.h" +#include "xud_std_requests.h" +#include "xua_hid.h" + +static unsigned hidSetIdle = 0; + +unsigned HidIsSetIdleSilenced(void) +{ + return hidSetIdle; +} + +XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, + USB_SetupPacket_t &sp) +{ + switch (sp.bRequest) { + case HID_SET_IDLE: + printstrln("HID_SET_IDLE\n"); + hidSetIdle = 1; // TODO implement duration + return XUD_DoSetRequestStatus(c_ep0_in); + default: + break; + } + return XUD_RES_ERR; +} diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h new file mode 100644 index 00000000..df89dc55 --- /dev/null +++ b/lib_xua/src/hid/xua_hid.h @@ -0,0 +1,9 @@ +#include +#include +#include "xud.h" +#include "xud_std_requests.h" + +XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, + REFERENCE_PARAM(USB_SetupPacket_t, sp)); + +unsigned HidIsSetIdleSilenced(void); From 8ba9a0064cb6d00d4e7fd74469b5329f84050cdb Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Wed, 9 Oct 2019 16:45:50 +0100 Subject: [PATCH 046/233] Cosmetic --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index d7cda428..fd7cb32b 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -16,7 +16,7 @@ XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, { switch (sp.bRequest) { case HID_SET_IDLE: - printstrln("HID_SET_IDLE\n"); + printstr("HID_SET_IDLE\n"); hidSetIdle = 1; // TODO implement duration return XUD_DoSetRequestStatus(c_ep0_in); default: From 1808d7affac01baa37e203cd7d32aeb0607b3238 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 10 Oct 2019 17:21:21 +0100 Subject: [PATCH 047/233] Initial implementation of the USB HID Set_Idle Request. This code builds successfully. It has not been tested even a little. --- lib_xua/src/core/endpoint0/descriptor_defs.h | 4 + .../src/core/endpoint0/xua_ep0_descriptors.h | 4 +- lib_xua/src/hid/hid.xc | 196 ++++++++++++++++-- lib_xua/src/hid/xua_hid.h | 12 +- 4 files changed, 196 insertions(+), 20 deletions(-) diff --git a/lib_xua/src/core/endpoint0/descriptor_defs.h b/lib_xua/src/core/endpoint0/descriptor_defs.h index b348d6f1..53ba28ed 100644 --- a/lib_xua/src/core/endpoint0/descriptor_defs.h +++ b/lib_xua/src/core/endpoint0/descriptor_defs.h @@ -60,4 +60,8 @@ enum USBInterfaceNumber INTERFACE_COUNT /* End marker */ }; +#if( 0 < HID_CONTROLS ) +#define ENDPOINT_INT_INTERVAL_IN_HID 0x08 +#endif + #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 0c2c3eb5..066319f4 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2184,7 +2184,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= ENDPOINT_ADDRESS_IN_HID, /* 2 bEndpointAddress */ 3, /* 3 bmAttributes (INTERRUPT) */ 64, /* 4 wMaxPacketSize */ - 8, /* 6 bInterval */ + ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */ } #endif @@ -2862,7 +2862,7 @@ unsigned char cfgDesc_Audio1[] = 0x03, /* 3 bmAttributes (INTERRUPT) */ 0x40, /* 4 wMaxPacketSize */ 0x00, /* 5 wMaxPacketSize */ - 0x08, /* 6 bInterval */ + ENDPOINT_INT_INTERVAL_IN_HID, /* 6 bInterval */ #endif }; diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index fd7cb32b..1e92e283 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,26 +1,192 @@ #include -#include "xud.h" +#include "descriptor_defs.h" #include "hid.h" +#include "xud.h" #include "xud_std_requests.h" #include "xua_hid.h" -static unsigned hidSetIdle = 0; +#define MS_IN_TICKS 100000U -unsigned HidIsSetIdleSilenced(void) +static unsigned s_hidIdleActive = 0; +static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; +static unsigned s_hidNextReportTime = 0; +static unsigned s_hidReportTime = 0; + +/** + * \brief Calculate the difference between two points in time + * + * This function calculates the difference between two two points in time. + * It always returns a positive value even if the timer used to obtain the two + * time measurements has wrapped around. + * + * \warning If time values have been obtained from a timer that has wrapped + * more than once in between the two measurements, this function returns an + * incorrect value. + * + * \param[in] earlierTime -- A value from a timer + * \param[in] laterTime -- A value from a timer taken after \a earlierTime + * + * \return The interval between the two points in time + */ +static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ) { - return hidSetIdle; + return ( earlierTime < laterTime ) ? laterTime - earlierTime : UINT_MAX - earlierTime + laterTime; } -XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, - USB_SetupPacket_t &sp) +/** + * \brief Calculate the time interval between the most recent HID Report and a subsequent Set Idle Request + * + * \warning For this function to produce an accurate interval measument, it must be called without delay + * upon receiving a Set Idle Request from the USB Host. + * + * \param[in] reportTime -- The time at which the last HID Report was sent + * + * \return The time interval between receiving the Set Idle Request and sending the most recent HID Report + */ +static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ) { - switch (sp.bRequest) { - case HID_SET_IDLE: - printstr("HID_SET_IDLE\n"); - hidSetIdle = 1; // TODO implement duration - return XUD_DoSetRequestStatus(c_ep0_in); - default: - break; - } - return XUD_RES_ERR; + timer tmr; + unsigned setIdleTime; + + tmr :> setIdleTime; + unsigned result = HidTimeDiff( reportTime, setIdleTime ); + return result; +} + +/** + * \brief Indicate if activation of the Set Idle Request happens at the previous or next HID Report + * + * Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human Interface + * Devices (HID) Version 1.11 makes two statements about the activation point for starting the + * duration of the request: + * - 'A new request will be executed as if it were issued immediately after the last report, if + * the new request is received at least 4 milliseconds before the end of the currently executing + * period.' + * - 'If the new request is received within 4 milliseconds of the end of the current period, then + * the new request will have no effect until after the report.' + * + * \param[in] currentPeriod -- The duration of the current period + * \param[in] timeWithinPeriod -- The current point in time relative to the current period + * + * \return A Boolean indicating where the activation of the Set Idle Request Duration occurs. + * \retval 1 -- Activate immediately after the next HID Report + * \retval 0 -- Activate immediately after the previous HID Report + */ +static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ) +{ + unsigned result = (( currentPeriod - timeWithinPeriod ) < ( 4U * MS_IN_TICKS )) ? 1 : 0; + + return result; +} + +/** + * \brief Calculate the timer value for sending the next HID Report. + * + * With regard to Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human + * Interface Devices (HID) Version 1.11, I've interpreted 'currently executing period' and + * 'current period' to mean the previously established Set Idle duration if one has been + * established or the polling interval from the HID Report Descriptor if a Set Idle duration + * has not been established. + * + * \param[in] currentPeriod -- The duration of the current period in timer ticks + * \param[in] reportTime -- The time at which the last HID Report was sent + * \param[in] reportToSetIdleInterval -- The time interval between receiving the Set Idle Request + * and sending the most recent HID Report + * \param[in] nextPeriod -- The new period value in timer ticks + * + * \return The time at which the next HID Report should be sent + */ +static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned nextPeriod ) +{ + unsigned nextReportTime = 0; + + if( HidFindSetIdleActivationPoint( currentPeriod, reportToSetIdleInterval )) { + /* Activate immediately after sending the next HID Report */ + nextReportTime = reportTime + currentPeriod; + } else { + /* Activate immediately after sending the most recent HID Report */ + nextReportTime = reportTime + nextPeriod; + } + + return nextReportTime; +} + +void HidCalcNextReportTime( void ) +{ + s_hidNextReportTime = s_hidReportTime + s_hidCurrentPeriod; +} + +void HidCaptureReportTime( void ) +{ + timer tmr; + tmr :> s_hidReportTime; +} + +XUD_Result_t HidInterfaceClassRequests( + XUD_ep c_ep0_out, + XUD_ep c_ep0_in, + USB_SetupPacket_t &sp ) +{ + XUD_Result_t result = XUD_RES_ERR; + + switch ( sp.bRequest ) { + case HID_SET_IDLE: + printstr("HID_SET_IDLE\n"); + /* + The Set Idle request wValue field contains two sub-fields: + - Duration in the MSB; and + - Report ID in the LSB. + + The Duration field specifies how long the USB Device responds with NAK provided the HID data hasn't changed. + Zero means indefinitely. + The value is in units of 4ms. + + The Report ID identifies the HID report that the USB Host wishes to silence. + + The Set Idle request xIndex field contains the interface number. + */ + uint8_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform into units of 1ms. + uint8_t reportId = sp.wValue & 0x00FF; + uint16_t interfaceNum = ( sp.wIndex & 0xFF00 ) >> 8; + + /* + As long as our HID Report Descriptor does not include a Report ID, any Report ID value other than zero + indicates an error by the USB Host (see xua_ep0_descriptors.h for the definition of the HID + Report Descriptor). + + Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host. + */ + if(( 0U == reportId ) && ( interfaceNum == INTERFACE_NUMBER_HID )) { + s_hidIdleActive = !(( 0 < duration ) && ( duration < ENDPOINT_INT_INTERVAL_IN_HID )); + + if( s_hidIdleActive ) { + unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime ); + s_hidNextReportTime = HidCalcNewReportTime( s_hidCurrentPeriod, s_hidReportTime, reportToSetIdleInterval, duration * MS_IN_TICKS ); + s_hidCurrentPeriod = duration * MS_IN_TICKS; + } else { + s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; + } + + result = XUD_DoSetRequestStatus( c_ep0_in ); + } + break; + + default: + break; + } + + return result; +} + +unsigned HidIsSetIdleSilenced( void ) +{ + unsigned isSilenced = s_hidIdleActive; + + if( s_hidIdleActive ) { + unsigned currentTime; + asm volatile( "gettime %0" : "=r" ( currentTime )); // Use inline assembly to access the time without creating a side-effect + isSilenced = timeafter( s_hidNextReportTime, currentTime ); + } + + return isSilenced; } diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index df89dc55..c3dfcc66 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -3,7 +3,13 @@ #include "xud.h" #include "xud_std_requests.h" -XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, - REFERENCE_PARAM(USB_SetupPacket_t, sp)); +void HidCalcNextReportTime( void ); -unsigned HidIsSetIdleSilenced(void); +void HidCaptureReportTime( void ); + +XUD_Result_t HidInterfaceClassRequests( + XUD_ep c_ep0_out, + XUD_ep c_ep0_in, + REFERENCE_PARAM( USB_SetupPacket_t, sp )); + +unsigned HidIsSetIdleSilenced( void ); From 9f98e13342b2b4fb4bfe19da9da3e0e8df7bc9e2 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 14 Oct 2019 16:42:34 +0100 Subject: [PATCH 048/233] Use the HID_CONTROLS pre-processor symbol consistently. --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index c59886c6..7b42909b 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -60,7 +60,7 @@ extern void device_reboot(void); #endif -#if HID_CONTROLS +#if( 0 < HID_CONTROLS ) #include "xua_hid.h" #endif @@ -993,7 +993,7 @@ void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend } } #endif -#if HID_CONTROLS +#if( 0 < HID_CONTROLS ) if (interfaceNum == INTERFACE_NUMBER_HID) { result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp); From 962e91adeca2238307e5e30eb2c71512754fb24b Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 14 Oct 2019 16:47:59 +0100 Subject: [PATCH 049/233] Include xua.h to pick up the NUM_USB_CHAN_IN and NUM_USB_CHAN_OUT pre-processor symbols. They're used further down in the file. If not present through an #include of xua_h outside of and before the #include of descriptor_defs.h or through definition in the Make file, the enumeration of interface numbers silently mis-assigns values. --- lib_xua/src/core/endpoint0/descriptor_defs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_xua/src/core/endpoint0/descriptor_defs.h b/lib_xua/src/core/endpoint0/descriptor_defs.h index 53ba28ed..1f29d58e 100644 --- a/lib_xua/src/core/endpoint0/descriptor_defs.h +++ b/lib_xua/src/core/endpoint0/descriptor_defs.h @@ -3,6 +3,11 @@ #ifndef __DESCRIPTOR_DEFS_H__ #define __DESCRIPTOR_DEFS_H__ +/* + Include xua.h to pick up the #defines of NUM_USB_CHAN_IN and NUM_USB_CHAN_OUT. + */ +#include "xua.h" + #if (NUM_USB_CHAN_IN > 0) && (NUM_USB_CHAN_OUT > 0) #define AUDIO_INTERFACE_COUNT 3 #elif (NUM_USB_CHAN_IN > 0) || (NUM_USB_CHAN_OUT > 0) From 97e32331203f7f590d8ae33f80d2df691a724d22 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 10:42:33 +0100 Subject: [PATCH 050/233] Rename parameter to a less ambiguous name. --- lib_xua/src/hid/hid.xc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 1e92e283..972158ff 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -92,11 +92,11 @@ static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, con * \param[in] reportTime -- The time at which the last HID Report was sent * \param[in] reportToSetIdleInterval -- The time interval between receiving the Set Idle Request * and sending the most recent HID Report - * \param[in] nextPeriod -- The new period value in timer ticks + * \param[in] newPeriod -- The new period value in timer ticks * * \return The time at which the next HID Report should be sent */ -static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned nextPeriod ) +static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ) { unsigned nextReportTime = 0; @@ -105,7 +105,7 @@ static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsign nextReportTime = reportTime + currentPeriod; } else { /* Activate immediately after sending the most recent HID Report */ - nextReportTime = reportTime + nextPeriod; + nextReportTime = reportTime + newPeriod; } return nextReportTime; From aeb1d58bf347bed3008dbd76d76ce1720fcc6608 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 10:44:34 +0100 Subject: [PATCH 051/233] The interface number occupies the entire sp.wIndex field. --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 972158ff..0152b071 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -147,7 +147,7 @@ XUD_Result_t HidInterfaceClassRequests( */ uint8_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform into units of 1ms. uint8_t reportId = sp.wValue & 0x00FF; - uint16_t interfaceNum = ( sp.wIndex & 0xFF00 ) >> 8; + uint16_t interfaceNum = sp.wIndex; /* As long as our HID Report Descriptor does not include a Report ID, any Report ID value other than zero From 3331c9e97bc168753b97a48bb04ed41aad421b8f Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 10:45:20 +0100 Subject: [PATCH 052/233] Add handling for an indefinite duration. --- lib_xua/src/hid/hid.xc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 0152b071..794e244b 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -9,6 +9,7 @@ static unsigned s_hidIdleActive = 0; static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; +static unsigned s_hidIndefiniteDuration = 0; static unsigned s_hidNextReportTime = 0; static unsigned s_hidReportTime = 0; @@ -163,8 +164,10 @@ XUD_Result_t HidInterfaceClassRequests( unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime ); s_hidNextReportTime = HidCalcNewReportTime( s_hidCurrentPeriod, s_hidReportTime, reportToSetIdleInterval, duration * MS_IN_TICKS ); s_hidCurrentPeriod = duration * MS_IN_TICKS; + s_hidIndefiniteDuration = ( 0U == duration ); } else { s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; + s_hidIndefiniteDuration = 0; } result = XUD_DoSetRequestStatus( c_ep0_in ); @@ -185,7 +188,7 @@ unsigned HidIsSetIdleSilenced( void ) if( s_hidIdleActive ) { unsigned currentTime; asm volatile( "gettime %0" : "=r" ( currentTime )); // Use inline assembly to access the time without creating a side-effect - isSilenced = timeafter( s_hidNextReportTime, currentTime ); + isSilenced = ( s_hidIndefiniteDuration || ( timeafter( s_hidNextReportTime, currentTime ))); } return isSilenced; From e4f0b73a88928bc004dcdc029722930298e5fb59 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 15:38:16 +0100 Subject: [PATCH 053/233] Explicitly label assignment of zero as unsigned when used with unsigned variables. --- lib_xua/src/hid/hid.xc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 794e244b..88ced493 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -7,11 +7,11 @@ #define MS_IN_TICKS 100000U -static unsigned s_hidIdleActive = 0; +static unsigned s_hidIdleActive = 0U; static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; -static unsigned s_hidIndefiniteDuration = 0; -static unsigned s_hidNextReportTime = 0; -static unsigned s_hidReportTime = 0; +static unsigned s_hidIndefiniteDuration = 0U; +static unsigned s_hidNextReportTime = 0U; +static unsigned s_hidReportTime = 0U; /** * \brief Calculate the difference between two points in time @@ -167,7 +167,7 @@ XUD_Result_t HidInterfaceClassRequests( s_hidIndefiniteDuration = ( 0U == duration ); } else { s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; - s_hidIndefiniteDuration = 0; + s_hidIndefiniteDuration = 0U; } result = XUD_DoSetRequestStatus( c_ep0_in ); From a5f17c46fc3d7a22b2a547236aa576e4326b934c Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 15:39:14 +0100 Subject: [PATCH 054/233] Use a variable large enough to hold the Set Idle duration in ms without overflow. --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 88ced493..40014575 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -146,7 +146,7 @@ XUD_Result_t HidInterfaceClassRequests( The Set Idle request xIndex field contains the interface number. */ - uint8_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform into units of 1ms. + uint16_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform from units of 4ms into units of 1ms. uint8_t reportId = sp.wValue & 0x00FF; uint16_t interfaceNum = sp.wIndex; From 5caca37177cfc34e88f1b903f196dcbc9ff3f705 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 15:40:26 +0100 Subject: [PATCH 055/233] Change the representation, but not the logic, of a multi-part conditional expression to make it easier to understand. --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 40014575..cee8d49a 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -158,7 +158,7 @@ XUD_Result_t HidInterfaceClassRequests( Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host. */ if(( 0U == reportId ) && ( interfaceNum == INTERFACE_NUMBER_HID )) { - s_hidIdleActive = !(( 0 < duration ) && ( duration < ENDPOINT_INT_INTERVAL_IN_HID )); + s_hidIdleActive = (( 0U == duration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < duration )); if( s_hidIdleActive ) { unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime ); From 6afb4ab7e452175791ec43ec2f78a8cd5bd31d29 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 15 Oct 2019 15:43:05 +0100 Subject: [PATCH 056/233] Remove debugging print. --- lib_xua/src/hid/hid.xc | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index cee8d49a..606349b2 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -132,7 +132,6 @@ XUD_Result_t HidInterfaceClassRequests( switch ( sp.bRequest ) { case HID_SET_IDLE: - printstr("HID_SET_IDLE\n"); /* The Set Idle request wValue field contains two sub-fields: - Duration in the MSB; and From 8820ddf2699e9635f03f5e45f9b7f157bc2dd863 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 11:37:27 +0100 Subject: [PATCH 057/233] Add documentation. --- lib_xua/src/hid/xua_hid.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index c3dfcc66..ab8b2e05 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -3,8 +3,31 @@ #include "xud.h" #include "xud_std_requests.h" +/** + * \brief Calculate the next time to respond with a HID Report. + * + * If the USB Host has previously sent a valid HID Set_Idle request with + * a duration of zero or greater than the default reporting interval, + * the device sends HID Reports periodically or when the value of the + * payload has changed. + * + * This function calculates the time for sending the next periodic + * HID Report. + */ void HidCalcNextReportTime( void ); +/** + * \brief Capture the time of sending the current HID Report. + * + * If the USB Host has previously sent a valid HID Set_Idle request with + * a duration of zero or greater than the default reporting interval, + * the device sends HID Reports periodically or when the value of the + * payload has changed. + * + * This function captures the time when the HID Report was sent so that + * a subsequent call to HidCalNextReportTime() can calculate the time + * to send the next periodic HID Report. + */ void HidCaptureReportTime( void ); XUD_Result_t HidInterfaceClassRequests( @@ -12,4 +35,20 @@ XUD_Result_t HidInterfaceClassRequests( XUD_ep c_ep0_in, REFERENCE_PARAM( USB_SetupPacket_t, sp )); +/** + * \brief Indicate whether to send a HID Report based on elapsed time. + * + * If the USB Host has previously sent a valid HID Set_Idle request with + * a duration of zero or greater than the default reporting interval, + * the device sends HID Reports periodically or when the value of the + * payload has changed. + * + * This function monitors the passage of time and reports to the caller + * whether or not the time to send the next periodic HID Report has + * elapsed. + * + * \return A Boolean value indicating whether or not to send the HID Report. + * \retval 1 -- Do not send the HID Report + * \retval 0 -- Send the HID Report + */ unsigned HidIsSetIdleSilenced( void ); From 9a7c2d85b20ff9f76ea25935e8f528e767c5351c Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 11:47:32 +0100 Subject: [PATCH 058/233] Reorganise file layout for easier maintenance and reading. --- lib_xua/src/hid/hid.xc | 201 +++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 98 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 606349b2..da4f5c78 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -13,104 +13,10 @@ static unsigned s_hidIndefiniteDuration = 0U; static unsigned s_hidNextReportTime = 0U; static unsigned s_hidReportTime = 0U; -/** - * \brief Calculate the difference between two points in time - * - * This function calculates the difference between two two points in time. - * It always returns a positive value even if the timer used to obtain the two - * time measurements has wrapped around. - * - * \warning If time values have been obtained from a timer that has wrapped - * more than once in between the two measurements, this function returns an - * incorrect value. - * - * \param[in] earlierTime -- A value from a timer - * \param[in] laterTime -- A value from a timer taken after \a earlierTime - * - * \return The interval between the two points in time - */ -static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ) -{ - return ( earlierTime < laterTime ) ? laterTime - earlierTime : UINT_MAX - earlierTime + laterTime; -} - -/** - * \brief Calculate the time interval between the most recent HID Report and a subsequent Set Idle Request - * - * \warning For this function to produce an accurate interval measument, it must be called without delay - * upon receiving a Set Idle Request from the USB Host. - * - * \param[in] reportTime -- The time at which the last HID Report was sent - * - * \return The time interval between receiving the Set Idle Request and sending the most recent HID Report - */ -static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ) -{ - timer tmr; - unsigned setIdleTime; - - tmr :> setIdleTime; - unsigned result = HidTimeDiff( reportTime, setIdleTime ); - return result; -} - -/** - * \brief Indicate if activation of the Set Idle Request happens at the previous or next HID Report - * - * Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human Interface - * Devices (HID) Version 1.11 makes two statements about the activation point for starting the - * duration of the request: - * - 'A new request will be executed as if it were issued immediately after the last report, if - * the new request is received at least 4 milliseconds before the end of the currently executing - * period.' - * - 'If the new request is received within 4 milliseconds of the end of the current period, then - * the new request will have no effect until after the report.' - * - * \param[in] currentPeriod -- The duration of the current period - * \param[in] timeWithinPeriod -- The current point in time relative to the current period - * - * \return A Boolean indicating where the activation of the Set Idle Request Duration occurs. - * \retval 1 -- Activate immediately after the next HID Report - * \retval 0 -- Activate immediately after the previous HID Report - */ -static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ) -{ - unsigned result = (( currentPeriod - timeWithinPeriod ) < ( 4U * MS_IN_TICKS )) ? 1 : 0; - - return result; -} - -/** - * \brief Calculate the timer value for sending the next HID Report. - * - * With regard to Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human - * Interface Devices (HID) Version 1.11, I've interpreted 'currently executing period' and - * 'current period' to mean the previously established Set Idle duration if one has been - * established or the polling interval from the HID Report Descriptor if a Set Idle duration - * has not been established. - * - * \param[in] currentPeriod -- The duration of the current period in timer ticks - * \param[in] reportTime -- The time at which the last HID Report was sent - * \param[in] reportToSetIdleInterval -- The time interval between receiving the Set Idle Request - * and sending the most recent HID Report - * \param[in] newPeriod -- The new period value in timer ticks - * - * \return The time at which the next HID Report should be sent - */ -static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ) -{ - unsigned nextReportTime = 0; - - if( HidFindSetIdleActivationPoint( currentPeriod, reportToSetIdleInterval )) { - /* Activate immediately after sending the next HID Report */ - nextReportTime = reportTime + currentPeriod; - } else { - /* Activate immediately after sending the most recent HID Report */ - nextReportTime = reportTime + newPeriod; - } - - return nextReportTime; -} +static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); +static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); +static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ); +static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ); void HidCalcNextReportTime( void ) { @@ -192,3 +98,102 @@ unsigned HidIsSetIdleSilenced( void ) return isSilenced; } + +/** + * \brief Calculate the timer value for sending the next HID Report. + * + * With regard to Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human + * Interface Devices (HID) Version 1.11, I've interpreted 'currently executing period' and + * 'current period' to mean the previously established Set Idle duration if one has been + * established or the polling interval from the HID Report Descriptor if a Set Idle duration + * has not been established. + * + * \param[in] currentPeriod -- The duration of the current period in timer ticks + * \param[in] reportTime -- The time at which the last HID Report was sent + * \param[in] reportToSetIdleInterval -- The time interval between receiving the Set Idle Request + * and sending the most recent HID Report + * \param[in] newPeriod -- The new period value in timer ticks + * + * \return The time at which the next HID Report should be sent + */ +static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ) +{ + unsigned nextReportTime = 0; + + if( HidFindSetIdleActivationPoint( currentPeriod, reportToSetIdleInterval )) { + /* Activate immediately after sending the next HID Report */ + nextReportTime = reportTime + currentPeriod; + } else { + /* Activate immediately after sending the most recent HID Report */ + nextReportTime = reportTime + newPeriod; + } + + return nextReportTime; +} + +/** + * \brief Calculate the time interval between the most recent HID Report and a subsequent Set Idle Request + * + * \warning For this function to produce an accurate interval measument, it must be called without delay + * upon receiving a Set Idle Request from the USB Host. + * + * \param[in] reportTime -- The time at which the last HID Report was sent + * + * \return The time interval between receiving the Set Idle Request and sending the most recent HID Report + */ +static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ) +{ + timer tmr; + unsigned setIdleTime; + + tmr :> setIdleTime; + unsigned result = HidTimeDiff( reportTime, setIdleTime ); + return result; +} + +/** + * \brief Indicate if activation of the Set Idle Request happens at the previous or next HID Report + * + * Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human Interface + * Devices (HID) Version 1.11 makes two statements about the activation point for starting the + * duration of the request: + * - 'A new request will be executed as if it were issued immediately after the last report, if + * the new request is received at least 4 milliseconds before the end of the currently executing + * period.' + * - 'If the new request is received within 4 milliseconds of the end of the current period, then + * the new request will have no effect until after the report.' + * + * \param[in] currentPeriod -- The duration of the current period + * \param[in] timeWithinPeriod -- The current point in time relative to the current period + * + * \return A Boolean indicating where the activation of the Set Idle Request Duration occurs. + * \retval 1 -- Activate immediately after the next HID Report + * \retval 0 -- Activate immediately after the previous HID Report + */ +static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ) +{ + unsigned result = (( currentPeriod - timeWithinPeriod ) < ( 4U * MS_IN_TICKS )) ? 1 : 0; + + return result; +} + +/** + * \brief Calculate the difference between two points in time + * + * This function calculates the difference between two two points in time. + * It always returns a positive value even if the timer used to obtain the two + * time measurements has wrapped around. + * + * \warning If time values have been obtained from a timer that has wrapped + * more than once in between the two measurements, this function returns an + * incorrect value. + * + * \param[in] earlierTime -- A value from a timer + * \param[in] laterTime -- A value from a timer taken after \a earlierTime + * + * \return The interval between the two points in time + */ +static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ) +{ + return ( earlierTime < laterTime ) ? laterTime - earlierTime : UINT_MAX - earlierTime + laterTime; +} From 21ec3cf7bdb7169733634342a628263387714f86 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 12:18:50 +0100 Subject: [PATCH 059/233] Put the processing of the Set Idle request in a static function. This reorganisation prepares this file for adding other HID Class-specific requests without the --- lib_xua/src/hid/hid.xc | 105 ++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 43 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index da4f5c78..dd988f9c 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -13,10 +13,11 @@ static unsigned s_hidIndefiniteDuration = 0U; static unsigned s_hidNextReportTime = 0U; static unsigned s_hidReportTime = 0U; -static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); -static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); -static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ); -static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ); +static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); +static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); +static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ); +static XUD_Result_t HidProcessSetIdleRequest( XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t &sp ); +static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTime ); void HidCalcNextReportTime( void ) { @@ -38,45 +39,7 @@ XUD_Result_t HidInterfaceClassRequests( switch ( sp.bRequest ) { case HID_SET_IDLE: - /* - The Set Idle request wValue field contains two sub-fields: - - Duration in the MSB; and - - Report ID in the LSB. - - The Duration field specifies how long the USB Device responds with NAK provided the HID data hasn't changed. - Zero means indefinitely. - The value is in units of 4ms. - - The Report ID identifies the HID report that the USB Host wishes to silence. - - The Set Idle request xIndex field contains the interface number. - */ - uint16_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform from units of 4ms into units of 1ms. - uint8_t reportId = sp.wValue & 0x00FF; - uint16_t interfaceNum = sp.wIndex; - - /* - As long as our HID Report Descriptor does not include a Report ID, any Report ID value other than zero - indicates an error by the USB Host (see xua_ep0_descriptors.h for the definition of the HID - Report Descriptor). - - Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host. - */ - if(( 0U == reportId ) && ( interfaceNum == INTERFACE_NUMBER_HID )) { - s_hidIdleActive = (( 0U == duration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < duration )); - - if( s_hidIdleActive ) { - unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime ); - s_hidNextReportTime = HidCalcNewReportTime( s_hidCurrentPeriod, s_hidReportTime, reportToSetIdleInterval, duration * MS_IN_TICKS ); - s_hidCurrentPeriod = duration * MS_IN_TICKS; - s_hidIndefiniteDuration = ( 0U == duration ); - } else { - s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; - s_hidIndefiniteDuration = 0U; - } - - result = XUD_DoSetRequestStatus( c_ep0_in ); - } + result = HidProcessSetIdleRequest( c_ep0_out, c_ep0_in, sp ); break; default: @@ -177,6 +140,62 @@ static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, con return result; } +/** + * \brief Process a Set Idle request + * + * \param[in] c_ep0_out -- the channel that carries data from Endpoint 0 + * \param[in] c_ep0_in -- the channel that carries data for Endpoint 0 + * \param[in] sp -- a structure containing the Set Idle data + * + * \return An XUD status value + */ +static XUD_Result_t HidProcessSetIdleRequest( XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t &sp ) +{ + XUD_Result_t result = XUD_RES_ERR; + + /* + The Set Idle request wValue field contains two sub-fields: + - Duration in the MSB; and + - Report ID in the LSB. + + The Duration field specifies how long the USB Device responds with NAK provided the HID data hasn't changed. + Zero means indefinitely. + The value is in units of 4ms. + + The Report ID identifies the HID report that the USB Host wishes to silence. + + The Set Idle request xIndex field contains the interface number. + */ + uint16_t duration = ( sp.wValue & 0xFF00 ) >> 6; // Transform from units of 4ms into units of 1ms. + uint8_t reportId = sp.wValue & 0x00FF; + uint16_t interfaceNum = sp.wIndex; + + /* + As long as our HID Report Descriptor does not include a Report ID, any Report ID value other than zero + indicates an error by the USB Host (see xua_ep0_descriptors.h for the definition of the HID + Report Descriptor). + + Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host. + */ + if(( 0U == reportId ) && ( interfaceNum == INTERFACE_NUMBER_HID )) { + s_hidIdleActive = (( 0U == duration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < duration )); + + if( s_hidIdleActive ) { + unsigned reportToSetIdleInterval = HidCalcReportToSetIdleInterval( s_hidReportTime ); + s_hidNextReportTime = HidCalcNewReportTime( s_hidCurrentPeriod, s_hidReportTime, reportToSetIdleInterval, duration * MS_IN_TICKS ); + s_hidCurrentPeriod = duration * MS_IN_TICKS; + s_hidIndefiniteDuration = ( 0U == duration ); + } else { + s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; + s_hidIndefiniteDuration = 0U; + } + + result = XUD_DoSetRequestStatus( c_ep0_in ); + } + + return result; +} + /** * \brief Calculate the difference between two points in time * From 024c0304f1008a49f628ac8c4139ce56e1855c63 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 14:57:33 +0100 Subject: [PATCH 060/233] Reverse the order of operands in an equals comparison to allow the compiler to catch a mistaken use of '=' instead of '=='. --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index dd988f9c..72a4fea6 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -177,7 +177,7 @@ static XUD_Result_t HidProcessSetIdleRequest( XUD_ep c_ep0_out, XUD_ep c_ep0_in, Any Interface value other than INTERFACE_NUMBER_HID indicates an error by the USB Host. */ - if(( 0U == reportId ) && ( interfaceNum == INTERFACE_NUMBER_HID )) { + if(( 0U == reportId ) && ( INTERFACE_NUMBER_HID == interfaceNum )) { s_hidIdleActive = (( 0U == duration ) || ( ENDPOINT_INT_INTERVAL_IN_HID < duration )); if( s_hidIdleActive ) { From a7c0ac623420344d20b919ad0d93a9d8efb6934b Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 15:58:06 +0100 Subject: [PATCH 061/233] Protect configurations that do not include HID functionality from HID code. --- lib_xua/src/hid/hid.xc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 72a4fea6..bdd5aef3 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -5,6 +5,7 @@ #include "xud_std_requests.h" #include "xua_hid.h" +#if( 0 < HID_CONTROLS ) #define MS_IN_TICKS 100000U static unsigned s_hidIdleActive = 0U; @@ -216,3 +217,5 @@ static unsigned HidTimeDiff( const unsigned earlierTime, const unsigned laterTim { return ( earlierTime < laterTime ) ? laterTime - earlierTime : UINT_MAX - earlierTime + laterTime; } + +#endif /* ( 0 < HID_CONTROLS ) */ From a6f3daf5817d6ff3da694086fa511dd52620e4a2 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 16 Oct 2019 16:03:52 +0100 Subject: [PATCH 062/233] Update change log. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 35c363bc..e3d99159 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ lib_xua Change Log ---------- * ADDED: UAC1 HID support with simulated Voice Command detection reported every 10 seconds + * ADDED: Support for USB HID Set Idle request 0.2.0 ----- From 102d1b4e3abe880f67263d55369620cf13862099 Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Wed, 23 Oct 2019 14:26:49 +0100 Subject: [PATCH 063/233] Tidy up HID --- lib_xua/module_build_info | 2 +- lib_xua/src/core/user/{ => hid}/user_hid.h | 25 +--------------------- 2 files changed, 2 insertions(+), 25 deletions(-) rename lib_xua/src/core/user/{ => hid}/user_hid.h (50%) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index f13abe6b..be92c565 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -17,7 +17,7 @@ VERSION = 0.2.0 DEPENDENT_MODULES = lib_logging(>=2.1.0) lib_xassert(>=2.0.0) lib_xud(>=0.1.0) lib_spdif(>=3.0.0) -INCLUDE_DIRS = api src/* src/core/user +INCLUDE_DIRS = api src/* src/core/* src/core/user/hid #ignore host dir SOURCE_DIRS = src/* diff --git a/lib_xua/src/core/user/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h similarity index 50% rename from lib_xua/src/core/user/user_hid.h rename to lib_xua/src/core/user/hid/user_hid.h index 5688c7c6..88165b2a 100644 --- a/lib_xua/src/core/user/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,5 +1,4 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved - +// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved /* These defines relate to the HID report desc - do not mod */ #define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 @@ -11,30 +10,8 @@ #define HID_DATA_SIZE 1 -#ifndef HID_SIMULATE_INTERRUPTS -#define HID_SIMULATE_INTERRUPTS 0 -#endif - -#ifndef INTERRUPT_ASSERT_LEVEL -#define INTERRUPT_ASSERT_LEVEL 0 -#endif - #if( 0 < HID_CONTROLS ) -#if( 0 < INTERRUPT_ASSERT_LEVEL ) -#define INT_ASSERT_LEVEL 1 -#define INT_DEASSERT_LEVEL 0 -#else -#define INT_ASSERT_LEVEL 0 -#define INT_DEASSERT_LEVEL 1 -#endif - -#if( 0 < HID_SIMULATE_INTERRUPTS ) -#define HID_DEASSERT_COUNT 10000000 -#define HID_INTERRUPT_COUNT 1000000000 -#endif - -select UserHIDTrigger( unsigned* hidValueLatched ); void UserInitHIDData( void ); void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); void UserSetHIDData( const unsigned hidData ); From 75abc71cd78995c0563ce22bb8683f418c7a6986 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 29 Oct 2019 16:45:03 +0000 Subject: [PATCH 064/233] Cleaning up a previous merge conflict. --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 71 ++++++++++------------ 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 0f7f766f..4a4e8882 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -439,55 +439,48 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 } #if (NUM_USB_CHAN_OUT > 0) && (NUM_USB_CHAN_IN > 0) + unsigned num_input_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]; + unsigned num_output_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT]; + if (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT) { - unsigned num_input_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT]; - unsigned num_output_interfaces = g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT]; - if (sp.wIndex == INTERFACE_NUMBER_AUDIO_INPUT) + // in: 0 -> 1 + if (sp.wValue && !num_input_interfaces) { - // in: 0 -> 1 - if (sp.wValue && !num_input_interfaces) + UserAudioInputStreamStart(); + if (!num_output_interfaces) { - UserAudioInputStreamStart(); - if (!num_output_interfaces) - { - UserAudioStreamStart(); - } - } - // in: 1 -> 0 - else if (!sp.wValue && num_input_interfaces) - { - UserAudioInputStreamStop(); - if (!num_output_interfaces) - { - UserAudioStreamStop(); - } + UserAudioStreamStart(); } } - else if (sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) + // in: 1 -> 0 + else if (!sp.wValue && num_input_interfaces) { - // out: 0 -> 1 - if (sp.wValue && !num_output_interfaces) + UserAudioInputStreamStop(); + if (!num_output_interfaces) { - UserAudioOutputStreamStart(); - if (!num_input_interfaces) - { - UserAudioStreamStart(); - } - } - // out: 1 -> 0 - else if (!sp.wValue && num_output_interfaces) - { - UserAudioOutputStreamStop(); - if (!num_input_interfaces) - { - UserAudioStreamStop(); - } + UserAudioStreamStop(); } } - else if(((sp.wIndex == 2) && (!sp.wValue)) && g_interfaceAlt[INTERFACE_NUMBER_AUDIO_INPUT] && (!g_interfaceAlt[INTERFACE_NUMBER_AUDIO_OUTPUT])) + } + else if (sp.wIndex == INTERFACE_NUMBER_AUDIO_OUTPUT) + { + // out: 0 -> 1 + if (sp.wValue && !num_output_interfaces) { - /* if input stop and input running and output not running */ - UserAudioStreamStop(); + UserAudioOutputStreamStart(); + if (!num_input_interfaces) + { + UserAudioStreamStart(); + } + } + // out: 1 -> 0 + else if (!sp.wValue && num_output_interfaces) + { + UserAudioOutputStreamStop(); + if (!num_input_interfaces) + { + UserAudioStreamStop(); + } } } #elif (NUM_USB_CHAN_OUT > 0) From 8768bb0ee0887e63a826de429a57598cfcd4074b Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 5 Nov 2019 12:34:10 +0000 Subject: [PATCH 065/233] Fix descriptors for XUA_ADAPTIVE --- CHANGELOG.rst | 5 ++ lib_xua/module_build_info | 2 +- .../src/core/endpoint0/xua_ep0_descriptors.h | 89 +++++++++++++++---- 3 files changed, 77 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2a114f45..be867bab 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +0.2.1 +----- + + * HOTFIX: Fix descriptors for XUA_ADAPTIVE + 0.2.0 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index ce383df3..f2b3c05d 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 0.2.0 +VERSION = 0.2.1 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 4c85c56c..c9f87ab5 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors @@ -28,6 +28,15 @@ #define STR_TABLE_ENTRY(name) char *name +#define ISO_EP_ATTRIBUTES_ASYNCH 0x05 //ISO, ASYNCH, DATA EP +#define ISO_EP_ATTRIBUTES_ADAPTIVE 0x09 //ISO, ADAPTIVE, DATA EP +#define ISO_EP_IMPL_ATTRIBUTES_ASYNCH 0x25 //ISO, ASYNCH, IMPLICIT FB DATA EP +#define ISO_EP_IMPL_ATTRIBUTES_ADAPTIVE 0x29 //ISO, ADAPTIVE, IMPLICIT FB DATA EP + +#if (defined(XUA_ADAPTIVE) && (XUA_ADAPTIVE == 0)) +#undef XUA_ADAPTIVE +#endif + #if __STDC__ typedef struct { @@ -1463,7 +1472,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = sizeof(USB_Descriptor_Endpoint_t), .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, - .bmAttributes = 0x05, /* (bitmap) */ +#ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ +#else + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ +#endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE, .bInterval = 1, }, @@ -1541,7 +1554,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = sizeof(USB_Descriptor_Endpoint_t), .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, - .bmAttributes = 0x05, +#ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ +#else + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ +#endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE, .bInterval = 1, }, @@ -1621,8 +1638,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = 0x07, .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, - .bmAttributes = 0x05, - .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, +#ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ +#else + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ +#endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, .bInterval = 1, }, @@ -1715,9 +1735,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = 0x05, /* Iso, async, data endpoint */ + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else - .bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */ + #ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE, .bInterval = 0x01, @@ -1783,9 +1807,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = 0x05, /* Iso, async, data endpoint */ + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else - .bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */ + #ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_2_MAXPACKETSIZE, .bInterval = 0x01, @@ -1852,9 +1880,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = 0x05, /* Iso, async, data endpoint */ + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else - .bmAttributes = 0x25, /* Iso, async, implicit feedback data endpoint */ + #ifdef XUA_ADAPTIVE + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif .wMaxPacketSize = HS_STREAM_FORMAT_INPUT_3_MAXPACKETSIZE, .bInterval = 0x01, @@ -2614,15 +2646,23 @@ unsigned char cfgDesc_Audio1[] = 0x09, 0x05, /* ENDPOINT */ 0x01, /* endpointAddress - D7, direction (0 OUT, 1 IN). D6..4 reserved (0). D3..0 endpoint no. */ - 0x05, /* attributes - isochronous async */ +#ifdef XUA_ADAPTIVE + ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + ISO_EP_ATTRIBUTES_ASYNCH, +#endif (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff), /* 4 wMaxPacketSize (Typically 294 bytes)*/ (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ 0x01, /* bInterval */ - 0x00, /* bRefresh */ + 0x00, /* bRefresh */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) ENDPOINT_ADDRESS_IN_FEEDBACK, /* bSynchAdddress - address of EP used to communicate sync info */ +#else /* Bi-directional in/out device */ +#ifdef XUA_ADAPTIVE + 0, /* OUT */ #else ENDPOINT_ADDRESS_IN_AUDIO, +#endif #endif /* CS_Endpoint Descriptor ?? */ @@ -2631,7 +2671,11 @@ unsigned char cfgDesc_Audio1[] = 0x01, /* subtype - GENERAL */ 0x01, /* attributes. D[0]: sample freq ctrl. */ 0x02, /* bLockDelayUnits */ - 0x00, 0x00, /* bLockDelay */ +#ifdef XUA_ADAPTIVE + 0x08, 0x00, /* bLockDelay */ +#else + 0x00, 0x00, /* Not used */ +#endif #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) /* Feedback EP */ @@ -2743,9 +2787,13 @@ unsigned char cfgDesc_Audio1[] = 0x05, /* ENDPOINT */ ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - 0x05, /* Iso, async, data endpoint */ + ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else - 0x25, /* Iso, async, implicit feedback data endpoint */ + #ifdef XUA_ADAPTIVE + ISO_EP_ATTRIBUTES_ADAPTIVE, + #else + ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/ (FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ @@ -2758,8 +2806,13 @@ unsigned char cfgDesc_Audio1[] = 0x25, /* CS_ENDPOINT */ 0x01, /* Subtype - GENERAL */ 0x01, /* Attributes. D[0]: sample freq ctrl. */ - 0x00, /* Unused */ - 0x00, 0x00, /* Unused */ +#ifdef XUA_ADAPTIVE + 0x02, /* Lock Delay units PCM samples*/ + 0x08, 0x00, /* No lock delay */ +#else + 0x00, /* Undefined */ + 0x00, 0x00, /* Not used */ +#endif // XUA_ADAPTIVE #endif #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1) From 5a0bc319eadfdd4e60467942312d56e9ef1fd91d Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 5 Nov 2019 12:57:03 +0000 Subject: [PATCH 066/233] Fix copyright --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index c9f87ab5..570bc1b8 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors From 6dd185309410c1fcd5bc7e0c09c0283cddb6c051 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Wed, 6 Nov 2019 11:47:25 +0000 Subject: [PATCH 067/233] Add missing line break in ep0_descriptors --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 570bc1b8..d9d0c832 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1642,7 +1642,8 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ #else .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ -#endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, +#endif + .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, .bInterval = 1, }, From 92019d851a92db5e442e3fe2947e500356aa015a Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 6 Nov 2019 14:58:34 +0000 Subject: [PATCH 068/233] Remove xua_lite examples. Requested by Oscar Bailey as part of github.com/xmos/lib_xua Pull Request #103. --- examples/xua_lite_example/Makefile | 21 - examples/xua_lite_example/config.xscope | 3 - .../xua_lite_example/config/RPI_HAT_60QFN.xn | 66 --- examples/xua_lite_example/config/xua_conf.h | 41 -- examples/xua_lite_example/config/xud_conf.h | 7 - examples/xua_lite_example/plot_fill_level.sh | 1 - examples/xua_lite_example/src/app_xua_lite.xc | 157 ------- examples/xua_lite_example/src/audio_config.h | 8 - examples/xua_lite_example/src/audio_config.xc | 279 ------------- examples/xua_lite_example/src/audio_hub.h | 4 - examples/xua_lite_example/src/audio_hub.xc | 86 ---- examples/xua_lite_example/src/pdm_mic.h | 12 - examples/xua_lite_example/src/pdm_mic.xc | 112 ----- examples/xua_lite_example/test/Makefile | 35 -- examples/xua_lite_example/test/test_fifoxc | 139 ------- examples/xua_lite_example/todo.txt | 22 - examples/xua_lite_example/wscript | 26 -- .../xua_lite/rate_control/fifo_impl.h | 206 ---------- .../xua_lite/rate_control/fifo_types.h | 37 -- .../xua_lite/rate_control/rate_controller.h | 21 - .../xua_lite/rate_control/rate_controller.xc | 201 --------- .../xua_lite/xua_buffer_lite.h | 48 --- .../xua_lite/xua_buffer_lite.xc | 384 ------------------ .../xua_lite/xua_buffer_pack.h | 65 --- 24 files changed, 1981 deletions(-) delete mode 100644 examples/xua_lite_example/Makefile delete mode 100644 examples/xua_lite_example/config.xscope delete mode 100644 examples/xua_lite_example/config/RPI_HAT_60QFN.xn delete mode 100644 examples/xua_lite_example/config/xua_conf.h delete mode 100644 examples/xua_lite_example/config/xud_conf.h delete mode 100644 examples/xua_lite_example/plot_fill_level.sh delete mode 100644 examples/xua_lite_example/src/app_xua_lite.xc delete mode 100755 examples/xua_lite_example/src/audio_config.h delete mode 100755 examples/xua_lite_example/src/audio_config.xc delete mode 100644 examples/xua_lite_example/src/audio_hub.h delete mode 100644 examples/xua_lite_example/src/audio_hub.xc delete mode 100644 examples/xua_lite_example/src/pdm_mic.h delete mode 100644 examples/xua_lite_example/src/pdm_mic.xc delete mode 100644 examples/xua_lite_example/test/Makefile delete mode 100644 examples/xua_lite_example/test/test_fifoxc delete mode 100644 examples/xua_lite_example/todo.txt delete mode 100644 examples/xua_lite_example/wscript delete mode 100644 examples/xua_lite_example/xua_lite/rate_control/fifo_impl.h delete mode 100644 examples/xua_lite_example/xua_lite/rate_control/fifo_types.h delete mode 100644 examples/xua_lite_example/xua_lite/rate_control/rate_controller.h delete mode 100644 examples/xua_lite_example/xua_lite/rate_control/rate_controller.xc delete mode 100644 examples/xua_lite_example/xua_lite/xua_buffer_lite.h delete mode 100644 examples/xua_lite_example/xua_lite/xua_buffer_lite.xc delete mode 100644 examples/xua_lite_example/xua_lite/xua_buffer_pack.h diff --git a/examples/xua_lite_example/Makefile b/examples/xua_lite_example/Makefile deleted file mode 100644 index daa7dc5f..00000000 --- a/examples/xua_lite_example/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -APP_NAME = - -TARGET = RPI_HAT_60QFN.xn - -# The flags passed to xcc when building the application -XCC_FLAGS = -fcomment-asm -Xmapper --map -Xmapper MAPFILE -Os -report \ - -g -Wno-unused-function -Wno-timing -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSB_TILE=tile[1] \ - -D MIC_ARRAY_CH0=PIN0 -D MIC_ARRAY_CH1=PIN4 - -# The USED_MODULES variable lists other module used by the application. These -# modules will extend the SOURCE_DIRS, INCLUDE_DIRS and LIB_DIRS variables. -# Modules are expected to be in the directory above the BASE_DIR directory. -USED_MODULES = lib_xua lib_i2s lib_xud lib_i2c lib_mic_array - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/xua_lite_example/config.xscope b/examples/xua_lite_example/config.xscope deleted file mode 100644 index f336ddac..00000000 --- a/examples/xua_lite_example/config.xscope +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/examples/xua_lite_example/config/RPI_HAT_60QFN.xn b/examples/xua_lite_example/config/RPI_HAT_60QFN.xn deleted file mode 100644 index c0c3f85c..00000000 --- a/examples/xua_lite_example/config/RPI_HAT_60QFN.xn +++ /dev/null @@ -1,66 +0,0 @@ - - - Device - XVF3510 Device - - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/xua_lite_example/config/xua_conf.h b/examples/xua_lite_example/config/xua_conf.h deleted file mode 100644 index ae9de112..00000000 --- a/examples/xua_lite_example/config/xua_conf.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved - -#ifndef _XUA_CONF_H_ -#define _XUA_CONF_H_ - -#define NUM_USB_CHAN_OUT 2 /* Number of channels from host to device */ -#define NUM_USB_CHAN_IN 2 /* Number of channels from device to host */ -#define I2S_CHANS_DAC 2 /* Number of I2S channels out of xCORE */ -#define I2S_CHANS_ADC 2 /* Number of I2S channels in to xCORE */ -#define MCLK_441 (512 * 44100) /* 44.1kHz family master clock frequency */ -#define MCLK_48 (512 * 48000) /* 48kHz family master clock frequency */ -#define MIN_FREQ 48000 /* Minimum sample rate */ -#define MAX_FREQ 48000 /* Maximum sample rate */ - -#define EXCLUDE_USB_AUDIO_MAIN - -#define VENDOR_STR "XMOS" -#define VENDOR_ID 0x20B1 -#define PRODUCT_STR_A2 "XUA Lite Class 2" -#define PRODUCT_STR_A1 "XUA Lite Class 1" -#define PID_AUDIO_1 1 -#define PID_AUDIO_2 2 -#define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example) */ - -#define INPUT_FORMAT_COUNT 1 -#define STREAM_FORMAT_INPUT_1_RESOLUTION_BITS 16 -#define OUTPUT_FORMAT_COUNT 1 -#define STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS 16 - -#define OUTPUT_VOLUME_CONTROL 0 -#define INPUT_VOLUME_CONTROL 0 - -#define UAC_FORCE_FEEDBACK_EP 0 -#define XUA_ADAPTIVE 1 -#define XUA_LITE 1 // Use simple/optimised USB buffer tasks -#define AUDIO_CLASS 1 - -#define XUA_NUM_PDM_MICS 4 // It's actually 2 but we run 4ch and ignore 2 -#define PDM_MAX_DECIMATION (96000/(MIN_FREQ)) - -#endif diff --git a/examples/xua_lite_example/config/xud_conf.h b/examples/xua_lite_example/config/xud_conf.h deleted file mode 100644 index c14d64a8..00000000 --- a/examples/xua_lite_example/config/xud_conf.h +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved - -#include "xua_conf.h" - -/* TODO */ -#define XUD_UAC_NUM_USB_CHAN_OUT NUM_USB_CHAN_OUT -#define XUD_UAC_NUM_USB_CHAN_IN NUM_USB_CHAN_IN diff --git a/examples/xua_lite_example/plot_fill_level.sh b/examples/xua_lite_example/plot_fill_level.sh deleted file mode 100644 index bb2ad5a3..00000000 --- a/examples/xua_lite_example/plot_fill_level.sh +++ /dev/null @@ -1 +0,0 @@ -grep pid: dump.txt | grep -Eo "\-?\d+" > proc.txt && gnuplot -p -e 'set term png; plot "proc.txt" with lines' > plot.png && open plot.png \ No newline at end of file diff --git a/examples/xua_lite_example/src/app_xua_lite.xc b/examples/xua_lite_example/src/app_xua_lite.xc deleted file mode 100644 index 64830667..00000000 --- a/examples/xua_lite_example/src/app_xua_lite.xc +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved - -// A very simple *example* of a USB audio application (and as such is un-verified for production) -#include - -#include -#include - -#include "xua.h" -#include "xud.h" -#include "i2s.h" -#include "i2c.h" -#include "mic_array.h" -#include "xua_buffer_lite.h" -#include "xua_ep0_wrapper.h" -#include "pdm_mic.h" -#include "audio_config.h" -#include "audio_hub.h" - -#define DEBUG_UNIT XUA_APP -#define DEBUG_PRINT_ENABLE_XUA_APP 1 -#include "debug_print.h" - -// Port declarations. Note, the defines come from the xn file -on tile[0]: buffered out port:32 p_i2s_dac[] = {XS1_PORT_1N}; //DAC -on tile[0]: buffered in port:32 p_i2s_adc[] = {XS1_PORT_1F}; //Unused currently -on tile[0]: buffered out port:32 p_lrclk = XS1_PORT_1O; //I2S Bit-clock -on tile[0]: out port p_bclk = XS1_PORT_1P; //I2S L/R-clock - -// Master clock for the audio IO tile -on tile[0]: in port p_mclk_in = XS1_PORT_1K; - -// [0] : DAC_RESET_N -// [1] : I2C_INTERRUPT_N -// [2] : MUTE_EN -// [3] : LED -on tile[0]: out port p_gpio = XS1_PORT_4D; - -on tile[1]: port p_scl = XS1_PORT_1C; -on tile[1]: port p_sda = XS1_PORT_1D; -on tile[1]: in port p_mclk_in_usb = XS1_PORT_1A; -on tile[1]: in port p_for_mclk_count= XS1_PORT_16A; // Extra port for counting master clock ticks -on tile[1]: clock clk_usb_mclk = XS1_CLKBLK_3; // Master clock - -// Clock-block declarations -on tile[0]: clock clk_audio_bclk = XS1_CLKBLK_2; // Bit clock -on tile[0]: clock clk_audio_mclk = XS1_CLKBLK_3; // Master clock -//XUD uses XS1_CLKBLK_4, XS1_CLKBLK_5 on tile[1] - -//Mic array resources -on tile[0]: out port p_pdm_clk = XS1_PORT_1L; -on tile[0]: in buffered port:32 p_pdm_mics = XS1_PORT_4E; - -on tile[0]: clock pdmclk = XS1_CLKBLK_4; -on tile[0]: clock pdmclk6 = XS1_CLKBLK_5; - - -// Endpoint type tables - informs XUD what the transfer types for each Endpoint in use and also -// if the endpoint wishes to be informed of USB bus resets - -XUD_EpType epTypeTableOut[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO}; -XUD_EpType epTypeTableIn[] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; - -void burn_normal_priority(void){ - while(1); -} - -void burn_high_priority(void){ - set_core_high_priority_on(); - while(1); -} - -int main() -{ - // Channels for lib_xud - chan c_ep_out[XUA_ENDPOINT_COUNT_OUT]; - chan c_ep_in[XUA_ENDPOINT_COUNT_IN]; - - // Channel for communicating SOF notifications from XUD to the Buffering cores - chan c_sof; - - interface i2s_frame_callback_if i_i2s; - interface i2c_master_if i_i2c[1]; - - streaming chan c_audio; //We use the channel buffering (48B across switch each way) - streaming chan c_ds_output[1]; - - interface ep0_control_if i_ep0_ctl; - - par - { - on tile[0]: { - //Set the GPIOs needed for audio (reset and mute) - setup_audio_gpio(p_gpio); - c_audio <: 0; //Signal that we can now do i2c setup - c_audio :> int _; //Now wait until i2c has finished mclk setup - - const unsigned micDiv = MCLK_48/3072000; - mic_array_setup_ddr(pdmclk, pdmclk6, p_mclk_in, p_pdm_clk, p_pdm_mics, micDiv); - - par { - i2s_frame_master(i_i2s, p_i2s_dac, 1, p_i2s_adc, 1, p_bclk, p_lrclk, p_mclk_in, clk_audio_bclk); - [[distribute]] AudioHub(i_i2s, c_audio, c_ds_output); - pdm_mic(c_ds_output[0], p_pdm_mics); - - par (int i = 0; i < 5; i++) burn_normal_priority(); - par (int i = 0; i < 0; i++) burn_high_priority(); - } - } - on tile[1]:unsafe{ - // Connect master-clock input clock-block to clock-block pin for asnch feedback calculation - set_clock_src(clk_usb_mclk, p_mclk_in_usb); // Clock clock-block from mclk pin - set_port_clock(p_for_mclk_count, clk_usb_mclk); // Clock the "count" port from the clock block - start_clock(clk_usb_mclk); // Set the clock off running - - //Setup DAC over i2c and then return so we do not use a thread - c_audio :> int _; //Wait for reset to be asserted/deasserted by other tile - par{ - i2c_master(i_i2c, 1, p_scl, p_sda, 100); - AudioHwConfigure(DEFAULT_FREQ, i_i2c[0]); - } - c_audio <: 0; //Signal to tile[0] that mclk is now good - - par { - // Low level USB device layer core - XUD_Main(c_ep_out, XUA_ENDPOINT_COUNT_OUT, c_ep_in, XUA_ENDPOINT_COUNT_IN, - c_sof, epTypeTableOut, epTypeTableIn, - null, null, -1 , - (AUDIO_CLASS == 1) ? XUD_SPEED_FS : XUD_SPEED_HS, XUD_PWR_BUS); - - // // Buffering core - handles audio and control data to/from EP's and gives/gets data to/from the audio I/O core - // XUA_Buffer_lite(c_ep_out[0], - // c_ep_in[0], - // c_ep_out[1], - // null, //c_ep_in[XUA_ENDPOINT_COUNT_IN - 2],/*feedback*/ - // c_ep_in[XUA_ENDPOINT_COUNT_IN - 1], - // c_sof, p_for_mclk_count, c_audio); - - //[[combine]] - par{ - XUA_Buffer_lite2(i_ep0_ctl, - c_ep_out[1], - null, //c_ep_in[XUA_ENDPOINT_COUNT_IN - 2],/*feedback*/ - c_ep_in[XUA_ENDPOINT_COUNT_IN - 1], - c_sof, p_for_mclk_count, c_audio); - XUA_Endpoint0_select(c_ep_out[0], c_ep_in[0], i_ep0_ctl, null VENDOR_REQUESTS_PARAMS_DEC_); - } - par (int i = 0; i < 3; i++) burn_normal_priority(); - par (int i = 0; i < 2; i++) burn_high_priority(); - } - }//Tile[1] par - }//Top level par - - return 0; -} - - diff --git a/examples/xua_lite_example/src/audio_config.h b/examples/xua_lite_example/src/audio_config.h deleted file mode 100755 index 6b7c079b..00000000 --- a/examples/xua_lite_example/src/audio_config.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _AUDIO_CONFIG_ -#define _AUDIO_CONFIG_ - -void AudioHwConfigure(unsigned samFreq, client i2c_master_if i_i2c); -void pll_nudge(int nudge); -void setup_audio_gpio(out port p_gpio); - -#endif diff --git a/examples/xua_lite_example/src/audio_config.xc b/examples/xua_lite_example/src/audio_config.xc deleted file mode 100755 index 3235387d..00000000 --- a/examples/xua_lite_example/src/audio_config.xc +++ /dev/null @@ -1,279 +0,0 @@ -#include -#include -#include -#include -#include -#include "i2c.h" -#include "xua.h" -#define DEBUG_UNIT AUDIO_CFG -#define DEBUG_PRINT_ENABLE_AUDIO_CFG 1 -#include "debug_print.h" - - -// TLV320DAC3101 Device I2C Address -#define DAC3101_I2C_DEVICE_ADDR 0x18 - -// TLV320DAC3101 Register Addresses -// Page 0 -#define DAC3101_PAGE_CTRL 0x00 // Register 0 - Page Control -#define DAC3101_SW_RST 0x01 // Register 1 - Software Reset -#define DAC3101_CLK_GEN_MUX 0x04 // Register 4 - Clock-Gen Muxing -#define DAC3101_PLL_P_R 0x05 // Register 5 - PLL P and R Values -#define DAC3101_PLL_J 0x06 // Register 6 - PLL J Value -#define DAC3101_PLL_D_MSB 0x07 // Register 7 - PLL D Value (MSB) -#define DAC3101_PLL_D_LSB 0x08 // Register 8 - PLL D Value (LSB) -#define DAC3101_NDAC_VAL 0x0B // Register 11 - NDAC Divider Value -#define DAC3101_MDAC_VAL 0x0C // Register 12 - MDAC Divider Value -#define DAC3101_DOSR_VAL_LSB 0x0E // Register 14 - DOSR Divider Value (LS Byte) -#define DAC3101_CLKOUT_MUX 0x19 // Register 25 - CLKOUT MUX -#define DAC3101_CLKOUT_M_VAL 0x1A // Register 26 - CLKOUT M_VAL -#define DAC3101_CODEC_IF 0x1B // Register 27 - CODEC Interface Control -#define DAC3101_DAC_DAT_PATH 0x3F // Register 63 - DAC Data Path Setup -#define DAC3101_DAC_VOL 0x40 // Register 64 - DAC Vol Control -#define DAC3101_DACL_VOL_D 0x41 // Register 65 - DAC Left Digital Vol Control -#define DAC3101_DACR_VOL_D 0x42 // Register 66 - DAC Right Digital Vol Control -#define DAC3101_GPIO1_IO 0x33 // Register 51 - GPIO1 In/Out Pin Control -// Page 1 -#define DAC3101_HP_DRVR 0x1F // Register 31 - Headphone Drivers -#define DAC3101_SPK_AMP 0x20 // Register 32 - Class-D Speaker Amp -#define DAC3101_HP_DEPOP 0x21 // Register 33 - Headphone Driver De-pop -#define DAC3101_DAC_OP_MIX 0x23 // Register 35 - DAC_L and DAC_R Output Mixer Routing -#define DAC3101_HPL_VOL_A 0x24 // Register 36 - Analog Volume to HPL -#define DAC3101_HPR_VOL_A 0x25 // Register 37 - Analog Volume to HPR -#define DAC3101_SPKL_VOL_A 0x26 // Register 38 - Analog Volume to Left Speaker -#define DAC3101_SPKR_VOL_A 0x27 // Register 39 - Analog Volume to Right Speaker -#define DAC3101_HPL_DRVR 0x28 // Register 40 - Headphone Left Driver -#define DAC3101_HPR_DRVR 0x29 // Register 41 - Headphone Right Driver -#define DAC3101_SPKL_DRVR 0x2A // Register 42 - Left Class-D Speaker Driver -#define DAC3101_SPKR_DRVR 0x2B // Register 43 - Right Class-D Speaker Driver - -// TLV320DAC3101 easy register access defines -#define DAC3101_REGWRITE(reg, val) {i_i2c.write_reg(DAC3101_I2C_DEVICE_ADDR, reg, val);} - - -// Nominal setting is ref div = 25, fb_div = 1024, op_div = 2 -// PCF Freq 0.96MHz - -enum clock_nudge{ - PLL_SLOWER = -1, - PLL_NOMINAL = 0, - PLL_FASTER = 1 -}; - -//These steps provide just under +-0.1% frequency jumps -#define PLL_LOW 0xC003FE18 // This is 3.069MHz -#define PLL_NOM 0xC003FF18 // This is 3.072MHz -#define PLL_HIGH 0xC0040018 // This is 3.075MHz - -on tile[0]: out port p_leds = XS1_PORT_4F; - -//Note use of no_ack write to prevent backpressure. There is enough buffering to -//store both writes so we can move on without blocking -void pll_nudge(int nudge) { - if (nudge > 0){ - write_sswitch_reg_no_ack(get_tile_id(tile[0]), XS1_SSWITCH_PLL_CTL_NUM, PLL_HIGH); - p_leds <: 0x02; //LED B - } - else if (nudge < 0){ - write_sswitch_reg_no_ack(get_tile_id(tile[0]), XS1_SSWITCH_PLL_CTL_NUM, PLL_LOW); - p_leds <: 0x01; //LED A - - } - else { - p_leds <: 0x0; - } - write_sswitch_reg_no_ack(get_tile_id(tile[0]), XS1_SSWITCH_PLL_CTL_NUM, PLL_NOM); -} - -void setup_audio_gpio(out port p_gpio){ - // Reset DAC and disable MUTE - p_gpio <: 0x0; - delay_milliseconds(1); - p_gpio <: 0x1; - delay_milliseconds(1); -} - -void AudioHwConfigure(unsigned samFreq, client i2c_master_if i_i2c) -{ - - // Wait for 2ms because we apply reset for 1ms from other tile - delay_milliseconds(2); - - // Set register page to 0 - DAC3101_REGWRITE(DAC3101_PAGE_CTRL, 0x00); - // Initiate SW reset (PLL is powered off as part of reset) - DAC3101_REGWRITE(DAC3101_SW_RST, 0x01); - - // so I've got 24MHz in to PLL, I want 24.576MHz or 22.5792MHz out. - - // I will always be using fractional-N (D != 0) so we must set R = 1 - // PLL_CLKIN/P must be between 10 and 20MHz so we must set P = 2 - - // PLL_CLK = CLKIN * ((RxJ.D)/P) - // We know R = 1, P = 2. - // PLL_CLK = CLKIN * (J.D / 2) - - // For 24.576MHz: - // J = 8 - // D = 1920 - // So PLL_CLK = 24 * (8.192/2) = 24 x 4.096 = 98.304MHz - // Then: - // NDAC = 4 - // MDAC = 4 - // DOSR = 128 - // So: - // DAC_CLK = PLL_CLK / 4 = 24.576MHz. - // DAC_MOD_CLK = DAC_CLK / 4 = 6.144MHz. - // DAC_FS = DAC_MOD_CLK / 128 = 48kHz. - - // For 22.5792MHz: - // J = 7 - // D = 5264 - // So PLL_CLK = 24 * (7.5264/2) = 24 x 3.7632 = 90.3168MHz - // Then: - // NDAC = 4 - // MDAC = 4 - // DOSR = 128 - // So: - // DAC_CLK = PLL_CLK / 4 = 22.5792MHz. - // DAC_MOD_CLK = DAC_CLK / 4 = 5.6448MHz. - // DAC_FS = DAC_MOD_CLK / 128 = 44.1kHz. - -#if XUA_ADAPTIVE - //Set nominal clock speed on PLL - write_sswitch_reg(get_tile_id(tile[0]), XS1_SSWITCH_PLL_CTL_NUM, PLL_NOM); - - // We are assuming 48kHz family only and we generate MCLK in the DAC from BLCK supplied by XCORE - // Set PLL J Value to 8 - DAC3101_REGWRITE(DAC3101_PLL_J, 0x08); - // Set PLL D to 0 ... - // Set PLL D MSB Value to 0x00 - DAC3101_REGWRITE(DAC3101_PLL_D_MSB, 0x00); - // Set PLL D LSB Value to 0x00 - DAC3101_REGWRITE(DAC3101_PLL_D_LSB, 0x00); - - delay_milliseconds(1); - - // Set PLL_CLKIN = BCLK (device pin), CODEC_CLKIN = PLL_CLK (generated on-chip) - DAC3101_REGWRITE(DAC3101_CLK_GEN_MUX, 0x07); - - // Set PLL P=1 and R=4 values and power up. - DAC3101_REGWRITE(DAC3101_PLL_P_R, 0x94); - // Set NDAC clock divider to 4 and power up. - DAC3101_REGWRITE(DAC3101_NDAC_VAL, 0x84); - // Set MDAC clock divider to 4 and power up. - DAC3101_REGWRITE(DAC3101_MDAC_VAL, 0x84); - // Set OSR clock divider to 128. - DAC3101_REGWRITE(DAC3101_DOSR_VAL_LSB, 0x80); - -#else - /* Sample frequency dependent register settings */ - if ((samFreq % 11025) == 0) - { - // MCLK = 22.5792MHz (44.1,88.2,176.4kHz) - // Set PLL J Value to 7 - DAC3101_REGWRITE(DAC3101_PLL_J, 0x07); - // Set PLL D to 5264 ... (0x1490) - // Set PLL D MSB Value to 0x14 - DAC3101_REGWRITE(DAC3101_PLL_D_MSB, 0x14); - // Set PLL D LSB Value to 0x90 - DAC3101_REGWRITE(DAC3101_PLL_D_LSB, 0x90); - - } - else if ((samFreq % 8000) == 0) - { - // MCLK = 24.576MHz (48,96,192kHz) - // Set PLL J Value to 8 - DAC3101_REGWRITE(DAC3101_PLL_J, 0x08); - // Set PLL D to 1920 ... (0x780) - // Set PLL D MSB Value to 0x07 - DAC3101_REGWRITE(DAC3101_PLL_D_MSB, 0x07); - // Set PLL D LSB Value to 0x80 - DAC3101_REGWRITE(DAC3101_PLL_D_LSB, 0x80); - } - else - { - //debug_printf("Unrecognised sample freq of %d in ConfigCodec\n", samFreq); - } - - delay_milliseconds(1); - - // Set PLL_CLKIN = MCLK (device pin), CODEC_CLKIN = PLL_CLK (generated on-chip) - DAC3101_REGWRITE(DAC3101_CLK_GEN_MUX, 0x03); - - // Set PLL P and R values and power up. - DAC3101_REGWRITE(DAC3101_PLL_P_R, 0xA1); - // Set NDAC clock divider to 4 and power up. - DAC3101_REGWRITE(DAC3101_NDAC_VAL, 0x84); - // Set MDAC clock divider to 4 and power up. - DAC3101_REGWRITE(DAC3101_MDAC_VAL, 0x84); - // Set OSR clock divider to 128. - DAC3101_REGWRITE(DAC3101_DOSR_VAL_LSB, 0x80); - -#endif - - // Set CLKOUT Mux to DAC_CLK - DAC3101_REGWRITE(DAC3101_CLKOUT_MUX, 0x04); - // Set CLKOUT M divider to 1 and power up. - DAC3101_REGWRITE(DAC3101_CLKOUT_M_VAL, 0x81); - // Set GPIO1 output to come from CLKOUT output. - DAC3101_REGWRITE(DAC3101_GPIO1_IO, 0x10); - - // Set CODEC interface mode: I2S, 24 bit, slave mode (BCLK, WCLK both inputs). - DAC3101_REGWRITE(DAC3101_CODEC_IF, 0x20); - // Set register page to 1 - DAC3101_REGWRITE(DAC3101_PAGE_CTRL, 0x01); - // Program common-mode voltage to mid scale 1.65V. - DAC3101_REGWRITE(DAC3101_HP_DRVR, 0x14); - // Program headphone-specific depop settings. - // De-pop, Power on = 800 ms, Step time = 4 ms - DAC3101_REGWRITE(DAC3101_HP_DEPOP, 0x4E); - // Program routing of DAC output to the output amplifier (headphone/lineout or speaker) - // LDAC routed to left channel mixer amp, RDAC routed to right channel mixer amp - DAC3101_REGWRITE(DAC3101_DAC_OP_MIX, 0x44); - // Unmute and set gain of output driver - // Unmute HPL, set gain = 0 db - DAC3101_REGWRITE(DAC3101_HPL_DRVR, 0x06); - // Unmute HPR, set gain = 0 dB - DAC3101_REGWRITE(DAC3101_HPR_DRVR, 0x06); - // Unmute Left Class-D, set gain = 12 dB - DAC3101_REGWRITE(DAC3101_SPKL_DRVR, 0x0C); - // Unmute Right Class-D, set gain = 12 dB - DAC3101_REGWRITE(DAC3101_SPKR_DRVR, 0x0C); - // Power up output drivers - // HPL and HPR powered up - DAC3101_REGWRITE(DAC3101_HP_DRVR, 0xD4); - // Power-up L and R Class-D drivers - DAC3101_REGWRITE(DAC3101_SPK_AMP, 0xC6); - // Enable HPL output analog volume, set = -9 dB - DAC3101_REGWRITE(DAC3101_HPL_VOL_A, 0x92); - // Enable HPR output analog volume, set = -9 dB - DAC3101_REGWRITE(DAC3101_HPR_VOL_A, 0x92); - // Enable Left Class-D output analog volume, set = -9 dB - DAC3101_REGWRITE(DAC3101_SPKL_VOL_A, 0x92); - // Enable Right Class-D output analog volume, set = -9 dB - DAC3101_REGWRITE(DAC3101_SPKR_VOL_A, 0x92); - - delay_milliseconds(100); - - // Power up DAC - // Set register page to 0 - DAC3101_REGWRITE(DAC3101_PAGE_CTRL, 0x00); - // Power up DAC channels and set digital gain - // Powerup DAC left and right channels (soft step enabled) - DAC3101_REGWRITE(DAC3101_DAC_DAT_PATH, 0xD4); - // DAC Left gain = 0dB - DAC3101_REGWRITE(DAC3101_DACL_VOL_D, 0x00); - // DAC Right gain = 0dB - DAC3101_REGWRITE(DAC3101_DACR_VOL_D, 0x00); - // Unmute digital volume control - // Unmute DAC left and right channels - DAC3101_REGWRITE(DAC3101_DAC_VOL, 0x00); - - i_i2c.shutdown(); -} - - -//These are here just to silence compiler warnings about unimplemented xua callbacks (not needed in xua lite) -void AudioHwInit(){} -void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode, unsigned sampRes_DAC, unsigned sampRes_ADC){} diff --git a/examples/xua_lite_example/src/audio_hub.h b/examples/xua_lite_example/src/audio_hub.h deleted file mode 100644 index b7f1b7f9..00000000 --- a/examples/xua_lite_example/src/audio_hub.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "i2s.h" - -[[distributable]] -void AudioHub(server i2s_frame_callback_if i2s, streaming chanend c_audio, streaming chanend (&?c_ds_output)[1]); \ No newline at end of file diff --git a/examples/xua_lite_example/src/audio_hub.xc b/examples/xua_lite_example/src/audio_hub.xc deleted file mode 100644 index bec765a1..00000000 --- a/examples/xua_lite_example/src/audio_hub.xc +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include "i2s.h" -#include "i2c.h" -#include "xua.h" -#define DEBUG_UNIT XUA_AUDIO_HUB -#define DEBUG_PRINT_ENABLE_XUA_AUDIO_HUB 1 -#include "debug_print.h" -#include "mic_array.h" -#include "audio_config.h" -#include "pdm_mic.h" -#include "xua_buffer_lite.h" - -//Globally declared for 64b alignment -int mic_decimator_fir_data_array[8][THIRD_STAGE_COEFS_PER_STAGE * PDM_MAX_DECIMATION] = {{0}}; -mic_array_frame_time_domain mic_audio_frame[2]; - -[[distributable]] -void AudioHub(server i2s_frame_callback_if i2s, - streaming chanend c_audio, - streaming chanend (&?c_ds_output)[1]) -{ - int32_t samples_out[NUM_USB_CHAN_OUT] = {0}; - int32_t samples_in[NUM_USB_CHAN_IN] = {0}; - - int32_t clock_nudge = 0; - - //PDM mic and decimator - unsigned buffer; - int raw_mics[XUA_NUM_PDM_MICS] = {0}; - const unsigned decimatorCount = 1; // Supports up to 4 mics - mic_array_decimator_conf_common_t dcc; - mic_array_decimator_config_t dc[1]; - mic_array_frame_time_domain * unsafe current; - - mic_array_decimator_set_samprate(DEFAULT_FREQ, mic_decimator_fir_data_array[0], &dcc, dc); - mic_array_decimator_configure(c_ds_output, decimatorCount, dc); - mic_array_init_time_domain_frame(c_ds_output, decimatorCount, buffer, mic_audio_frame, dc); - - // Used for debug - //int saw = 0; - - while (1) { - select { - case i2s.init(i2s_config_t &?i2s_config, tdm_config_t &?tdm_config): - i2s_config.mode = I2S_MODE_I2S; - i2s_config.mclk_bclk_ratio = (MCLK_48/DEFAULT_FREQ)/64; - debug_printf("I2S init\n"); - delay_milliseconds(500); //Work around to ensure I2S does not start until enumeration complete so timing does not break for exchange - //This should be ideally done by set config by the host (via xua_buffer) to know we are enumerated - break; - - case i2s.receive(size_t n_chans, int32_t in_samps[n_chans]): - for (int i = 0; i < n_chans; i++) samples_in[i] = in_samps[i]; - break; - - case i2s.send(size_t n_chans, int32_t out_samps[n_chans]): - for (int i = 0; i < n_chans; i++) out_samps[i] = samples_out[i]; - break; - - //Exchange samples with mics & host - case i2s.restart_check() -> i2s_restart_t restart: - restart = I2S_NO_RESTART; // Keep on looping - timer tmr; int t0, t1; tmr :> t0; - - XUA_transfer_samples(c_audio, (unsigned *) samples_out, (unsigned *) raw_mics, (clock_nudge, int)); - - //Grab mics. Takes about 200 ticks currently - current = mic_array_get_next_time_domain_frame(c_ds_output, decimatorCount, buffer, mic_audio_frame, dc); - //50 ticks - unsafe { - for (int i = 0; i < XUA_NUM_PDM_MICS; i++) raw_mics[i] = current->data[i][0]; - } - - //memset(raw_mics, saw, sizeof(int) * XUA_NUM_PDM_MICS); - //saw += 500; - - //Taking about 160 ticks when adjusting, 100 when not - tmr :> t0; - pll_nudge(clock_nudge); - tmr :> t1; - if (t1-t0 > 500) debug_printf("*%d\n", t1 - t0); - //delay_microseconds(10); //Test backpressure tolerance - break; - } - } -} diff --git a/examples/xua_lite_example/src/pdm_mic.h b/examples/xua_lite_example/src/pdm_mic.h deleted file mode 100644 index 04b13c3f..00000000 --- a/examples/xua_lite_example/src/pdm_mic.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _PDM_MIC_H_ -#define _PDM_MIC_H_ - -#include "mic_array.h" - -void mic_array_decimator_set_samprate(const unsigned samplerate, int mic_decimator_fir_data_array[], mic_array_decimator_conf_common_t *dcc, mic_array_decimator_config_t dc[]); -void pdm_mic(streaming chanend c_ds_output, in buffered port:32 p_pdm_mics); -void mic_array_setup_ddr(clock pdmclk, clock pdmclk6, in port p_mclk, - out port p_pdm_clk, buffered in port:32 p_pdm_data, - int divide); - -#endif diff --git a/examples/xua_lite_example/src/pdm_mic.xc b/examples/xua_lite_example/src/pdm_mic.xc deleted file mode 100644 index 59d506be..00000000 --- a/examples/xua_lite_example/src/pdm_mic.xc +++ /dev/null @@ -1,112 +0,0 @@ -#include "xua.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mic_array.h" - - -void mic_array_decimator_set_samprate(const unsigned samplerate, int mic_decimator_fir_data_array[], mic_array_decimator_conf_common_t *dcc, mic_array_decimator_config_t dc[]) -{ - unsigned decimationfactor = 96000/samplerate; - int fir_gain_compen[7]; - int * unsafe fir_coefs[7]; - unsafe - { - fir_gain_compen[0] = 0; - fir_gain_compen[1] = FIR_COMPENSATOR_DIV_2; //48kHz - fir_gain_compen[2] = FIR_COMPENSATOR_DIV_4; - fir_gain_compen[3] = FIR_COMPENSATOR_DIV_6; //16kHz - fir_gain_compen[4] = FIR_COMPENSATOR_DIV_8; - fir_gain_compen[5] = 0; - fir_gain_compen[6] = FIR_COMPENSATOR_DIV_12; - - fir_coefs[0] = 0; - fir_coefs[1] = (int * unsafe)g_third_stage_div_2_fir; - fir_coefs[2] = (int * unsafe)g_third_stage_div_4_fir; - fir_coefs[3] = (int * unsafe)g_third_stage_div_6_fir; - fir_coefs[4] = (int * unsafe)g_third_stage_div_8_fir; - fir_coefs[5] = 0; - fir_coefs[6] = (int * unsafe)g_third_stage_div_12_fir; - - //dcc = {MIC_ARRAY_MAX_FRAME_SIZE_LOG2, 1, 0, 0, decimationfactor, fir_coefs[decimationfactor/2], 0, 0, DECIMATOR_NO_FRAME_OVERLAP, 2}; - dcc->len = MIC_ARRAY_MAX_FRAME_SIZE_LOG2; - dcc->apply_dc_offset_removal = 1; - dcc->index_bit_reversal = 0; - dcc->windowing_function = null; - dcc->output_decimation_factor = decimationfactor; - dcc->coefs = fir_coefs[decimationfactor/2]; - dcc->apply_mic_gain_compensation = 0; - dcc->fir_gain_compensation = fir_gain_compen[decimationfactor/2]; - dcc->buffering_type = DECIMATOR_NO_FRAME_OVERLAP; - dcc->number_of_frame_buffers = 2; - - //dc[0] = {&dcc, mic_decimator_fir_data[0], {0, 0, 0, 0}, 4}; - dc[0].dcc = dcc; - dc[0].data = mic_decimator_fir_data_array; - dc[0].mic_gain_compensation[0]=0; - dc[0].mic_gain_compensation[1]=0; - dc[0].mic_gain_compensation[2]=0; - dc[0].mic_gain_compensation[3]=0; - dc[0].channel_count = 4; - } -} - -#if MAX_FREQ > 48000 -#error MAX_FREQ > 48000 NOT CURRENTLY SUPPORTED -#endif - -void pdm_mic(streaming chanend c_ds_output, in buffered port:32 p_pdm_mics) -{ - streaming chan c_4x_pdm_mic_0; - assert((MCLK_48 / 3072000) == (MCLK_441 / 2822400)); //Make sure mic clock is achievable from MCLK - par - { - mic_array_pdm_rx(p_pdm_mics, c_4x_pdm_mic_0, null); - mic_array_decimate_to_pcm_4ch(c_4x_pdm_mic_0, c_ds_output, MIC_ARRAY_NO_INTERNAL_CHANS); - - } -} - -void mic_array_setup_ddr(clock pdmclk, - clock pdmclk6, - in port p_mclk, /*used only in I2S slave case*/ - out port p_pdm_clk, - buffered in port:32 p_pdm_data, - int divide) { - - -#if !XUA_ADAPTIVE //i2s slave - //p_mclk coming from the Pi is 24.576 MHz - configure_clock_src_divide(pdmclk, p_mclk, 4); //3.072 = 24.576 / 8 - configure_clock_src_divide(pdmclk6, p_mclk, 2); //6.144 = 24.576 / 4 - -#else - configure_clock_xcore(pdmclk, 80); // 3.072 - configure_clock_xcore(pdmclk6, 40); // 6.144 -#endif - - configure_port_clock_output(p_pdm_clk, pdmclk); - configure_in_port(p_pdm_data, pdmclk6); - - /* start the faster capture clock */ - start_clock(pdmclk6); - /* wait for a rising edge on the capture clock */ - partin(p_pdm_data, 4); - /* start the slower output clock */ - start_clock(pdmclk); - - /* - * this results in the rising edge of the capture clock - * leading the rising edge of the output clock by one period - * of p_mclk, which is about 40.7 ns for the typical frequency - * of 24.576 megahertz. - * This should fall within the data valid window. - */ - -} diff --git a/examples/xua_lite_example/test/Makefile b/examples/xua_lite_example/test/Makefile deleted file mode 100644 index b3bbbe69..00000000 --- a/examples/xua_lite_example/test/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2018, XMOS Ltd, All rights reserved - -#Note no xcommon included - we are going bareback here because xcommon not good -#at dealing excluding/including source directories out of normal structure. -#We want to have a test app here using some source files from sw_vocalfusion (delay estimator) - - -BUILD_FLAGS = -O3 -g -XCC_FLAGS = $(BUILD_FLAGS) - -INCLUDE_DIRS = \ - -I ../src/ \ - -I . \ - -COMMON = \ - -O2 -g -report \ - -target=XCORE-200-EXPLORER \ - -SOURCES = \ - ./test_fifo.xc \ - -BINARY=bin/test_fifo.xe \ - - -all: - mkdir -p bin; \ - mv test_fifoxc test_fifo.xc; \ - xcc $(SOURCES) $(COMMON) $(INCLUDE_DIRS) -D AUDIO_DELAY_SAMPLES=$$DELAY -o $(BINARY); \ - mv test_fifo.xc test_fifoxc; \ - -sim: - xsim $(BINARY) - -clean: - rm -rf bin/* diff --git a/examples/xua_lite_example/test/test_fifoxc b/examples/xua_lite_example/test/test_fifoxc deleted file mode 100644 index befb966b..00000000 --- a/examples/xua_lite_example/test/test_fifoxc +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include "fifo_impl.h" - -typedef enum test_t{ - FAIL=0, - PASS=1 -}test_t; - -#define FIFO_SIZE 4 - -unsafe test_t test_is_empty(mem_fifo_short_t * unsafe fifo){ - unsigned fill = fifo_get_fill_short(fifo); - short data[1]; - fifo_ret_t ret = fifo_block_pop_short(fifo, data, 1); - if (fill == 0 && ret == FIFO_EMPTY) return PASS; - return FAIL; -} - -unsafe test_t test_push_one(mem_fifo_short_t * unsafe fifo){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[] = {123}; - fifo_ret_t ret = fifo_block_push_short(fifo, data, 1); - unsigned fill_1 = fifo_get_fill_short(fifo); - - if (ret != FIFO_SUCCESS || fill_0 + 1 != fill_1) return FAIL; - return PASS; -} - -unsafe test_t test_partial_fill(mem_fifo_short_t * unsafe fifo){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[] = {80, 90, 100}; - fifo_ret_t ret = fifo_block_push_short(fifo, data, 3); - unsigned fill_1 = fifo_get_fill_short(fifo); - - if (ret != FIFO_SUCCESS || fill_0 != 0 || fill_1 != 3) return FAIL; - return PASS; -} - -unsafe test_t test_fill_level(mem_fifo_short_t * unsafe fifo){ - unsigned fill = fifo_get_fill_short(fifo); - if (fill != 3) return FAIL; - return PASS; -} - -unsafe test_t test_pop_one(mem_fifo_short_t * unsafe fifo, short expect){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[1] = {0xffff}; - fifo_ret_t ret = fifo_block_pop_short(fifo, data, 1); - unsigned fill_1 = fifo_get_fill_short(fifo); - if (ret != FIFO_SUCCESS || fill_0 != fill_1 + 1 || data[0] != expect) { - printf("grr %d\n", data[0]); - return FAIL; - } - return PASS; -} - -unsafe test_t test_pop_three_fail(mem_fifo_short_t * unsafe fifo){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[3] = {0xffff, 0xffff, 0xffff}; - fifo_ret_t ret = fifo_block_pop_short(fifo, data, 3); - unsigned fill_1 = fifo_get_fill_short(fifo); - if (ret == FIFO_SUCCESS || fill_0 != 2 || fill_1 != 2) return FAIL; - return PASS; -} - -unsafe test_t test_partial_fill_fast(mem_fifo_short_t * unsafe fifo){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[] = {20, 30, 40}; - fifo_ret_t ret = fifo_block_push_short_fast(fifo, data, 3); - unsigned fill_1 = fifo_get_fill_short(fifo); - - if (ret != FIFO_SUCCESS || fill_0 != 0 || fill_1 != 3) return FAIL; - return PASS; -} - -unsafe test_t test_pop_block_fast(mem_fifo_short_t * unsafe fifo, short expect[], unsigned n){ - unsigned fill_0 = fifo_get_fill_short(fifo); - short data[10] = {0xffff}; - fifo_ret_t ret = fifo_block_pop_short_fast(fifo, data, n); - unsigned fill_1 = fifo_get_fill_short(fifo); - unsigned data_ok = memcmp(data, expect, n * sizeof(short)) == 0; - if (ret != FIFO_SUCCESS || fill_0 != fill_1 + n || !data_ok) return FAIL; - return PASS; -} - -unsafe void print_fifo(mem_fifo_short_t * unsafe fifo){ - for (int i = fifo->size - 1; i >= 0; i--){ - printf("FIFO[%d]: %hd %s %s\n", i, fifo->data_base_ptr[i], fifo->read_idx == i ? "RD" : "", fifo->write_idx == i ? "WR" : ""); - } -} - - -int main(void){ - unsafe{ - short test_fifo_storage[FIFO_SIZE]; - mem_fifo_short_t test_fifo = {sizeof(test_fifo_storage)/sizeof(test_fifo_storage[0]), test_fifo_storage, 0, 0}; - volatile mem_fifo_short_t * unsafe test_fifo_ptr = &test_fifo; - - // print_fifo(test_fifo_ptr); - printf("test_is_empty: %d\n", test_is_empty(test_fifo_ptr)); - printf("test_partial_fill: %d\n", test_partial_fill(test_fifo_ptr)); - // print_fifo(test_fifo_ptr); - - printf("test_fill_level: %d\n", test_fill_level(test_fifo_ptr)); - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 80)); - printf("test_pop_three_fail: %d\n", test_pop_three_fail(test_fifo_ptr)); - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 90)); - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 100)); - printf("test_is_empty: %d\n", test_is_empty(test_fifo_ptr)); - - printf("test_partial_fill_fast: %d\n", test_partial_fill_fast(test_fifo_ptr)); - - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 20)); - // print_fifo(test_fifo_ptr); - - short td[] = {30, 40}; - - printf("test_pop_block_fast: %d\n", test_pop_block_fast(test_fifo_ptr, td, 2)); //no wrap - - printf("test_is_empty: %d\n", test_is_empty(test_fifo_ptr)); - printf("test_push_one: %d\n", test_push_one(test_fifo_ptr)); - printf("test_push_one: %d\n", test_push_one(test_fifo_ptr)); - printf("test_pop_three_fail: %d\n", test_pop_three_fail(test_fifo_ptr)); - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 123)); - printf("test_pop_one: %d\n", test_pop_one(test_fifo_ptr, 123)); - - printf("test_partial_fill_fast: %d\n", test_partial_fill_fast(test_fifo_ptr)); //no wrap - short te[] = {20, 30, 40}; - printf("test_pop_block_fast: %d\n", test_pop_block_fast(test_fifo_ptr, te, 3));// no wrap - printf("test_partial_fill_fast: %d\n", test_partial_fill_fast(test_fifo_ptr)); //wrap - printf("test_pop_block_fast: %d\n", test_pop_block_fast(test_fifo_ptr, te, 3));// wrap - // print_fifo(test_fifo_ptr); - - - - - return 0; - } -} \ No newline at end of file diff --git a/examples/xua_lite_example/todo.txt b/examples/xua_lite_example/todo.txt deleted file mode 100644 index 4d0ab456..00000000 --- a/examples/xua_lite_example/todo.txt +++ /dev/null @@ -1,22 +0,0 @@ -- Bring ep0 serivice into xua_buffer select (make control mem) (DONE) -- Tidy feedback endpoint (DONE) -- Input path + FIFO (DONE) -- Function prototypes into includes (DONE) -- Single input/ouput format (DONE) -- Get UAC1 / FS working (DONE) -- Optimised EP buffer (either triple block or block FIFO) (DONE) -- Fix output gain issue (IN PROGRESS) -- Add timer to xua_buffer to prepare for exchange with audio (remove backpressure to audio) (WONT DO - use port buffer and reduce case overhead) -- Adaptive endpoint EP and descriptors (DONE) -- Adpative clock control (IN PROGRESS) -- Proper control loop w/filtering (IN PROGRESS) -- Switchable MICS using define (WONT DO - separate app) -- DFU -- Combinable EP0 (DONE) -- Interrupt EP0 option -- Control processing -- Fix cast warning (DONE) -- Work out why no clock drift on Android / OSX (drift seen on Linux and Win) (DONE) -- Tidy/cut down EP0 handling -- Broader host testing (Android, W10, MAC) (IN PROGRESS) -- Peer review diff --git a/examples/xua_lite_example/wscript b/examples/xua_lite_example/wscript deleted file mode 100644 index 5d6de68c..00000000 --- a/examples/xua_lite_example/wscript +++ /dev/null @@ -1,26 +0,0 @@ -def options(ctx): - ctx.add_option('--target', action='store', default='xua_lite_example.xe') - ctx.add_option('--debug', action='store_true') - - -def configure(conf): - conf.load('xwaf.compiler_xcc') - conf.env.PROJECT_ROOT = '../../..' - -def build(bld): - target_path = 'bin/' + bld.options.target - bld.env.TARGET_ARCH ='config/RPI_HAT_60QFN.xn' - bld.env.XSCOPE = bld.path.find_resource('config.xscope') - depends_on = ['lib_xua','lib_i2s','lib_xud','lib_mic_array', 'lib_i2c'] - #bld.env.XCC_FLAGS = ['-O2', '-g', '-Wall', '-fcmdline-buffer-bytes=512', '-report', '-DDISABLE_STAGE_C'] - bld.env.XCC_FLAGS = ['-fcomment-asm','-Xmapper','--map','-Xmapper','MAPFILE', - '-Os','-report','-g','-Wno-unused-function','-Wno-timing', - '-DXUD_SERIES_SUPPORT=XUD_X200_SERIES','-DUSB_TILE=tile[1]', - '-DMIC_ARRAY_CH0=PIN0','-DMIC_ARRAY_CH1=PIN4', '-DDEBUG_PRINT_ENABLE=1'] - if bld.options.debug: - bld.env.XCC_FLAGS.append('-DDEBUG') - - source = bld.path.ant_glob(['src/**/*.xc', 'src/**/*.c', - 'xua_lite/**/*.xc', 'xua_lite/**/*.c']) - includes = ['config'] - bld.program(source=source, includes=includes, depends_on=depends_on,target=target_path) diff --git a/examples/xua_lite_example/xua_lite/rate_control/fifo_impl.h b/examples/xua_lite_example/xua_lite/rate_control/fifo_impl.h deleted file mode 100644 index 080f3c95..00000000 --- a/examples/xua_lite_example/xua_lite/rate_control/fifo_impl.h +++ /dev/null @@ -1,206 +0,0 @@ -#ifndef __FIFO__ -#define __FIFO__ -#include //memcpy -#include "fifo_types.h" - -//Asynch FIFO implementaion -//Note these are in the include file to allow the compiler to inline for performance - -/////////////////////////////////////// -//Shared memory FIFO (sample by sample) -//Can be any size -/////////////////////////////////////// - - -static inline unsigned fifo_get_fill(volatile mem_fifo_t * unsafe fifo) { - unsafe{ - unsigned fifo_fill = 0; - if (fifo->write_idx >= fifo->read_idx){ - fifo_fill = fifo->write_idx - fifo->read_idx; - } - else{ - fifo_fill = (fifo->size + fifo->write_idx) - fifo->read_idx; - } - return fifo_fill; - } -} - -static inline unsigned fifo_get_fill_short(volatile mem_fifo_short_t * unsafe fifo) { - unsafe{ - unsigned fifo_fill = 0; - if (fifo->write_idx >= fifo->read_idx){ - fifo_fill = fifo->write_idx - fifo->read_idx; - } - else{ - fifo_fill = (fifo->size + fifo->write_idx) - fifo->read_idx; - } - return fifo_fill; - } -} - -static inline void fifo_init_short(volatile mem_fifo_short_t * unsafe fifo) { - unsafe{ - fifo->write_idx = 0; - fifo->read_idx = (fifo->size * 2) / 4; - memset(fifo->data_base_ptr , 0, fifo->size * sizeof(short)); - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_push(volatile mem_fifo_t * unsafe fifo, int data[], unsigned n) { - unsafe{ - //check there is a block of space large enough - unsigned space_remaining = fifo->size - fifo_get_fill(fifo) - 1; - if (n > space_remaining) { - return FIFO_FULL; - } - for (int i = 0; i < n; i++){ - unsigned next_idx = fifo->write_idx + 1; - if (next_idx == fifo->size) next_idx = 0; //Check for wrap - fifo->data_base_ptr[fifo->write_idx] = data[i]; - fifo->write_idx = next_idx; - } - return FIFO_SUCCESS; - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_push_short(volatile mem_fifo_short_t * unsafe fifo, short data[], unsigned n) { - unsafe{ - //check there is a block of space large enough - unsigned space_remaining = fifo->size - fifo_get_fill_short(fifo) - 1; - if (n > space_remaining) { - return FIFO_FULL; - } - for (int i = 0; i < n; i++){ - unsigned next_idx = fifo->write_idx + 1; - if (next_idx == fifo->size) next_idx = 0; //Check for wrap - fifo->data_base_ptr[fifo->write_idx] = data[i]; - fifo->write_idx = next_idx; - } - return FIFO_SUCCESS; - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_push_short_fast(volatile mem_fifo_short_t * unsafe fifo, short data[], unsigned n) { - unsafe{ - //check there is a block of space large enough - unsigned space_remaining = fifo->size - fifo_get_fill_short(fifo) - 1; - if (n > space_remaining) { - return FIFO_FULL; - } - //We will write either one or two blocks depending on wrap - unsigned first_block_size = 0; - unsigned second_block_size = 0; - - //See if we need to wrap during block writes - unsigned space_left_at_top = fifo->size - fifo->write_idx; - //printf("space_left_at_top %d\n", space_left_at_top); - //Yes, we do need to wrap - if (n > space_left_at_top){ - first_block_size = space_left_at_top; - second_block_size = n - space_left_at_top; - memcpy(&fifo->data_base_ptr[fifo->write_idx], &data[0], first_block_size * sizeof(short)); - memcpy(&fifo->data_base_ptr[0], &data[first_block_size], second_block_size * sizeof(short)); - fifo->write_idx = second_block_size; - } - //No wrap, do all in one go - else{ - first_block_size = n; - second_block_size = 0; - memcpy(&fifo->data_base_ptr[fifo->write_idx], &data[0], first_block_size * sizeof(short)); - fifo->write_idx += first_block_size; - } - - return FIFO_SUCCESS; - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_pop(volatile mem_fifo_t * unsafe fifo, int data[], unsigned n) { - unsafe{ - //Check we have a block big enough to send - if (n > fifo_get_fill(fifo)){ - return FIFO_EMPTY; - } - for (int i = 0; i < n; i++){ - data[i] = fifo->data_base_ptr[fifo->read_idx]; - fifo->read_idx++; - if (fifo->read_idx == fifo->size) fifo->read_idx = 0; //Check for wrap - } - return FIFO_SUCCESS; - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_pop_short(volatile mem_fifo_short_t * unsafe fifo, short data[], unsigned n) { - unsafe{ - //Check we have a block big enough to send - if (n > fifo_get_fill_short(fifo)){ - return FIFO_EMPTY; - } - for (int i = 0; i < n; i++){ - data[i] = fifo->data_base_ptr[fifo->read_idx]; - fifo->read_idx++; - if (fifo->read_idx == fifo->size) fifo->read_idx = 0; //Check for wrap - } - return FIFO_SUCCESS; - } -} - -#pragma unsafe arrays -static inline fifo_ret_t fifo_block_pop_short_fast(volatile mem_fifo_short_t * unsafe fifo, short data[], unsigned n) { - unsafe{ - //Check we have a block big enough to send - if (n > fifo_get_fill_short(fifo)){ - return FIFO_EMPTY; - } - //We will read either one or two blocks depending on wrap - unsigned first_block_size = 0; - unsigned second_block_size = 0; - - //See if we need to wrap during block read - unsigned num_read_at_top = fifo->size - fifo->read_idx; - // printf("num_read_at_top %d\n", num_read_at_top); - //Yes, we do need to wrap - if (n > num_read_at_top){ - first_block_size = num_read_at_top; - second_block_size = n - num_read_at_top; - memcpy(&data[0], &fifo->data_base_ptr[fifo->read_idx], first_block_size * sizeof(short)); - memcpy( &data[first_block_size], &fifo->data_base_ptr[0], second_block_size * sizeof(short)); - fifo->read_idx = second_block_size; - // printf("wrap\n"); - } - //No wrap, do all in one go - else{ - first_block_size = n; - second_block_size = 0; - memcpy(&data[0], &fifo->data_base_ptr[fifo->read_idx], first_block_size * sizeof(short)); - fifo->read_idx += first_block_size; - // printf("no wrap\n"); - - } - - return FIFO_SUCCESS; - } -} - -//Version of above that returns fill level relative to half full -static inline int fifo_get_fill_relative_half(volatile mem_fifo_t * unsafe fifo){ - unsafe{ - int fifo_fill = (int)fifo_get_fill(fifo); - fifo_fill -= (fifo->size / 2); - return fifo_fill; - } -} - -//Version of above that returns fill level relative to half full -static inline int fifo_get_fill_relative_half_short(volatile mem_fifo_short_t * unsafe fifo){ - unsafe{ - int fifo_fill = (int)fifo_get_fill_short(fifo); - fifo_fill -= (fifo->size / 2); - return fifo_fill; - } -} -#endif diff --git a/examples/xua_lite_example/xua_lite/rate_control/fifo_types.h b/examples/xua_lite_example/xua_lite/rate_control/fifo_types.h deleted file mode 100644 index af7994e7..00000000 --- a/examples/xua_lite_example/xua_lite/rate_control/fifo_types.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __ASRC_FIFO_TYPES__ -#define __ASRC_FIFO_TYPES__ -#include - -//Shared FIFO return types -typedef enum fifo_ret_t { - FIFO_SUCCESS = 0, - FIFO_FULL, - FIFO_EMPTY -} fifo_ret_t; - -///////////////////////////////////////////////////////////////////////// -//Shared memory FIFO (sample by sample or block) -//Can be any size -// -//Note that the actual storage for the FIFO is declared externally -//and a reference to the base address of the storage is passed in along -//with the size of the storage. This way, multiple instances may be -//different sizes. -// -///////////////////////////////////////////////////////////////////////// - -typedef struct mem_fifo_t { - const unsigned size; //Size in INTs - int * const unsafe data_base_ptr; //Base of the data array - declared externally so we can have differnt sized FIFOs - unsigned write_idx; - unsigned read_idx; -} mem_fifo_t; - -typedef struct mem_fifo_short_t { - const unsigned size; //Size in SHORTs - short * const unsafe data_base_ptr; //Base of the data array - declared externally so we can have differnt sized FIFOs - unsigned write_idx; - unsigned read_idx; -} mem_fifo_short_t; - -#endif diff --git a/examples/xua_lite_example/xua_lite/rate_control/rate_controller.h b/examples/xua_lite_example/xua_lite/rate_control/rate_controller.h deleted file mode 100644 index 8dee3f75..00000000 --- a/examples/xua_lite_example/xua_lite/rate_control/rate_controller.h +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -typedef int32_t xua_lite_fixed_point_t; - -typedef struct pid_state_t{ - xua_lite_fixed_point_t fifo_level_filtered_old; - xua_lite_fixed_point_t fifo_level_accum; -} pid_state_t; - - -//USB Adaptive mode helper -xua_lite_fixed_point_t do_rate_control(int fill_level, pid_state_t *pid_state); - -//PDM modulator for clock control -void do_clock_nudge_pdm(xua_lite_fixed_point_t controller_out, int *clock_nudge); - - -//USB Asynch mode helper -void do_feedback_calculation(unsigned &sof_count, const unsigned mclk_hz, unsigned mclk_port_counter,unsigned &mclk_port_counter_old - ,long long &feedback_value, unsigned &mod_from_last_time, unsigned fb_clocks[1]); \ No newline at end of file diff --git a/examples/xua_lite_example/xua_lite/rate_control/rate_controller.xc b/examples/xua_lite_example/xua_lite/rate_control/rate_controller.xc deleted file mode 100644 index 58fddf48..00000000 --- a/examples/xua_lite_example/xua_lite/rate_control/rate_controller.xc +++ /dev/null @@ -1,201 +0,0 @@ -#include -#include "xua_buffer_lite.h" -#include "rate_controller.h" -#define DEBUG_UNIT XUA_RATE_CONTROL -#define DEBUG_PRINT_ENABLE_XUA_RATE_CONTROL 1 -#include "debug_print.h" - -#define XUA_LIGHT_FIXED_POINT_Q_BITS 10 //Including sign bit. 10b gets us to +511.999999 to -512.000000 -#define XUA_LIGHT_FIXED_POINT_TOTAL_BITS (sizeof(xua_lite_fixed_point_t) * 8) -#define XUA_LIGHT_FIXED_POINT_FRAC_BITS (XUA_LIGHT_FIXED_POINT_TOTAL_BITS - XUA_LIGHT_FIXED_POINT_Q_BITS) -#define XUA_LIGHT_FIXED_POINT_ONE (1 << XUA_LIGHT_FIXED_POINT_FRAC_BITS) -#define XUA_LIGHT_FIXED_POINT_MINUS_ONE (-XUA_LIGHT_FIXED_POINT_ONE) - -#define FIFO_LEVEL_EMA_COEFF 0.939 //Proportion of signal from y[-1]. - //0.939 gives ~10Hz 3db cutoff low pass filter for filter rate of 1kHz - //dsp.stackexchange.com/questions/40462/exponential-moving-average-cut-off-frequency/40465 -#define FIFO_LEVEL_A_COEFF ((int32_t)(INT_MAX * FIFO_LEVEL_EMA_COEFF)) //Scale to signed 1.31 format -#define FIFO_LEVEL_B_COEFF (INT_MAX - FIFO_LEVEL_A_COEFF) - -#define RANDOMISATION_PERCENT 20 //How much radnom noise to inject in percent of existing signal amplitude -#define RANDOMISATION_COEFF_A ((INT_MAX / 100) * RANDOMISATION_PERCENT) - -#define PID_CALC_OVERHEAD_BITS 2 //Allow large P,I or D constants, up to 2^(this number) - - -#define PID_CONTROL_P_TERM 10.0 -#define PID_CONTROL_I_TERM 150.0 -#define PID_CONTROL_D_TERM 1.0 - -#define PID_RATE_MULTIPLIER SOF_FREQ_HZ - -#define PID_CONTROL_P_TERM_COEFF ((xua_lite_fixed_point_t)((XUA_LIGHT_FIXED_POINT_ONE >> PID_CALC_OVERHEAD_BITS) * (float)PID_CONTROL_P_TERM)) //scale to fixed point -#define PID_CONTROL_I_TERM_COEFF ((xua_lite_fixed_point_t)((XUA_LIGHT_FIXED_POINT_ONE >> PID_CALC_OVERHEAD_BITS) * (float)PID_CONTROL_I_TERM / PID_RATE_MULTIPLIER)) //scale to fixed point -#define PID_CONTROL_D_TERM_COEFF ((xua_lite_fixed_point_t)((XUA_LIGHT_FIXED_POINT_ONE >> PID_CALC_OVERHEAD_BITS) * (float)PID_CONTROL_D_TERM * PID_RATE_MULTIPLIER)) //scale to fixed point - - -static inline xua_lite_fixed_point_t do_fifo_depth_lowpass_filter(xua_lite_fixed_point_t old, int fifo_depth){ - //we grow from 32b to 64b for intermediate - int64_t intermediate = ((int64_t)(fifo_depth << XUA_LIGHT_FIXED_POINT_FRAC_BITS) * (int64_t)FIFO_LEVEL_B_COEFF) + ((int64_t)old * (int64_t)FIFO_LEVEL_A_COEFF); - xua_lite_fixed_point_t new_fifo_depth = (xua_lite_fixed_point_t)( intermediate >> (64 - XUA_LIGHT_FIXED_POINT_TOTAL_BITS - 1)); //-1 because signed int - return new_fifo_depth; -} - -static inline int32_t get_random_number(void) -{ - static const unsigned random_poly = 0xEDB88320; - static unsigned random = 0x12345678; - crc32(random, -1, random_poly); - return (int32_t) random; -} - -static inline xua_lite_fixed_point_t add_noise(xua_lite_fixed_point_t input){ - //Note the input number cannot be bigger than 2 ^ (FIXED_POINT_Q_BITS - 1) * (1 + PERCENT) else we could oveflow - //Eg. if Q bits = 10 then biggest input value is 255.9999 - int32_t random = get_random_number(); - int32_t input_fraction = ((int64_t)input * (int64_t)RANDOMISATION_COEFF_A) >> (XUA_LIGHT_FIXED_POINT_TOTAL_BITS - 1); - int64_t output_64 = ((int64_t)input << (XUA_LIGHT_FIXED_POINT_TOTAL_BITS - 1)) + ((int64_t)input_fraction * (int64_t)random); - return (xua_lite_fixed_point_t)( output_64 >> (64 - XUA_LIGHT_FIXED_POINT_TOTAL_BITS - 1)); -} - -//Convert the control input into a pdm output (dither) with optional noise -void do_clock_nudge_pdm(xua_lite_fixed_point_t controller_out, int *clock_nudge){ - - //Randomise - add a proportion of rectangular probability distribution noise to spread the spectrum - controller_out = add_noise(controller_out); - - //Convert to pulse density modulation (sigma-delta) - static xua_lite_fixed_point_t nudge_accumulator = 0; - nudge_accumulator += controller_out; //Note no overflow check as if we reach XUA_LIGHT_FIXED_POINT_Q_BITS - //something is very wrong - //printf("co: %d ratio: %f \n", controller_out, (float)controller_out/XUA_LIGHT_FIXED_POINT_ONE); - if (nudge_accumulator >= XUA_LIGHT_FIXED_POINT_ONE){ - *clock_nudge = 1; - nudge_accumulator -= XUA_LIGHT_FIXED_POINT_ONE; - } - else if (nudge_accumulator <= XUA_LIGHT_FIXED_POINT_MINUS_ONE){ - nudge_accumulator -= XUA_LIGHT_FIXED_POINT_MINUS_ONE; - *clock_nudge = -1; - } - else{ - *clock_nudge = 0; - } -} - - -//Do PI control and modulation for adaptive USB audio -xua_lite_fixed_point_t do_rate_control(int fill_level, pid_state_t *pid_state){ - - //We always check the FIFO level after USB has produced a block, and total FIFO size is 2x max, so half full is at 3/4 - const int half_full = ((MAX_OUT_SAMPLES_PER_SOF_PERIOD * 2) * 3) / 4; - int fill_level_wrt_half = fill_level - half_full; //Will be +ve for more than half full and negative for less than half full - - //Low pass filter fill level and get error w.r.t. to set point which is depth = 0 (relative to half full) - xua_lite_fixed_point_t fifo_level_filtered = do_fifo_depth_lowpass_filter(pid_state->fifo_level_filtered_old , fill_level_wrt_half); - //printf("old fill_level: %f fill_level: %f\n", (float)pid_state->fifo_level_filtered_old/(1<fifo_level_accum + fifo_level_filtered; - - //clip the I term (which can wind up) to maximum fixed point representation. Check to see if overflow (which will change sign) - if (fifo_level_filtered >= 0){ //If it was positive before, ensure it still is else clip to positive - if (i_term_pre_clip >= pid_state->fifo_level_accum){ - //debug_printf("grow %d %d\n", (int32_t)i_term_pre_clip, (int32_t)pid_state->fifo_level_accum); - pid_state->fifo_level_accum = i_term_pre_clip; - } - else{ - pid_state->fifo_level_accum = INT_MAX; - //debug_printf("clip+ %d\n", pid_state->fifo_level_accum); - } - } - else{ //Value was negative so ensure it still is else clip negative - if (i_term_pre_clip <= pid_state->fifo_level_accum){ - pid_state->fifo_level_accum = i_term_pre_clip; - } - else{ - pid_state->fifo_level_accum = INT_MIN; - //debug_printf("clip- %d %d\n", pid_state->fifo_level_accum, fifo_level_filtered); - } - } - - //Calculate D term. No clipping required because it can never be larger than the D term, - //which is already scaled to fit within the fixed point representation - xua_lite_fixed_point_t fifo_level_delta = fifo_level_filtered - pid_state->fifo_level_filtered_old; - - //Save to struct for next iteration - pid_state->fifo_level_filtered_old = fifo_level_filtered; - - //Do PID calculation. Note there is an implicit cast back to xua_lite_fixed_point_t before assignment - xua_lite_fixed_point_t p_term = (((int64_t) fifo_level_filtered * (int64_t)PID_CONTROL_P_TERM_COEFF)) >> XUA_LIGHT_FIXED_POINT_FRAC_BITS; - xua_lite_fixed_point_t i_term = (((int64_t) pid_state->fifo_level_accum * (int64_t)PID_CONTROL_I_TERM_COEFF)) >> XUA_LIGHT_FIXED_POINT_FRAC_BITS; - xua_lite_fixed_point_t d_term = (((int64_t) fifo_level_delta * (int64_t)PID_CONTROL_D_TERM_COEFF)) >> XUA_LIGHT_FIXED_POINT_FRAC_BITS; - - //debug_printf("p: %d i: %d f: %d\n", p_term >> XUA_LIGHT_FIXED_POINT_Q_BITS, i_term >> XUA_LIGHT_FIXED_POINT_Q_BITS, fifo_level_filtered >> (XUA_LIGHT_FIXED_POINT_FRAC_BITS - 10)); - //printf("p: %f i: %f d: %f filtered: %f integrated: %f\n", (float)p_term / (1<<(XUA_LIGHT_FIXED_POINT_FRAC_BITS-PID_CALC_OVERHEAD_BITS)), (float)i_term / (1<<(XUA_LIGHT_FIXED_POINT_FRAC_BITS-PID_CALC_OVERHEAD_BITS)), (float)d_term / (1<<(XUA_LIGHT_FIXED_POINT_FRAC_BITS-PID_CALC_OVERHEAD_BITS)), (float)fifo_level_filtered/(1<fifo_level_accum/(1<> (XUA_LIGHT_FIXED_POINT_Q_BITS - 1 - PID_CALC_OVERHEAD_BITS); - - - //debug_printf("filtered: %d raw: %d\n", fifo_level_filtered >> 22, fill_level_wrt_half); - - //static unsigned counter; counter++; if (counter>100){counter = 0; debug_printf("pid: %d\n",i_term >> (XUA_LIGHT_FIXED_POINT_FRAC_BITS - 10));} - debug_printf("co: %d\n", controller_out >> XUA_LIGHT_FIXED_POINT_FRAC_BITS); - return controller_out; -} - - -//Calculate feedback for asynchronous USB audio -void do_feedback_calculation(unsigned &sof_count - ,const unsigned mclk_hz - ,unsigned mclk_port_counter - ,unsigned &mclk_port_counter_old - ,long long &feedback_value - ,unsigned &mod_from_last_time - ,unsigned fb_clocks[1]){ - // Assuming 48kHz from a 24.576 master clock (0.0407uS period) - // MCLK ticks per SOF = 125uS / 0.0407 = 3072 MCLK ticks per SOF. - // expected Feedback is 48000/8000 = 6 samples. so 0x60000 in 16:16 format. - // Average over 128 SOFs - 128 x 3072 = 0x60000. - - unsigned long long feedbackMul = 64ULL; - if(AUDIO_CLASS == 1) feedbackMul = 8ULL; // TODO Use 4 instead of 8 to avoid windows LSB issues? - - // Number of MCLK ticks in this SOF period (E.g = 125 * 24.576 = 3072) - int mclk_ticks_this_sof_period = (int) ((short)(mclk_port_counter - mclk_port_counter_old)); - unsigned long long full_result = mclk_ticks_this_sof_period * feedbackMul * DEFAULT_FREQ; - feedback_value += full_result; - - // Store MCLK for next time around... - mclk_port_counter_old = mclk_port_counter; - - // Reset counts based on SOF counting. Expect 16ms (128 HS SOFs/16 FS SOFS) per feedback poll - // We always count 128 SOFs, so 16ms @ HS, 128ms @ FS - if(sof_count == 128){ - //debug_printf("fb\n"); - sof_count = 0; - - feedback_value += mod_from_last_time; - unsigned clocks = feedback_value / mclk_hz; - mod_from_last_time = feedback_value % mclk_hz; - feedback_value = 0; - - //Scale for working out number of samps to take from device for input - if(AUDIO_CLASS == 2){ - clocks <<= 3; - } - else{ - clocks <<= 6; - } - asm volatile("stw %0, dp[g_speed]"::"r"(clocks)); // g_speed = clocks - - //Write to feedback EP buffer - if (AUDIO_CLASS == 2){ - fb_clocks[0] = clocks; - } - else{ - fb_clocks[0] = clocks >> 2; - } - } -} - diff --git a/examples/xua_lite_example/xua_lite/xua_buffer_lite.h b/examples/xua_lite_example/xua_lite/xua_buffer_lite.h deleted file mode 100644 index 8ac52765..00000000 --- a/examples/xua_lite_example/xua_lite/xua_buffer_lite.h +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include "xua_ep0_wrapper.h" -#include "xua.h" - -//Currently only single frequency supported -#define NOMINAL_SR_DEVICE DEFAULT_FREQ -#define NOMINAL_SR_HOST DEFAULT_FREQ - -#define DIV_ROUND_UP(n, d) (n / d + 1) //Always rounds up to the next integer. Needed for 48001Hz case etc. -#define BIGGEST(a, b) (a > b ? a : b) - -#define SOF_FREQ_HZ (8000 - ((2 - AUDIO_CLASS) * 7000) ) //1000 for FS or 8000 for HS - -//Defines for endpoint buffer sizes. Samples is total number of samples across all channels -#define MAX_OUT_SAMPLES_PER_SOF_PERIOD (DIV_ROUND_UP(MAX_FREQ, SOF_FREQ_HZ) * NUM_USB_CHAN_OUT) -#define MAX_IN_SAMPLES_PER_SOF_PERIOD (DIV_ROUND_UP(MAX_FREQ, SOF_FREQ_HZ) * NUM_USB_CHAN_IN) -#define MAX_OUTPUT_SLOT_SIZE 4 -#define MAX_INPUT_SLOT_SIZE 4 - -#define OUT_AUDIO_BUFFER_SIZE_BYTES (MAX_OUT_SAMPLES_PER_SOF_PERIOD * MAX_OUTPUT_SLOT_SIZE) -#define IN_AUDIO_BUFFER_SIZE_BYTES (MAX_IN_SAMPLES_PER_SOF_PERIOD * MAX_INPUT_SLOT_SIZE) - -unsafe void XUA_Buffer_lite(chanend c_ep0_out, chanend c_ep0_in, chanend c_aud_out, chanend ?c_feedback, chanend c_aud_in, chanend c_sof, in port p_for_mclk_count, streaming chanend c_audio_hub); -[[combinable]] -unsafe void XUA_Buffer_lite2(server ep0_control_if i_ep0_ctl, chanend c_aud_out, chanend ?c_feedback, chanend c_aud_in, chanend c_sof, in port p_for_mclk_count, streaming chanend c_audio_hub); - -/** Transfer samples to/from XUA. Should be called at the current USB rate. - * This function is non-blocking. - * - * \param[in,out] c_audio Channel to XUA. - * - * \param[out] sampsFromUsbToAudio Samples sent from host to device. - * - * \param[in] sampsFromAudioToUsb Samples to send from device to host. - * - * \param[out] clock_nudge Notification that the device is running - * too slowly/quickly. Only used when in - * adaptive endpoint mode. - */ -static inline void XUA_transfer_samples(streaming chanend c_audio, - unsigned sampsFromUsbToAudio[], - unsigned sampsFromAudioToUsb[], - int &clock_nudge) { - //Transfer samples. Takes about 25 ticks - for (int i = 0; i < NUM_USB_CHAN_OUT; i++) c_audio :> sampsFromUsbToAudio[i]; - if (XUA_ADAPTIVE) c_audio :> clock_nudge; - for (int i = 0; i < NUM_USB_CHAN_IN; i++) c_audio <: sampsFromAudioToUsb[i]; -} diff --git a/examples/xua_lite_example/xua_lite/xua_buffer_lite.xc b/examples/xua_lite_example/xua_lite/xua_buffer_lite.xc deleted file mode 100644 index 597cb938..00000000 --- a/examples/xua_lite_example/xua_lite/xua_buffer_lite.xc +++ /dev/null @@ -1,384 +0,0 @@ -#include -#include -#include - -#include "xua_commands.h" -#include "xud.h" -#include "testct_byref.h" -#define DEBUG_UNIT XUA_LITE_BUFFER -#define DEBUG_PRINT_ENABLE_XUA_LITE_BUFFER 1 -#include "debug_print.h" -#include "xua.h" -#include "fifo_impl.h" -#include "xua_ep0_wrapper.h" -#include "rate_controller.h" -#include "xua_buffer_lite.h" - - -extern "C"{ -void XUA_Endpoint0_lite_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend ?c_mix_ctl, chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_); -void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend ?c_mix_ctl, chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_, unsigned *input_interface_num, unsigned *output_interface_num); -} -#pragma select handler -void XUD_GetSetupData_Select(chanend c, XUD_ep e_out, unsigned &length, XUD_Result_t &result); - -extern XUD_ep ep0_out; -extern XUD_ep ep0_in; - -#if 0 -//Unsafe to allow us to use fifo API without local unsafe scope -unsafe void XUA_Buffer_lite(chanend c_ep0_out, chanend c_ep0_in, chanend c_aud_out, chanend ?c_feedback, chanend c_aud_in, chanend c_sof, in port p_for_mclk_count, streaming chanend c_audio_hub) { - - debug_printf("%d\n", MAX_OUT_SAMPLES_PER_SOF_PERIOD); - - //These buffers are unions so we can access them as different types - union buffer_aud_out{ - unsigned char bytes[OUT_AUDIO_BUFFER_SIZE_BYTES]; - short short_words[OUT_AUDIO_BUFFER_SIZE_BYTES / 2]; - long long_words[OUT_AUDIO_BUFFER_SIZE_BYTES / 4]; - }buffer_aud_out; - union buffer_aud_in{ - unsigned char bytes[IN_AUDIO_BUFFER_SIZE_BYTES]; - short short_words[IN_AUDIO_BUFFER_SIZE_BYTES / 2]; - unsigned long long_words[IN_AUDIO_BUFFER_SIZE_BYTES / 4]; - }buffer_aud_in; - - unsigned in_subslot_size = (AUDIO_CLASS == 1) ? FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES : HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES; - unsigned out_subslot_size = (AUDIO_CLASS == 1) ? FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES : HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; - - //Asynch feedback calculation - unsigned sof_count = 0; - unsigned mclk_port_counter_old = 0; - long long feedback_value = 0; - unsigned mod_from_last_time = 0; - const unsigned mclk_hz = MCLK_48; - unsigned int fb_clocks[1] = {0}; - - //Adapative device clock control - int clock_nudge = 0; - pid_state_t pid_state = {0, 0}; - - //Endpoints - XUD_ep ep_aud_out = XUD_InitEp(c_aud_out); - XUD_ep ep_aud_in = XUD_InitEp(c_aud_in); - XUD_ep ep_feedback = 0; - if (!isnull(c_feedback)) ep_feedback = XUD_InitEp(c_feedback); - - unsigned num_samples_received_from_host = 0; - unsigned num_samples_to_send_to_host = 0; - - short samples_in_short[NUM_USB_CHAN_IN] = {0}; - short samples_out_short[NUM_USB_CHAN_OUT] = {0}; - - #define c_audioControl null - #define dfuInterface null - XUA_Endpoint0_lite_init(c_ep0_out, c_ep0_in, c_audioControl, null, null, null, dfuInterface); - unsigned char sbuffer[120]; //Raw buffer for EP0 data - USB_SetupPacket_t sp; //Parsed setup packet from EP0 - - unsigned input_interface_num = 0; - unsigned output_interface_num = 0; - - //Enable all EPs - XUD_SetReady_OutPtr(ep_aud_out, (unsigned)buffer_aud_out.long_words); - XUD_SetReady_InPtr(ep_aud_in, (unsigned)buffer_aud_in.long_words, num_samples_to_send_to_host); - XUD_SetReady_Out(ep0_out, sbuffer); - if (!isnull(c_feedback)) XUD_SetReady_InPtr(ep_feedback, (unsigned)fb_clocks, (AUDIO_CLASS == 2) ? 4 : 3); - - - //Send initial samples so audiohub is not blocked - for (int i = 0; i < 2 * (NUM_USB_CHAN_OUT + (XUA_ADAPTIVE != 0 ? 1 : 0)); i++) c_audio_hub <: 0; - - //FIFOs from EP buffers to audio - short host_to_device_fifo_storage[MAX_OUT_SAMPLES_PER_SOF_PERIOD * 2]; - short device_to_host_fifo_storage[MAX_IN_SAMPLES_PER_SOF_PERIOD * 2]; - mem_fifo_short_t host_to_device_fifo = {sizeof(host_to_device_fifo_storage)/sizeof(host_to_device_fifo_storage[0]), host_to_device_fifo_storage, 0, 0}; - mem_fifo_short_t device_to_host_fifo = {sizeof(device_to_host_fifo_storage)/sizeof(device_to_host_fifo_storage[0]), device_to_host_fifo_storage, 0, 0}; - volatile mem_fifo_short_t * unsafe host_to_device_fifo_ptr = &host_to_device_fifo; - volatile mem_fifo_short_t * unsafe device_to_host_fifo_ptr = &device_to_host_fifo; - - //XUD transaction variables passed in by reference - XUD_Result_t result; - unsigned length = 0; - unsigned u_tmp; //For select channel input by ref on EP0 - int s_tmp; //For select on channel from audiohub - while(1){ - #pragma ordered - select{ - //Handle EP0 requests - case XUD_GetSetupData_Select(c_ep0_out, ep0_out, length, result): - timer tmr; int t0, t1; tmr :> t0; - - debug_printf("ep0, result: %d, length: %d\n", result, length); //-1 reset, 0 ok, 1 error - USB_ParseSetupPacket(sbuffer, sp); //Parse data buffer end populate SetupPacket struct - - XUA_Endpoint0_lite_loop(result, sp, c_ep0_out, c_ep0_in, c_audioControl, null/*mix*/, null/*clk*/, null/*EA*/, dfuInterface, &input_interface_num, &output_interface_num); - XUD_SetReady_Out(ep0_out, sbuffer); - tmr :> t1; debug_printf("c%d\n", t1 - t0); - - break; - - //SOF handling - case inuint_byref(c_sof, u_tmp): - timer tmr; int t0, t1; tmr :> t0; - unsigned mclk_port_counter = 0; - asm volatile(" getts %0, res[%1]" : "=r" (mclk_port_counter) : "r" (p_for_mclk_count)); - if (!isnull(c_feedback)) do_feedback_calculation(sof_count, mclk_hz, mclk_port_counter, mclk_port_counter_old, feedback_value, mod_from_last_time, fb_clocks); - sof_count++; - tmr :> t1; debug_printf("s%d\n", t1 - t0); - - break; - - //Receive samples from host - case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result): - timer tmr; int t0, t1; tmr :> t0; - - num_samples_received_from_host = length / out_subslot_size; - - fifo_ret_t ret = fifo_block_push_short(host_to_device_fifo_ptr, buffer_aud_out.short_words, num_samples_received_from_host); - if (ret != FIFO_SUCCESS) debug_printf("h2d full\n"); - num_samples_to_send_to_host = num_samples_received_from_host; - - int fill_level = fifo_get_fill_short(host_to_device_fifo_ptr); - if (isnull(c_feedback)) do_clock_nudge_pdm(do_rate_control(fill_level, &pid_state), &clock_nudge); - - //Mark EP as ready for next frame from host - XUD_SetReady_OutPtr(ep_aud_out, (unsigned)buffer_aud_out.long_words); - tmr :> t1; debug_printf("o%d\n", t1 - t0); - break; - - //Send asynch explicit feedback value, but only if enabled - case !isnull(c_feedback) => XUD_SetData_Select(c_feedback, ep_feedback, result): - timer tmr; int t0, t1; tmr :> t0; - - XUD_SetReady_In(ep_feedback, (fb_clocks, unsigned char[]), (AUDIO_CLASS == 2) ? 4 : 3); - //debug_printf("0x%x\n", fb_clocks[0]); - tmr :> t1; debug_printf("f%d\n", t1 - t0); - - break; - - //Send samples to host - case XUD_SetData_Select(c_aud_in, ep_aud_in, result): - timer tmr; int t0, t1; tmr :> t0; - - if (output_interface_num == 0) num_samples_to_send_to_host = (DEFAULT_FREQ / SOF_FREQ_HZ) * NUM_USB_CHAN_IN; - - fifo_ret_t ret = fifo_block_pop_short(device_to_host_fifo_ptr, buffer_aud_in.short_words, num_samples_received_from_host); - if (ret != FIFO_SUCCESS) debug_printf("d2h empty\n"); - - //Populate the input buffer ready for the next read - //pack_samples_to_buff(loopback_samples, num_samples_to_send_to_host, in_subslot_size, buffer_aud_in); - //Use the number of samples we received last time so we are always balanced (assumes same in/out count) - - unsigned input_buffer_size = num_samples_to_send_to_host * in_subslot_size; - XUD_SetReady_InPtr(ep_aud_in, (unsigned)buffer_aud_in.long_words, input_buffer_size); //loopback - num_samples_to_send_to_host = 0; - tmr :> t1; debug_printf("i%d\n", t1 - t0); - - break; - - //Exchange samples with audiohub. Note we are using channel buffering here to act as a FIFO - case c_audio_hub :> s_tmp: - timer tmr; int t0, t1; tmr :> t0; - samples_in_short[0] = s_tmp >> 16; - for (int i = 1; i < NUM_USB_CHAN_IN; i++){ - c_audio_hub :> s_tmp; - samples_in_short[i] = s_tmp >> 16; - } - fifo_ret_t ret = fifo_block_pop_short(host_to_device_fifo_ptr, samples_out_short, NUM_USB_CHAN_OUT); - if (ret != FIFO_SUCCESS && output_interface_num != 0) debug_printf("h2d empty\n"); - for (int i = 0; i < NUM_USB_CHAN_OUT; i++) c_audio_hub <: (int)samples_out_short[i] << 16; - if (XUA_ADAPTIVE) c_audio_hub <: clock_nudge; - ret = fifo_block_push_short(device_to_host_fifo_ptr, samples_in_short, NUM_USB_CHAN_IN); - if (ret != FIFO_SUCCESS && input_interface_num != 0) debug_printf("d2h full\n"); - tmr :> t1; debug_printf("a%d\n", t1 - t0); - break; - } - } -} -#endif -extern port p_sda; - -[[combinable]] -//Unsafe to allow us to use fifo API without local unsafe scope -unsafe void XUA_Buffer_lite2(server ep0_control_if i_ep0_ctl, chanend c_aud_out, chanend ?c_feedback, chanend c_aud_in, chanend c_sof, in port p_for_mclk_count, streaming chanend c_audio_hub) { - - debug_printf("%d\n", MAX_OUT_SAMPLES_PER_SOF_PERIOD); - - //These buffers are unions so we can access them as different types - union buffer_aud_out{ - unsigned char bytes[OUT_AUDIO_BUFFER_SIZE_BYTES]; - short short_words[OUT_AUDIO_BUFFER_SIZE_BYTES / 2]; - long long_words[OUT_AUDIO_BUFFER_SIZE_BYTES / 4]; - }buffer_aud_out; - union buffer_aud_in{ - unsigned char bytes[IN_AUDIO_BUFFER_SIZE_BYTES]; - short short_words[IN_AUDIO_BUFFER_SIZE_BYTES / 2]; - unsigned long long_words[IN_AUDIO_BUFFER_SIZE_BYTES / 4]; - }buffer_aud_in; - - unsigned in_subslot_size = (AUDIO_CLASS == 1) ? FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES : HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES; - unsigned out_subslot_size = (AUDIO_CLASS == 1) ? FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES : HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; - - //Asynch feedback calculation - unsigned sof_count = 0; - unsigned mclk_port_counter_old = 0; - long long feedback_value = 0; - unsigned mod_from_last_time = 0; - const unsigned mclk_hz = MCLK_48; - unsigned int fb_clocks[1] = {0}; - - //Adapative device clock control - int clock_nudge = 0; - pid_state_t pid_state = {0, 0}; - - - //Endpoints - XUD_ep ep_aud_out = XUD_InitEp(c_aud_out); - XUD_ep ep_aud_in = XUD_InitEp(c_aud_in); - XUD_ep ep_feedback = 0; - if (!isnull(c_feedback)) ep_feedback = XUD_InitEp(c_feedback); - - unsigned num_samples_received_from_host = 0; - unsigned num_samples_to_send_to_host = 0; - - unsigned input_interface_num = 0; - unsigned output_interface_num = 0; - - //Enable all EPs - XUD_SetReady_OutPtr(ep_aud_out, (unsigned)buffer_aud_out.long_words); - XUD_SetReady_InPtr(ep_aud_in, (unsigned)buffer_aud_in.long_words, num_samples_to_send_to_host); - if (!isnull(c_feedback)) XUD_SetReady_InPtr(ep_feedback, (unsigned)fb_clocks, (AUDIO_CLASS == 2) ? 4 : 3); - - short samples_in_short[NUM_USB_CHAN_IN] = {0}; - short samples_out_short[NUM_USB_CHAN_OUT] = {0}; - - - //Send initial samples so audiohub is not blocked - const unsigned n_sample_periods_to_preload = 2; - for (int i = 0; i < n_sample_periods_to_preload * (NUM_USB_CHAN_OUT + (XUA_ADAPTIVE != 0 ? 1 : 0)); i++) c_audio_hub <: 0; - - //FIFOs from EP buffers to audio - short host_to_device_fifo_storage[MAX_OUT_SAMPLES_PER_SOF_PERIOD * 2]; - short device_to_host_fifo_storage[MAX_IN_SAMPLES_PER_SOF_PERIOD * 2]; - mem_fifo_short_t host_to_device_fifo = {sizeof(host_to_device_fifo_storage)/sizeof(host_to_device_fifo_storage[0]), host_to_device_fifo_storage, 0, 0}; - mem_fifo_short_t device_to_host_fifo = {sizeof(device_to_host_fifo_storage)/sizeof(device_to_host_fifo_storage[0]), device_to_host_fifo_storage, 0, 0}; - volatile mem_fifo_short_t * unsafe host_to_device_fifo_ptr = &host_to_device_fifo; - volatile mem_fifo_short_t * unsafe device_to_host_fifo_ptr = &device_to_host_fifo; - - //XUD transaction variables passed in by reference - XUD_Result_t result; - unsigned length = 0; - unsigned u_tmp; //For select channel input by ref on EP0 - int s_tmp; //For select on channel from audiohub - while(1){ - select{ - //Handle EP0 requests - case i_ep0_ctl.set_output_interface(unsigned num): - //Reset output FIFO if moving from idle to streaming - if (num != 0 && output_interface_num == 0) fifo_init_short(host_to_device_fifo_ptr); - output_interface_num = num; - debug_printf("output_interface_num: %d\n", num); - break; - - case i_ep0_ctl.set_input_interface(unsigned num): - input_interface_num = num; - debug_printf("input_interface_num: %d\n", num); - break; - - case i_ep0_ctl.set_host_active(unsigned active): - break; - - //SOF handling - case inuint_byref(c_sof, u_tmp): - timer tmr; int t0, t1; tmr :> t0; - unsigned mclk_port_counter = 0; - asm volatile(" getts %0, res[%1]" : "=r" (mclk_port_counter) : "r" (p_for_mclk_count)); - if (!isnull(c_feedback)) do_feedback_calculation(sof_count, mclk_hz, mclk_port_counter, mclk_port_counter_old, feedback_value, mod_from_last_time, fb_clocks); - sof_count++; - //tmr :> t1; debug_printf("s%d\n", t1 - t0); - uint16_t port_counter; - p_sda <: 1 @ port_counter; - p_sda @ port_counter + 100 <: 0; - break; - - //Receive samples from host - case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result): - timer tmr; int t0, t1; tmr :> t0; - - num_samples_received_from_host = length / out_subslot_size; - - if (num_samples_received_from_host != 96) debug_printf("hs: %d\n", num_samples_received_from_host); - - fifo_ret_t ret = fifo_block_push_short_fast(host_to_device_fifo_ptr, buffer_aud_out.short_words, num_samples_received_from_host); - if (ret != FIFO_SUCCESS) debug_printf("h2d full\n"); - num_samples_to_send_to_host = num_samples_received_from_host; - - int fill_level = fifo_get_fill_short(host_to_device_fifo_ptr); - if (isnull(c_feedback)) do_clock_nudge_pdm(do_rate_control(fill_level, &pid_state), &clock_nudge); - - //Mark EP as ready for next frame from host - XUD_SetReady_OutPtr(ep_aud_out, (unsigned)buffer_aud_out.long_words); - //tmr :> t1; debug_printf("o%d\n", t1 - t0); - break; - - //Send asynch explicit feedback value, but only if enabled - case !isnull(c_feedback) => XUD_SetData_Select(c_feedback, ep_feedback, result): - timer tmr; int t0, t1; tmr :> t0; - - XUD_SetReady_In(ep_feedback, (fb_clocks, unsigned char[]), (AUDIO_CLASS == 2) ? 4 : 3); - //debug_printf("0x%x\n", fb_clocks[0]); - //tmr :> t1; debug_printf("f%d\n", t1 - t0); - break; - - //Send samples to host - case XUD_SetData_Select(c_aud_in, ep_aud_in, result): - timer tmr; int t0, t1; tmr :> t0; - - //If host is not streaming out, then send a fixed number of samples to host - if (output_interface_num == 0) { - num_samples_to_send_to_host = (DEFAULT_FREQ / SOF_FREQ_HZ) * NUM_USB_CHAN_IN; - int fill_level = fifo_get_fill_short(device_to_host_fifo_ptr); - if (isnull(c_feedback)) do_clock_nudge_pdm(-do_rate_control(fill_level, &pid_state), &clock_nudge); - } - - fifo_ret_t ret = fifo_block_pop_short_fast(device_to_host_fifo_ptr, buffer_aud_in.short_words, num_samples_received_from_host); - if (ret != FIFO_SUCCESS) { - memset(buffer_aud_in.short_words, 0, sizeof(buffer_aud_in.short_words)); - debug_printf("d2h empty\n"); - } - - //Populate the input buffer ready for the next read - //pack_samples_to_buff(loopback_samples, num_samples_to_send_to_host, in_subslot_size, buffer_aud_in); - //Use the number of samples we received last time so we are always balanced (assumes same in/out count) - - unsigned input_buffer_size = num_samples_to_send_to_host * in_subslot_size; - XUD_SetReady_InPtr(ep_aud_in, (unsigned) buffer_aud_in.long_words, input_buffer_size); //loopback - num_samples_to_send_to_host = 0; - //tmr :> t1; debug_printf("i%d\n", t1 - t0); - break; - - //Exchange samples with audiohub. Note we are using channel buffering here to act as a FIFO - case c_audio_hub :> s_tmp: - timer tmr; int t0, t1; tmr :> t0; - samples_in_short[0] = s_tmp >> 16; - for (int i = 1; i < NUM_USB_CHAN_IN; i++){ - c_audio_hub :> s_tmp; - samples_in_short[i] = s_tmp >> 16; - } - fifo_ret_t ret = fifo_block_pop_short(host_to_device_fifo_ptr, samples_out_short, NUM_USB_CHAN_OUT); - if (ret != FIFO_SUCCESS && output_interface_num != 0) { - memset(samples_out_short, 0, sizeof(samples_out_short)); - debug_printf("h2d empty\n"); - } - for (int i = 0; i < NUM_USB_CHAN_OUT; i++) c_audio_hub <: (int)samples_out_short[i] << 16; - if (XUA_ADAPTIVE) c_audio_hub <: clock_nudge; - ret = fifo_block_push_short(device_to_host_fifo_ptr, samples_in_short, NUM_USB_CHAN_IN); - if (ret != FIFO_SUCCESS && input_interface_num != 0) debug_printf("d2h full\n"); - //tmr :> t1; debug_printf("a%d\n", t1 - t0); - break; - } - } -} diff --git a/examples/xua_lite_example/xua_lite/xua_buffer_pack.h b/examples/xua_lite_example/xua_lite/xua_buffer_pack.h deleted file mode 100644 index 36fc2f33..00000000 --- a/examples/xua_lite_example/xua_lite/xua_buffer_pack.h +++ /dev/null @@ -1,65 +0,0 @@ -//Helper to disassemble USB packets into 32b left aligned audio samples -#pragma unsafe arrays -static inline void unpack_buff_to_samples(unsigned char input[], const unsigned n_samples, const unsigned slot_size, int output[]){ - switch(slot_size){ - case 4: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 4; - output[i] = (input[base + 3] << 24) | (input[base + 2] << 16) | (input[base + 1] << 8) | input[base + 0]; - } - break; - case 3: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 3; - output[i] = (input[base + 2] << 24) | (input[base + 1] << 16) | (input[base + 0] << 8); - } - break; - case 2: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 2; - output[i] = (input[base + 1] << 24) | (input[base + 0] << 16); - } - break; - default: - debug_printf("Invalid slot_size\n"); - break; - } -} - -//Helper to assemble USB packets from 32b left aligned audio samples -#pragma unsafe arrays -static inline void pack_samples_to_buff(int input[], const unsigned n_samples, const unsigned slot_size, unsigned char output[]){ - switch(slot_size){ - case 4: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 4; - unsigned in_word = (unsigned)input[i]; - output[base + 0] = in_word & 0xff; - output[base + 1] = (in_word & 0xff00) >> 8; - output[base + 2] = (in_word & 0xff0000) >> 16; - output[base + 3] = (in_word) >> 24; - } - break; - case 3: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 3; - unsigned in_word = (unsigned)input[i]; - output[base + 0] = (in_word & 0xff00) >> 8; - output[base + 1] = (in_word & 0xff0000) >> 16; - output[base + 2] = (in_word) >> 24; - } - break; - case 2: - for (int i = 0; i < n_samples; i++){ - unsigned base = i * 2; - unsigned in_word = (unsigned)input[i]; - output[base + 0] = (in_word & 0xff0000) >> 16; - output[base + 1] = (in_word) >> 24; - } - break; - default: - debug_printf("Invalid slot_size\n"); - break; - } -} - From 28cce8b51cb0143b430dad35abfc033b4d910bdb Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 6 Nov 2019 15:12:21 +0000 Subject: [PATCH 069/233] Remove xua_ep0_wrapper.h and xua_ep0_wrapper.xc. Requested by Oscar Bailey as part of github.com/xmos/lib_xua Pull Request #103. --- lib_xua/src/core/endpoint0/xua_ep0_wrapper.h | 27 ---------- lib_xua/src/core/endpoint0/xua_ep0_wrapper.xc | 51 ------------------- 2 files changed, 78 deletions(-) delete mode 100644 lib_xua/src/core/endpoint0/xua_ep0_wrapper.h delete mode 100644 lib_xua/src/core/endpoint0/xua_ep0_wrapper.xc diff --git a/lib_xua/src/core/endpoint0/xua_ep0_wrapper.h b/lib_xua/src/core/endpoint0/xua_ep0_wrapper.h deleted file mode 100644 index 8015b95e..00000000 --- a/lib_xua/src/core/endpoint0/xua_ep0_wrapper.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _EP0_WRAPPER_ -#define _EP0_WRAPPER_ - -#include -#include -#include -#include "xua.h" - -typedef interface ep0_control_if{ - void set_output_interface(unsigned num); - void set_input_interface(unsigned num); - void set_host_active(unsigned num); -}ep0_control_if; - -extern "C"{ -void XUA_Endpoint0_lite_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend ?c_mix_ctl, chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_); -void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend ?c_mix_ctl, chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_, unsigned *input_interface_num, unsigned *output_interface_num); -} -#pragma select handler -void XUD_GetSetupData_Select(chanend c, XUD_ep e_out, unsigned &length, XUD_Result_t &result); - -[[combinable]] -void XUA_Endpoint0_select(chanend c_ep0_out, chanend c_ep0_in, client ep0_control_if i_ep0_ctl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_); - -#endif \ No newline at end of file diff --git a/lib_xua/src/core/endpoint0/xua_ep0_wrapper.xc b/lib_xua/src/core/endpoint0/xua_ep0_wrapper.xc deleted file mode 100644 index 092345a0..00000000 --- a/lib_xua/src/core/endpoint0/xua_ep0_wrapper.xc +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include -#include "xua.h" - -#if XUA_USB_EN -#include "xua_ep0_wrapper.h" - -#define DEBUG_UNIT EP0_WRAPPER -#define DEBUG_PRINT_ENABLE_EP0_WRAPPER 0 -#include "debug_print.h" - -extern XUD_ep ep0_out; -extern XUD_ep ep0_in; - -[[combinable]] -void XUA_Endpoint0_select(chanend c_ep0_out, chanend c_ep0_in, client ep0_control_if i_ep0_ctl, CLIENT_INTERFACE(i_dfu, ?dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) -{ - - USB_SetupPacket_t sp; - XUA_Endpoint0_lite_init(c_ep0_out, c_ep0_in, null, null, null, null, dfuInterface VENDOR_REQUESTS_PARAMS_); - unsigned char sbuffer[120]; - XUD_SetReady_Out(ep0_out, sbuffer); - - unsigned input_interface_num = 0; - unsigned output_interface_num = 0; - - XUD_Result_t result = XUD_RES_ERR; - unsigned length = 0; - - while(1){ - select{ - case XUD_GetSetupData_Select(c_ep0_out, ep0_out, length, result): - if (result == XUD_RES_OKAY) - { - /* Parse data buffer end populate SetupPacket struct */ - USB_ParseSetupPacket(sbuffer, sp); - } - debug_printf("ep0, result: %d, length: %d\n", result, length); //-1 reset, 0 ok, 1 error - - XUA_Endpoint0_lite_loop(result, sp, c_ep0_out, c_ep0_in, null, null, null, null, dfuInterface - VENDOR_REQUESTS_PARAMS_, &input_interface_num, &output_interface_num); - i_ep0_ctl.set_output_interface(output_interface_num); - i_ep0_ctl.set_input_interface(input_interface_num); - - XUD_SetReady_Out(ep0_out, sbuffer); - break; - } - } -} -#endif From a2094e895349444b8bfe5031f64dcf013781d753 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Fri, 8 Nov 2019 12:08:11 +0000 Subject: [PATCH 070/233] Remove upstream triggers --- Jenkinsfile | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 044d9bfe..10ed3fc0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,44 +8,6 @@ pipeline { REPO = 'lib_xua' VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" } - triggers { - /* Trigger this Pipeline on changes to the repos dependencies - * - * If this Pipeline is running in a pull request, the triggers are set - * on the base branch the PR is set to merge in to. - * - * Otherwise the triggers are set on the branch of a matching name to the - * one this Pipeline is on. - */ - upstream( - upstreamProjects: - (env.JOB_NAME.contains('PR-') ? - "../lib_device_control/${env.CHANGE_TARGET}," + - "../lib_dsp/${env.CHANGE_TARGET}," + - "../lib_i2c/${env.CHANGE_TARGET}," + - "../lib_logging/${env.CHANGE_TARGET}," + - "../lib_mic_array/${env.CHANGE_TARGET}," + - "../lib_spdif/${env.CHANGE_TARGET}," + - "../lib_xassert/${env.CHANGE_TARGET}," + - "../lib_xud/${env.CHANGE_TARGET}," + - "../tools_released/${env.CHANGE_TARGET}," + - "../tools_xmostest/${env.CHANGE_TARGET}," + - "../xdoc_released/${env.CHANGE_TARGET}" - : - "../lib_device_control/${env.BRANCH_NAME}," + - "../lib_dsp/${env.BRANCH_NAME}," + - "../lib_i2c/${env.BRANCH_NAME}," + - "../lib_logging/${env.BRANCH_NAME}," + - "../lib_mic_array/${env.BRANCH_NAME}," + - "../lib_spdif/${env.BRANCH_NAME}," + - "../lib_xassert/${env.BRANCH_NAME}," + - "../lib_xud/${env.BRANCH_NAME}," + - "../tools_released/${env.BRANCH_NAME}," + - "../tools_xmostest/${env.BRANCH_NAME}," + - "../xdoc_released/${env.BRANCH_NAME}"), - threshold: hudson.model.Result.SUCCESS - ) - } options { skipDefaultCheckout() } From bc6a0cbcd8a86609e2473d237b396b7039210b02 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Fri, 8 Nov 2019 12:08:11 +0000 Subject: [PATCH 071/233] Remove upstream triggers --- Jenkinsfile | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 044d9bfe..10ed3fc0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,44 +8,6 @@ pipeline { REPO = 'lib_xua' VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" } - triggers { - /* Trigger this Pipeline on changes to the repos dependencies - * - * If this Pipeline is running in a pull request, the triggers are set - * on the base branch the PR is set to merge in to. - * - * Otherwise the triggers are set on the branch of a matching name to the - * one this Pipeline is on. - */ - upstream( - upstreamProjects: - (env.JOB_NAME.contains('PR-') ? - "../lib_device_control/${env.CHANGE_TARGET}," + - "../lib_dsp/${env.CHANGE_TARGET}," + - "../lib_i2c/${env.CHANGE_TARGET}," + - "../lib_logging/${env.CHANGE_TARGET}," + - "../lib_mic_array/${env.CHANGE_TARGET}," + - "../lib_spdif/${env.CHANGE_TARGET}," + - "../lib_xassert/${env.CHANGE_TARGET}," + - "../lib_xud/${env.CHANGE_TARGET}," + - "../tools_released/${env.CHANGE_TARGET}," + - "../tools_xmostest/${env.CHANGE_TARGET}," + - "../xdoc_released/${env.CHANGE_TARGET}" - : - "../lib_device_control/${env.BRANCH_NAME}," + - "../lib_dsp/${env.BRANCH_NAME}," + - "../lib_i2c/${env.BRANCH_NAME}," + - "../lib_logging/${env.BRANCH_NAME}," + - "../lib_mic_array/${env.BRANCH_NAME}," + - "../lib_spdif/${env.BRANCH_NAME}," + - "../lib_xassert/${env.BRANCH_NAME}," + - "../lib_xud/${env.BRANCH_NAME}," + - "../tools_released/${env.BRANCH_NAME}," + - "../tools_xmostest/${env.BRANCH_NAME}," + - "../xdoc_released/${env.BRANCH_NAME}"), - threshold: hudson.model.Result.SUCCESS - ) - } options { skipDefaultCheckout() } From a865f4bc51ed39322ba1f5d18fe83d29eac72e44 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Fri, 8 Nov 2019 14:50:01 +0000 Subject: [PATCH 072/233] Add src/hid to the list of source directories. --- lib_xua/module_build_info | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index edb13e76..f57e59ef 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -62,6 +62,7 @@ SOURCE_DIRS = src/core \ src/core/user/hostactive \ src/core/xuduser \ src/dfu \ + src/hid \ src/midi EXCLUDE_FILES += descriptors_2.rst From 94afffe517cefcd713e7615500b3c21567888c60 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 09:59:02 +0000 Subject: [PATCH 073/233] Corrected change log information and version numbering. --- CHANGELOG.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 21b53f06..c9e8cd07 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,17 +1,17 @@ lib_xua Change Log ================== +0.3.0 +---------- + * ADDED: UAC1 HID support with simulated Voice Command detection reported + every 10 seconds + * ADDED: Support for USB HID Set Idle request + 0.2.1 ----- * HOTFIX: Fix descriptors for XUA_ADAPTIVE -0.2.0_demo ----------- - * ADDED: UAC1 HID support with simulated Voice Command detection reported - every 10 seconds - * ADDED: Support for USB HID Set Idle request - 0.2.0 ----- From 861d20827be636d7aa90bf36996b8e49ee5217d9 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 11:09:30 +0000 Subject: [PATCH 074/233] Change version to 0.3.0 to match change log. --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index f57e59ef..b41fc2ff 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 0.2.1 +VERSION = 0.3.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ From 41654b17a9a0f3bc8680c44eec3c9dd1fc3c6ae8 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 11:17:48 +0000 Subject: [PATCH 075/233] Fixed bad formatting. --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c9e8cd07..ae7d7c01 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,7 +2,7 @@ lib_xua Change Log ================== 0.3.0 ----------- +----- * ADDED: UAC1 HID support with simulated Voice Command detection reported every 10 seconds * ADDED: Support for USB HID Set Idle request From c7cce77fb2055368c505319d93091e99218cc1c7 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 11:28:13 +0000 Subject: [PATCH 076/233] Added empty line demanded by Jenkins checks. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ae7d7c01..498faf1e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,7 @@ lib_xua Change Log 0.3.0 ----- + * ADDED: UAC1 HID support with simulated Voice Command detection reported every 10 seconds * ADDED: Support for USB HID Set Idle request From 3f03dae23d8d687c62e8688e7833eab7d5fa23ae Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 13:40:47 +0000 Subject: [PATCH 077/233] Add missing copyright notices. --- lib_xua/src/hid/hid.xc | 1 + lib_xua/src/hid/xua_hid.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index bdd5aef3..478bfea5 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,3 +1,4 @@ +// Copyright (c) 2019, XMOS Ltd, All rights reserved #include #include "descriptor_defs.h" #include "hid.h" diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index ab8b2e05..23d507e0 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -1,3 +1,4 @@ +// Copyright (c) 2019, XMOS Ltd, All rights reserved #include #include #include "xud.h" From b0a26351ce636ec0b0ba5d85002160e7f85912e2 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 11 Nov 2019 13:41:07 +0000 Subject: [PATCH 078/233] Update copyright notices. --- lib_xua/api/xua_buffer.h | 2 +- lib_xua/api/xua_conf_default.h | 2 +- lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/endpoint0/descriptor_defs.h | 2 +- lib_xua/src/core/main.xc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index 93ca3219..d351ddc1 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved #ifndef __XUA_BUFFER_H__ #define __XUA_BUFFER_H__ diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 5e311e9f..b7bd71cf 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /* * @brief Defines relating to device configuration and customisation of lib_xua * @author Ross Owen, XMOS Limited diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 8e291aef..297dff8d 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 5916da17..45e08da3 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN #include diff --git a/lib_xua/src/core/endpoint0/descriptor_defs.h b/lib_xua/src/core/endpoint0/descriptor_defs.h index 1f29d58e..0a5a94fd 100644 --- a/lib_xua/src/core/endpoint0/descriptor_defs.h +++ b/lib_xua/src/core/endpoint0/descriptor_defs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved #ifndef __DESCRIPTOR_DEFS_H__ #define __DESCRIPTOR_DEFS_H__ diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index 5a7aace0..afc819c4 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2012-2019, XMOS Ltd, All rights reserved #include "xua.h" /* Device specific defines */ #ifndef EXCLUDE_USB_AUDIO_MAIN From ec396961be46e6bdb80e9f0d43ca7debe3fede0a Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 14 Nov 2019 14:19:51 +0000 Subject: [PATCH 079/233] Remove XUA_Endpoint0_lite_init() and XUA_Endpoint0_lite_loop() functions which are not used. --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 411 --------------------- 1 file changed, 411 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 4a4e8882..3c92defa 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -302,31 +302,6 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont } -void XUA_Endpoint0_lite_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) -{ - ep0_out = XUD_InitEp(c_ep0_out); - ep0_in = XUD_InitEp(c_ep0_in); - - VendorRequests_Init(VENDOR_REQUESTS_PARAMS); - -#ifdef VENDOR_AUDIO_REQS - VendorAudioRequestsInit(c_audioControl, c_mix_ctl, c_clk_ctl); -#endif - -#if (XUA_DFU_EN == 1) - /* Check if device has started in DFU mode */ - if (DFUReportResetState(null)) - { - /* Stop audio */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, AUDIO_STOP_FOR_DFU); - /* No Handshake */ - DFU_mode_active = 1; - } -#endif -} - void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) { @@ -861,392 +836,6 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 } } -void XUA_Endpoint0_lite_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, - chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_ - , unsigned *input_interface_num, unsigned *output_interface_num) -{ - if (result == XUD_RES_OKAY) - { - result = XUD_RES_ERR; - - /* Inspect Request type and Receipient and direction */ - switch( (sp.bmRequestType.Direction << 7) | (sp.bmRequestType.Recipient ) | (sp.bmRequestType.Type << 5) ) - { - case USB_BMREQ_H2D_STANDARD_INT: - - /* Over-riding USB_StandardRequests implementation */ - if(sp.bRequest == USB_SET_INTERFACE) - { - switch (sp.wIndex) - { - /* Check for audio stream from host start/stop */ -#if (NUM_USB_CHAN_OUT > 0) - case INTERFACE_NUMBER_AUDIO_OUTPUT: - *output_interface_num = sp.wValue; - break; -#endif - -#if (NUM_USB_CHAN_IN > 0) - case INTERFACE_NUMBER_AUDIO_INPUT: - *input_interface_num = sp.wValue; - break; -#endif - default: - /* Unhandled interface */ - break; - } - } /* if(sp.bRequest == SET_INTERFACE) */ - - break; /* BMREQ_H2D_STANDARD_INT */ - - case USB_BMREQ_D2H_STANDARD_INT: - - switch(sp.bRequest) - { -#if( 0 < HID_CONTROLS ) - case USB_GET_DESCRIPTOR: - - /* Check what inteface request is for */ - if(sp.wIndex == INTERFACE_NUMBER_HID) - { - /* High byte of wValue is descriptor type */ - unsigned descriptorType = sp.wValue & 0xff00; - - switch (descriptorType) - { - case HID_HID: - /* Return HID Descriptor */ - result = XUD_DoGetRequest(ep0_out, ep0_in, hidDescriptor, - sizeof(hidDescriptor), sp.wLength); - break; - case HID_REPORT: - /* Return HID report descriptor */ - result = XUD_DoGetRequest(ep0_out, ep0_in, hidReportDescriptor, - sizeof(hidReportDescriptor), sp.wLength); - break; - } - } - break; -#endif - default: - break; - } - break; - - /* Recipient: Device */ - case USB_BMREQ_H2D_STANDARD_DEV: - - /* Inspect for actual request */ - switch( sp.bRequest ) - { - /* Standard request: SetConfiguration */ - /* Overriding implementation in USB_StandardRequests */ - case USB_SET_CONFIGURATION: - - //if(g_current_config == 1) - { - /* Consider host active with valid driver at this point */ - UserHostActive(1); - } - - /* We want to run USB_StandardsRequests() implementation also. Don't modify result - * and don't call XUD_DoSetRequestStatus() */ - break; - - default: - //Unknown device request" - break; - } - break; - - /* Audio Class 1.0 Sampling Freqency Requests go to Endpoint */ - case USB_BMREQ_H2D_CLASS_EP: - case USB_BMREQ_D2H_CLASS_EP: - { - unsigned epNum = sp.wIndex & 0xff; - - if ((epNum == ENDPOINT_ADDRESS_OUT_AUDIO) || (epNum == ENDPOINT_ADDRESS_IN_AUDIO)) - { -#if (AUDIO_CLASS == 2) && (AUDIO_CLASS_FALLBACK) - if(g_curUsbSpeed == XUD_SPEED_FS) - { - result = AudioEndpointRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); - } -#elif (AUDIO_CLASS==1) - result = AudioEndpointRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); -#endif - } - - } - break; - - case USB_BMREQ_H2D_CLASS_INT: - case USB_BMREQ_D2H_CLASS_INT: - { - unsigned interfaceNum = sp.wIndex & 0xff; - //unsigned request = (sp.bmRequestType.Recipient ) | (sp.bmRequestType.Type << 5); - - /* TODO Check on return value retval = */ -#if (XUA_DFU_EN == 1) - unsigned DFU_IF = INTERFACE_NUMBER_DFU; - - /* DFU interface number changes based on which mode we are currently running in */ - if (DFU_mode_active) - { - DFU_IF = 0; - } - - if (interfaceNum == DFU_IF) - { - int reset = 0; - - /* If running in application mode stop audio */ - /* Don't interupt audio for save and restore cmds */ - if ((DFU_IF == INTERFACE_NUMBER_DFU) && (sp.bRequest != XMOS_DFU_SAVESTATE) && - (sp.bRequest != XMOS_DFU_RESTORESTATE)) - { - // Stop audio - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, AUDIO_STOP_FOR_DFU); - // Handshake - chkct(c_audioControl, XS1_CT_END); - } - - /* This will return 1 if reset requested */ - result = DFUDeviceRequests(ep0_out, &ep0_in, &sp, null, g_interfaceAlt[sp.wIndex], dfuInterface, &reset); - - if(reset) - { - DFUDelay(50000000); - device_reboot(); - } - } -#endif -#if( 0 < HID_CONTROLS ) - if (interfaceNum == INTERFACE_NUMBER_HID) - { - result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp); - } -#endif - /* 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) - */ - if(((interfaceNum == 0) || (interfaceNum == 1) || (interfaceNum == 2)) - && result == XUD_RES_ERR -#if (XUA_DFU_EN == 1) - && !DFU_mode_active -#endif - ) - { -#if (AUDIO_CLASS == 2) && (AUDIO_CLASS_FALLBACK) - if(g_curUsbSpeed == XUD_SPEED_HS) - { - result = AudioClassRequests_2(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); - } - else - { - result = AudioClassRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); - } -#elif (AUDIO_CLASS==2) - result = AudioClassRequests_2(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); -#else - result = AudioClassRequests_1(ep0_out, ep0_in, &sp, c_audioControl, c_mix_ctl, c_clk_ctl); -#endif - -#ifdef VENDOR_AUDIO_REQS - /* If result is ERR at this point, then request to audio interface not handled - handle vendor audio reqs */ - if(result == XUD_RES_ERR) - { - result = VendorAudioRequests(ep0_out, ep0_in, sp.bRequest, - sp.wValue >> 8, sp.wValue & 0xff, - sp.wIndex >> 8, sp.bmRequestType.Direction, - c_audioControl, c_mix_ctl, c_clk_ctl); - } -#endif - } - } - break; - - default: - break; - } - - } /* if(result == XUD_RES_OKAY) */ - - { - if(result == XUD_RES_ERR) - { - /* Run vendor defined parsing/processing */ - /* Note, an interface might seem ideal here but this *must* be executed on the same - * core sure to shared memory depandancy */ - result = VendorRequests(ep0_out, ep0_in, &sp VENDOR_REQUESTS_PARAMS_); - } - } - - if(result == XUD_RES_ERR) - { -#if (XUA_DFU_EN == 1) - if (!DFU_mode_active) - { -#endif -#if (AUDIO_CLASS_FALLBACK) && (AUDIO_CLASS != 1) - /* Return Audio 2.0 Descriptors with Audio 1.0 as fallback */ - result = USB_StandardRequests(ep0_out, ep0_in, - (unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2), - (unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2), - (unsigned char*)&devDesc_Audio1, sizeof(devDesc_Audio1), - cfgDesc_Audio1, sizeof(cfgDesc_Audio1), - (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), - &sp, g_curUsbSpeed); -#elif FULL_SPEED_AUDIO_2 - /* Return Audio 2.0 Descriptors for high_speed and full-speed */ - - /* Unfortunately we need to munge the descriptors a bit between full and high-speed */ - if(g_curUsbSpeed == XUD_SPEED_HS) - { - /* Modify Audio Class 2.0 Config descriptor for High-speed operation */ -#if (NUM_USB_CHAN_OUT > 0) - cfgDesc_Audio2.Audio_CS_Control_Int.Audio_Out_InputTerminal.bNrChannels = NUM_USB_CHAN_OUT; -#if (NUM_USB_CHAN_OUT > 0) - cfgDesc_Audio2.Audio_Out_Format.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format.bBitResolution = HS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface.bNrChannels = NUM_USB_CHAN_OUT; -#endif -#if (OUTPUT_FORMAT_COUNT > 1) - cfgDesc_Audio2.Audio_Out_Format_2.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format_2.bBitResolution = HS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint_2.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface_2.bNrChannels = NUM_USB_CHAN_OUT; -#endif - -#if (OUTPUT_FORMAT_COUNT > 2) - cfgDesc_Audio2.Audio_Out_Format_3.bSubslotSize = HS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format_3.bBitResolution = HS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint_3.wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface_3.bNrChannels = NUM_USB_CHAN_OUT; -#endif -#endif -#if (NUM_USB_CHAN_IN > 0) - cfgDesc_Audio2.Audio_CS_Control_Int.Audio_In_InputTerminal.bNrChannels = NUM_USB_CHAN_IN; - cfgDesc_Audio2.Audio_In_Format.bSubslotSize = HS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_In_Format.bBitResolution = HS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_In_Endpoint.wMaxPacketSize = HS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_In_ClassStreamInterface.bNrChannels = NUM_USB_CHAN_IN; -#endif - } - else - { - /* Modify Audio Class 2.0 Config descriptor for Full-speed operation */ -#if (NUM_USB_CHAN_OUT > 0) - cfgDesc_Audio2.Audio_CS_Control_Int.Audio_Out_InputTerminal.bNrChannels = NUM_USB_CHAN_OUT_FS; -#if (NUM_USB_CHAN_OUT > 0) - cfgDesc_Audio2.Audio_Out_Format.bSubslotSize = FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format.bBitResolution = FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint.wMaxPacketSize = FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface.bNrChannels = NUM_USB_CHAN_OUT_FS; -#endif -#if (OUTPUT_FORMAT_COUNT > 1) - cfgDesc_Audio2.Audio_Out_Format_2.bSubslotSize = FS_STREAM_FORMAT_OUTPUT_2_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format_2.bBitResolution = FS_STREAM_FORMAT_OUTPUT_2_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint_2.wMaxPacketSize = FS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface_2.bNrChannels = NUM_USB_CHAN_OUT_FS; -#endif - -#if (OUTPUT_FORMAT_COUNT > 2) - cfgDesc_Audio2.Audio_Out_Format_3.bSubslotSize = FS_STREAM_FORMAT_OUTPUT_3_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_Out_Format_3.bBitResolution = FS_STREAM_FORMAT_OUTPUT_3_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_Out_Endpoint_3.wMaxPacketSize = FS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_Out_ClassStreamInterface_3.bNrChannels = NUM_USB_CHAN_OUT_FS; -#endif -#endif -#if (NUM_USB_CHAN_IN > 0) - cfgDesc_Audio2.Audio_CS_Control_Int.Audio_In_InputTerminal.bNrChannels = NUM_USB_CHAN_IN_FS; - cfgDesc_Audio2.Audio_In_Format.bSubslotSize = FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES; - cfgDesc_Audio2.Audio_In_Format.bBitResolution = FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS; - cfgDesc_Audio2.Audio_In_Endpoint.wMaxPacketSize = FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE; - cfgDesc_Audio2.Audio_In_ClassStreamInterface.bNrChannels = NUM_USB_CHAN_IN_FS; -#endif - } - - result = USB_StandardRequests(ep0_out, ep0_in, - (unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2), - (unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2), - null, 0, - null, 0, -#ifdef __XC__ - g_strTable, sizeof(g_strTable), sp, null, g_curUsbSpeed); -#else - (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed); -#endif -#elif (AUDIO_CLASS == 1) - /* Return Audio 1.0 Descriptors in FS, should never be in HS! */ - result = USB_StandardRequests(ep0_out, ep0_in, - null, 0, - null, 0, - (unsigned char*)&devDesc_Audio1, sizeof(devDesc_Audio1), - cfgDesc_Audio1, sizeof(cfgDesc_Audio1), - (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed); -#else - /* Return Audio 2.0 Descriptors with Null device as fallback */ - result = USB_StandardRequests(ep0_out, ep0_in, - (unsigned char*)&devDesc_Audio2, sizeof(devDesc_Audio2), - (unsigned char*)&cfgDesc_Audio2, sizeof(cfgDesc_Audio2), - devDesc_Null, sizeof(devDesc_Null), - cfgDesc_Null, sizeof(cfgDesc_Null), - (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed); -#endif -#if (XUA_DFU_EN == 1) - } - - else - { - /* Running in DFU mode - always return same descs for DFU whether HS or FS */ - result = USB_StandardRequests(ep0_out, ep0_in, - DFUdevDesc, sizeof(DFUdevDesc), - DFUcfgDesc, sizeof(DFUcfgDesc), - null, 0, /* Used same descriptors for full and high-speed */ - null, 0, - (char**)&g_strTable, sizeof(g_strTable)/sizeof(char *), &sp, g_curUsbSpeed); - } -#endif - } - - if (result == XUD_RES_RST) - { -#ifdef __XC__ - g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, ep0_in); -#else - g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, &ep0_in); -#endif - g_currentConfig = 0; - g_curStreamAlt_Out = 0; - g_curStreamAlt_In = 0; - -#if (XUA_DFU_EN == 1) - if (DFUReportResetState(null)) - { - if (!DFU_mode_active) - { - DFU_mode_active = 1; - } - } - else - { - if (DFU_mode_active) - { - DFU_mode_active = 0; - - /* Send reboot command */ - DFUDelay(5000000); - device_reboot(); - } - } -#endif - } -} - /* Endpoint 0 function. Handles all requests to the device */ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) From e0c7272190998aa12dc82181e988936bbbdcf9b0 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Fri, 15 Nov 2019 14:29:49 +0000 Subject: [PATCH 080/233] Add missing definition of MIC_DUAL_FRAME_SIZE. Use the MIC_ARRAY_FRAME_SIZE value from lib_xua. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index 7f105514..e7ea8b46 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -12,4 +12,8 @@ #define MIC_ARRAY_NUM_MICS (XUA_NUM_PDM_MICS) #endif +#ifndef MIC_DUAL_FRAME_SIZE +#define MIC_DUAL_FRAME_SIZE (MIC_ARRAY_FRAME_SIZE) +#endif + #endif /* MIC_ARRAY_CONF_H_ */ From fecc01d2031ac17e509c21dab97e5605b8b6761b Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Fri, 15 Nov 2019 17:19:44 +0000 Subject: [PATCH 081/233] Update the copyright date. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index e7ea8b46..2da348df 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved #ifndef MIC_ARRAY_CONF_H_ #define MIC_ARRAY_CONF_H_ From 5c3cff6a91ebb7dacd035cd217ce1a200352893a Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 11:15:00 +0000 Subject: [PATCH 082/233] Add missing #defines. The XUA library code now depends on these constants. --- tests/app_test_i2s_loopback/xua_conf.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/app_test_i2s_loopback/xua_conf.h b/tests/app_test_i2s_loopback/xua_conf.h index 6dc9c95d..0b555dba 100644 --- a/tests/app_test_i2s_loopback/xua_conf.h +++ b/tests/app_test_i2s_loopback/xua_conf.h @@ -22,5 +22,7 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 +#define MIC_DUAL_ENABLED 1 //Use single thread, dual PDM mic +#define MIC_ARRAY_FRAME_SIZE 240 #endif // __custom_defines_h__ From 3b6f6b6a1082c6a1611f6b9c02718b29e354ab73 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 11:18:46 +0000 Subject: [PATCH 083/233] Added comment to change log. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 498faf1e..26be68d4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,8 @@ lib_xua Change Log * ADDED: UAC1 HID support with simulated Voice Command detection reported every 10 seconds * ADDED: Support for USB HID Set Idle request + * ADDED: Pre-processor symbols to enable single-threaded, dual-PDM + microphone operation 0.2.1 ----- From 192d8f54d7ebbec4a9776ab883ea870619b280a8 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 11:28:42 +0000 Subject: [PATCH 084/233] Update copyright date range. --- tests/app_test_i2s_loopback/xua_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app_test_i2s_loopback/xua_conf.h b/tests/app_test_i2s_loopback/xua_conf.h index 0b555dba..29316351 100644 --- a/tests/app_test_i2s_loopback/xua_conf.h +++ b/tests/app_test_i2s_loopback/xua_conf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved #ifndef __custom_defines_h__ #define __custom_defines_h__ From 9674ae3328a724c5da918142166344a08bc9052e Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 11:36:41 +0000 Subject: [PATCH 085/233] Update copyright date range. --- tests/app_test_i2s_loopback/LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app_test_i2s_loopback/LICENSE.txt b/tests/app_test_i2s_loopback/LICENSE.txt index c7b8c711..5fee4f02 100644 --- a/tests/app_test_i2s_loopback/LICENSE.txt +++ b/tests/app_test_i2s_loopback/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2016-2018, XMOS, All rights reserved. +Copyright (c) 2016-2019, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From f91728485cfed8f48e64c1f93b5df975d167bd73 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 13:08:44 +0000 Subject: [PATCH 086/233] Add missing constant --- examples/AN00246_xua_example/src/xua_conf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index d879e272..6fa7ae62 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -21,5 +21,6 @@ #define PID_AUDIO_1 1 #define PID_AUDIO_2 2 #define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example */ +#define MIC_DUAL_ENABLED 0 // Use multiple thread #endif From c8299998c87f9087524839b92b249b2b7e36695a Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 18 Nov 2019 13:16:05 +0000 Subject: [PATCH 087/233] Update copyright date range. --- examples/AN00246_xua_example/LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/AN00246_xua_example/LICENSE.txt b/examples/AN00246_xua_example/LICENSE.txt index 82cfb860..8b37ec93 100644 --- a/examples/AN00246_xua_example/LICENSE.txt +++ b/examples/AN00246_xua_example/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2018, XMOS, All rights reserved. +Copyright (c) 2018-2019, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From f594d1d4232e3c35b644055f7ff2ef46e4b41ad0 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 19 Nov 2019 09:59:18 +0000 Subject: [PATCH 088/233] Add missing #define and update copyright date range. --- examples/AN00247_xua_example_spdif_tx/src/xua_conf.h | 3 ++- examples/AN00248_xua_example_pdm_mics/src/xua_conf.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h index d83f5a2e..ccbaaa91 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ @@ -26,5 +26,6 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 +#define MIC_DUAL_ENABLED 0 // Use multiple thread #endif diff --git a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h index 8cdf256e..b28ede56 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ @@ -25,5 +25,6 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 +#define MIC_DUAL_ENABLED 0 // Use multiple thread #endif From e097b5dc3dc82962e74541bc94e4fca34dbb3092 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 19 Nov 2019 09:59:37 +0000 Subject: [PATCH 089/233] Update copyright date range. --- examples/AN00246_xua_example/src/xua_conf.h | 2 +- examples/AN00247_xua_example_spdif_tx/LICENSE.txt | 2 +- examples/AN00248_xua_example_pdm_mics/LICENSE.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index 6fa7ae62..2c8629ea 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ diff --git a/examples/AN00247_xua_example_spdif_tx/LICENSE.txt b/examples/AN00247_xua_example_spdif_tx/LICENSE.txt index 236b6d1a..381126d4 100644 --- a/examples/AN00247_xua_example_spdif_tx/LICENSE.txt +++ b/examples/AN00247_xua_example_spdif_tx/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2018, XMOS, All rights reserved. +Copyright (c) 2018-2019, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/examples/AN00248_xua_example_pdm_mics/LICENSE.txt b/examples/AN00248_xua_example_pdm_mics/LICENSE.txt index dd731b32..bdf72741 100644 --- a/examples/AN00248_xua_example_pdm_mics/LICENSE.txt +++ b/examples/AN00248_xua_example_pdm_mics/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2018, XMOS, All rights reserved. +Copyright (c) 2018-2019, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From 4ff6815d07fc4292acaae644f916ada8d4f42e90 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 19 Nov 2019 10:35:22 +0000 Subject: [PATCH 090/233] Add missing #define and switch to using the single-threaded, dual PDM microphone design. --- examples/AN00246_xua_example/src/xua_conf.h | 3 ++- examples/AN00247_xua_example_spdif_tx/src/xua_conf.h | 3 ++- examples/AN00248_xua_example_pdm_mics/src/xua_conf.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index 2c8629ea..61a4de4b 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -21,6 +21,7 @@ #define PID_AUDIO_1 1 #define PID_AUDIO_2 2 #define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example */ -#define MIC_DUAL_ENABLED 0 // Use multiple thread +#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones +#define MIC_ARRAY_FRAME_SIZE 240 #endif diff --git a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h index ccbaaa91..c572d59f 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h @@ -26,6 +26,7 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 -#define MIC_DUAL_ENABLED 0 // Use multiple thread +#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones +#define MIC_ARRAY_FRAME_SIZE 240 #endif diff --git a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h index b28ede56..fa0a015f 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h @@ -25,6 +25,7 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 -#define MIC_DUAL_ENABLED 0 // Use multiple thread +#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones +#define MIC_ARRAY_FRAME_SIZE 240 #endif From 6b454b0ebecb4e62230ccda22a359edbe1e13a31 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Wed, 20 Nov 2019 11:40:05 +0000 Subject: [PATCH 091/233] Fix descriptors for XUA_ADAPTIVE --- .../src/core/endpoint0/xua_ep0_descriptors.h | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 208114b5..fcc1e45b 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1470,9 +1470,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, #ifdef XUA_ADAPTIVE - .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, #else - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE, .bInterval = 1, @@ -1552,9 +1556,13 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, #ifdef XUA_ADAPTIVE - .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, #else - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_2_MAXPACKETSIZE, .bInterval = 1, @@ -1636,10 +1644,14 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_OUT_AUDIO, #ifdef XUA_ADAPTIVE - .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, /* (bitmap) */ + .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, #else - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* (bitmap) */ -#endif + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ + #else + .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif +#endif .wMaxPacketSize = HS_STREAM_FORMAT_OUTPUT_3_MAXPACKETSIZE, .bInterval = 1, }, @@ -1732,11 +1744,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = 0x07, .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, -#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ -#else - #ifdef XUA_ADAPTIVE +#ifdef XUA_ADAPTIVE .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ #endif @@ -1804,11 +1816,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = 0x07, .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, -#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ -#else - #ifdef XUA_ADAPTIVE +#ifdef XUA_ADAPTIVE .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ #endif @@ -1877,11 +1889,11 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .bLength = 0x07, .bDescriptorType = USB_DESCTYPE_ENDPOINT, .bEndpointAddress = ENDPOINT_ADDRESS_IN_AUDIO, -#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ -#else - #ifdef XUA_ADAPTIVE +#ifdef XUA_ADAPTIVE .bmAttributes = ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + .bmAttributes = ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else .bmAttributes = ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ #endif @@ -2642,7 +2654,11 @@ unsigned char cfgDesc_Audio1[] = #ifdef XUA_ADAPTIVE ISO_EP_ATTRIBUTES_ADAPTIVE, #else - ISO_EP_ATTRIBUTES_ASYNCH, + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ + #else + ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif #endif (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff), /* 4 wMaxPacketSize (Typically 294 bytes)*/ (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ @@ -2779,11 +2795,11 @@ unsigned char cfgDesc_Audio1[] = 0x09, 0x05, /* ENDPOINT */ ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */ -#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ -#else - #ifdef XUA_ADAPTIVE +#ifdef XUA_ADAPTIVE ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ #else ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ #endif From 2aaa12e60b021522f3d1c25d59197b1e75cd5bc1 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 21 Nov 2019 16:57:56 +0000 Subject: [PATCH 092/233] Remove the default definition of MIC_ARRAY_MAX_FRAME_SIZE_LOG2. It has been moved to mic_array_frame.h. Establish a value for MIC_ARRAY_FRAME_SIZE and MIC_DUAL_FRAME_SIZE if they have not already been defined. Give them the value of XUA_MIC_FRAME_SIZE in this case. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index 2da348df..81e062b4 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -4,8 +4,8 @@ #include "xua_conf_full.h" -#ifndef MIC_ARRAY_MAX_FRAME_SIZE_LOG2 -#define MIC_ARRAY_MAX_FRAME_SIZE_LOG2 0 +#ifndef MIC_ARRAY_FRAME_SIZE +#define MIC_ARRAY_FRAME_SIZE (XUA_MIC_FRAME_SIZE) #endif #ifndef MIC_ARRAY_NUM_MICS @@ -13,7 +13,7 @@ #endif #ifndef MIC_DUAL_FRAME_SIZE -#define MIC_DUAL_FRAME_SIZE (MIC_ARRAY_FRAME_SIZE) +#define MIC_DUAL_FRAME_SIZE (XUA_MIC_FRAME_SIZE) #endif #endif /* MIC_ARRAY_CONF_H_ */ From 241afbe7e6d36278e2a7c825240f7d8e0f795be3 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 21 Nov 2019 16:58:24 +0000 Subject: [PATCH 093/233] Establish a default value for XUA_MIC_FRAME_SIZE. --- lib_xua/api/xua_conf_default.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index b7bd71cf..9bfa7bbd 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -288,6 +288,13 @@ #define PDM_MIC_INDEX (0) #endif +/** + * @brief Size of a frame of microphone data samples. Default: 1 + */ +#ifndef XUA_MIC_FRAME_SIZE +#define XUA_MIC_FRAME_SIZE (1) +#endif + /** * @brief Enable MIDI functionality including buffering, descriptors etc. Default: DISABLED */ From eeca5fdd60a6142211d0bf00848b9521ee510538 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 21 Nov 2019 17:32:39 +0000 Subject: [PATCH 094/233] Move the default definition of MIC_ARRAY_MAX_FRAME_SIZE_LOG2 to mic_array_conf.h so that an assembler file can pick it up using a #include. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index 81e062b4..e88cdbb6 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -8,6 +8,13 @@ #define MIC_ARRAY_FRAME_SIZE (XUA_MIC_FRAME_SIZE) #endif +// The default definition of MIC_ARRAY_MAX_FRAME_SIZE_LOG2 must appear in this file +// because an assembler file #includes it. +// The assembler does not understand C language syntax, only C pre-processor syntax. +#ifndef MIC_ARRAY_MAX_FRAME_SIZE_LOG2 +#define MIC_ARRAY_MAX_FRAME_SIZE_LOG2 (0) +#endif + #ifndef MIC_ARRAY_NUM_MICS #define MIC_ARRAY_NUM_MICS (XUA_NUM_PDM_MICS) #endif From 3a1c1b0265bfe90a936c0b7b388ea989a46b4885 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Fri, 22 Nov 2019 10:08:36 +0000 Subject: [PATCH 095/233] Only override the value of MIC_DUAL_FRAME_SIZE if MIC_DUAL_ENABLED is set to true. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index e88cdbb6..ededfedf 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -19,8 +19,12 @@ #define MIC_ARRAY_NUM_MICS (XUA_NUM_PDM_MICS) #endif +// MIC_DUAL_FRAME_SIZE has no meaning if MIC_DUAL_ENABLED is false. +// Only define MIC_DUAL_FRAME_SIZE if MIC_DUAL_ENABLED is true. +#if defined(MIC_DUAL_ENABLED) && (MIC_DUAL_ENABLED != 0) #ifndef MIC_DUAL_FRAME_SIZE #define MIC_DUAL_FRAME_SIZE (XUA_MIC_FRAME_SIZE) #endif +#endif #endif /* MIC_ARRAY_CONF_H_ */ From 82d364a25d8069004a4b6c44ed6405e027f018db Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Fri, 22 Nov 2019 11:19:07 +0000 Subject: [PATCH 096/233] Disable single-threaded mic array processing for these examples. Remove the unnecessary definition of MIC_ARRAY_FRAME_SIZE. --- examples/AN00246_xua_example/src/xua_conf.h | 3 +-- examples/AN00247_xua_example_spdif_tx/src/xua_conf.h | 3 +-- examples/AN00248_xua_example_pdm_mics/src/xua_conf.h | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index 61a4de4b..c969f6cf 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -21,7 +21,6 @@ #define PID_AUDIO_1 1 #define PID_AUDIO_2 2 #define XUA_DFU_EN 0 /* Disable DFU (for simplicity of example */ -#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones -#define MIC_ARRAY_FRAME_SIZE 240 +#define MIC_DUAL_ENABLED 0 // Use multi-threaded design #endif diff --git a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h index c572d59f..b2867ee7 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h @@ -26,7 +26,6 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 -#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones -#define MIC_ARRAY_FRAME_SIZE 240 +#define MIC_DUAL_ENABLED 0 // Use multi-threaded design #endif diff --git a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h index fa0a015f..e2f0f84f 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h @@ -25,7 +25,6 @@ #define AUDIO_CLASS_FALLBACK 0 #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 -#define MIC_DUAL_ENABLED 1 // Use single-threaded design with dual PDM microphones -#define MIC_ARRAY_FRAME_SIZE 240 +#define MIC_DUAL_ENABLED 0 // Use multi-threaded design #endif From a85cbc06b80dcd1ba2c8dd80644871e5579b9fa9 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Fri, 22 Nov 2019 11:27:59 +0000 Subject: [PATCH 097/233] Update CHANGELOG.rst --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 498faf1e..a1f23ede 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ lib_xua Change Log * ADDED: UAC1 HID support with simulated Voice Command detection reported every 10 seconds * ADDED: Support for USB HID Set Idle request + * FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint 0.2.1 ----- From f22027564d5bc1787114546bda03b9b1976e0e8c Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 25 Nov 2019 12:10:26 +0000 Subject: [PATCH 098/233] Use the XUA-specific microphone frame size constant instead of directly overriding the microphone frame size constant from lib_mic_array. Multiple constants may be derived from XUA_MIC_FRAME_SIZE. The override of MIC_ARRAY_FRAME_SIZE occurs in mic_array_conf.h. --- tests/app_test_i2s_loopback/xua_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app_test_i2s_loopback/xua_conf.h b/tests/app_test_i2s_loopback/xua_conf.h index 29316351..70298c70 100644 --- a/tests/app_test_i2s_loopback/xua_conf.h +++ b/tests/app_test_i2s_loopback/xua_conf.h @@ -23,6 +23,6 @@ #define BCD_DEVICE 0x1234 #define XUA_DFU_EN 0 #define MIC_DUAL_ENABLED 1 //Use single thread, dual PDM mic -#define MIC_ARRAY_FRAME_SIZE 240 +#define XUA_MIC_FRAME_SIZE 240 #endif // __custom_defines_h__ From 471ab4548a60db66bb498b4af1eed2a19f5157d8 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Mon, 25 Nov 2019 13:48:58 +0000 Subject: [PATCH 099/233] Move the override of MIC_ARRAY_FRAME_SIZE from mic_array_conf.h in lib_xua to ap_conf.h in sw_xvf3510/app_xk/xvf3510_l71. This constant is only used in the audio pipelines, hence does not belong in the configuration of XUA. --- lib_xua/src/core/pdm_mics/mic_array_conf.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index ededfedf..10840331 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -4,10 +4,6 @@ #include "xua_conf_full.h" -#ifndef MIC_ARRAY_FRAME_SIZE -#define MIC_ARRAY_FRAME_SIZE (XUA_MIC_FRAME_SIZE) -#endif - // The default definition of MIC_ARRAY_MAX_FRAME_SIZE_LOG2 must appear in this file // because an assembler file #includes it. // The assembler does not understand C language syntax, only C pre-processor syntax. From daf378e4a52a3940c5f8a9f14e95a4b48ab8f290 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Tue, 26 Nov 2019 11:37:38 +0000 Subject: [PATCH 100/233] Add in the code to call HidInterfaceClassRequests(). It was inadvertently removed during the removal of the XUA_Endpoint0_lite_loop() function. --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 3c92defa..91576287 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -617,6 +617,12 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 device_reboot(); } } +#endif +#if( 0 < HID_CONTROLS ) + if (interfaceNum == INTERFACE_NUMBER_HID) + { + result = HidInterfaceClassRequests(ep0_out, ep0_in, &sp); + } #endif /* Check for: - Audio CONTROL interface request - always 0, note we check for DFU first * - Audio STREAMING interface request (In or Out) From 255e9f75b543aa8d9bdcf1cfb67a303f116712e0 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 16:45:11 +0000 Subject: [PATCH 101/233] Add missing header file guards. --- lib_xua/src/core/user/hid/user_hid.h | 4 ++++ lib_xua/src/hid/xua_hid.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 88165b2a..7d67b00c 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,5 +1,8 @@ // Copyright (c) 2013-2019, XMOS Ltd, All rights reserved +#ifndef __USER_HID_H__ +#define __USER_HID_H__ + /* These defines relate to the HID report desc - do not mod */ #define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 #define HID_CONTROL_NEXT_SHIFT 0x01 @@ -17,3 +20,4 @@ void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); void UserSetHIDData( const unsigned hidData ); #endif /* ( 0 < HID_CONTROLS ) */ +#endif /* __USER_HID_H__ */ diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 23d507e0..63469054 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -1,4 +1,8 @@ // Copyright (c) 2019, XMOS Ltd, All rights reserved + +#ifndef __XUA_HID_H__ +#define __XUA_HID_H__ + #include #include #include "xud.h" @@ -53,3 +57,5 @@ XUD_Result_t HidInterfaceClassRequests( * \retval 0 -- Send the HID Report */ unsigned HidIsSetIdleSilenced( void ); + +#endif // __XUA_HID_H__ From 83284620ccc6cf9dd3ce8b2f38724924ede7a4af Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 16:45:49 +0000 Subject: [PATCH 102/233] Explain the need for using the assembler gettime operation instead of an XC timer more fully. --- lib_xua/src/hid/hid.xc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 478bfea5..854b78d3 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -57,7 +57,10 @@ unsigned HidIsSetIdleSilenced( void ) if( s_hidIdleActive ) { unsigned currentTime; - asm volatile( "gettime %0" : "=r" ( currentTime )); // Use inline assembly to access the time without creating a side-effect + // Use inline assembly to access the time without creating a side-effect. + // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. + // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. + asm volatile( "gettime %0" : "=r" ( currentTime )); isSilenced = ( s_hidIndefiniteDuration || ( timeafter( s_hidNextReportTime, currentTime ))); } From 746635b2eb48dd7eb39024a6c755184a18983741 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 18:01:14 +0000 Subject: [PATCH 103/233] Update change log. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 11d15168..d8b82f4a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,7 @@ lib_xua Change Log * ADDED: Pre-processor symbols to enable single-threaded, dual-PDM microphone operation * FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint + * ADDED: Guards to user_hid.h and xua_hid.h 0.2.1 ----- From 31bb86c161b099c82b42ae8ba588446d89dd96c2 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 11 Dec 2019 16:02:16 +0000 Subject: [PATCH 104/233] First changes to move to a USB HID design that allows some degree of boot-time configurability. These changes are far from complete. They build successfully, but have received very little bench testing. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/hid/user_hid.h | 48 +++++++++++++++++++------ lib_xua/src/hid/hid.xc | 26 +++++++++++++- lib_xua/src/hid/xua_hid.h | 16 +++++++++ 4 files changed, 80 insertions(+), 12 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 45e08da3..3e28a2e5 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDData(g_hidData); + g_hidData[0]=UserHIDGetData(); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 7d67b00c..35d2578d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,21 +3,49 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These defines relate to the HID report desc - do not mod */ -#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 -#define HID_CONTROL_NEXT_SHIFT 0x01 -#define HID_CONTROL_PREV_SHIFT 0x02 -#define HID_CONTROL_VOLUP_SHIFT 0x03 -#define HID_CONTROL_VOLDN_SHIFT 0x04 -#define HID_CONTROL_MUTE_SHIFT 0x05 +/* These enumerated constants relate to the HID report desc - do not mod */ +typedef enum hidEventId_t { + HID_EVENT_ID_GPI0 = 0, + HID_EVENT_ID_GPI1, + HID_EVENT_ID_GPI2, + HID_EVENT_ID_GPI3, + HID_EVENT_ID_EVT0, + HID_EVENT_ID_EVT1, + HID_EVENT_ID_EVT2, + HID_EVENT_ID_EVT3, + HID_EVENT_ID_EVT4, + HID_EVENT_ID_EVT5, + HID_EVENT_ID_EVT6, + HID_EVENT_ID_EVT7, + HID_EVENT_ID_EVT8, + HID_EVENT_ID_EVT9, + HID_EVENT_ID_EVT10, + HID_EVENT_ID_EVT11, + HID_EVENT_ID_EVT12, + HID_EVENT_ID_EVT13, + HID_EVENT_ID_EVT14, + HID_EVENT_ID_EVT15, + HID_EVENT_ID_EVT16, + HID_EVENT_ID_EVT17, + HID_EVENT_ID_EVT18, + HID_EVENT_ID_EVT19, + HID_EVENT_ID_EVT20, + HID_EVENT_ID_EVT21, + HID_EVENT_ID_EVT22, + HID_EVENT_ID_EVT23, + HID_EVENT_ID_EVT24, + HID_EVENT_ID_EVT25, + HID_EVENT_ID_EVT26, + HID_EVENT_ID_EVT27 +} hidEventId_t; #define HID_DATA_SIZE 1 #if( 0 < HID_CONTROLS ) -void UserInitHIDData( void ); -void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); -void UserSetHIDData( const unsigned hidData ); +unsigned UserHIDGetData( void ); +void UserHIDInit( void ); +void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 854b78d3..906fd1ec 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -9,12 +9,17 @@ #if( 0 < HID_CONTROLS ) #define MS_IN_TICKS 100000U -static unsigned s_hidIdleActive = 0U; +static unsigned s_hidChangePending = 0U; static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; +static unsigned s_hidIdleActive = 0U; static unsigned s_hidIndefiniteDuration = 0U; static unsigned s_hidNextReportTime = 0U; static unsigned s_hidReportTime = 0U; +unsafe { + volatile unsigned * unsafe s_hidChangePendingPtr = &s_hidChangePending; +} + static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ); @@ -51,6 +56,18 @@ XUD_Result_t HidInterfaceClassRequests( return result; } +void HidClearChangePending( void ) +{ + unsafe { + *s_hidChangePendingPtr = 0U; + } +} + +unsigned HidIsChangePending( void ) +{ + return( s_hidChangePending != 0 ); +} + unsigned HidIsSetIdleSilenced( void ) { unsigned isSilenced = s_hidIdleActive; @@ -67,6 +84,13 @@ unsigned HidIsSetIdleSilenced( void ) return isSilenced; } +void HidSetChangePending( void ) +{ + unsafe { + *s_hidChangePendingPtr = 1; + } +} + /** * \brief Calculate the timer value for sending the next HID Report. * diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 63469054..9e620788 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -40,6 +40,17 @@ XUD_Result_t HidInterfaceClassRequests( XUD_ep c_ep0_in, REFERENCE_PARAM( USB_SetupPacket_t, sp )); +/** + * \brief Register that previously changed HID Report data has reported + * to the USB Host. + */ +void HidClearChangePending( void ); + +/** + * \brief Indicate if a change to the HID Report data has been received. + */ +unsigned HidIsChangePending( void ); + /** * \brief Indicate whether to send a HID Report based on elapsed time. * @@ -58,4 +69,9 @@ XUD_Result_t HidInterfaceClassRequests( */ unsigned HidIsSetIdleSilenced( void ); +/** + * \brief Register that a change to the HID Report data has been received. + */ +void HidSetChangePending( void ); + #endif // __XUA_HID_H__ From e5389e434846e50e34b164df27c2ad80f2b918d9 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 13 Dec 2019 18:17:36 +0000 Subject: [PATCH 105/233] Added support for AC Stop (End Call), Volume Increment and Volume Decrement bit fields in the HID report. --- CHANGELOG.rst | 2 ++ lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 9 ++++++--- lib_xua/src/core/user/hid/user_hid.h | 10 ++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8b82f4a..d653a370 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,8 @@ lib_xua Change Log microphone operation * FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint * ADDED: Guards to user_hid.h and xua_hid.h + * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and + Volume Decrement 0.2.1 ----- diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index fcc1e45b..8abd18e9 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -573,9 +573,12 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ 0xa1, 0x02, /* Collection (Logical) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x95, 0x01, /* Report Count (1) */ + 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x09, 0xea, /* Usage (Volume Decrement) */ + 0x95, 0x04, /* Report Count (4) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x95, 0x07, /* Report Count (7) */ + 0x95, 0x04, /* Report Count (4) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0, /* End collection (Logical) */ 0xc0 /* End collection (Application) */ @@ -2884,7 +2887,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x1E, /* 7 wDescriptorLength[0] */ + 0x25, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 7d67b00c..79b420a3 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -4,12 +4,10 @@ #define __USER_HID_H__ /* These defines relate to the HID report desc - do not mod */ -#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 -#define HID_CONTROL_NEXT_SHIFT 0x01 -#define HID_CONTROL_PREV_SHIFT 0x02 -#define HID_CONTROL_VOLUP_SHIFT 0x03 -#define HID_CONTROL_VOLDN_SHIFT 0x04 -#define HID_CONTROL_MUTE_SHIFT 0x05 +#define HID_CONTROL_KEYWORD_SHIFT 0x00 +#define HID_CONTROL_ENDCALL_SHIFT 0x01 +#define HID_CONTROL_VOLUP_SHIFT 0x02 +#define HID_CONTROL_VOLDN_SHIFT 0x03 #define HID_DATA_SIZE 1 From 1ee146ef608c65250c27f01563c72a531b468ab2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 12:33:59 +0000 Subject: [PATCH 106/233] Define each active bit field separately. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 8abd18e9..1461fc16 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -572,11 +572,14 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x01, /* Collection (Application) */ 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ 0xa1, 0x02, /* Collection (Logical) */ + 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ - 0x95, 0x04, /* Report Count (4) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ @@ -2887,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x25, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 9f1e9735b8a55d6bec7e861090fdbd1f6ad99f96 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 14:53:38 +0000 Subject: [PATCH 107/233] Remove unnecessary Input statements. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..319d3fd4 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -574,11 +574,8 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x02, /* Collection (Logical) */ 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ @@ -2890,7 +2887,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x2B, /* 7 wDescriptorLength[0] */ + 0x25, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 8b6f6bc8e1b7cd6f847e2e64aabd4f35ac672877 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 15:13:53 +0000 Subject: [PATCH 108/233] Revert "Remove unnecessary Input statements." This reverts commit 9f1e9735b8a55d6bec7e861090fdbd1f6ad99f96. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 319d3fd4..1461fc16 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -574,8 +574,11 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x02, /* Collection (Logical) */ 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ @@ -2887,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x25, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 538f2be5b41b74c39b977b927d19363d5e371957 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 18 Dec 2019 12:09:11 +0000 Subject: [PATCH 109/233] Modify the interface to the User HID functionality. Setting the HID data use to occur through a global variable. It now occurs through a function call. A list of general HID events has been provided as well. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 ++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 3e28a2e5..97984b85 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[1] = {0}; +unsigned char g_hidData[HID_DATA_BYTES] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - g_hidData[0]=UserHIDGetData(); + UserHIDGetData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 35d2578d..5288ee7b 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,7 +3,13 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These enumerated constants relate to the HID report desc - do not mod */ +/** + * \brief HID event identifiers + * + * This enumeration defines a constant value for each HID event. + * It defines one value for each of the four GPI pins supported in the standard voice products. + * It defines a further 28 values for generic events. + */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -39,13 +45,40 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_SIZE 1 +#define HID_DATA_BYTES 4 #if( 0 < HID_CONTROLS ) -unsigned UserHIDGetData( void ); +/** + * \brief Get the data for the next HID report + * + * \note This function returns the HID data as a list of unsigned char because the + * \c XUD_SetReady_In() accepts data for transmission to the USB Host using + * this type. + * + * \param{out} hidData The HID data + */ +void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); + +/** + * \brief Initialize HID processing + */ void UserHIDInit( void ); -void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); + +/** + * \brief Record that a HID event has occurred + * + * \param{in} hidEventId The identifier of an event which has occurred + * \param{in} hidEventData A list of data associated with the event + * \param{in} hidEventDataSize The length of the event data list + * + * \note At present, this function only takes a single element of event data, i.e. + * hidEventDataSize must equal 1. + * + * \note At present, this function treats the event data as a Boolean flag. + * Zero means False; all other values mean True. + */ +void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From d81af18d1fddf85278ca392065336195bff97854 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 19 Dec 2019 09:52:13 +0000 Subject: [PATCH 110/233] Revert "Modify the interface to the User HID functionality." This reverts commit 538f2be5b41b74c39b977b927d19363d5e371957. On branch feature/hid_4bit_reliance_jan_demo Changes to be committed: modified: lib_xua/src/core/buffer/ep/ep_buffer.xc modified: lib_xua/src/core/user/hid/user_hid.h --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 +++---------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 97984b85..3e28a2e5 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[HID_DATA_BYTES] = {0}; +unsigned char g_hidData[1] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserHIDGetData(g_hidData); + g_hidData[0]=UserHIDGetData(); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 5288ee7b..35d2578d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,13 +3,7 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/** - * \brief HID event identifiers - * - * This enumeration defines a constant value for each HID event. - * It defines one value for each of the four GPI pins supported in the standard voice products. - * It defines a further 28 values for generic events. - */ +/* These enumerated constants relate to the HID report desc - do not mod */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -45,40 +39,13 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_BYTES 4 +#define HID_DATA_SIZE 1 #if( 0 < HID_CONTROLS ) -/** - * \brief Get the data for the next HID report - * - * \note This function returns the HID data as a list of unsigned char because the - * \c XUD_SetReady_In() accepts data for transmission to the USB Host using - * this type. - * - * \param{out} hidData The HID data - */ -void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); - -/** - * \brief Initialize HID processing - */ +unsigned UserHIDGetData( void ); void UserHIDInit( void ); - -/** - * \brief Record that a HID event has occurred - * - * \param{in} hidEventId The identifier of an event which has occurred - * \param{in} hidEventData A list of data associated with the event - * \param{in} hidEventDataSize The length of the event data list - * - * \note At present, this function only takes a single element of event data, i.e. - * hidEventDataSize must equal 1. - * - * \note At present, this function treats the event data as a Boolean flag. - * Zero means False; all other values mean True. - */ -void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); +void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From 6eb30c56468582351877ff676c5c827cc2701c61 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 20 Dec 2019 13:37:54 +0000 Subject: [PATCH 111/233] Replace the HID Report descriptor with one that uses the Usage values specified by Reliance in their Reliance Jio Infocomm Limited, RJIL Devices, VoicePoD, Technical Requirements Document, Rev. No. 2.0, Date 18-12-2019. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..74319030 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -564,26 +564,18 @@ unsigned char devQualDesc_Null[] = #if( 0 < HID_CONTROLS ) unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */ { - 0x15, 0x01, /* Logical Minimum (1) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x75, 0x01, /* Report Size (1) */ - 0x05, 0x0c, /* Usage Page (Consumer Device) */ - 0x09, 0x01, /* Usage (Consumer Control) */ + 0x05, 0x01, /* Usage Page (Generic Desktop) */ + 0x09, 0x06, /* Usage (Keyboard) */ 0xa1, 0x01, /* Collection (Application) */ - 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ - 0xa1, 0x02, /* Collection (Logical) */ - 0x95, 0x01, /* Report Count (1) */ - 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x09, 0xe9, /* Usage (Volume Increment) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x09, 0xea, /* Usage (Volume Decrement) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ + 0x75, 0x01, /* Report Size (1) */ 0x95, 0x04, /* Report Count (4) */ - 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ - 0xc0, /* End collection (Logical) */ + 0x05, 0x07, /* Usage Page (Key Codes) */ + 0x19, 0x70, /* Usage Minimum (Keyboard F21) */ + 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */ 0xc0 /* End collection (Application) */ }; #endif @@ -2669,7 +2661,7 @@ unsigned char cfgDesc_Audio1[] = (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff), /* 4 wMaxPacketSize (Typically 294 bytes)*/ (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ 0x01, /* bInterval */ - 0x00, /* bRefresh */ + 0x00, /* bRefresh */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) ENDPOINT_ADDRESS_IN_FEEDBACK, /* bSynchAdddress - address of EP used to communicate sync info */ #else /* Bi-directional in/out device */ @@ -2890,7 +2882,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x2B, /* 7 wDescriptorLength[0] */ + 0x19, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 3b80f63cb99c5b0bd7c51133598f2f15c24b4388 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 31 Dec 2019 10:34:32 +0800 Subject: [PATCH 112/233] modified audio output frequency as a variable --- lib_xua/api/xua_conf_default.h | 7 +++++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 3 ++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 29 ++++++++++--------- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 9bfa7bbd..b22046f0 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -226,6 +226,13 @@ #define DEFAULT_FREQ (MIN_FREQ) #endif +/** + * @brief Default Audio output sampling frequency + */ +#ifndef DEFAULT_AUDOUT_FREQ +#define DEFAULT_AUDOUT_FREQ (48000) +#endif + /* Audio Class Defines */ /** diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index ab4c613d..dae6863a 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -17,4 +17,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_S void VendorAudioRequestsInit(chanend c_audioControl, NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl)); +extern unsigned int g_curAudOut_SamFreq; + + #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..7ae5040b 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -17,6 +17,7 @@ #ifdef MIXER #include "mixer.h" #endif +#include "xua_conf.h" #define CS_XU_MIXSEL (0x06) @@ -46,7 +47,7 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif /* Global var for current frequency, set to default freq */ -unsigned int g_curSamFreq = DEFAULT_FREQ; +unsigned int g_curAudOut_SamFreq = DEFAULT_AUDOUT_FREQ; #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -320,14 +321,14 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c int newSampleRate = buffer[0]; /* Instruct audio thread to change sample freq (if change required) */ - if(newSampleRate != g_curSamFreq) + if(newSampleRate != g_curAudOut_SamFreq) { int newMasterClock; - g_curSamFreq = newSampleRate; + g_curAudOut_SamFreq = newSampleRate; #if 0 /* Original feedback implementation */ - g_curSamFreq48000Family = ((MCLK_48 % g_curSamFreq) == 0); + g_curSamFreq48000Family = ((MCLK_48 % g_curAudOut_SamFreq) == 0); if(g_curSamFreq48000Family) { @@ -338,17 +339,17 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c newMasterClock = MCLK_441; } - setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512)); + setG_curSamFreqMultiplier(g_curAudOut_SamFreq/(newMasterClock/512)); #endif #if ADAT_RX /* Configure ADAT SMUX based on sample rate */ outuint(c_clk_ctl, SET_SMUX); - if(g_curSamFreq < 88200) + if(g_curAudOut_SamFreq < 88200) { /* No SMUX */ outuint(c_clk_ctl, 0); } - else if(g_curSamFreq < 176400) + else if(g_curAudOut_SamFreq < 176400) { /* SMUX */ outuint(c_clk_ctl, 1); @@ -361,7 +362,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c outct(c_clk_ctl, XS1_CT_END); #endif outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curSamFreq); + outuint(c_audioControl, g_curAudOut_SamFreq); /* Wait for handshake back - i.e. PLL locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); @@ -395,7 +396,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c } else { - buffer[0] = g_curSamFreq; + buffer[0] = g_curAudOut_SamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 4, sp.wLength ); } @@ -403,7 +404,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c #endif case ID_CLKSRC_INT: /* Always report our current operating frequency */ - buffer[0] = g_curSamFreq; + buffer[0] = g_curAudOut_SamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 4, sp.wLength ); break; @@ -1107,7 +1108,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp /* Recontruct sample-freq */ int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); - if(newSampleRate != g_curSamFreq) + if(newSampleRate != g_curAudOut_SamFreq) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1119,11 +1120,11 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - g_curSamFreq = newSampleRate; + g_curAudOut_SamFreq = newSampleRate; /* Instruct audio thread to change sample freq */ outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curSamFreq); + outuint(c_audioControl, g_curAudOut_SamFreq); /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); @@ -1147,7 +1148,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp switch(sp.bRequest) { case UAC_B_REQ_GET_CUR: - buffer[0] = g_curSamFreq; + buffer[0] = g_curAudOut_SamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 3, sp.wLength); break; } From 67764fb0e8f29f7329c26dc1cabe871c5cea6ea6 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 6 Jan 2020 17:13:58 +0000 Subject: [PATCH 113/233] Update change log. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d653a370..b68c4154 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,8 @@ lib_xua Change Log * ADDED: Guards to user_hid.h and xua_hid.h * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and Volume Decrement + * CHANGE: UAC1 HID to report function keys f21 through f24 as specified + by customer 0.2.1 ----- From ad453c8a821c07378bc94d3a90e15daba4b4b99b Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 6 Jan 2020 17:22:57 +0000 Subject: [PATCH 114/233] Update change log to keep Jenkins happy. --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b68c4154..b77784ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,8 +13,8 @@ lib_xua Change Log * ADDED: Guards to user_hid.h and xua_hid.h * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and Volume Decrement - * CHANGE: UAC1 HID to report function keys f21 through f24 as specified - by customer + * CHANGE: UAC1 HID to report function keys f21 through f24 as specified by + customer 0.2.1 ----- From 6b1da7610fd0ba59c316c543fdc3e1bdd423abb9 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 7 Jan 2020 15:01:54 +0800 Subject: [PATCH 115/233] revert xua_ep0_uacreqs.xc so that frequency global variable is not affected by USB command. Now frequency can be varied by changing the default value. --- lib_xua/api/xua_conf_default.h | 7 +++++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 3 -- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 29 +++++++++---------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index b22046f0..828e9682 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -231,6 +231,13 @@ */ #ifndef DEFAULT_AUDOUT_FREQ #define DEFAULT_AUDOUT_FREQ (48000) + +#define USB_IN_DESCRIPTOR_FREQ_OVERRIDE //used if USB in frequency is not conifigurable by USB endpoint command +#ifdef USB_IN_DESCRIPTOR_FREQ_OVERRIDE + #define USB_IN_FREQ_DESCIPTOR_OFFSET 161 //161- (3 * 3) are the position of descriptor that needed to be modified for USB in frequency + #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) +#endif + #endif /* Audio Class Defines */ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index dae6863a..ab4c613d 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -17,7 +17,4 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, REFERENCE_PARAM(USB_S void VendorAudioRequestsInit(chanend c_audioControl, NULLABLE_RESOURCE(chanend, c_mix_ctl), NULLABLE_RESOURCE(chanend, c_clk_ctl)); -extern unsigned int g_curAudOut_SamFreq; - - #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 7ae5040b..2fdd434c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -17,7 +17,6 @@ #ifdef MIXER #include "mixer.h" #endif -#include "xua_conf.h" #define CS_XU_MIXSEL (0x06) @@ -47,7 +46,7 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif /* Global var for current frequency, set to default freq */ -unsigned int g_curAudOut_SamFreq = DEFAULT_AUDOUT_FREQ; +unsigned int g_curSamFreq = DEFAULT_FREQ; #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -321,14 +320,14 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c int newSampleRate = buffer[0]; /* Instruct audio thread to change sample freq (if change required) */ - if(newSampleRate != g_curAudOut_SamFreq) + if(newSampleRate != g_curSamFreq) { int newMasterClock; - g_curAudOut_SamFreq = newSampleRate; + g_curSamFreq = newSampleRate; #if 0 /* Original feedback implementation */ - g_curSamFreq48000Family = ((MCLK_48 % g_curAudOut_SamFreq) == 0); + g_curSamFreq48000Family = ((MCLK_48 % g_curSamFreq) == 0); if(g_curSamFreq48000Family) { @@ -339,17 +338,17 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c newMasterClock = MCLK_441; } - setG_curSamFreqMultiplier(g_curAudOut_SamFreq/(newMasterClock/512)); + setG_curSamFreqMultiplier(g_curSamFreq/(newMasterClock/512)); #endif #if ADAT_RX /* Configure ADAT SMUX based on sample rate */ outuint(c_clk_ctl, SET_SMUX); - if(g_curAudOut_SamFreq < 88200) + if(g_curSamFreq < 88200) { /* No SMUX */ outuint(c_clk_ctl, 0); } - else if(g_curAudOut_SamFreq < 176400) + else if(g_curSamFreq < 176400) { /* SMUX */ outuint(c_clk_ctl, 1); @@ -362,7 +361,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c outct(c_clk_ctl, XS1_CT_END); #endif outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curAudOut_SamFreq); + outuint(c_audioControl, g_curSamFreq); /* Wait for handshake back - i.e. PLL locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); @@ -396,7 +395,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c } else { - buffer[0] = g_curAudOut_SamFreq; + buffer[0] = g_curSamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 4, sp.wLength ); } @@ -404,7 +403,7 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c #endif case ID_CLKSRC_INT: /* Always report our current operating frequency */ - buffer[0] = g_curAudOut_SamFreq; + buffer[0] = g_curSamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 4, sp.wLength ); break; @@ -1108,7 +1107,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp /* Recontruct sample-freq */ int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); - if(newSampleRate != g_curAudOut_SamFreq) + if(newSampleRate != g_curSamFreq) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1120,11 +1119,11 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - g_curAudOut_SamFreq = newSampleRate; + g_curSamFreq = newSampleRate; /* Instruct audio thread to change sample freq */ outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curAudOut_SamFreq); + outuint(c_audioControl, g_curSamFreq); /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); @@ -1148,7 +1147,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp switch(sp.bRequest) { case UAC_B_REQ_GET_CUR: - buffer[0] = g_curAudOut_SamFreq; + buffer[0] = g_curSamFreq; return XUD_DoGetRequest(ep0_out, ep0_in, (buffer, unsigned char[]), 3, sp.wLength); break; } From 5361ef88667d907a346d6cda763bf9e506d20b65 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 7 Jan 2020 17:58:20 +0800 Subject: [PATCH 116/233] added option USB_CMD_CFG_SAMP_FREQ that allows host to conifgure sampling rate by endpoint command --- lib_xua/api/xua_conf_default.h | 27 +++++++++++++++---- .../src/core/endpoint0/xua_ep0_descriptors.h | 10 +++++++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 23 +++++++++++++++- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 828e9682..2b2a722a 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -231,13 +231,30 @@ */ #ifndef DEFAULT_AUDOUT_FREQ #define DEFAULT_AUDOUT_FREQ (48000) - -#define USB_IN_DESCRIPTOR_FREQ_OVERRIDE //used if USB in frequency is not conifigurable by USB endpoint command -#ifdef USB_IN_DESCRIPTOR_FREQ_OVERRIDE - #define USB_IN_FREQ_DESCIPTOR_OFFSET 161 //161- (3 * 3) are the position of descriptor that needed to be modified for USB in frequency - #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) #endif +#define USB_CMD_CFG_SAMP_FREQ +// Not ready yet +// #define USB_IN_CONFIGURABLE_BIT_RES +// #ifdef USB_IN_CONFIGURABLE_BIT_RES + // #define USB_IN_BIT_RES_0 STREAM_FORMAT_INPUT_1_RESOLUTION_BITS + // #define USB_IN_BIT_RES_1 STREAM_FORMAT_INPUT_1_RESOLUTION_BITS//24 +// #endif + +#ifdef USB_CMD_CFG_SAMP_FREQ + #define USB_IN_SAMP_FREQ_NUM 3 + #define USB_IN_SAMP_FREQ_0 DEFAULT_AUDOUT_FREQ + #define USB_IN_SAMP_FREQ_1 16000 + #define USB_IN_SAMP_FREQ_2 16000 + + #if (USB_IN_SAMP_FREQ_NUM < 3) + #error "USB_IN_SAMP_FREQ_NUM must be >=3" + #endif +#else + #define USB_IN_DESCRIPTOR_FREQ_OVERRIDE //used if USB in frequency is not conifigurable by USB endpoint command + #ifdef USB_IN_DESCRIPTOR_FREQ_OVERRIDE + #define USB_IN_FREQ_DESCIPTOR_OFFSET 161 //161- (3 * 3) are the position of descriptor that needed to be modified for USB in frequency + #endif #endif /* Audio Class Defines */ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index fcc1e45b..bcb2178e 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -20,6 +20,8 @@ #include "iap2.h" /* Defines iAP EA Native Transport protocol name */ #endif +#include "xua_conf_default.h" + #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x #define APPEND_PRODUCT_STR_A2(x) PRODUCT_STR_A2 " "#x @@ -2738,6 +2740,13 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ + +#ifdef USB_CMD_CFG_SAMP_FREQ + USB_IN_SAMP_FREQ_NUM, + CHARIFY_SR(USB_IN_SAMP_FREQ_0), + CHARIFY_SR(USB_IN_SAMP_FREQ_1), + CHARIFY_SR(USB_IN_SAMP_FREQ_2), +#else num_freqs_a1, /* SamFreqType - sample freq count */ /* Windows enum issue with <= two sample rates work around */ @@ -2790,6 +2799,7 @@ unsigned char cfgDesc_Audio1[] = #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ #endif +#endif //USB_CMD_CFG_SAMP_FREQ /* Standard Endpoint Descriptor */ 0x09, diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..d07ffe59 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -17,6 +17,12 @@ #ifdef MIXER #include "mixer.h" #endif +#include "xua_conf_default.h" + + +#define DEBUG_UNIT XUA_EP0_UACREQS +#define DEBUG_PRINT_ENABLE_XUA_EP0_UACREQS 0 +#include "debug_print.h" #define CS_XU_MIXSEL (0x06) @@ -45,8 +51,17 @@ extern unsigned char channelMapUsb[NUM_USB_CHAN_IN]; extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif + +#ifdef USB_CMD_CFG_SAMP_FREQ +extern unsigned int g_curAudOut_SamFreq; +#endif + /* Global var for current frequency, set to default freq */ +#ifdef DEFAULT_AUDOUT_FREQ +unsigned int g_curSamFreq = DEFAULT_AUDOUT_FREQ; +#else unsigned int g_curSamFreq = DEFAULT_FREQ; +#endif #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -325,6 +340,9 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c int newMasterClock; g_curSamFreq = newSampleRate; + #ifdef USB_CMD_CFG_SAMP_FREQ + g_curAudOut_SamFreq = newSampleRate; + #endif #if 0 /* Original feedback implementation */ g_curSamFreq48000Family = ((MCLK_48 % g_curSamFreq) == 0); @@ -1098,7 +1116,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp { return result; } -#if (MAX_FREQ != MIN_FREQ) +#if ((MAX_FREQ != MIN_FREQ) || (defined USB_CMD_CFG_SAMP_FREQ) if(controlSelector == SAMPLING_FREQ_CONTROL) { /* Expect length 3 for sample rate */ @@ -1120,6 +1138,9 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { g_curSamFreq = newSampleRate; + #ifdef USB_CMD_CFG_SAMP_FREQ + g_curAudOut_SamFreq = newSampleRate; + #endif /* Instruct audio thread to change sample freq */ outuint(c_audioControl, SET_SAMPLE_FREQ); From a2ff2897f9ef039215f48ee9cf9d13a27764bf84 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 7 Jan 2020 11:52:24 +0000 Subject: [PATCH 117/233] Update license to new year. --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 19f8e7cc..d4acef94 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2011-2019, XMOS, All rights reserved. +Copyright (c) 2011-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From f189f02c0290f56390dd630c11c081798fa91e8e Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 7 Jan 2020 14:58:08 +0000 Subject: [PATCH 118/233] Revert "Revert "Modify the interface to the User HID functionality."" This reverts commit d81af18d1fddf85278ca392065336195bff97854. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 ++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 3e28a2e5..97984b85 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[1] = {0}; +unsigned char g_hidData[HID_DATA_BYTES] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - g_hidData[0]=UserHIDGetData(); + UserHIDGetData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 35d2578d..5288ee7b 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,7 +3,13 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These enumerated constants relate to the HID report desc - do not mod */ +/** + * \brief HID event identifiers + * + * This enumeration defines a constant value for each HID event. + * It defines one value for each of the four GPI pins supported in the standard voice products. + * It defines a further 28 values for generic events. + */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -39,13 +45,40 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_SIZE 1 +#define HID_DATA_BYTES 4 #if( 0 < HID_CONTROLS ) -unsigned UserHIDGetData( void ); +/** + * \brief Get the data for the next HID report + * + * \note This function returns the HID data as a list of unsigned char because the + * \c XUD_SetReady_In() accepts data for transmission to the USB Host using + * this type. + * + * \param{out} hidData The HID data + */ +void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); + +/** + * \brief Initialize HID processing + */ void UserHIDInit( void ); -void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); + +/** + * \brief Record that a HID event has occurred + * + * \param{in} hidEventId The identifier of an event which has occurred + * \param{in} hidEventData A list of data associated with the event + * \param{in} hidEventDataSize The length of the event data list + * + * \note At present, this function only takes a single element of event data, i.e. + * hidEventDataSize must equal 1. + * + * \note At present, this function treats the event data as a Boolean flag. + * Zero means False; all other values mean True. + */ +void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From eae62a9e3c7498e276bd9c8f9582c5f1b21e576e Mon Sep 17 00:00:00 2001 From: Keith Au Date: Wed, 8 Jan 2020 13:49:54 +0800 Subject: [PATCH 119/233] moved defined to xua_conf.h. Fixed bug that causes compile error --- lib_xua/api/xua_conf_default.h | 24 ------------------- .../src/core/endpoint0/xua_ep0_descriptors.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 2b2a722a..b22046f0 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -233,30 +233,6 @@ #define DEFAULT_AUDOUT_FREQ (48000) #endif -#define USB_CMD_CFG_SAMP_FREQ -// Not ready yet -// #define USB_IN_CONFIGURABLE_BIT_RES -// #ifdef USB_IN_CONFIGURABLE_BIT_RES - // #define USB_IN_BIT_RES_0 STREAM_FORMAT_INPUT_1_RESOLUTION_BITS - // #define USB_IN_BIT_RES_1 STREAM_FORMAT_INPUT_1_RESOLUTION_BITS//24 -// #endif - -#ifdef USB_CMD_CFG_SAMP_FREQ - #define USB_IN_SAMP_FREQ_NUM 3 - #define USB_IN_SAMP_FREQ_0 DEFAULT_AUDOUT_FREQ - #define USB_IN_SAMP_FREQ_1 16000 - #define USB_IN_SAMP_FREQ_2 16000 - - #if (USB_IN_SAMP_FREQ_NUM < 3) - #error "USB_IN_SAMP_FREQ_NUM must be >=3" - #endif -#else - #define USB_IN_DESCRIPTOR_FREQ_OVERRIDE //used if USB in frequency is not conifigurable by USB endpoint command - #ifdef USB_IN_DESCRIPTOR_FREQ_OVERRIDE - #define USB_IN_FREQ_DESCIPTOR_OFFSET 161 //161- (3 * 3) are the position of descriptor that needed to be modified for USB in frequency - #endif -#endif - /* Audio Class Defines */ /** diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index bcb2178e..05c8a906 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -20,7 +20,7 @@ #include "iap2.h" /* Defines iAP EA Native Transport protocol name */ #endif -#include "xua_conf_default.h" +#include "xua_conf.h" #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index d07ffe59..d096c9c9 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1116,7 +1116,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp { return result; } -#if ((MAX_FREQ != MIN_FREQ) || (defined USB_CMD_CFG_SAMP_FREQ) +#if ((MAX_FREQ != MIN_FREQ) || (defined USB_CMD_CFG_SAMP_FREQ)) if(controlSelector == SAMPLING_FREQ_CONTROL) { /* Expect length 3 for sample rate */ From 8f2509845aafc5d7ccb39e988cb3323cf855ff4f Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 8 Jan 2020 11:09:03 +0000 Subject: [PATCH 120/233] Update change log. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b77784ce..2bc5f24b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,8 @@ lib_xua Change Log Volume Decrement * CHANGE: UAC1 HID to report function keys f21 through f24 as specified by customer + * CHANGE: HID interface for user to set and clear events from global + variable to function 0.2.1 ----- From f6d0ede13373af99f19ccb2e154103ab39622944 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 9 Jan 2020 16:50:17 +0800 Subject: [PATCH 121/233] added USB IN alternate setting descriptor --- .../src/core/endpoint0/xua_ep0_descriptors.h | 128 ++++++++++++++++++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 5 +- 2 files changed, 131 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 05c8a906..350c9107 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2360,7 +2360,11 @@ const unsigned num_freqs_a1 = MAX(3, (0 #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) #else + #ifdef USB_CMD_CFG_SAMP_FREQ + #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3) + (40 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) + #else #define CFG_TOTAL_LENGTH_A1 (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 + HID_INTERFACE_BYTES) + #endif //USB_CMD_CFG_SAMP_FREQ #endif #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) @@ -2832,6 +2836,130 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* Undefined */ 0x00, 0x00, /* Not used */ #endif // XUA_ADAPTIVE + +#ifdef USB_CMD_CFG_SAMP_FREQ + /* Standard Interface Descriptor - Audio streaming IN */ + 0x09, + 0x04, /* INTERFACE */ + (OUTPUT_INTERFACES_A1 + 1), /* bInterfaceNumber */ + 0x02, /* AlternateSetting */ + 0x01, /* bNumEndpoints */ + 0x01, /* Interface class - AUDIO */ + 0x02, /* Subclass - AUDIO_STREAMING */ + 0x00, /* Unused */ + offsetof(StringDescTable_t, inputInterfaceStr_Audio1)/sizeof(char *), + + /* CS_Interface AC interface header descriptor */ + 0x07, + UAC_CS_DESCTYPE_INTERFACE, + 0x01, /* subtype - GENERAL */ + 0x07, /* TerminalLink - linked to Streaming OUT terminal */ + 0x01, /* Interface delay */ + 0x01,0x00, /* Format - PCM */ + + /* CS_Interface Terminal Descriptor */ + (8 + (num_freqs_a1 * 3)), + UAC_CS_DESCTYPE_INTERFACE, + 0x02, /* Subtype - FORMAT_TYPE */ + 0x01, /* Format type - FORMAT_TYPE_1 */ + NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ + FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ + FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ + +#ifdef USB_CMD_CFG_SAMP_FREQ + USB_IN_SAMP_FREQ_NUM, + CHARIFY_SR(USB_IN_SAMP_FREQ_0), + CHARIFY_SR(USB_IN_SAMP_FREQ_1), + CHARIFY_SR(USB_IN_SAMP_FREQ_2), +#else + num_freqs_a1, /* SamFreqType - sample freq count */ + +/* Windows enum issue with <= two sample rates work around */ +#if ((MIN_FREQ == 8000) && (MAX_FREQ_FS == 11025)) \ + || (MIN_FREQ == 11025) && (MAX_FREQ_FS == 12000) \ + || (MIN_FREQ == 12000) && (MAX_FREQ_FS == 16000) \ + || (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \ + || (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \ + || (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \ + || (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000) + CHARIFY_SR(MAX_FREQ_FS), +#endif +#if (MIN_FREQ == MAX_FREQ_FS) + CHARIFY_SR(MAX_FREQ_FS), + CHARIFY_SR(MAX_FREQ_FS), +#endif + +#if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) + 0x40, 0x1F, 0x00, /* sampleFreq - 8000KHz */ +#endif + +#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025) + 0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */ +#endif + +#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000) + 0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */ +#endif + +#if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000) + CHARIFY_SR(16000), /* sampleFreq - 32KHz */ +#endif + +#if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000) + CHARIFY_SR(32000), /* sampleFreq - 32KHz */ +#endif + +#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100) + 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ +#endif + +#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000) + 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ +#endif + +#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200) + 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ +#endif + +#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) + 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ +#endif +#endif //USB_CMD_CFG_SAMP_FREQ + + /* Standard Endpoint Descriptor */ + 0x09, + 0x05, /* ENDPOINT */ + ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */ +#ifdef XUA_ADAPTIVE + ISO_EP_ATTRIBUTES_ADAPTIVE, +#else + #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) + ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ + #else + ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ + #endif +#endif + FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/ + (FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ + 0x01, /* bInterval */ + 0x00, /* bRefresh */ + 0x00, /* bSynchAddress */ + + /* CS_Endpoint Descriptor */ + 0x07, + 0x25, /* CS_ENDPOINT */ + 0x01, /* Subtype - GENERAL */ + 0x01, /* Attributes. D[0]: sample freq ctrl. */ +#ifdef XUA_ADAPTIVE + 0x02, /* Lock Delay units PCM samples*/ + 0x08, 0x00, /* No lock delay */ +#else + 0x00, /* Undefined */ + 0x00, 0x00, /* Not used */ +#endif // XUA_ADAPTIVE +#endif//USB_CMD_CFG_SAMP_FREQ + + #endif #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index d096c9c9..22bfc43f 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -57,8 +57,9 @@ extern unsigned int g_curAudOut_SamFreq; #endif /* Global var for current frequency, set to default freq */ -#ifdef DEFAULT_AUDOUT_FREQ -unsigned int g_curSamFreq = DEFAULT_AUDOUT_FREQ; +#ifdef USB_CMD_CFG_SAMP_FREQ +#define g_curSamFreq g_curAudOut_SamFreq +//unsigned int g_curSamFreq = DEFAULT_AUDOUT_FREQ; #else unsigned int g_curSamFreq = DEFAULT_FREQ; #endif From 1ef566a570d017752cceed4768b4a44726583a7e Mon Sep 17 00:00:00 2001 From: Keith Au Date: Mon, 13 Jan 2020 10:15:10 +0800 Subject: [PATCH 122/233] modified AudioEndpointRequests_1 to distinguish between ep0 request for USB in and out --- .../src/core/endpoint0/xua_ep0_descriptors.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 39 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 350c9107..3a567417 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2656,7 +2656,7 @@ unsigned char cfgDesc_Audio1[] = /* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */ 0x09, 0x05, /* ENDPOINT */ - 0x01, /* endpointAddress - D7, direction (0 OUT, 1 IN). D6..4 reserved (0). D3..0 endpoint no. */ + ENDPOINT_ADDRESS_OUT_AUDIO, /* endpointAddress - D7, direction (0 OUT, 1 IN). D6..4 reserved (0). D3..0 endpoint no. */ #ifdef XUA_ADAPTIVE ISO_EP_ATTRIBUTES_ADAPTIVE, #else diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 22bfc43f..446b9213 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -18,6 +18,7 @@ #include "mixer.h" #endif #include "xua_conf_default.h" +#include "descriptor_defs.h" #define DEBUG_UNIT XUA_EP0_UACREQS @@ -58,10 +59,13 @@ extern unsigned int g_curAudOut_SamFreq; /* Global var for current frequency, set to default freq */ #ifdef USB_CMD_CFG_SAMP_FREQ -#define g_curSamFreq g_curAudOut_SamFreq -//unsigned int g_curSamFreq = DEFAULT_AUDOUT_FREQ; +#define g_curUSBin_SamFreq g_curAudOut_SamFreq +unsigned int g_curUSBout_SamFreq = DEFAULT_FREQ; +unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #else -unsigned int g_curSamFreq = DEFAULT_FREQ; +unsigned int g_curUSBin_SamFreq = DEFAULT_FREQ; +unsigned int g_curUSBout_SamFreq = DEFAULT_FREQ; +unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #endif #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -341,9 +345,6 @@ int AudioClassRequests_2(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp, c int newMasterClock; g_curSamFreq = newSampleRate; - #ifdef USB_CMD_CFG_SAMP_FREQ - g_curAudOut_SamFreq = newSampleRate; - #endif #if 0 /* Original feedback implementation */ g_curSamFreq48000Family = ((MCLK_48 % g_curSamFreq) == 0); @@ -1096,6 +1097,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp * bmRequestType.Recipient = Endpoint * bmRequestType.Type = Class * endpoint (wIndex & 0xff) is 0x01 or 0x82 + * wIndex is endpoint address for distinguishing input and output */ XUD_Result_t result; @@ -1126,7 +1128,8 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp /* Recontruct sample-freq */ int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); - if(newSampleRate != g_curSamFreq) + if(((sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO) && (newSampleRate != g_curUSBin_SamFreq)) || \ + ((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq))) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1138,21 +1141,25 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - g_curSamFreq = newSampleRate; - #ifdef USB_CMD_CFG_SAMP_FREQ - g_curAudOut_SamFreq = newSampleRate; - #endif - - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curSamFreq); + if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ + g_curUSBin_SamFreq = newSampleRate; + /* Instruct audio thread to change sample freq */ + outuint(c_audioControl, SET_SAMPLE_FREQ); + outuint(c_audioControl, g_curUSBin_SamFreq); + } + else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO + g_curUSBout_SamFreq = newSampleRate; + /* Instruct audio thread to change sample freq */ + //outuint(c_audioControl, SET_SAMPLE_FREQ); + //outuint(c_audioControl, g_curUSBout_SamFreq); // FIXME: not implemented yet + } /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); /* Allow time for the change - feedback to stabilise */ FeedbackStabilityDelay(); - } + } } return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0); } From 2f4da7f2621cad20fa1967e01a801c92b99ed6a9 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 16 Jan 2020 15:05:41 +0800 Subject: [PATCH 123/233] adding variable reference freqency support. Currently only 48kHz work --- lib_xua/api/xua_conf_default.h | 7 +++++++ lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 8 ++++++++ lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index b22046f0..2810a7d5 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -233,6 +233,13 @@ #define DEFAULT_AUDOUT_FREQ (48000) #endif +/** + * @brief Default Reference input sampling frequency + */ +#ifndef DEFAULT_AUDIN_FREQ +#define DEFAULT_AUDIN_FREQ (48000) +#endif + /* Audio Class Defines */ /** diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 3a567417..cfe8a664 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2599,6 +2599,13 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_OUT_FS, /* nrChannels */ FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, /* subFrameSize */ FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */ + + #ifdef USB_CMD_CFG_SAMP_FREQ + USB_OUT_SAMP_FREQ_NUM, + CHARIFY_SR(USB_OUT_SAMP_FREQ_0), + CHARIFY_SR(USB_OUT_SAMP_FREQ_1), + CHARIFY_SR(USB_OUT_SAMP_FREQ_2), + #else num_freqs_a1, /* SamFreqType - sample freq count */ @@ -2652,6 +2659,7 @@ unsigned char cfgDesc_Audio1[] = #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ #endif + #endif //USB_CMD_CFG_SAMP_FREQ /* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */ 0x09, diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 446b9213..eabe3b56 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -55,12 +55,14 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #ifdef USB_CMD_CFG_SAMP_FREQ extern unsigned int g_curAudOut_SamFreq; +extern unsigned int g_curAudIn_SamFreq; #endif /* Global var for current frequency, set to default freq */ #ifdef USB_CMD_CFG_SAMP_FREQ #define g_curUSBin_SamFreq g_curAudOut_SamFreq -unsigned int g_curUSBout_SamFreq = DEFAULT_FREQ; +#define g_curUSBout_SamFreq g_curAudIn_SamFreq + unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #else unsigned int g_curUSBin_SamFreq = DEFAULT_FREQ; From 6e184af8992f7dbb5af7efa573ef25116f36b279 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:07:24 +0000 Subject: [PATCH 124/233] Update copyright date range. --- lib_xua/LICENSE.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 3932a9ae..37950686 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2019, XMOS, All rights reserved. +Copyright (c) 2017-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. @@ -30,7 +30,7 @@ The headings in this License do not affect its interpretation. Save where the co Unless the context otherwise requires: -- references to XMOS and the Customer include their permitted successors and assigns; +- references to XMOS and the Customer include their permitted successors and assigns; - references to statutory provisions include those statutory provisions as amended or re-enacted; and - references to any gender include all genders. @@ -58,12 +58,12 @@ The Customer will adhere to all applicable import and export laws and regulation The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. -XMOS will own all intellectual property rights in the XMOS Modifications. +XMOS will own all intellectual property rights in the XMOS Modifications. The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. 7. Support -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. 8. Warranty and Disclaimer From 7530591a64105dcd5c918c0372408f0ee27bf660 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:18:33 +0000 Subject: [PATCH 125/233] Put trailing white space back because the License file check currently fails if it's missing. --- lib_xua/LICENSE.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 37950686..7f5e44ce 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -30,7 +30,7 @@ The headings in this License do not affect its interpretation. Save where the co Unless the context otherwise requires: -- references to XMOS and the Customer include their permitted successors and assigns; +- references to XMOS and the Customer include their permitted successors and assigns; - references to statutory provisions include those statutory provisions as amended or re-enacted; and - references to any gender include all genders. @@ -58,12 +58,12 @@ The Customer will adhere to all applicable import and export laws and regulation The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. -XMOS will own all intellectual property rights in the XMOS Modifications. +XMOS will own all intellectual property rights in the XMOS Modifications. The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. 7. Support -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. 8. Warranty and Disclaimer From 16138c2d429690be4986c7559403f3afb95cd458 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:27:25 +0000 Subject: [PATCH 126/233] Update copyright date range. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/hid/user_hid.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 97984b85..ae58ef83 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN #include diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 5288ee7b..e2d64c7d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2013-2020, XMOS Ltd, All rights reserved #ifndef __USER_HID_H__ #define __USER_HID_H__ From 97e6ae42690574e81b469962a3e7286983e1b201 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 11:55:19 +0000 Subject: [PATCH 127/233] Shift bit flags to reflect the change to generic HID events. Use AC Search to report Wake-phrase detection and AC Stop to report End Call detection. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 74319030..566bc436 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -569,13 +569,21 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x01, /* Collection (Application) */ 0x75, 0x01, /* Report Size (1) */ 0x95, 0x04, /* Report Count (4) */ - 0x05, 0x07, /* Usage Page (Key Codes) */ - 0x19, 0x70, /* Usage Minimum (Keyboard F21) */ - 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ 0x15, 0x00, /* Logical Minimum (0) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x25, 0x00, /* Logical Maximum (0) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x95, 0x01, /* Report Count (1) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x05, 0x0C, /* Usage Page (Consumer) */ + 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x95, 0x02, /* Report Count (2) */ + 0x05, 0x07, /* Usage Page (Key Codes) */ + 0x19, 0x72, /* Usage Minimum (Keyboard F23) */ + 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ 0xc0 /* End collection (Application) */ }; #endif @@ -2882,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x19, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 90edaebc6e4ba9f458db0abf86758906188dc442 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 13:13:28 +0000 Subject: [PATCH 128/233] Add comment to change log --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bc5f24b..f2aa6a1e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,9 @@ lib_xua Change Log customer * CHANGE: HID interface for user to set and clear events from global variable to function + * CHANGE HID report descriptor to use generic events instead of GPI + events, to report Key-phrase detection as AC Search, and to report end-call + detection as AC Stop 0.2.1 ----- From dac71e8b38eff92525fd740f9e0538630daec0b3 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 13:16:26 +0000 Subject: [PATCH 129/233] Update copyright date range --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 566bc436..d91dbe7a 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors From 6485830a73fc805d33d06c00346e31bb9b996ebc Mon Sep 17 00:00:00 2001 From: Keith Au Date: Mon, 20 Jan 2020 16:14:09 +0800 Subject: [PATCH 130/233] implemented descriptor handler flow for USB_DESCRIPTOR_OVERRIDE_RATE_RES --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 27 +++++++++++++++++++ .../src/core/endpoint0/xua_ep0_descriptors.h | 9 ++++++- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 91576287..5c402473 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -88,6 +88,12 @@ int min(int x, int y); /* Global current device config var*/ extern unsigned char g_currentConfig; + +#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +extern unsigned int g_curAudOut_SamFreq; +extern unsigned int g_curAudIn_SamFreq; +#endif + /* Global endpoint status arrays - declared in usb_device.xc */ extern unsigned char g_interfaceAlt[]; @@ -777,6 +783,27 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 #endif #elif (AUDIO_CLASS == 1) /* Return Audio 1.0 Descriptors in FS, should never be in HS! */ + + + #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here + int i=0; + for(i=0;i<3;i++) + { + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = g_curAudOut_SamFreq & 0xff; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (g_curAudOut_SamFreq & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (g_curAudOut_SamFreq & 0xff0000)>> 16; + } + + for(i=0;i<3;i++) + { + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = g_curAudIn_SamFreq & 0xff; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (g_curAudIn_SamFreq & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (g_curAudIn_SamFreq & 0xff0000)>> 16; + } + #endif + + + result = USB_StandardRequests(ep0_out, ep0_in, null, 0, null, 0, diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index cfe8a664..a97e476c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2357,7 +2357,7 @@ const unsigned num_freqs_a1 = MAX(3, (0 /* Note, this is different that INTERFACE_COUNT since we dont support items such as MIDI, iAP etc in UAC1 mode */ #define NUM_INTERFACES_A1 (1 + INPUT_INTERFACES_A1 + OUTPUT_INTERFACES_A1 + NUM_CONTROL_USB_INTERFACES + DFU_INTERFACES_A1 + HID_INTERFACES_A1) -#if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) +#if ((NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)) #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) #else #ifdef USB_CMD_CFG_SAMP_FREQ @@ -2367,6 +2367,13 @@ const unsigned num_freqs_a1 = MAX(3, (0 #endif //USB_CMD_CFG_SAMP_FREQ #endif +#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES + #define AS_INTERFACE_BYTES (7) + #define INTERFACE_DESCRIPTOR_BYTES (9) + #define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) + #define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) +#endif + #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) #if (MIN_FREQ_FS < 12000) && (MAX_FREQ_FS > 48000) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index eabe3b56..a2fbdffd 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -53,7 +53,7 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif -#ifdef USB_CMD_CFG_SAMP_FREQ +#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) extern unsigned int g_curAudOut_SamFreq; extern unsigned int g_curAudIn_SamFreq; #endif From 4e13f9e442efd34100977c81abfe9a612065834f Mon Sep 17 00:00:00 2001 From: shuchitak Date: Tue, 21 Jan 2020 11:32:36 +0000 Subject: [PATCH 131/233] added an invalid event type --- lib_xua/src/core/user/hid/user_hid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index e2d64c7d..91b32290 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -42,7 +42,8 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT24, HID_EVENT_ID_EVT25, HID_EVENT_ID_EVT26, - HID_EVENT_ID_EVT27 + HID_EVENT_ID_EVT27, + HID_EVENT_ID_INVALID = 0xffffffff, } hidEventId_t; #define HID_DATA_BYTES 4 From ae2f19224e667c56c33b47a4d7d9520808fb34be Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Tue, 21 Jan 2020 16:12:38 +0000 Subject: [PATCH 132/233] Expose DFU detach timeout value --- lib_xua/api/xua_conf_default.h | 7 ++++++- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 9bfa7bbd..490647cc 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1445,6 +1445,12 @@ enum USBEndpointNumber_Out #error Bad DEFAULT_MCLK_FREQ #endif +/* DFU functional descriptor wDetachTimeOut field (milliseconds) + * Time for device to wait for bus reset after DETACH request before reverting to idle state */ +#ifndef DFU_DETACH_TIME_OUT +#define DFU_DETACH_TIME_OUT 250 +#endif + #if ((MCLK_441 % MIN_FREQ) == 0) #define MIN_FREQ_44 MIN_FREQ #define MIN_FREQ_48 ((48000 * 512)/((44100 * 512)/MIN_FREQ)) @@ -1466,4 +1472,3 @@ enum USBEndpointNumber_Out #if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0) #error CODEC_MASTER with DSD is currently unsupported #endif - diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..76245fac 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2068,8 +2068,8 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x09, /* 0 Size */ 0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */ 0x07, /* 2 bmAttributes */ - 0xFA, /* 3 wDetachTimeOut */ - 0x00, /* 4 wDetachTimeOut */ + DFU_DETACH_TIME_OUT & 0xFF, /* 3 wDetachTimeOut */ + (DFU_DETACH_TIME_OUT >> 8) & 0xFF, /* 4 wDetachTimeOut */ 0x40, /* 5 wTransferSize */ 0x00, /* 6 wTransferSize */ 0x10, /* 7 bcdDFUVersion */ @@ -2849,8 +2849,8 @@ unsigned char cfgDesc_Audio1[] = 0x09, /* 0 Size */ 0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */ 0x07, /* 2 bmAttributes */ - 0xFA, /* 3 wDetachTimeOut */ - 0x00, /* 4 wDetachTimeOut */ + DFU_DETACH_TIME_OUT & 0xFF, /* 3 wDetachTimeOut */ + (DFU_DETACH_TIME_OUT >> 8) & 0xFF, /* 4 wDetachTimeOut */ 0x40, /* 5 wTransferSize */ 0x00, /* 6 wTransferSize */ 0x10, /* 7 bcdDFUVersion */ From 86667227980740d82f135def26f2f24509c33a2f Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Tue, 21 Jan 2020 16:45:54 +0000 Subject: [PATCH 133/233] Library checks --- LICENSE.txt | 2 +- lib_xua/LICENSE.txt | 2 +- lib_xua/api/xua_conf_default.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 19f8e7cc..d4acef94 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2011-2019, XMOS, All rights reserved. +Copyright (c) 2011-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 3932a9ae..7f5e44ce 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2019, XMOS, All rights reserved. +Copyright (c) 2017-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 490647cc..79aa061b 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /* * @brief Defines relating to device configuration and customisation of lib_xua * @author Ross Owen, XMOS Limited diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 76245fac..eb71309e 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors From ad7ce6369e7d6fe8fc818de5034cc34becb5bd9e Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 22 Jan 2020 11:39:55 +0800 Subject: [PATCH 134/233] modified to change bit resolution --- lib_xua/src/core/buffer/decouple/decouple.xc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 297dff8d..01bb7bb4 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -136,6 +136,8 @@ unsigned unpackData = 0; unsigned packState = 0; unsigned packData = 0; +extern unsigned int g_BitResolution; + /* Default to something sensible but the following are setup at stream start (unless UAC1 only..) */ #if (AUDIO_CLASS == 2) unsigned g_curSubSlot_Out = HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; @@ -145,7 +147,6 @@ unsigned g_curSubSlot_Out = FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES; unsigned g_curSubSlot_In = FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES; #endif - /* IN packet size. Init to something sensible, but expect to be re-set before stream start */ #if (AUDIO_CLASS==2) int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_HS; @@ -158,6 +159,10 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; + if (AUDIO_CLASS == 1){ + g_curSubSlot_Out = g_BitResolution/8; + g_curSubSlot_In = g_BitResolution/8; + } /* Input word that triggered interrupt and handshake back */ unsigned underflowSample = inuint(c_mix_out); From f6d5bffad50e6103d4754e96eef08533a347e5a3 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 31 Jan 2020 16:44:52 +0800 Subject: [PATCH 135/233] modified codes to change USB descriptor according to bit resolution variable values --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 16 ++++++++++++++++ lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 5c402473..cf62f7b2 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -92,6 +92,8 @@ extern unsigned char g_currentConfig; #if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) extern unsigned int g_curAudOut_SamFreq; extern unsigned int g_curAudIn_SamFreq; +extern unsigned int g_BitResolution_In; +extern unsigned int g_BitResolution_Out; #endif /* Global endpoint status arrays - declared in usb_device.xc */ @@ -786,6 +788,13 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here + + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = g_BitResolution_In >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (g_BitResolution_In & 0xff); //bit resolution + + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = g_BitResolution_Out >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (g_BitResolution_Out & 0xff); //bit resolution + int i=0; for(i=0;i<3;i++) { @@ -800,6 +809,13 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (g_curAudIn_SamFreq & 0xff00)>> 8; cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (g_curAudIn_SamFreq & 0xff0000)>> 16; } + + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((g_BitResolution_In >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((g_BitResolution_In >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size + + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((g_BitResolution_Out >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((g_BitResolution_Out >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size + #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index a97e476c..42f26651 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2370,8 +2370,16 @@ const unsigned num_freqs_a1 = MAX(3, (0 #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES #define AS_INTERFACE_BYTES (7) #define INTERFACE_DESCRIPTOR_BYTES (9) + #define AS_FORMAT_TYPE_BYTES (17) + #define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5) + #define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5) + #define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) #define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) + + #define USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + (AS_FORMAT_TYPE_BYTES) + 4) + #define USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + (AS_FORMAT_TYPE_BYTES) + 4) + #endif #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) From a46c8b134ab18247fd006861724490ab0af772b5 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 31 Jan 2020 17:06:04 +0800 Subject: [PATCH 136/233] added default values for bit resolutions --- lib_xua/api/xua_conf_default.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 2810a7d5..a1d700f3 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -240,6 +240,20 @@ #define DEFAULT_AUDIN_FREQ (48000) #endif +/** + * @brief Default USB input (Audio output) bit resolution + */ +#ifndef DEFAULT_BIT_RES_IN +#define DEFAULT_BIT_RES_IN (16) +#endif + +/** + * @brief Default USB output (Reference input) bit resolution + */ +#ifndef DEFAULT_BIT_RES_OUT +#define DEFAULT_BIT_RES_OUT (32) +#endif + /* Audio Class Defines */ /** From 03b5dd63194438fb3b2ef34136056f304d4c4756 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 4 Feb 2020 15:04:38 +0800 Subject: [PATCH 137/233] changed global variables to be accessed by APIs --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 42 +++++++++---------- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 4 +- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index cf62f7b2..f8cf499a 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -64,6 +64,13 @@ extern void device_reboot(void); #include "xua_hid.h" #endif +#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +unsigned int xua_lite_curAudOutFreq(void); +unsigned int xua_lite_curAudInFreq(void); +unsigned int xua_lite_curUSB_Res_In(void); +unsigned int xua_lite_curUSB_Res_Out(void); +#endif + unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active /* Global volume and mute tables */ @@ -89,13 +96,6 @@ int min(int x, int y); extern unsigned char g_currentConfig; -#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -extern unsigned int g_curAudOut_SamFreq; -extern unsigned int g_curAudIn_SamFreq; -extern unsigned int g_BitResolution_In; -extern unsigned int g_BitResolution_Out; -#endif - /* Global endpoint status arrays - declared in usb_device.xc */ extern unsigned char g_interfaceAlt[]; @@ -789,32 +789,32 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = g_BitResolution_In >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (g_BitResolution_In & 0xff); //bit resolution + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = g_BitResolution_Out >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (g_BitResolution_Out & 0xff); //bit resolution + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution int i=0; for(i=0;i<3;i++) { - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = g_curAudOut_SamFreq & 0xff; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (g_curAudOut_SamFreq & 0xff00)>> 8; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (g_curAudOut_SamFreq & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curAudOutFreq() & 0xff; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curAudOutFreq() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; } for(i=0;i<3;i++) { - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = g_curAudIn_SamFreq & 0xff; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (g_curAudIn_SamFreq & 0xff00)>> 8; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (g_curAudIn_SamFreq & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curAudInFreq() & 0xff; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curAudInFreq() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; } - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((g_BitResolution_In >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((g_BitResolution_In >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((g_BitResolution_Out >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((g_BitResolution_Out >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index a2fbdffd..6e46ae30 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -60,8 +60,8 @@ extern unsigned int g_curAudIn_SamFreq; /* Global var for current frequency, set to default freq */ #ifdef USB_CMD_CFG_SAMP_FREQ -#define g_curUSBin_SamFreq g_curAudOut_SamFreq -#define g_curUSBout_SamFreq g_curAudIn_SamFreq +#define g_curUSBin_SamFreq xua_lite_curAudOutFreq() +#define g_curUSBout_SamFreq xua_lite_curAudInFreq() unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #else From e99d1cc4860fa1f87e9c25736e6fbf5d42c952e7 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 4 Feb 2020 16:16:05 +0800 Subject: [PATCH 138/233] remove extern reference to freq/bitres global variable --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 6e46ae30..95b37197 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -53,11 +53,6 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif -#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -extern unsigned int g_curAudOut_SamFreq; -extern unsigned int g_curAudIn_SamFreq; -#endif - /* Global var for current frequency, set to default freq */ #ifdef USB_CMD_CFG_SAMP_FREQ #define g_curUSBin_SamFreq xua_lite_curAudOutFreq() From 2c44f2c3235e16a0fe985c0dc66943d54f5d4d9c Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 6 Feb 2020 15:09:34 +0800 Subject: [PATCH 139/233] replace old g_BitResolution variable with latest API --- lib_xua/src/core/buffer/decouple/decouple.xc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 01bb7bb4..438abe80 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -17,6 +17,13 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) +#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +unsigned int xua_lite_curAudOutFreq(void); +unsigned int xua_lite_curAudInFreq(void); +unsigned int xua_lite_curUSB_Res_In(void); +unsigned int xua_lite_curUSB_Res_Out(void); +#endif + /* TODO use SLOTSIZE to potentially save memory */ /* Note we could improve on this, for one subslot is set to 4 */ /* The *4 is conversion to bytes, note we're assuming a slotsize of 4 here whic is potentially as waste */ @@ -136,7 +143,6 @@ unsigned unpackData = 0; unsigned packState = 0; unsigned packData = 0; -extern unsigned int g_BitResolution; /* Default to something sensible but the following are setup at stream start (unless UAC1 only..) */ #if (AUDIO_CLASS == 2) @@ -160,8 +166,8 @@ void handle_audio_request(chanend c_mix_out) { int space_left; if (AUDIO_CLASS == 1){ - g_curSubSlot_Out = g_BitResolution/8; - g_curSubSlot_In = g_BitResolution/8; + g_curSubSlot_Out = xua_lite_curUSB_Res_Out() >> 3; + g_curSubSlot_In = xua_lite_curUSB_Res_In() >> 3; } /* Input word that triggered interrupt and handshake back */ From bef8fad109d226c8a6565ed1af212243fbb50f55 Mon Sep 17 00:00:00 2001 From: lucianom Date: Fri, 7 Feb 2020 19:17:24 +0000 Subject: [PATCH 140/233] Add new API functions for VID and PID --- CHANGELOG.rst | 1 + lib_xua/api/xua_endpoint0.h | 26 ++++++++++++++- lib_xua/src/core/endpoint0/xua_endpoint0.c | 38 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f2aa6a1e..e2ff343b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop + * ADDED: Enndpoint0 API functions to read and write Vendor and Product IDs 0.2.1 ----- diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index ed3ffda2..70782c85 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #ifndef _XUA_ENDPOINT0_H_ #define _XUA_ENDPOINT0_H_ @@ -28,5 +28,29 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl, chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu ?dfuInterface VENDOR_REQUESTS_PARAMS_DEC_); +/** Function to set the Vendor ID value + * + * \param vid vendor ID value to set +*/ +void XUA_Endpoint0_setVendorId(unsigned short vid); + +/** Function to set the Product ID value + * + * \param pid Product ID value to set +*/ +void XUA_Endpoint0_setProductId(unsigned short pid); + +/** Function to get the Vendor ID value + * + * \return Vendor ID value +*/ +unsigned short XUA_Endpoint0_getVendorId(); + +/** Function to get the Vendor ID value + * + * \return Product ID value +*/ +unsigned short XUA_Endpoint0_getProductId(); + #endif #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 91576287..e62f5fb8 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements endpoint zero for an USB Audio 1.0/2.0 device * @author Ross Owen, XMOS Semiconductor @@ -207,6 +207,42 @@ const unsigned g_chanCount_In_HS[INPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_I XUD_ep ep0_out; XUD_ep ep0_in; +void XUA_Endpoint0_setVendorId(unsigned short vid) { +#if (AUDIO_CLASS == 1) + devDesc_Audio1.idVendor = vid; +#else + devDesc_Audio2.idVendor = vid; +#endif // AUDIO_CLASS == 1} +} + +void XUA_Endpoint0_setProductId(unsigned short pid) { +#if (AUDIO_CLASS == 1) + devDesc_Audio1.idProduct = pid; +#else + devDesc_Audio2.idProduct = pid; +#endif // AUDIO_CLASS == 1} +} + +unsigned short XUA_Endpoint0_getVendorId() { + unsigned short vid; +#if (AUDIO_CLASS == 1) + vid = devDesc_Audio1.idVendor; +#else + vid = devDesc_Audio2.idVendor; +#endif // AUDIO_CLASS == 1} + return vid; +} + +unsigned short XUA_Endpoint0_getProductId() { + unsigned short pid; +#if (AUDIO_CLASS == 1) + pid = devDesc_Audio1.idProduct; +#else + pid = devDesc_Audio2.idProduct; +#endif // AUDIO_CLASS == 1} + return pid; +} + void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) { From 86c8bc9128ab21c6f688a9a08352aac725d912c8 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 11 Feb 2020 12:07:27 +0800 Subject: [PATCH 141/233] commit after updating to latest develop branch on 10 Feb 2020 --- lib_xua/api/xua_conf_default.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 6255221e..65894a8c 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -244,7 +244,7 @@ * @brief Default USB input (Audio output) bit resolution */ #ifndef DEFAULT_BIT_RES_IN -#define DEFAULT_BIT_RES_IN (16) +#define DEFAULT_BIT_RES_IN (32) #endif /** diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index dd284b0a..9faca34a 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -20,8 +20,6 @@ #include "iap2.h" /* Defines iAP EA Native Transport protocol name */ #endif -#include "xua_conf.h" - #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x #define APPEND_PRODUCT_STR_A2(x) PRODUCT_STR_A2 " "#x From f1b6a0b90340a3979dd21bf43fb99d2b13570793 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 11 Feb 2020 16:53:38 +0000 Subject: [PATCH 142/233] Fix typo --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2ff343b..da37d4a4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,7 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop - * ADDED: Enndpoint0 API functions to read and write Vendor and Product IDs + * ADDED: Endpoint0 API functions to read and write Vendor and Product IDs 0.2.1 ----- From c8da4ca8f6923013cd2795fad56f6a482d155bdd Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 11 Feb 2020 16:54:48 +0000 Subject: [PATCH 143/233] Fix typo --- lib_xua/api/xua_endpoint0.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 70782c85..c741225f 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -46,7 +46,7 @@ void XUA_Endpoint0_setProductId(unsigned short pid); */ unsigned short XUA_Endpoint0_getVendorId(); -/** Function to get the Vendor ID value +/** Function to get the Product ID value * * \return Product ID value */ From 035970c7a96a13e9b484bc19c47232ff9fd14c15 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Feb 2020 09:27:32 +0000 Subject: [PATCH 144/233] Fix description --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index da37d4a4..fc73742f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,7 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop - * ADDED: Endpoint0 API functions to read and write Vendor and Product IDs + * ADDED: Ability to read or modify vendor and product IDs 0.2.1 ----- From 40a2ac6d73b29de4d78a2149b833ea1885fe1026 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 14:17:46 +0800 Subject: [PATCH 145/233] moved the flow of changing USB descriptor values to XUA_Endpoint0_init() --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 68 ++++++++++------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index f8cf499a..887a451f 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -95,7 +95,6 @@ int min(int x, int y); /* Global current device config var*/ extern unsigned char g_currentConfig; - /* Global endpoint status arrays - declared in usb_device.xc */ extern unsigned char g_interfaceAlt[]; @@ -308,6 +307,38 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont } #endif +#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here + + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution + + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution + + const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h + int i=0; + for(i=0;i> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; + } + + for(i=0;i> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; + } + + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size + + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size + +#endif + } void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, @@ -785,41 +816,6 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 #endif #elif (AUDIO_CLASS == 1) /* Return Audio 1.0 Descriptors in FS, should never be in HS! */ - - - #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here - - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution - - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution - - int i=0; - for(i=0;i<3;i++) - { - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curAudOutFreq() & 0xff; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curAudOutFreq() & 0xff00)>> 8; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; - } - - for(i=0;i<3;i++) - { - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curAudInFreq() & 0xff; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curAudInFreq() & 0xff00)>> 8; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; - } - - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size - - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size - - #endif - - - result = USB_StandardRequests(ep0_out, ep0_in, null, 0, null, 0, From ed6ad4ce9f420c6161c8a34900b9c06c872cb3ce Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 15:05:45 +0800 Subject: [PATCH 146/233] remove unused USB descriptor lines under USB_CMD_CFG_SAMP_FREQ in xua_ep0_descriptor.h --- .../src/core/endpoint0/xua_ep0_descriptors.h | 58 +------------------ 1 file changed, 2 insertions(+), 56 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 9faca34a..d0d44795 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2864,7 +2864,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, 0x00, /* Not used */ #endif // XUA_ADAPTIVE -#ifdef USB_CMD_CFG_SAMP_FREQ +#ifdef USB_CMD_CFG_SAMP_FREQ //add extra Interface Descriptor in case mulitple bit resolution is needed to be offered to host /* Standard Interface Descriptor - Audio streaming IN */ 0x09, 0x04, /* INTERFACE */ @@ -2892,66 +2892,12 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ - -#ifdef USB_CMD_CFG_SAMP_FREQ + USB_IN_SAMP_FREQ_NUM, CHARIFY_SR(USB_IN_SAMP_FREQ_0), CHARIFY_SR(USB_IN_SAMP_FREQ_1), CHARIFY_SR(USB_IN_SAMP_FREQ_2), -#else - num_freqs_a1, /* SamFreqType - sample freq count */ -/* Windows enum issue with <= two sample rates work around */ -#if ((MIN_FREQ == 8000) && (MAX_FREQ_FS == 11025)) \ - || (MIN_FREQ == 11025) && (MAX_FREQ_FS == 12000) \ - || (MIN_FREQ == 12000) && (MAX_FREQ_FS == 16000) \ - || (MIN_FREQ == 16000) && (MAX_FREQ_FS == 32000) \ - || (MIN_FREQ == 44100) && (MAX_FREQ_FS == 48000) \ - || (MIN_FREQ == 48000) && (MAX_FREQ_FS == 88200) \ - || (MIN_FREQ == 88200) && (MAX_FREQ_FS == 96000) - CHARIFY_SR(MAX_FREQ_FS), -#endif -#if (MIN_FREQ == MAX_FREQ_FS) - CHARIFY_SR(MAX_FREQ_FS), - CHARIFY_SR(MAX_FREQ_FS), -#endif - -#if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) - 0x40, 0x1F, 0x00, /* sampleFreq - 8000KHz */ -#endif - -#if(MIN_FREQ <= 11025) && (MAX_FREQ_FS >= 11025) - 0x11, 0x2B, 0x00, /* sampleFreq - 11025KHz */ -#endif - -#if(MIN_FREQ <= 12000) && (MAX_FREQ_FS >= 12000) - 0xE0, 0x2E, 0x00, /* sampleFreq - 12000KHz */ -#endif - -#if(MIN_FREQ <= 16000) && (MAX_FREQ_FS >= 16000) - CHARIFY_SR(16000), /* sampleFreq - 32KHz */ -#endif - -#if(MIN_FREQ <= 32000) && (MAX_FREQ_FS >= 32000) - CHARIFY_SR(32000), /* sampleFreq - 32KHz */ -#endif - -#if (MIN_FREQ <= 44100) && (MAX_FREQ_FS >= 44100) - 0x44, 0xAC, 0x00, /* sampleFreq - 44.1Khz */ -#endif - -#if (MIN_FREQ <= 48000) && (MAX_FREQ_FS >= 48000) - 0x80, 0xBB, 0x00, /* sampleFreq - 48KHz */ -#endif - -#if (MIN_FREQ <= 88200) && (MAX_FREQ_FS >= 88200) - 0x88, 0x58, 0x01, /* sampleFreq - 88.2KHz */ -#endif - -#if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) - 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ -#endif -#endif //USB_CMD_CFG_SAMP_FREQ /* Standard Endpoint Descriptor */ 0x09, From 23cf086b8456fd7f53a56d95ce5ef32d641fd507 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 15:33:43 +0800 Subject: [PATCH 147/233] replace all tab by 4 spaces --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 56 +++++++++---------- .../src/core/endpoint0/xua_ep0_descriptors.h | 26 ++++----- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 28 +++++----- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 887a451f..8c39d1b9 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -309,34 +309,34 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution - - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution - - const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h - int i=0; - for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; - } - - for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; - } - - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size - - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size - + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution + + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution + + const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h + int i=0; + for(i=0;i> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; + } + + for(i=0;i> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; + } + + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size + + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size + #endif } diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index d0d44795..cee0f709 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2618,13 +2618,13 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_OUT_FS, /* nrChannels */ FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, /* subFrameSize */ FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */ - - #ifdef USB_CMD_CFG_SAMP_FREQ - USB_OUT_SAMP_FREQ_NUM, - CHARIFY_SR(USB_OUT_SAMP_FREQ_0), - CHARIFY_SR(USB_OUT_SAMP_FREQ_1), - CHARIFY_SR(USB_OUT_SAMP_FREQ_2), - #else + + #ifdef USB_CMD_CFG_SAMP_FREQ + USB_OUT_SAMP_FREQ_NUM, + CHARIFY_SR(USB_OUT_SAMP_FREQ_0), + CHARIFY_SR(USB_OUT_SAMP_FREQ_1), + CHARIFY_SR(USB_OUT_SAMP_FREQ_2), + #else num_freqs_a1, /* SamFreqType - sample freq count */ @@ -2678,7 +2678,7 @@ unsigned char cfgDesc_Audio1[] = #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ #endif - #endif //USB_CMD_CFG_SAMP_FREQ + #endif //USB_CMD_CFG_SAMP_FREQ /* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */ 0x09, @@ -2771,12 +2771,12 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ - + #ifdef USB_CMD_CFG_SAMP_FREQ - USB_IN_SAMP_FREQ_NUM, - CHARIFY_SR(USB_IN_SAMP_FREQ_0), - CHARIFY_SR(USB_IN_SAMP_FREQ_1), - CHARIFY_SR(USB_IN_SAMP_FREQ_2), + USB_IN_SAMP_FREQ_NUM, + CHARIFY_SR(USB_IN_SAMP_FREQ_0), + CHARIFY_SR(USB_IN_SAMP_FREQ_1), + CHARIFY_SR(USB_IN_SAMP_FREQ_2), #else num_freqs_a1, /* SamFreqType - sample freq count */ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 95b37197..0346809b 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1094,7 +1094,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp * bmRequestType.Recipient = Endpoint * bmRequestType.Type = Class * endpoint (wIndex & 0xff) is 0x01 or 0x82 - * wIndex is endpoint address for distinguishing input and output + * wIndex is endpoint address for distinguishing input and output */ XUD_Result_t result; @@ -1126,7 +1126,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); if(((sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO) && (newSampleRate != g_curUSBin_SamFreq)) || \ - ((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq))) + ((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq))) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1138,18 +1138,18 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ - g_curUSBin_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curUSBin_SamFreq); - } - else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO - g_curUSBout_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - //outuint(c_audioControl, SET_SAMPLE_FREQ); - //outuint(c_audioControl, g_curUSBout_SamFreq); // FIXME: not implemented yet - } + if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ + g_curUSBin_SamFreq = newSampleRate; + /* Instruct audio thread to change sample freq */ + outuint(c_audioControl, SET_SAMPLE_FREQ); + outuint(c_audioControl, g_curUSBin_SamFreq); + } + else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO + g_curUSBout_SamFreq = newSampleRate; + /* Instruct audio thread to change sample freq */ + //outuint(c_audioControl, SET_SAMPLE_FREQ); + //outuint(c_audioControl, g_curUSBout_SamFreq); // FIXME: not implemented yet + } /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); From 18cef82b06ffcdad49b2e7a9b2954f7456a19640 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 15:48:46 +0800 Subject: [PATCH 148/233] modified to have USB out frequency be informed to c_audioControl after getting EP0 request --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 0346809b..7226f4ec 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1147,8 +1147,8 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO g_curUSBout_SamFreq = newSampleRate; /* Instruct audio thread to change sample freq */ - //outuint(c_audioControl, SET_SAMPLE_FREQ); - //outuint(c_audioControl, g_curUSBout_SamFreq); // FIXME: not implemented yet + outuint(c_audioControl, SET_SAMPLE_FREQ); + outuint(c_audioControl, g_curUSBout_SamFreq); } /* Wait for handshake back - i.e. pll locked and clocks okay */ From 27c99623ac90b48b83bdbe63a15408c92f3fbbc2 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 15:54:46 +0800 Subject: [PATCH 149/233] update Changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f2aa6a1e..397eefd5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop + * ADDED: Support of variable USB sampling frequency 0.2.1 ----- From cb842df4920673191c69a4e79aa92f2f007eedbd Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 16:10:57 +0800 Subject: [PATCH 150/233] remove unnecessary AUDIO_CLASS checking --- lib_xua/src/core/buffer/decouple/decouple.xc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 438abe80..4920c2da 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -165,10 +165,8 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; - if (AUDIO_CLASS == 1){ - g_curSubSlot_Out = xua_lite_curUSB_Res_Out() >> 3; - g_curSubSlot_In = xua_lite_curUSB_Res_In() >> 3; - } + g_curSubSlot_Out = xua_lite_curUSB_Res_Out() >> 3; + g_curSubSlot_In = xua_lite_curUSB_Res_In() >> 3; /* Input word that triggered interrupt and handshake back */ unsigned underflowSample = inuint(c_mix_out); From 76f12ccad6c18dcd2c3375c33ce629b8649cb05b Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 16:35:21 +0800 Subject: [PATCH 151/233] rename default frequency naming --- lib_xua/api/xua_conf_default.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 65894a8c..e4e85c7b 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -229,15 +229,15 @@ /** * @brief Default Audio output sampling frequency */ -#ifndef DEFAULT_AUDOUT_FREQ -#define DEFAULT_AUDOUT_FREQ (48000) +#ifndef DEFAULT_AUD_TO_USB_FREQ +#define DEFAULT_AUD_TO_USB_FREQ (48000) #endif /** * @brief Default Reference input sampling frequency */ -#ifndef DEFAULT_AUDIN_FREQ -#define DEFAULT_AUDIN_FREQ (48000) +#ifndef DEFAULT_USB_TO_AUD_FREQ +#define DEFAULT_USB_TO_AUD_FREQ (48000) #endif /** From 07b829cd7e5eaa9b4589e83cc8d8a0ec10bdbcc3 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Thu, 13 Feb 2020 17:11:58 +0800 Subject: [PATCH 152/233] further renamed global variables and APIs --- lib_xua/src/core/buffer/decouple/decouple.xc | 4 ++-- lib_xua/src/core/endpoint0/xua_endpoint0.c | 16 ++++++++-------- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 4920c2da..c8d7ed8b 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -18,8 +18,8 @@ #define MAX(x,y) ((x)>(y) ? (x) : (y)) #if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -unsigned int xua_lite_curAudOutFreq(void); -unsigned int xua_lite_curAudInFreq(void); +unsigned int xua_lite_curAudToUsbFreq(void); +unsigned int xua_lite_curUsbToAudFreq(void); unsigned int xua_lite_curUSB_Res_In(void); unsigned int xua_lite_curUSB_Res_Out(void); #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 8c39d1b9..96126702 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -65,8 +65,8 @@ extern void device_reboot(void); #endif #if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -unsigned int xua_lite_curAudOutFreq(void); -unsigned int xua_lite_curAudInFreq(void); +unsigned int xua_lite_curAudToUsbFreq(void); +unsigned int xua_lite_curUsbToAudFreq(void); unsigned int xua_lite_curUSB_Res_In(void); unsigned int xua_lite_curUSB_Res_Out(void); #endif @@ -319,16 +319,16 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont int i=0; for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudOutFreq() & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curAudToUsbFreq() & 0xff; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curAudToUsbFreq() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudToUsbFreq() & 0xff0000)>> 16; } for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudInFreq() & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = xua_lite_curUsbToAudFreq() & 0xff; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (xua_lite_curUsbToAudFreq() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curUsbToAudFreq() & 0xff0000)>> 16; } cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 7226f4ec..28979a3f 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -55,8 +55,8 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; /* Global var for current frequency, set to default freq */ #ifdef USB_CMD_CFG_SAMP_FREQ -#define g_curUSBin_SamFreq xua_lite_curAudOutFreq() -#define g_curUSBout_SamFreq xua_lite_curAudInFreq() +#define g_curUSBin_SamFreq xua_lite_curAudToUsbFreq() +#define g_curUSBout_SamFreq xua_lite_curUsbToAudFreq() unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #else From dac808e9fab7f97f424db632ecd9a46ccd2a59f8 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Mon, 17 Feb 2020 12:09:54 +0000 Subject: [PATCH 153/233] get usb_adaptive to compile --- lib_xua/src/core/buffer/decouple/decouple.xc | 12 +++--- lib_xua/src/core/endpoint0/xua_endpoint0.c | 37 ++++++++++--------- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 11 ++++-- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index c8d7ed8b..ef5ebdf0 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -18,10 +18,10 @@ #define MAX(x,y) ((x)>(y) ? (x) : (y)) #if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -unsigned int xua_lite_curAudToUsbFreq(void); -unsigned int xua_lite_curUsbToAudFreq(void); -unsigned int xua_lite_curUSB_Res_In(void); -unsigned int xua_lite_curUSB_Res_Out(void); +extern uint32_t get_usb_to_device_rate(); +extern uint32_t get_device_to_usb_rate(); +extern uint32_t get_usb_to_device_bit_res(); +extern uint32_t get_device_to_usb_bit_res(); #endif /* TODO use SLOTSIZE to potentially save memory */ @@ -165,8 +165,8 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; - g_curSubSlot_Out = xua_lite_curUSB_Res_Out() >> 3; - g_curSubSlot_In = xua_lite_curUSB_Res_In() >> 3; + g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3; + g_curSubSlot_In = get_device_to_usb_bit_res() >> 3; /* Input word that triggered interrupt and handshake back */ unsigned underflowSample = inuint(c_mix_out); diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index f0df91bd..bb48571b 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "xua.h" @@ -65,10 +66,10 @@ extern void device_reboot(void); #endif #if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) -unsigned int xua_lite_curAudToUsbFreq(void); -unsigned int xua_lite_curUsbToAudFreq(void); -unsigned int xua_lite_curUSB_Res_In(void); -unsigned int xua_lite_curUSB_Res_Out(void); +extern uint32_t get_usb_to_device_rate(); +extern uint32_t get_device_to_usb_rate(); +extern uint32_t get_usb_to_device_bit_res(); +extern uint32_t get_device_to_usb_bit_res(); #endif unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active @@ -345,33 +346,33 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_In() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_In() & 0xff); //bit resolution + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = xua_lite_curUSB_Res_Out() >> 3; //sub frame rate = bit rate /8 - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (xua_lite_curUSB_Res_Out() & 0xff); //bit resolution + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8 + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h int i=0; for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curAudToUsbFreq() & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_device_to_usb_rate() & 0xff; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_device_to_usb_rate() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_device_to_usb_rate() & 0xff0000)>> 16; } for(i=0;i> 8; - cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (xua_lite_curUsbToAudFreq() & 0xff0000)>> 16; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i] = get_usb_to_device_rate() & 0xff; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 1] = (get_usb_to_device_rate() & 0xff00)>> 8; + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_usb_to_device_rate() & 0xff0000)>> 16; } - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_In() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size - cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((xua_lite_curUSB_Res_Out() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 28979a3f..cfe349f3 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -53,10 +53,15 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif + /* Global var for current frequency, set to default freq */ -#ifdef USB_CMD_CFG_SAMP_FREQ -#define g_curUSBin_SamFreq xua_lite_curAudToUsbFreq() -#define g_curUSBout_SamFreq xua_lite_curUsbToAudFreq() +#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +extern uint32_t get_usb_to_device_rate(); +extern uint32_t get_device_to_usb_rate(); +extern uint32_t get_usb_to_device_bit_res(); +extern uint32_t get_device_to_usb_bit_res(); +#define g_curUSBin_SamFreq get_device_to_usb_rate() +#define g_curUSBout_SamFreq get_usb_to_device_rate() unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used #else From 1efe7c88225c660b12e20b82830554384d15346c Mon Sep 17 00:00:00 2001 From: Keith Au Date: Tue, 18 Feb 2020 15:40:53 +0800 Subject: [PATCH 154/233] removed USB_CMD_CFG_SAMP_FREQ related codes --- lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- .../src/core/endpoint0/xua_ep0_descriptors.h | 91 ------------------- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 4 +- 4 files changed, 4 insertions(+), 95 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index ef5ebdf0..6fc1b5c9 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -17,7 +17,7 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) -#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index bb48571b..18ae1ee6 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -65,7 +65,7 @@ extern void device_reboot(void); #include "xua_hid.h" #endif -#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index cee0f709..c66c6dba 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2364,11 +2364,7 @@ const unsigned num_freqs_a1 = MAX(3, (0 #if ((NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP)) #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (58 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) #else - #ifdef USB_CMD_CFG_SAMP_FREQ - #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3) + (40 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) - #else #define CFG_TOTAL_LENGTH_A1 (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 + HID_INTERFACE_BYTES) - #endif //USB_CMD_CFG_SAMP_FREQ #endif #ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES @@ -2618,14 +2614,6 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_OUT_FS, /* nrChannels */ FS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, /* subFrameSize */ FS_STREAM_FORMAT_OUTPUT_1_RESOLUTION_BITS, /* bitResolution */ - - #ifdef USB_CMD_CFG_SAMP_FREQ - USB_OUT_SAMP_FREQ_NUM, - CHARIFY_SR(USB_OUT_SAMP_FREQ_0), - CHARIFY_SR(USB_OUT_SAMP_FREQ_1), - CHARIFY_SR(USB_OUT_SAMP_FREQ_2), - #else - num_freqs_a1, /* SamFreqType - sample freq count */ /* Windows enum issue with <= two sample rates work around */ @@ -2678,7 +2666,6 @@ unsigned char cfgDesc_Audio1[] = #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ #endif - #endif //USB_CMD_CFG_SAMP_FREQ /* Standard AS Isochronous Audio Data Endpoint Descriptor 4.6.1.1 */ 0x09, @@ -2771,13 +2758,6 @@ unsigned char cfgDesc_Audio1[] = NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ - -#ifdef USB_CMD_CFG_SAMP_FREQ - USB_IN_SAMP_FREQ_NUM, - CHARIFY_SR(USB_IN_SAMP_FREQ_0), - CHARIFY_SR(USB_IN_SAMP_FREQ_1), - CHARIFY_SR(USB_IN_SAMP_FREQ_2), -#else num_freqs_a1, /* SamFreqType - sample freq count */ /* Windows enum issue with <= two sample rates work around */ @@ -2830,7 +2810,6 @@ unsigned char cfgDesc_Audio1[] = #if (MIN_FREQ <= 96000) && (MAX_FREQ_FS >= 96000) 0x00, 0x77, 0x01, /* sampleFreq - 96KHz */ #endif -#endif //USB_CMD_CFG_SAMP_FREQ /* Standard Endpoint Descriptor */ 0x09, @@ -2863,76 +2842,6 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* Undefined */ 0x00, 0x00, /* Not used */ #endif // XUA_ADAPTIVE - -#ifdef USB_CMD_CFG_SAMP_FREQ //add extra Interface Descriptor in case mulitple bit resolution is needed to be offered to host - /* Standard Interface Descriptor - Audio streaming IN */ - 0x09, - 0x04, /* INTERFACE */ - (OUTPUT_INTERFACES_A1 + 1), /* bInterfaceNumber */ - 0x02, /* AlternateSetting */ - 0x01, /* bNumEndpoints */ - 0x01, /* Interface class - AUDIO */ - 0x02, /* Subclass - AUDIO_STREAMING */ - 0x00, /* Unused */ - offsetof(StringDescTable_t, inputInterfaceStr_Audio1)/sizeof(char *), - - /* CS_Interface AC interface header descriptor */ - 0x07, - UAC_CS_DESCTYPE_INTERFACE, - 0x01, /* subtype - GENERAL */ - 0x07, /* TerminalLink - linked to Streaming OUT terminal */ - 0x01, /* Interface delay */ - 0x01,0x00, /* Format - PCM */ - - /* CS_Interface Terminal Descriptor */ - (8 + (num_freqs_a1 * 3)), - UAC_CS_DESCTYPE_INTERFACE, - 0x02, /* Subtype - FORMAT_TYPE */ - 0x01, /* Format type - FORMAT_TYPE_1 */ - NUM_USB_CHAN_IN_FS, /* bNrChannels - Typically 2 */ - FS_STREAM_FORMAT_INPUT_1_SUBSLOT_BYTES, /* subFrameSize - Typically 4 bytes per slot */ - FS_STREAM_FORMAT_INPUT_1_RESOLUTION_BITS, /* bitResolution - Typically 24bit */ - - USB_IN_SAMP_FREQ_NUM, - CHARIFY_SR(USB_IN_SAMP_FREQ_0), - CHARIFY_SR(USB_IN_SAMP_FREQ_1), - CHARIFY_SR(USB_IN_SAMP_FREQ_2), - - - /* Standard Endpoint Descriptor */ - 0x09, - 0x05, /* ENDPOINT */ - ENDPOINT_ADDRESS_IN_AUDIO, /* EndpointAddress */ -#ifdef XUA_ADAPTIVE - ISO_EP_ATTRIBUTES_ADAPTIVE, -#else - #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) - ISO_EP_ATTRIBUTES_ASYNCH, /* Iso, async, data endpoint */ - #else - ISO_EP_IMPL_ATTRIBUTES_ASYNCH, /* Feedback data endpoint */ - #endif -#endif - FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff, /* 4 wMaxPacketSize (Typically 294 bytes)*/ - (FS_STREAM_FORMAT_INPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ - 0x01, /* bInterval */ - 0x00, /* bRefresh */ - 0x00, /* bSynchAddress */ - - /* CS_Endpoint Descriptor */ - 0x07, - 0x25, /* CS_ENDPOINT */ - 0x01, /* Subtype - GENERAL */ - 0x01, /* Attributes. D[0]: sample freq ctrl. */ -#ifdef XUA_ADAPTIVE - 0x02, /* Lock Delay units PCM samples*/ - 0x08, 0x00, /* No lock delay */ -#else - 0x00, /* Undefined */ - 0x00, 0x00, /* Not used */ -#endif // XUA_ADAPTIVE -#endif//USB_CMD_CFG_SAMP_FREQ - - #endif #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index cfe349f3..d08555b6 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -55,7 +55,7 @@ extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; /* Global var for current frequency, set to default freq */ -#if((defined USB_CMD_CFG_SAMP_FREQ) || (defined USB_DESCRIPTOR_OVERRIDE_RATE_RES)) +#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); @@ -1121,7 +1121,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp { return result; } -#if ((MAX_FREQ != MIN_FREQ) || (defined USB_CMD_CFG_SAMP_FREQ)) +#if (MAX_FREQ != MIN_FREQ) if(controlSelector == SAMPLING_FREQ_CONTROL) { /* Expect length 3 for sample rate */ From 050d7757bcbd8c8f6dd767213305de9053ab713b Mon Sep 17 00:00:00 2001 From: shuchitak Date: Tue, 18 Feb 2020 09:04:57 +0000 Subject: [PATCH 155/233] removed unused defines --- lib_xua/api/xua_conf_default.h | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index e4e85c7b..79aa061b 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -226,34 +226,6 @@ #define DEFAULT_FREQ (MIN_FREQ) #endif -/** - * @brief Default Audio output sampling frequency - */ -#ifndef DEFAULT_AUD_TO_USB_FREQ -#define DEFAULT_AUD_TO_USB_FREQ (48000) -#endif - -/** - * @brief Default Reference input sampling frequency - */ -#ifndef DEFAULT_USB_TO_AUD_FREQ -#define DEFAULT_USB_TO_AUD_FREQ (48000) -#endif - -/** - * @brief Default USB input (Audio output) bit resolution - */ -#ifndef DEFAULT_BIT_RES_IN -#define DEFAULT_BIT_RES_IN (32) -#endif - -/** - * @brief Default USB output (Reference input) bit resolution - */ -#ifndef DEFAULT_BIT_RES_OUT -#define DEFAULT_BIT_RES_OUT (32) -#endif - /* Audio Class Defines */ /** From c63df2e961277404fa6017aef6a90e96602d67d9 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Tue, 18 Feb 2020 10:20:25 +0000 Subject: [PATCH 156/233] update g_curSubSlot_Out and g_curSubSlot_In under #if USB_DESCRIPTOR_OVERRIDE_RATE_RES --- lib_xua/src/core/buffer/decouple/decouple.xc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index 6fc1b5c9..d7634195 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -165,8 +165,10 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; +#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3; g_curSubSlot_In = get_device_to_usb_bit_res() >> 3; +#endif /* Input word that triggered interrupt and handshake back */ unsigned underflowSample = inuint(c_mix_out); From 0b5ddbd85e5413d0cf10fd69fdab21a678bea5e0 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Wed, 19 Feb 2020 16:52:52 +0800 Subject: [PATCH 157/233] fixed typo of comments --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 18ae1ee6..cce5a9c9 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -352,7 +352,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution - const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h + const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h int i=0; for(i=0;i Date: Wed, 19 Feb 2020 15:45:58 +0000 Subject: [PATCH 158/233] undo changes in xua_ep0_uacreqs --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 47 ++++--------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index d08555b6..2fdd434c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -17,13 +17,6 @@ #ifdef MIXER #include "mixer.h" #endif -#include "xua_conf_default.h" -#include "descriptor_defs.h" - - -#define DEBUG_UNIT XUA_EP0_UACREQS -#define DEBUG_PRINT_ENABLE_XUA_EP0_UACREQS 0 -#include "debug_print.h" #define CS_XU_MIXSEL (0x06) @@ -52,23 +45,8 @@ extern unsigned char channelMapUsb[NUM_USB_CHAN_IN]; extern unsigned char mixSel[MAX_MIX_COUNT][MIX_INPUTS]; #endif - - /* Global var for current frequency, set to default freq */ -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#define g_curUSBin_SamFreq get_device_to_usb_rate() -#define g_curUSBout_SamFreq get_usb_to_device_rate() - -unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used -#else -unsigned int g_curUSBin_SamFreq = DEFAULT_FREQ; -unsigned int g_curUSBout_SamFreq = DEFAULT_FREQ; -unsigned int g_curSamFreq = DEFAULT_FREQ; // should no longer be used -#endif +unsigned int g_curSamFreq = DEFAULT_FREQ; #if 0 unsigned int g_curSamFreq48000Family = DEFAULT_FREQ % 48000 == 0; @@ -1099,7 +1077,6 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp * bmRequestType.Recipient = Endpoint * bmRequestType.Type = Class * endpoint (wIndex & 0xff) is 0x01 or 0x82 - * wIndex is endpoint address for distinguishing input and output */ XUD_Result_t result; @@ -1130,8 +1107,7 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp /* Recontruct sample-freq */ int newSampleRate = (buffer, unsigned char[])[0] | ((buffer, unsigned char[])[1] << 8) | ((buffer, unsigned char[])[2] << 16); - if(((sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO) && (newSampleRate != g_curUSBin_SamFreq)) || \ - ((sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO) && (newSampleRate != g_curUSBout_SamFreq))) + if(newSampleRate != g_curSamFreq) { int curSamFreq44100Family; int curSamFreq48000Family; @@ -1143,25 +1119,18 @@ int AudioEndpointRequests_1(XUD_ep ep0_out, XUD_ep ep0_in, USB_SetupPacket_t &sp if(curSamFreq48000Family || curSamFreq44100Family) { - if(sp.wIndex == ENDPOINT_ADDRESS_IN_AUDIO){ - g_curUSBin_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curUSBin_SamFreq); - } - else{ //if sp.wIndex == ENDPOINT_ADDRESS_OUT_AUDIO - g_curUSBout_SamFreq = newSampleRate; - /* Instruct audio thread to change sample freq */ - outuint(c_audioControl, SET_SAMPLE_FREQ); - outuint(c_audioControl, g_curUSBout_SamFreq); - } + g_curSamFreq = newSampleRate; + + /* Instruct audio thread to change sample freq */ + outuint(c_audioControl, SET_SAMPLE_FREQ); + outuint(c_audioControl, g_curSamFreq); /* Wait for handshake back - i.e. pll locked and clocks okay */ chkct(c_audioControl, XS1_CT_END); /* Allow time for the change - feedback to stabilise */ FeedbackStabilityDelay(); - } + } } return XUD_SetBuffer(ep0_in, (buffer, unsigned char[]), 0); } From 4ae9956a139baeff95eb0ae17f0648d1ee020f05 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:20:24 +0000 Subject: [PATCH 159/233] changelog + source check --- CHANGELOG.rst | 2 +- lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a01c8c9d..115011b7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,7 +21,7 @@ lib_xua Change Log events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop * ADDED: Ability to read or modify vendor and product IDs - * ADDED: Support of variable USB sampling frequency + * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. 0.2.1 ----- diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index d7634195..b6dffe51 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index ab4c613d..f8c7cc33 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..2ce05108 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor From b31028a3d65ebb2d7c7c50736f7b5ab95d95fa79 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:28:16 +0000 Subject: [PATCH 160/233] undo copyright change --- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index f8c7cc33..ab4c613d 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2ce05108..2fdd434c 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor From abbafba3a714db5b4a4996e0f42e8a81246d3dbf Mon Sep 17 00:00:00 2001 From: shuchitak Date: Thu, 20 Feb 2020 09:59:52 +0000 Subject: [PATCH 161/233] changelog and source --- CHANGELOG.rst | 3 ++- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 115011b7..863e2c29 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,7 +21,8 @@ lib_xua Change Log events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop * ADDED: Ability to read or modify vendor and product IDs - * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. + * ADDED: Override USB descriptor with sampling frequency and + bit-resolution set at boot time. 0.2.1 ----- diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index ab4c613d..f8c7cc33 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2fdd434c..2ce05108 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor From d125860552be450e402f530e9ecfbb69f40862c2 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 10:48:46 +0800 Subject: [PATCH 162/233] changed define name USB_DESCRIPTOR_OVERRIDE_RATE_RES to XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES --- lib_xua/src/core/buffer/decouple/decouple.xc | 4 ++-- lib_xua/src/core/endpoint0/xua_endpoint0.c | 4 ++-- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index b6dffe51..d501ad9f 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -17,7 +17,7 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); @@ -165,7 +165,7 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3; g_curSubSlot_In = get_device_to_usb_bit_res() >> 3; #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index cce5a9c9..972f4a61 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -65,7 +65,7 @@ extern void device_reboot(void); #include "xua_hid.h" #endif -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); @@ -344,7 +344,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont } #endif -#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here +#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index c66c6dba..5e51b3dd 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2367,7 +2367,7 @@ const unsigned num_freqs_a1 = MAX(3, (0 #define CFG_TOTAL_LENGTH_A1 (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 + HID_INTERFACE_BYTES) #endif -#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES +#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES #define AS_INTERFACE_BYTES (7) #define INTERFACE_DESCRIPTOR_BYTES (9) #define AS_FORMAT_TYPE_BYTES (17) From d3f2220be48d1a4a7b2b90316dd78237b3f2a6c6 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 15:53:27 +0800 Subject: [PATCH 163/233] added xua_api.h for extern declaration of get/set_usb_to/from_device_rate/res APIs and removed from c/xc files --- lib_xua/api/xua_api.h | 18 ++++++++++++++++++ lib_xua/src/core/buffer/decouple/decouple.xc | 7 +------ lib_xua/src/core/endpoint0/xua_endpoint0.c | 9 ++------- 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 lib_xua/api/xua_api.h diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_api.h new file mode 100644 index 00000000..f3d3c735 --- /dev/null +++ b/lib_xua/api/xua_api.h @@ -0,0 +1,18 @@ +// Copyright (c) 2017-2020, XMOS Ltd, All rights reserved + +#ifndef __XUA_API_H__ +#define __XUA_API_H__ + +#if __XC__ +extern void set_usb_to_device_rate(uint32_t rate); +extern void set_device_to_usb_rate(uint32_t rate); +extern void set_usb_to_device_bit_res(uint32_t rate); +extern void set_device_to_usb_bit_res(uint32_t rate); +#endif + +extern uint32_t get_usb_to_device_rate(); +extern uint32_t get_device_to_usb_rate(); +extern uint32_t get_usb_to_device_bit_res(); +extern uint32_t get_device_to_usb_bit_res(); + +#endif //__XUA_API_H__ diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index d501ad9f..ae6d8ed5 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -7,6 +7,7 @@ #include "interrupt.h" #include "xua_commands.h" #include "xud.h" +#include "xua_api.h" #ifdef NATIVE_DSD #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ @@ -17,12 +18,6 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) -#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#endif /* TODO use SLOTSIZE to potentially save memory */ /* Note we could improve on this, for one subslot is set to 4 */ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 972f4a61..0a5dbcac 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -29,6 +29,8 @@ #include "dsd_support.h" #endif +#include "xua_api.h" + #ifndef __XC__ /* Support for xCORE channels in C */ #define null 0 @@ -65,13 +67,6 @@ extern void device_reboot(void); #include "xua_hid.h" #endif -#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#endif - unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active /* Global volume and mute tables */ From dbaf66fdb286e8d35a49fb9ae6d604ed3bae61e3 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 17:08:58 +0800 Subject: [PATCH 164/233] removed #if XC check --- lib_xua/api/xua_api.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_api.h index f3d3c735..460c4008 100644 --- a/lib_xua/api/xua_api.h +++ b/lib_xua/api/xua_api.h @@ -3,12 +3,10 @@ #ifndef __XUA_API_H__ #define __XUA_API_H__ -#if __XC__ extern void set_usb_to_device_rate(uint32_t rate); extern void set_device_to_usb_rate(uint32_t rate); extern void set_usb_to_device_bit_res(uint32_t rate); extern void set_device_to_usb_bit_res(uint32_t rate); -#endif extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); From cd8e46308f802befe78261938beae3d25bf64b31 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 17:14:47 +0800 Subject: [PATCH 165/233] renamed xua_api.h to xua_usb_params_funcs.h --- lib_xua/api/{xua_api.h => xua_usb_params_funcs.h} | 0 lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename lib_xua/api/{xua_api.h => xua_usb_params_funcs.h} (100%) diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_usb_params_funcs.h similarity index 100% rename from lib_xua/api/xua_api.h rename to lib_xua/api/xua_usb_params_funcs.h diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index ae6d8ed5..f217b0e4 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -7,7 +7,7 @@ #include "interrupt.h" #include "xua_commands.h" #include "xud.h" -#include "xua_api.h" +#include "xua_usb_params_funcs.h" #ifdef NATIVE_DSD #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 0a5dbcac..2a183c72 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -29,7 +29,7 @@ #include "dsd_support.h" #endif -#include "xua_api.h" +#include "xua_usb_params_funcs.h" #ifndef __XC__ /* Support for xCORE channels in C */ From 8b52c83b4c14f8505f0551fb5f49d10cf15f132a Mon Sep 17 00:00:00 2001 From: shuchitak Date: Fri, 28 Feb 2020 10:38:54 +0000 Subject: [PATCH 166/233] include stdint.h --- lib_xua/api/xua_usb_params_funcs.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_xua/api/xua_usb_params_funcs.h b/lib_xua/api/xua_usb_params_funcs.h index 460c4008..2c815943 100644 --- a/lib_xua/api/xua_usb_params_funcs.h +++ b/lib_xua/api/xua_usb_params_funcs.h @@ -3,6 +3,8 @@ #ifndef __XUA_API_H__ #define __XUA_API_H__ +#include + extern void set_usb_to_device_rate(uint32_t rate); extern void set_device_to_usb_rate(uint32_t rate); extern void set_usb_to_device_bit_res(uint32_t rate); From 73015bc44f42e19db6c52d794354ad99c2bf6877 Mon Sep 17 00:00:00 2001 From: shuchitak Date: Fri, 28 Feb 2020 11:22:26 +0000 Subject: [PATCH 167/233] remove extern from function declaration --- lib_xua/api/xua_usb_params_funcs.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_xua/api/xua_usb_params_funcs.h b/lib_xua/api/xua_usb_params_funcs.h index 2c815943..0a427046 100644 --- a/lib_xua/api/xua_usb_params_funcs.h +++ b/lib_xua/api/xua_usb_params_funcs.h @@ -5,14 +5,14 @@ #include -extern void set_usb_to_device_rate(uint32_t rate); -extern void set_device_to_usb_rate(uint32_t rate); -extern void set_usb_to_device_bit_res(uint32_t rate); -extern void set_device_to_usb_bit_res(uint32_t rate); +void set_usb_to_device_rate(uint32_t rate); +void set_device_to_usb_rate(uint32_t rate); +void set_usb_to_device_bit_res(uint32_t rate); +void set_device_to_usb_bit_res(uint32_t rate); -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); +uint32_t get_usb_to_device_rate(); +uint32_t get_device_to_usb_rate(); +uint32_t get_usb_to_device_bit_res(); +uint32_t get_device_to_usb_bit_res(); #endif //__XUA_API_H__ From 40ab0b563c36898f540eddaa261d470cbef20357 Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Mon, 2 Mar 2020 16:02:26 +0000 Subject: [PATCH 168/233] Add commands to configure USB bcdDevice version --- CHANGELOG.rst | 1 + lib_xua/api/xua_endpoint0.h | 4 ++++ lib_xua/src/core/endpoint0/xua_endpoint0.c | 20 +++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 863e2c29..c2862994 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,6 +21,7 @@ lib_xua Change Log events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop * ADDED: Ability to read or modify vendor and product IDs + * ADDED: Ability to read or modify bcdDevice * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index c741225f..13c00b61 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -52,5 +52,9 @@ unsigned short XUA_Endpoint0_getVendorId(); */ unsigned short XUA_Endpoint0_getProductId(); +unsigned short XUA_Endpoint0_getBcdDevice(); + +void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); + #endif #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 2a183c72..a75b0db3 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -237,7 +237,7 @@ unsigned short XUA_Endpoint0_getVendorId() { } unsigned short XUA_Endpoint0_getProductId() { - unsigned short pid; + unsigned short pid; #if (AUDIO_CLASS == 1) pid = devDesc_Audio1.idProduct; #else @@ -246,6 +246,24 @@ unsigned short XUA_Endpoint0_getProductId() { return pid; } +unsigned short XUA_Endpoint0_getBcdDevice() { + unsigned short bcd; +#if (AUDIO_CLASS == 1) + bcd = devDesc_Audio1.bcdDevice; +#else + bcd = devDesc_Audio2.bcdDevice; +#endif // AUDIO_CLASS == 1} + return bcd; +} + +void XUA_Endpoint0_setBcdDevice(unsigned short bcd) { +#if (AUDIO_CLASS == 1) + devDesc_Audio1.bcdDevice = bcd; +#else + devDesc_Audio2.bcdDevice = bcd; +#endif // AUDIO_CLASS == 1} +} + void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) { From e8bdaf8004dc09576e772c96a87c03aba98600ca Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 3 Mar 2020 22:52:36 +0000 Subject: [PATCH 169/233] Add USB string functions --- lib_xua/api/xua_endpoint0.h | 46 ++++++++++ lib_xua/src/core/endpoint0/xua_endpoint0.c | 88 ++++++++++++++++++- .../src/core/endpoint0/xua_ep0_descriptors.h | 7 +- 3 files changed, 139 insertions(+), 2 deletions(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index c741225f..bf279c5c 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -40,6 +40,52 @@ void XUA_Endpoint0_setVendorId(unsigned short vid); */ void XUA_Endpoint0_setProductId(unsigned short pid); + +/** Function to set the Vendor ID value + * + * \param vid vendor ID value to set +*/ +#ifdef __XC__ +extern "C" { +#endif + void XUA_Endpoint0_setVendorStr(char* vendor_str); +#ifdef __XC__ +} +#endif + +#ifdef __XC__ +extern "C" { +#endif + void XUA_Endpoint0_setProductStr(char* product_str); +#ifdef __XC__ +} +#endif + +/** Function to set the Vendor ID value + * + * \param vid vendor ID value to set +*/ +#ifdef __XC__ +extern "C" { +#endif +char* XUA_Endpoint0_getVendorStr(); +#ifdef __XC__ +} +#endif + +/** Function to set the Product ID value + * + * \param pid Product ID value to set +*/ +#ifdef __XC__ +extern "C" { +#endif +char* XUA_Endpoint0_getProductStr(); +#ifdef __XC__ +} +#endif + + /** Function to get the Vendor ID value * * \return Vendor ID value diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 2a183c72..bb296555 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -8,7 +8,7 @@ #include #include #include - +#include #include "xua.h" #if XUA_USB_EN @@ -217,6 +217,92 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { devDesc_Audio2.idVendor = vid; #endif // AUDIO_CLASS == 1} } +#include "print.h" +void copyCombinedStrings(char* string1, char* string2, char* string_buffer) { + uint32_t string_size = MIN(strlen(string1), MAX_STRING_SIZE); + memset(string_buffer, 0, MAX_STRING_SIZE); + memcpy(string_buffer, string1, string_size); + string_size = MIN(strlen(string1)+1, MAX_STRING_SIZE); + if (string_sizeMAX_STRING_SIZE) { + memcpy(string_buffer+strlen(string1)+1, string2, MAX_STRING_SIZE-strlen(string1)-1); + } else { + memcpy(string_buffer+strlen(string1)+1, string2, strlen(string2)); + } +} + +void XUA_Endpoint0_setVendorStr(char* vendor_str) { + uint32_t string_size = MIN(strlen(vendor_str), MAX_STRING_SIZE); + + memset(g_strTable.vendorStr, 0, MAX_STRING_SIZE); + memcpy(g_strTable.vendorStr, vendor_str, string_size); +#if (AUDIO_CLASS == 2) + copyCombinedStrings(g_strTable.clockSelectorStr, vendor_str, "Clock Selector"); + copyCombinedStrings(g_strTable.internalClockSourceStr, vendor_str, "Internal Clock"); +#endif +#if SPDIF_RX + copyCombinedStrings(g_strTable.spdifClockSourceStr, vendor_str, "S/PDIF Clock"); +#endif +#if ADAT_RX + copyCombinedStrings(g_strTable.adatClockSourceStr, vendor_str, "ADAT Clock"); +#endif +#if (XUA_DFU_EN == 1) + copyCombinedStrings(g_strTable.dfuStr, vendor_str, "DFU"); +#endif +#ifdef USB_CONTROL_DESCS + copyCombinedStrings(g_strTable.ctrlStr, vendor_str, "Control"); +#endif +#ifdef MIDI + copyCombinedStrings(g_strTable.midiOutStr, vendor_str, "MIDI Out"); + copyCombinedStrings(g_strTable.midiInStr, vendor_str, "MIDI In"); +#endif +} + +void XUA_Endpoint0_setProductStr(char* product_str) { + uint32_t string_size = MIN(strlen(product_str), MAX_STRING_SIZE); +#if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) + memset(g_strTable.productStr_Audio1, 0, MAX_STRING_SIZE); + memset(g_strTable.outputInterfaceStr_Audio1, 0, MAX_STRING_SIZE); + memset(g_strTable.inputInterfaceStr_Audio1, 0, MAX_STRING_SIZE); + memset(g_strTable.usbInputTermStr_Audio1, 0, MAX_STRING_SIZE); + memset(g_strTable.usbOutputTermStr_Audio1, 0, MAX_STRING_SIZE); + + memcpy(g_strTable.productStr_Audio1, product_str, string_size); + memcpy(g_strTable.outputInterfaceStr_Audio1, product_str, string_size); + memcpy(g_strTable.inputInterfaceStr_Audio1, product_str, string_size); + memcpy(g_strTable.usbInputTermStr_Audio1, product_str, string_size); + memcpy(g_strTable.usbOutputTermStr_Audio1, product_str, string_size); +#elif (AUDIO_CLASS == 2) + memset(g_strTable.productStr_Audio2, 0, MAX_STRING_SIZE); + memset(g_strTable.outputInterfaceStr_Audio2, 0, MAX_STRING_SIZE); + memset(g_strTable.inputInterfaceStr_Audio2, 0, MAX_STRING_SIZE); + memset(g_strTable.usbInputTermStr_Audio2, 0, MAX_STRING_SIZE); + memset(g_strTable.usbOutputTermStr_Audio2, 0, MAX_STRING_SIZE); + + memcpy(g_strTable.productStr_Audio1, product_str, string_size); + memcpy(g_strTable.outputInterfaceStr_Audio2, product_str, string_size); + memcpy(g_strTable.inputInterfaceStr_Audio2, product_str, string_size); + memcpy(g_strTable.usbInputTermStr_Audio2, product_str, string_size); + memcpy(g_strTable.usbOutputTermStr_Audio2, product_str, string_size); +#endif +} + +char* XUA_Endpoint0_getVendorStr() { + return g_strTable.vendorStr; +} + +char* XUA_Endpoint0_getProductStr() { + #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) + return g_strTable.productStr_Audio1; + #elif (AUDIO_CLASS == 2) + return g_strTable.productStr_Audio2; + #endif +} void XUA_Endpoint0_setProductId(unsigned short pid) { #if (AUDIO_CLASS == 1) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 5e51b3dd..521bdd64 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -20,13 +20,15 @@ #include "iap2.h" /* Defines iAP EA Native Transport protocol name */ #endif +#define MAX_STRING_SIZE (32) + #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x #define APPEND_PRODUCT_STR_A2(x) PRODUCT_STR_A2 " "#x #define APPEND_PRODUCT_STR_A1(x) PRODUCT_STR_A1 " "#x -#define STR_TABLE_ENTRY(name) char *name +#define STR_TABLE_ENTRY(name) char name[MAX_STRING_SIZE] #define ISO_EP_ATTRIBUTES_ASYNCH 0x05 //ISO, ASYNCH, DATA EP #define ISO_EP_ATTRIBUTES_ADAPTIVE 0x09 //ISO, ADAPTIVE, DATA EP @@ -327,6 +329,7 @@ StringDescTable_t g_strTable = .usbOutputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(), #endif #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) + .productStr_Audio1 = PRODUCT_STR_A1, .outputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), .inputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), @@ -2293,6 +2296,8 @@ unsigned char cfgDesc_Null[] = * To work around this we repeat MAX_FREQ_FS multiple times in some cases */ #define MAX(a,b) (((a)>(b))?(a):(b)) +#define MIN(a,b) (((a)<(b))?(a):(b)) + const unsigned num_freqs_a1 = MAX(3, (0 #if(MIN_FREQ <= 8000) && (MAX_FREQ_FS >= 8000) + 1 From d146435d07a9eec3914bcec72dc930796edea1cf Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 17:10:36 +0000 Subject: [PATCH 170/233] Add XUA_Endpoint0_setStrTable() function --- lib_xua/api/xua_endpoint0.h | 21 +-- lib_xua/src/core/endpoint0/xua_endpoint0.c | 144 +++++++++--------- .../src/core/endpoint0/xua_ep0_descriptors.h | 61 ++++---- 3 files changed, 119 insertions(+), 107 deletions(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index b33405ca..90dc0d42 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -41,9 +41,9 @@ void XUA_Endpoint0_setVendorId(unsigned short vid); void XUA_Endpoint0_setProductId(unsigned short pid); -/** Function to set the Vendor ID value +/** Function to set the Vendor string * - * \param vid vendor ID value to set + * \param vendor_str vendor string to set */ #ifdef __XC__ extern "C" { @@ -53,6 +53,11 @@ extern "C" { } #endif +/** Function to set the Product string + * + * \param product_str product string to set +*/ + #ifdef __XC__ extern "C" { #endif @@ -86,21 +91,17 @@ char* XUA_Endpoint0_getProductStr(); #endif -/** Function to get the Vendor ID value +/** Function to get the Vendor string * - * \return Vendor ID value + * \return Vendor string */ unsigned short XUA_Endpoint0_getVendorId(); -/** Function to get the Product ID value +/** Function to get the Product string * - * \return Product ID value + * \return Product string */ unsigned short XUA_Endpoint0_getProductId(); -unsigned short XUA_Endpoint0_getBcdDevice(); - -void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); - #endif #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 520fb91c..a6c9aae0 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -11,7 +11,7 @@ #include #include "xua.h" -#if XUA_USB_EN +#if XUA_USB_EN #include "xud_device.h" /* Standard descriptor requests */ #include "dfu_types.h" #include "usbaudio20.h" /* Defines from USB Audio 2.0 spec */ @@ -28,6 +28,11 @@ #if DSD_CHANS_DAC > 0 #include "dsd_support.h" #endif +#define DEBUG_UNIT XUA_EP0 +#ifndef DEBUG_PRINT_ENABLE_XUA_EP0 + #define DEBUG_PRINT_ENABLE_XUA_EP0 1 +#endif // DEBUG_PRINT_ENABLE_XUA_EP0 +#include "debug_print.h" #include "xua_usb_params_funcs.h" @@ -217,79 +222,74 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { devDesc_Audio2.idVendor = vid; #endif // AUDIO_CLASS == 1} } -#include "print.h" -void copyCombinedStrings(char* string1, char* string2, char* string_buffer) { - uint32_t string_size = MIN(strlen(string1), MAX_STRING_SIZE); - memset(string_buffer, 0, MAX_STRING_SIZE); +void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { + uint32_t string_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); + + memset(string_buffer, 0, XUA_MAX_STR_LEN); memcpy(string_buffer, string1, string_size); - string_size = MIN(strlen(string1)+1, MAX_STRING_SIZE); - if (string_sizeMAX_STRING_SIZE) { - memcpy(string_buffer+strlen(string1)+1, string2, MAX_STRING_SIZE-strlen(string1)-1); + uint32_t total_string_size = MIN(strlen(string1)+strlen(string2), XUA_MAX_STR_LEN-1); + if (total_string_size==XUA_MAX_STR_LEN-1) { + string_size = XUA_MAX_STR_LEN-1-strlen(string1); } else { - memcpy(string_buffer+strlen(string1)+1, string2, strlen(string2)); + string_size = strlen(string1); } + memcpy(string_buffer+strlen(string1), string2, string_size); + string_buffer[total_string_size] = '\0'; +} + +void XUA_Endpoint0_setStrTable() { + // update Vendor string + concatenateAndCopyStrings(g_vendor_str, "", g_strTable.vendorStr); +#if (AUDIO_CLASS == 2) + concatenateAndCopyStrings(g_vendor_str, " Clock Selector", g_strTable.clockSelectorStr); + concatenateAndCopyStrings(g_vendor_str, " Internal Clock", g_strTable.internalClockSourceStr); +#endif +#if SPDIF_RX + concatenateAndCopyStrings(g_vendor_str, " S/PDIF Clock", g_strTable.spdifClockSourceStr); +#endif +#if ADAT_RX + concatenateAndCopyStrings(g_vendor_str, " ADAT Clock", g_strTable.adatClockSourceStr); +#endif +#if (XUA_DFU_EN == 1) + concatenateAndCopyStrings(g_vendor_str, " DFU", g_strTable.dfuStr); +#endif +#ifdef USB_CONTROL_DESCS + concatenateAndCopyStrings(g_vendor_str, " Control", g_strTable.ctrlStr); +#endif +#ifdef MIDI + concatenateAndCopyStrings(g_vendor_str, " MIDI Out", g_strTable.midiOutStr); + concatenateAndCopyStrings(g_vendor_str, " MIDI In", g_strTable.midiInStr); +#endif + // update product string +#if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) + concatenateAndCopyStrings(g_product_str, "", g_strTable.productStr_Audio1); + concatenateAndCopyStrings(g_product_str, "", g_strTable.outputInterfaceStr_Audio1); + concatenateAndCopyStrings(g_product_str, "", g_strTable.inputInterfaceStr_Audio1); + concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio1); + concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio1); +#elif (AUDIO_CLASS == 2) + concatenateAndCopyStrings(g_product_str, "", g_strTable.productStr_Audio2); + concatenateAndCopyStrings(g_product_str, "", g_strTable.outputInterfaceStr_Audio2); + concatenateAndCopyStrings(g_product_str, "", g_strTable.inputInterfaceStr_Audio2); + concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2); + concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2); +#endif } void XUA_Endpoint0_setVendorStr(char* vendor_str) { - uint32_t string_size = MIN(strlen(vendor_str), MAX_STRING_SIZE); - - memset(g_strTable.vendorStr, 0, MAX_STRING_SIZE); - memcpy(g_strTable.vendorStr, vendor_str, string_size); -#if (AUDIO_CLASS == 2) - copyCombinedStrings(g_strTable.clockSelectorStr, vendor_str, "Clock Selector"); - copyCombinedStrings(g_strTable.internalClockSourceStr, vendor_str, "Internal Clock"); -#endif -#if SPDIF_RX - copyCombinedStrings(g_strTable.spdifClockSourceStr, vendor_str, "S/PDIF Clock"); -#endif -#if ADAT_RX - copyCombinedStrings(g_strTable.adatClockSourceStr, vendor_str, "ADAT Clock"); -#endif -#if (XUA_DFU_EN == 1) - copyCombinedStrings(g_strTable.dfuStr, vendor_str, "DFU"); -#endif -#ifdef USB_CONTROL_DESCS - copyCombinedStrings(g_strTable.ctrlStr, vendor_str, "Control"); -#endif -#ifdef MIDI - copyCombinedStrings(g_strTable.midiOutStr, vendor_str, "MIDI Out"); - copyCombinedStrings(g_strTable.midiInStr, vendor_str, "MIDI In"); -#endif + debug_printf("XUA_Endpoint0_setVendorStr() with string %s", vendor_str); + concatenateAndCopyStrings(vendor_str, "", g_vendor_str); } void XUA_Endpoint0_setProductStr(char* product_str) { - uint32_t string_size = MIN(strlen(product_str), MAX_STRING_SIZE); -#if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) - memset(g_strTable.productStr_Audio1, 0, MAX_STRING_SIZE); - memset(g_strTable.outputInterfaceStr_Audio1, 0, MAX_STRING_SIZE); - memset(g_strTable.inputInterfaceStr_Audio1, 0, MAX_STRING_SIZE); - memset(g_strTable.usbInputTermStr_Audio1, 0, MAX_STRING_SIZE); - memset(g_strTable.usbOutputTermStr_Audio1, 0, MAX_STRING_SIZE); - - memcpy(g_strTable.productStr_Audio1, product_str, string_size); - memcpy(g_strTable.outputInterfaceStr_Audio1, product_str, string_size); - memcpy(g_strTable.inputInterfaceStr_Audio1, product_str, string_size); - memcpy(g_strTable.usbInputTermStr_Audio1, product_str, string_size); - memcpy(g_strTable.usbOutputTermStr_Audio1, product_str, string_size); -#elif (AUDIO_CLASS == 2) - memset(g_strTable.productStr_Audio2, 0, MAX_STRING_SIZE); - memset(g_strTable.outputInterfaceStr_Audio2, 0, MAX_STRING_SIZE); - memset(g_strTable.inputInterfaceStr_Audio2, 0, MAX_STRING_SIZE); - memset(g_strTable.usbInputTermStr_Audio2, 0, MAX_STRING_SIZE); - memset(g_strTable.usbOutputTermStr_Audio2, 0, MAX_STRING_SIZE); - - memcpy(g_strTable.productStr_Audio1, product_str, string_size); - memcpy(g_strTable.outputInterfaceStr_Audio2, product_str, string_size); - memcpy(g_strTable.inputInterfaceStr_Audio2, product_str, string_size); - memcpy(g_strTable.usbInputTermStr_Audio2, product_str, string_size); - memcpy(g_strTable.usbOutputTermStr_Audio2, product_str, string_size); -#endif + debug_printf("XUA_Endpoint0_setProductStr() with string %s", product_str); + concatenateAndCopyStrings(product_str, "", g_product_str); } char* XUA_Endpoint0_getVendorStr() { @@ -300,7 +300,7 @@ char* XUA_Endpoint0_getProductStr() { #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) return g_strTable.productStr_Audio1; #elif (AUDIO_CLASS == 2) - return g_strTable.productStr_Audio2; + return g_strTable.productStr_Audio2; #endif } @@ -356,6 +356,8 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont ep0_out = XUD_InitEp(c_ep0_out); ep0_in = XUD_InitEp(c_ep0_in); + XUA_Endpoint0_setStrTable(); + #if 0 /* Dont need to init globals.. */ /* Init tables for volumes (+ 1 for master) */ @@ -447,10 +449,10 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution - + cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution - + const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h int i=0; for(i=0;i> 8; cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_device_to_usb_rate() & 0xff0000)>> 16; } - + for(i=0;i> 8; cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ + 3*i + 2] = (get_usb_to_device_rate() & 0xff0000)>> 16; } - + cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff; //max packet size cfgDesc_Audio1[USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_device_to_usb_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_IN_FS) & 0xff00) >> 8; //max packet size - + cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE] = ((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff; //max packet size cfgDesc_Audio1[USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE + 1] = (((get_usb_to_device_bit_res() >> 3) * MAX_PACKET_SIZE_MULT_OUT_FS) & 0xff00) >> 8; //max packet size - + #endif } @@ -856,7 +858,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 if(result == XUD_RES_ERR) { -#if (XUA_DFU_EN == 1) +#if (XUA_DFU_EN == 1) if (!DFU_mode_active) { #endif diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 521bdd64..a6c621b7 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -20,15 +20,18 @@ #include "iap2.h" /* Defines iAP EA Native Transport protocol name */ #endif -#define MAX_STRING_SIZE (32) - #define APPEND_VENDOR_STR(x) VENDOR_STR" "#x #define APPEND_PRODUCT_STR_A2(x) PRODUCT_STR_A2 " "#x #define APPEND_PRODUCT_STR_A1(x) PRODUCT_STR_A1 " "#x -#define STR_TABLE_ENTRY(name) char name[MAX_STRING_SIZE] +#define STR_TABLE_ENTRY(name) char * name + +// XUA_DESCR_EMPTY_STRING is used in the g_strTable to set the maximum size of the table entries +#define XUA_DESCR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +// The value below must match the length of XUA_DESCR_EMPTY_STRING. +#define XUA_MAX_STR_LEN (32) #define ISO_EP_ATTRIBUTES_ASYNCH 0x05 //ISO, ASYNCH, DATA EP #define ISO_EP_ATTRIBUTES_ADAPTIVE 0x09 //ISO, ADAPTIVE, DATA EP @@ -319,42 +322,42 @@ typedef struct StringDescTable_t g_strTable = { .langID = "\x09\x04", /* US English */ - .vendorStr = VENDOR_STR, + .vendorStr = XUA_DESCR_EMPTY_STRING,//VENDOR_STR, .serialStr = "", #if (AUDIO_CLASS == 2) - .productStr_Audio2 = PRODUCT_STR_A2, - .outputInterfaceStr_Audio2 = APPEND_PRODUCT_STR_A2(), - .inputInterfaceStr_Audio2 = APPEND_PRODUCT_STR_A2(), - .usbInputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(), - .usbOutputTermStr_Audio2 = APPEND_PRODUCT_STR_A2(), + .productStr_Audio2 = XUA_DESCR_EMPTY_STRING, + .outputInterfaceStr_Audio2 = XUA_DESCR_EMPTY_STRING, + .inputInterfaceStr_Audio2 = XUA_DESCR_EMPTY_STRING, + .usbInputTermStr_Audio2 = XUA_DESCR_EMPTY_STRING, + .usbOutputTermStr_Audio2 = XUA_DESCR_EMPTY_STRING, #endif #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) - - .productStr_Audio1 = PRODUCT_STR_A1, - .outputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), - .inputInterfaceStr_Audio1 = APPEND_PRODUCT_STR_A1(), - .usbInputTermStr_Audio1 = APPEND_PRODUCT_STR_A1(), - .usbOutputTermStr_Audio1 = APPEND_PRODUCT_STR_A1(), + + .productStr_Audio1 = XUA_DESCR_EMPTY_STRING, + .outputInterfaceStr_Audio1 = XUA_DESCR_EMPTY_STRING, + .inputInterfaceStr_Audio1 = XUA_DESCR_EMPTY_STRING, + .usbInputTermStr_Audio1 = XUA_DESCR_EMPTY_STRING, + .usbOutputTermStr_Audio1 = XUA_DESCR_EMPTY_STRING, #endif #if (AUDIO_CLASS == 2) - .clockSelectorStr = APPEND_VENDOR_STR(Clock Selector), - .internalClockSourceStr = APPEND_VENDOR_STR(Internal Clock), + .clockSelectorStr = XUA_DESCR_EMPTY_STRING, + .internalClockSourceStr = XUA_DESCR_EMPTY_STRING, #if SPDIF_RX - .spdifClockSourceStr = APPEND_VENDOR_STR(S/PDIF Clock), + .spdifClockSourceStr = XUA_DESCR_EMPTY_STRING, #endif #if ADAT_RX - .adatClockSourceStr = APPEND_VENDOR_STR(ADAT Clock), + .adatClockSourceStr = XUA_DESCR_EMPTY_STRING, #endif #endif #if (XUA_DFU_EN == 1) - .dfuStr = APPEND_VENDOR_STR(DFU), + .dfuStr = XUA_DESCR_EMPTY_STRING, #endif #ifdef USB_CONTROL_DESCS - .ctrlStr = APPEND_VENDOR_STR(Control), + .ctrlStr = XUA_DESCR_EMPTY_STRING, #endif #ifdef MIDI - .midiOutStr = APPEND_VENDOR_STR(MIDI Out), - .midiInStr = APPEND_VENDOR_STR(MIDI In), + .midiOutStr = XUA_DESCR_EMPTY_STRING, + .midiInStr = XUA_DESCR_EMPTY_STRING, #endif #include "chanstrings.h" @@ -401,6 +404,12 @@ StringDescTable_t g_strTable = .iAP_EANativeTransport_InterfaceStr = IAP2_EA_NATIVE_TRANS_PROTOCOL_NAME, #endif }; +char g_vendor_str[XUA_MAX_STR_LEN] = VENDOR_STR; +#if (AUDIO_CLASS == 2) +char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; +#else +char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; +#endif /***** Device Descriptors *****/ @@ -2378,13 +2387,13 @@ const unsigned num_freqs_a1 = MAX(3, (0 #define AS_FORMAT_TYPE_BYTES (17) #define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5) #define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 5) - + #define USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) #define USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_FREQ (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + 8) - + #define USB_AS_IN_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE (18 + AC_TOTAL_LENGTH + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + (AS_FORMAT_TYPE_BYTES) + 4) #define USB_AS_OUT_EP_DESCRIPTOR_OFFSET_MAXPACKETSIZE (18 + AC_TOTAL_LENGTH + (2*INTERFACE_DESCRIPTOR_BYTES) + (AS_INTERFACE_BYTES) + (AS_FORMAT_TYPE_BYTES) + 4) - + #endif #define CHARIFY_SR(x) (x & 0xff),((x & 0xff00)>> 8),((x & 0xff0000)>> 16) From b5d2aae3d62498332a76efefc6821e9743a03f64 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 17:12:13 +0000 Subject: [PATCH 171/233] Update entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c2862994..3276eada 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,7 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop - * ADDED: Ability to read or modify vendor and product IDs + * ADDED: Ability to read or modify vendor and product IDs and strings * ADDED: Ability to read or modify bcdDevice * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. From 3f2d0eb6f79ce2ed9ab2fbf60749b44947c0cdbd Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 17:16:35 +0000 Subject: [PATCH 172/233] Move global variables --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 12 ++++++++++-- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 6 ------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index a6c9aae0..63290cb8 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -107,6 +107,13 @@ unsigned g_curStreamAlt_In = 0; /* Global variable for current USB bus speed (i.e. FS/HS) */ XUD_BusSpeed_t g_curUsbSpeed = 0; +/* Global variables for current USB Vendor and Product strings */ +char g_vendor_str[XUA_MAX_STR_LEN] = VENDOR_STR; +#if (AUDIO_CLASS == 2) +char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; +#else +char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; +#endif /* Subslot */ const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, @@ -222,6 +229,7 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { devDesc_Audio2.idVendor = vid; #endif // AUDIO_CLASS == 1} } + void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { uint32_t string_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); @@ -244,7 +252,7 @@ void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer } void XUA_Endpoint0_setStrTable() { - // update Vendor string + // update Vendor strings concatenateAndCopyStrings(g_vendor_str, "", g_strTable.vendorStr); #if (AUDIO_CLASS == 2) concatenateAndCopyStrings(g_vendor_str, " Clock Selector", g_strTable.clockSelectorStr); @@ -266,7 +274,7 @@ void XUA_Endpoint0_setStrTable() { concatenateAndCopyStrings(g_vendor_str, " MIDI Out", g_strTable.midiOutStr); concatenateAndCopyStrings(g_vendor_str, " MIDI In", g_strTable.midiInStr); #endif - // update product string + // update product strings #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) concatenateAndCopyStrings(g_product_str, "", g_strTable.productStr_Audio1); concatenateAndCopyStrings(g_product_str, "", g_strTable.outputInterfaceStr_Audio1); diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index a6c621b7..34ace801 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -404,12 +404,6 @@ StringDescTable_t g_strTable = .iAP_EANativeTransport_InterfaceStr = IAP2_EA_NATIVE_TRANS_PROTOCOL_NAME, #endif }; -char g_vendor_str[XUA_MAX_STR_LEN] = VENDOR_STR; -#if (AUDIO_CLASS == 2) -char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; -#else -char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; -#endif /***** Device Descriptors *****/ From ee1feb6c4817de849fc8c5cdf3ef73c2abeacf91 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 17:51:03 +0000 Subject: [PATCH 173/233] Use unsafe pointers --- lib_xua/api/xua_endpoint0.h | 63 ++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 90dc0d42..60f68bf3 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -43,53 +43,52 @@ void XUA_Endpoint0_setProductId(unsigned short pid); /** Function to set the Vendor string * - * \param vendor_str vendor string to set + * \param vendor_str Vendor string to set */ #ifdef __XC__ -extern "C" { -#endif - void XUA_Endpoint0_setVendorStr(char* vendor_str); -#ifdef __XC__ -} +void XUA_Endpoint0_setVendorStr(char * unsafe vendor_str); +#else +void XUA_Endpoint0_setVendorStr(char * vendor_str); #endif /** Function to set the Product string * - * \param product_str product string to set + * \param product_str Product string to set */ #ifdef __XC__ -extern "C" { -#endif - void XUA_Endpoint0_setProductStr(char* product_str); -#ifdef __XC__ -} +void XUA_Endpoint0_setProductStr(char * unsafe product_str); +#else +void XUA_Endpoint0_setProductStr(char * product_str); #endif -/** Function to set the Vendor ID value +/** Function to set the BCD device * - * \param vid vendor ID value to set -*/ -#ifdef __XC__ -extern "C" { -#endif -char* XUA_Endpoint0_getVendorStr(); -#ifdef __XC__ -} -#endif + * \param bcdDevice BCD device to set -/** Function to set the Product ID value +*/ + +void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); + +/** Function to get the Vendor string * - * \param pid Product ID value to set + * \param vid vendor string */ #ifdef __XC__ -extern "C" { -#endif -char* XUA_Endpoint0_getProductStr(); -#ifdef __XC__ -} +char * unsafe XUA_Endpoint0_getVendorStr(); +#else +char * XUA_Endpoint0_getVendorStr(; #endif +/** Function to get the Product string + * + * \param pid Product string +*/ +#ifdef __XC__ +char * unsafe XUA_Endpoint0_getProductStr(); +#else +char * XUA_Endpoint0_getProductStr(; +#endif /** Function to get the Vendor string * @@ -103,5 +102,11 @@ unsigned short XUA_Endpoint0_getVendorId(); */ unsigned short XUA_Endpoint0_getProductId(); +/** Function to get the BCD device + * + * \return BCD device +*/ +unsigned short XUA_Endpoint0_getBcdDevice(); + #endif #endif From 09a81f5c1fadb986aeb6356529c71305c4cc131c Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 21:53:49 +0000 Subject: [PATCH 174/233] Use standard functions and different empty strings --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 19 ++----- .../src/core/endpoint0/xua_ep0_descriptors.h | 56 ++++++++++++------- 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 63290cb8..ee23714d 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -231,24 +231,15 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { } void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { - uint32_t string_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); - - memset(string_buffer, 0, XUA_MAX_STR_LEN); - memcpy(string_buffer, string1, string_size); - - - if (string_size==XUA_MAX_STR_LEN-1) { - string_buffer[XUA_MAX_STR_LEN-1] = '\0'; - return; - } + uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); + strncpy(string_buffer, string1, remaining_buffer_size); uint32_t total_string_size = MIN(strlen(string1)+strlen(string2), XUA_MAX_STR_LEN-1); if (total_string_size==XUA_MAX_STR_LEN-1) { - string_size = XUA_MAX_STR_LEN-1-strlen(string1); + remaining_buffer_size = XUA_MAX_STR_LEN-1-strlen(string1); } else { - string_size = strlen(string1); + remaining_buffer_size = strlen(string1); } - memcpy(string_buffer+strlen(string1), string2, string_size); - string_buffer[total_string_size] = '\0'; + strncat(string_buffer, string2, remaining_buffer_size); } void XUA_Endpoint0_setStrTable() { diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 34ace801..9dcbe989 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -28,8 +28,22 @@ #define STR_TABLE_ENTRY(name) char * name -// XUA_DESCR_EMPTY_STRING is used in the g_strTable to set the maximum size of the table entries -#define XUA_DESCR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +// The empty strings below are used in the g_strTable to set the maximum size of the table entries +#define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_OUTPUT_INTERFACE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_INPUT_INTERFACE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_INPUT_TERM_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_OUTPUT_TERM_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + // The value below must match the length of XUA_DESCR_EMPTY_STRING. #define XUA_MAX_STR_LEN (32) @@ -322,42 +336,42 @@ typedef struct StringDescTable_t g_strTable = { .langID = "\x09\x04", /* US English */ - .vendorStr = XUA_DESCR_EMPTY_STRING,//VENDOR_STR, + .vendorStr = XUA_VENDOR_EMPTY_STRING, .serialStr = "", #if (AUDIO_CLASS == 2) - .productStr_Audio2 = XUA_DESCR_EMPTY_STRING, - .outputInterfaceStr_Audio2 = XUA_DESCR_EMPTY_STRING, - .inputInterfaceStr_Audio2 = XUA_DESCR_EMPTY_STRING, - .usbInputTermStr_Audio2 = XUA_DESCR_EMPTY_STRING, - .usbOutputTermStr_Audio2 = XUA_DESCR_EMPTY_STRING, + .productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, + .outputInterfaceStr_Audio2 = XUA_OUTPUT_INTERFACE_EMPTY_STRING, + .inputInterfaceStr_Audio2 = XUA_INPUT_INTERFACE_EMPTY_STRING, + .usbInputTermStr_Audio2 = XUA_INPUT_TERM_EMPTY_STRING, + .usbOutputTermStr_Audio2 = XUA_OUTPUT_TERM_EMPTY_STRING, #endif #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) - .productStr_Audio1 = XUA_DESCR_EMPTY_STRING, - .outputInterfaceStr_Audio1 = XUA_DESCR_EMPTY_STRING, - .inputInterfaceStr_Audio1 = XUA_DESCR_EMPTY_STRING, - .usbInputTermStr_Audio1 = XUA_DESCR_EMPTY_STRING, - .usbOutputTermStr_Audio1 = XUA_DESCR_EMPTY_STRING, + .productStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, + .outputInterfaceStr_Audio1 = XUA_OUTPUT_INTERFACE_EMPTY_STRING, + .inputInterfaceStr_Audio1 = XUA_INPUT_INTERFACE_EMPTY_STRING, + .usbInputTermStr_Audio1 = XUA_INPUT_TERM_EMPTY_STRING, + .usbOutputTermStr_Audio1 = XUA_OUTPUT_TERM_EMPTY_STRING, #endif #if (AUDIO_CLASS == 2) - .clockSelectorStr = XUA_DESCR_EMPTY_STRING, - .internalClockSourceStr = XUA_DESCR_EMPTY_STRING, + .clockSelectorStr = XUA_CLOCK_SELECTOR_EMPTY_STRING, + .internalClockSourceStr = XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING, #if SPDIF_RX - .spdifClockSourceStr = XUA_DESCR_EMPTY_STRING, + .spdifClockSourceStr = XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING, #endif #if ADAT_RX - .adatClockSourceStr = XUA_DESCR_EMPTY_STRING, + .adatClockSourceStr = XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING, #endif #endif #if (XUA_DFU_EN == 1) - .dfuStr = XUA_DESCR_EMPTY_STRING, + .dfuStr = XUA_DFU_EMPTY_STRING, #endif #ifdef USB_CONTROL_DESCS - .ctrlStr = XUA_DESCR_EMPTY_STRING, + .ctrlStr = XUA_CTRL_EMPTY_STRING, #endif #ifdef MIDI - .midiOutStr = XUA_DESCR_EMPTY_STRING, - .midiInStr = XUA_DESCR_EMPTY_STRING, + .midiOutStr = XUA_MIDI_OUT_EMPTY_STRING, + .midiInStr = XUA_MIDI_IN_EMPTY_STRING, #endif #include "chanstrings.h" From c786b846d0325c4f091752620e356055b39b8a5f Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 4 Mar 2020 22:05:36 +0000 Subject: [PATCH 175/233] Define MIN if not defined --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index ee23714d..966f6321 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -71,6 +71,9 @@ extern void device_reboot(void); #if( 0 < HID_CONTROLS ) #include "xua_hid.h" #endif +#ifndef MIN +#define MIN(a,b) (((a)<(b))?(a):(b)) +#endif unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active From 5fd34acab5968fe24d448cc4d4d3409eadbe10b0 Mon Sep 17 00:00:00 2001 From: lucianom Date: Thu, 5 Mar 2020 09:14:03 +0000 Subject: [PATCH 176/233] Allocate separate strings and fix descriptions --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- .../src/core/endpoint0/xua_ep0_descriptors.h | 40 +++++++++---------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 966f6321..ef03874e 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -30,7 +30,7 @@ #endif #define DEBUG_UNIT XUA_EP0 #ifndef DEBUG_PRINT_ENABLE_XUA_EP0 - #define DEBUG_PRINT_ENABLE_XUA_EP0 1 + #define DEBUG_PRINT_ENABLE_XUA_EP0 0 #endif // DEBUG_PRINT_ENABLE_XUA_EP0 #include "debug_print.h" diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 9dcbe989..11554960 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -29,20 +29,16 @@ #define STR_TABLE_ENTRY(name) char * name // The empty strings below are used in the g_strTable to set the maximum size of the table entries -#define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_OUTPUT_INTERFACE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_INPUT_INTERFACE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_INPUT_TERM_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_OUTPUT_TERM_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" -#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +// The last char of the strings are different, so that the compiler allocates separate memory spaces +#define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\01" +#define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\02" +#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\03" +#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04" +#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\05" +#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06" +#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07" +#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08" +#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09" // The value below must match the length of XUA_DESCR_EMPTY_STRING. #define XUA_MAX_STR_LEN (32) @@ -340,18 +336,18 @@ StringDescTable_t g_strTable = .serialStr = "", #if (AUDIO_CLASS == 2) .productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, - .outputInterfaceStr_Audio2 = XUA_OUTPUT_INTERFACE_EMPTY_STRING, - .inputInterfaceStr_Audio2 = XUA_INPUT_INTERFACE_EMPTY_STRING, - .usbInputTermStr_Audio2 = XUA_INPUT_TERM_EMPTY_STRING, - .usbOutputTermStr_Audio2 = XUA_OUTPUT_TERM_EMPTY_STRING, + .outputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, + .inputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, + .usbInputTermStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, + .usbOutputTermStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, #endif #if (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) .productStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, - .outputInterfaceStr_Audio1 = XUA_OUTPUT_INTERFACE_EMPTY_STRING, - .inputInterfaceStr_Audio1 = XUA_INPUT_INTERFACE_EMPTY_STRING, - .usbInputTermStr_Audio1 = XUA_INPUT_TERM_EMPTY_STRING, - .usbOutputTermStr_Audio1 = XUA_OUTPUT_TERM_EMPTY_STRING, + .outputInterfaceStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, + .inputInterfaceStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, + .usbInputTermStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, + .usbOutputTermStr_Audio1 = XUA_PRODUCT_EMPTY_STRING, #endif #if (AUDIO_CLASS == 2) .clockSelectorStr = XUA_CLOCK_SELECTOR_EMPTY_STRING, From 4d0de4e01a49fd259bc855003154a752695cc61e Mon Sep 17 00:00:00 2001 From: lucianom Date: Thu, 5 Mar 2020 10:15:35 +0000 Subject: [PATCH 177/233] Add missing string and memset buffers --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 3 +++ lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index ef03874e..b773a4d3 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -234,6 +234,8 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { } void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { + memset(string_buffer, '\0', strlen(string_buffer)); + uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); strncpy(string_buffer, string1, remaining_buffer_size); uint32_t total_string_size = MIN(strlen(string1)+strlen(string2), XUA_MAX_STR_LEN-1); @@ -246,6 +248,7 @@ void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer } void XUA_Endpoint0_setStrTable() { + // update Vendor strings concatenateAndCopyStrings(g_vendor_str, "", g_strTable.vendorStr); #if (AUDIO_CLASS == 2) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 11554960..185575bb 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -32,13 +32,14 @@ // The last char of the strings are different, so that the compiler allocates separate memory spaces #define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\01" #define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\02" -#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\03" -#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04" -#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\05" -#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06" -#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07" -#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08" -#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09" +#define XUA_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\03" +#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04" +#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\05" +#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06" +#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07" +#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08" +#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09" +#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a" // The value below must match the length of XUA_DESCR_EMPTY_STRING. #define XUA_MAX_STR_LEN (32) From 045059ad1e61e62ebeed5f3477f2616d7127ad72 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 10 Mar 2020 10:53:21 +0000 Subject: [PATCH 178/233] Update version number to indicate the first major release. The version number has been changed since the library is used in a released product. --- CHANGELOG.rst | 2 +- lib_xua/module_build_info | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c2862994..12bbe76d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ lib_xua Change Log ================== -0.3.0 +1.0.0 ----- * ADDED: UAC1 HID support with simulated Voice Command detection reported diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index b41fc2ff..d51e4ca7 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 0.3.0 +VERSION = 1.0.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ From bd71651cc4919454d9d40122688843b6d1268b92 Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 11 Mar 2020 16:01:42 +0000 Subject: [PATCH 179/233] Allow access of mclk setting externally for hardware test harness --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index ae58ef83..2093502f 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -182,6 +182,8 @@ void XUA_Buffer( } } +// Allows us to externally modify masterClockFreq +unsafe{volatile unsigned * unsafe masterClockFreq_ptr;} /** * Buffers data from audio endpoints @@ -268,6 +270,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out, unsigned masterClockFreq = DEFAULT_MCLK_FREQ; unsigned lastClock = 0; + unsafe{masterClockFreq_ptr = &masterClockFreq;} + unsigned clocks = 0; long long clockcounter = 0; From c9989e4d872d51e91318410f87f6bbd21e888bb0 Mon Sep 17 00:00:00 2001 From: Ed Date: Thu, 12 Mar 2020 10:20:30 +0000 Subject: [PATCH 180/233] Changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8e57b5f6..d72dd59c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -24,6 +24,7 @@ lib_xua Change Log * ADDED: Ability to read or modify bcdDevice * ADDED: Override USB descriptor with sampling frequency and bit-resolution set at boot time. + * ADDED: Global pointer to allow external access to masterClockFreq 0.2.1 ----- From fff1568c6f78a9e2bcceca6227a9837e5810e250 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 19 Mar 2020 16:21:57 +0000 Subject: [PATCH 181/233] Update minimum dependency version for libraries with a higher major version --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index d51e4ca7..5f6cb27f 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -2,7 +2,7 @@ VERSION = 1.0.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ - lib_xud(>=0.2.0) \ + lib_xud(>=1.0.0) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) From a89371c143d99c114dd3c31f9f9834f3470af8c6 Mon Sep 17 00:00:00 2001 From: lucianom Date: Fri, 17 Apr 2020 14:44:19 +0100 Subject: [PATCH 182/233] Fix wrong size of vendor and product strings and add debug printouts --- CHANGELOG.rst | 5 +++++ lib_xua/module_build_info | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d72dd59c..c4fb7f95 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +1.0.1 +----- + + * FIXED: Wrong size of vendor and product strings + 1.0.0 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 5f6cb27f..b8b0aa5f 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.0.0 +VERSION = 1.0.1 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index b773a4d3..f30b4c5c 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -234,6 +234,8 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) { } void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) { + debug_printf("concatenateAndCopyStrings() for \"%s\" and \"%s\"\n", string1, string2); + memset(string_buffer, '\0', strlen(string_buffer)); uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1); @@ -242,9 +244,11 @@ void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer if (total_string_size==XUA_MAX_STR_LEN-1) { remaining_buffer_size = XUA_MAX_STR_LEN-1-strlen(string1); } else { - remaining_buffer_size = strlen(string1); + remaining_buffer_size = strlen(string2); } + strncat(string_buffer, string2, remaining_buffer_size); + debug_printf("concatenateAndCopyStrings() creates \"%s\"\n", string_buffer); } void XUA_Endpoint0_setStrTable() { @@ -288,12 +292,12 @@ void XUA_Endpoint0_setStrTable() { } void XUA_Endpoint0_setVendorStr(char* vendor_str) { - debug_printf("XUA_Endpoint0_setVendorStr() with string %s", vendor_str); + debug_printf("XUA_Endpoint0_setVendorStr() with string %s\n", vendor_str); concatenateAndCopyStrings(vendor_str, "", g_vendor_str); } void XUA_Endpoint0_setProductStr(char* product_str) { - debug_printf("XUA_Endpoint0_setProductStr() with string %s", product_str); + debug_printf("XUA_Endpoint0_setProductStr() with string %s\n", product_str); concatenateAndCopyStrings(product_str, "", g_product_str); } From bb73f2140e3cc742a5f86b2631dfef1fa6165caf Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 1 May 2020 13:51:05 +0100 Subject: [PATCH 183/233] Update to Jenkins Shared Library v0.12.1 and allow view file names containing '.'. --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 10ed3fc0..12512fd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -@Library('xmos_jenkins_shared_library@develop') _ +@Library('xmos_jenkins_shared_library@v0.12.1') _ getApproval() @@ -6,7 +6,7 @@ pipeline { agent none environment { REPO = 'lib_xua' - VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" + VIEW = getViewName(REPO) } options { skipDefaultCheckout() From da3da9b42299b2edd18bd3023f49f08893e1c739 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 1 May 2020 16:39:41 +0100 Subject: [PATCH 184/233] Update audioports.xc --- lib_xua/src/core/ports/audioports.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/ports/audioports.xc b/lib_xua/src/core/ports/audioports.xc index 80d2500a..6f1b7e82 100644 --- a/lib_xua/src/core/ports/audioports.xc +++ b/lib_xua/src/core/ports/audioports.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include #include #include @@ -61,7 +61,7 @@ unsigned int divide, unsigned curSamFreq) } #endif -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) unsafe { /* Clock bitclock clock block from master clock pin (divided) */ From 44d3e083052e02cca3ccae04801f3ab544865982 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 5 May 2020 16:33:51 +0100 Subject: [PATCH 185/233] Further updates for xs3 combat --- lib_xua/src/core/buffer/decouple/interrupt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/decouple/interrupt.h b/lib_xua/src/core/buffer/decouple/interrupt.h index ed000b75..7fc328ad 100644 --- a/lib_xua/src/core/buffer/decouple/interrupt.h +++ b/lib_xua/src/core/buffer/decouple/interrupt.h @@ -71,7 +71,7 @@ //int ksp_enter, ksp_exit, r11_store; -#ifdef __XS2A__ +#ifndef __XS1A__ #define ISSUE_MODE_SINGLE ".issue_mode single\n" #define ISSUE_MODE_DUAL ".issue_mode dual\n" #else From 82f651d930b43b57dbf1afee76177ec7c891bb22 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 5 May 2020 16:35:22 +0100 Subject: [PATCH 186/233] Mixer update for XS3 compat --- lib_xua/src/core/mixer/fastmix.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 4321b717..7f315bd7 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -5,7 +5,7 @@ #define MIX_INPUTS 18 -#if defined(__XS2A__) +#ifndef(__XS1A__) #define DOMIX_TOP(i) \ .cc_top doMix##i.function,doMix##i; \ From 57932ee0df4f49643bd5ff40814dd2941e603df3 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 5 May 2020 16:36:11 +0100 Subject: [PATCH 187/233] Update fastmix.S --- lib_xua/src/core/mixer/fastmix.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 7f315bd7..139f203a 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -5,7 +5,7 @@ #define MIX_INPUTS 18 -#ifndef(__XS1A__) +#if defined(__XS2A__) || defined(__XS3A__) #define DOMIX_TOP(i) \ .cc_top doMix##i.function,doMix##i; \ From 801e3fbe4e9fdd22ca1a12ebb9944d01cbba2053 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 5 May 2020 16:37:17 +0100 Subject: [PATCH 188/233] Update interrupt.h --- lib_xua/src/core/buffer/decouple/interrupt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/decouple/interrupt.h b/lib_xua/src/core/buffer/decouple/interrupt.h index 7fc328ad..44452d96 100644 --- a/lib_xua/src/core/buffer/decouple/interrupt.h +++ b/lib_xua/src/core/buffer/decouple/interrupt.h @@ -71,7 +71,7 @@ //int ksp_enter, ksp_exit, r11_store; -#ifndef __XS1A__ +#if defined(__XS2A__) || defined(__XS3A__) #define ISSUE_MODE_SINGLE ".issue_mode single\n" #define ISSUE_MODE_DUAL ".issue_mode dual\n" #else From c18ca44768d40dae24b7dc2d2a3b673080a59ee4 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 14 May 2020 13:55:27 +0100 Subject: [PATCH 189/233] Revert "Mixer update for XS3 compat" This reverts commit 82f651d930b43b57dbf1afee76177ec7c891bb22. --- lib_xua/src/core/mixer/fastmix.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 7f315bd7..4321b717 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -5,7 +5,7 @@ #define MIX_INPUTS 18 -#ifndef(__XS1A__) +#if defined(__XS2A__) #define DOMIX_TOP(i) \ .cc_top doMix##i.function,doMix##i; \ From 74772d864efeb75baa546d402440d4d3c91e80f7 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 14 May 2020 14:47:31 +0100 Subject: [PATCH 190/233] Update copyright date range. --- lib_xua/src/core/mixer/fastmix.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 4321b717..ca4e39e1 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -1,4 +1,4 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright (c) 2018-2020, XMOS Ltd, All rights reserved //#include "devicedefines.h" #define MAX_MIX_COUNT 8 From b7cbc5fe9eac820bfd8b77372a73d1a41e20a1dd Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 19 May 2020 12:43:56 +0100 Subject: [PATCH 191/233] Ability to read or modify serial number string --- CHANGELOG.rst | 6 ++++ lib_xua/api/xua_endpoint0.h | 32 +++++++++++++++---- lib_xua/module_build_info | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 14 ++++++++ .../src/core/endpoint0/xua_ep0_descriptors.h | 3 +- 5 files changed, 49 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c4fb7f95..15cf79fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ lib_xua Change Log ================== +1.1.0 +----- + + + * ADDED: Ability to read or modify serial number string + 1.0.1 ----- diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 60f68bf3..2cebd564 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -62,6 +62,16 @@ void XUA_Endpoint0_setProductStr(char * unsafe product_str); void XUA_Endpoint0_setProductStr(char * product_str); #endif +/** Function to set the Serial string + * + * \param serial_str Serial string to set +*/ +#ifdef __XC__ +void XUA_Endpoint0_setSerialStr(char * unsafe serial_str); +#else +void XUA_Endpoint0_setSerialStr(char * serial_str); +#endif + /** Function to set the BCD device * * \param bcdDevice BCD device to set @@ -72,7 +82,7 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); /** Function to get the Vendor string * - * \param vid vendor string + * \return vendor string */ #ifdef __XC__ char * unsafe XUA_Endpoint0_getVendorStr(); @@ -82,7 +92,7 @@ char * XUA_Endpoint0_getVendorStr(; /** Function to get the Product string * - * \param pid Product string + * \return Product string */ #ifdef __XC__ char * unsafe XUA_Endpoint0_getProductStr(); @@ -90,15 +100,25 @@ char * unsafe XUA_Endpoint0_getProductStr(); char * XUA_Endpoint0_getProductStr(; #endif -/** Function to get the Vendor string +/** Function to get the Serial Number string * - * \return Vendor string + * \return Serial string +*/ +#ifdef __XC__ +char * unsafe XUA_Endpoint0_getSerialStr(); +#else +char * XUA_Endpoint0_getSerialStr(; +#endif + +/** Function to get the Vendor ID + * + * \return Vendor ID */ unsigned short XUA_Endpoint0_getVendorId(); -/** Function to get the Product string +/** Function to get the Product ID * - * \return Product string + * \return Product ID */ unsigned short XUA_Endpoint0_getProductId(); diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index b8b0aa5f..6f454747 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.0.1 +VERSION = 1.1.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index f30b4c5c..e91d61fc 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -118,6 +118,8 @@ char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; #endif +char g_serial_str[XUA_MAX_STR_LEN] = ""; + /* Subslot */ const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, #if(OUTPUT_FORMAT_COUNT > 1) @@ -289,6 +291,9 @@ void XUA_Endpoint0_setStrTable() { concatenateAndCopyStrings(g_product_str, "", g_strTable.usbInputTermStr_Audio2); concatenateAndCopyStrings(g_product_str, "", g_strTable.usbOutputTermStr_Audio2); #endif + + // update Serial strings + concatenateAndCopyStrings(g_serial_str, "", g_strTable.serialStr); } void XUA_Endpoint0_setVendorStr(char* vendor_str) { @@ -301,6 +306,11 @@ void XUA_Endpoint0_setProductStr(char* product_str) { concatenateAndCopyStrings(product_str, "", g_product_str); } +void XUA_Endpoint0_setSerialStr(char* serial_str) { + debug_printf("XUA_Endpoint0_setSerialStr() with string %s\n", serial_str); + concatenateAndCopyStrings(serial_str, "", g_serial_str); +} + char* XUA_Endpoint0_getVendorStr() { return g_strTable.vendorStr; } @@ -313,6 +323,10 @@ char* XUA_Endpoint0_getProductStr() { #endif } +char* XUA_Endpoint0_getSerialStr() { + return g_strTable.serialStr; +} + void XUA_Endpoint0_setProductId(unsigned short pid) { #if (AUDIO_CLASS == 1) devDesc_Audio1.idProduct = pid; diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 185575bb..beaaa4e7 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -40,6 +40,7 @@ #define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08" #define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09" #define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a" +#define XUA_SERIAL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0b" // The value below must match the length of XUA_DESCR_EMPTY_STRING. #define XUA_MAX_STR_LEN (32) @@ -334,7 +335,7 @@ StringDescTable_t g_strTable = { .langID = "\x09\x04", /* US English */ .vendorStr = XUA_VENDOR_EMPTY_STRING, - .serialStr = "", + .serialStr = XUA_SERIAL_EMPTY_STRING, #if (AUDIO_CLASS == 2) .productStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, .outputInterfaceStr_Audio2 = XUA_PRODUCT_EMPTY_STRING, From 05dacde043f98efd8c5cfdf0ef027192911e636e Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 19 May 2020 13:45:52 +0100 Subject: [PATCH 192/233] Add SERIAL_STR configurable from xua_conf.h --- lib_xua/api/xua_conf_default.h | 10 ++++++++++ lib_xua/src/core/endpoint0/xua_endpoint0.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 79aa061b..a1fc3514 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -442,6 +442,16 @@ #define CODEC_MASTER (0) #endif +/** + * @brief Serial Number String used by the device + * + * Default: "" + */ +#ifndef SERIAL_STR +#define SERIAL_STR "" +#endif + + /** * @brief Vendor String used by the device. This is also pre-pended to various strings used by the design. * diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index e91d61fc..384aee2a 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -118,7 +118,8 @@ char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A2; char g_product_str[XUA_MAX_STR_LEN] = PRODUCT_STR_A1; #endif -char g_serial_str[XUA_MAX_STR_LEN] = ""; +/* Global variable for current USB Serial Number strings */ +char g_serial_str[XUA_MAX_STR_LEN] = SERIAL_STR; /* Subslot */ const unsigned g_subSlot_Out_HS[OUTPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_OUTPUT_1_SUBSLOT_BYTES, From fda4c3afb16039dd75364f2be2e7afad53cb853f Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 19 May 2020 14:12:51 +0100 Subject: [PATCH 193/233] Remove empty line --- CHANGELOG.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 15cf79fe..0160f5d3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,6 @@ lib_xua Change Log 1.1.0 ----- - * ADDED: Ability to read or modify serial number string 1.0.1 From 5c2a69288cc1b02ae450c14d0b2a618a4dbb366f Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 19 May 2020 15:26:27 +0100 Subject: [PATCH 194/233] Add missing bracket --- lib_xua/api/xua_endpoint0.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 2cebd564..41281115 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -87,7 +87,7 @@ void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice); #ifdef __XC__ char * unsafe XUA_Endpoint0_getVendorStr(); #else -char * XUA_Endpoint0_getVendorStr(; +char * XUA_Endpoint0_getVendorStr(); #endif /** Function to get the Product string @@ -97,7 +97,7 @@ char * XUA_Endpoint0_getVendorStr(; #ifdef __XC__ char * unsafe XUA_Endpoint0_getProductStr(); #else -char * XUA_Endpoint0_getProductStr(; +char * XUA_Endpoint0_getProductStr(); #endif /** Function to get the Serial Number string @@ -107,7 +107,7 @@ char * XUA_Endpoint0_getProductStr(; #ifdef __XC__ char * unsafe XUA_Endpoint0_getSerialStr(); #else -char * XUA_Endpoint0_getSerialStr(; +char * XUA_Endpoint0_getSerialStr(); #endif /** Function to get the Vendor ID From 7ccd5b526df98f3061b898bda83f7eadad65c192 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 19 May 2020 16:11:34 +0100 Subject: [PATCH 195/233] Set iSerial correctly --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index beaaa4e7..e0742f83 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -435,7 +435,7 @@ USB_Descriptor_Device_t devDesc_Audio1 = .bcdDevice = BCD_DEVICE, .iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *), .iProduct = offsetof(StringDescTable_t, productStr_Audio1)/sizeof(char *), - .iSerialNumber = 0, + .iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *), .bNumConfigurations = 1 }; #endif @@ -471,7 +471,7 @@ USB_Descriptor_Device_t devDesc_Audio2 = .bcdDevice = BCD_DEVICE, .iManufacturer = offsetof(StringDescTable_t, vendorStr)/sizeof(char *), .iProduct = offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *), - .iSerialNumber = 0, + .iSerialNumber = offsetof(StringDescTable_t, serialStr)/sizeof(char *), .bNumConfigurations = 0x02 /* Set to 2 such that windows does not load composite driver */ }; @@ -494,7 +494,7 @@ unsigned char devDesc_Null[] = (BCD_DEVICE >> 8), /* 13 bcdDevice : Device release number */ offsetof(StringDescTable_t, vendorStr)/sizeof(char *), offsetof(StringDescTable_t, productStr_Audio2)/sizeof(char *), - 0, /* 16 iSerialNumber : Index of serial number decriptor */ + offsetof(StringDescTable_t, serialStr)/sizeof(char *), /* 16 iSerialNumber : Index of serial number decriptor */ 0x01 /* 17 bNumConfigurations : Number of possible configs */ }; #endif From a61f0e7a5f8fcad838a3bf4fbd0d8046a2d727f0 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 20 May 2020 11:46:17 +0100 Subject: [PATCH 196/233] Update Jenkins Shared Library to v0.14.1 to correct a Groovy iteration bug that results in intermittent test failures. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 12512fd1..4f167c75 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -@Library('xmos_jenkins_shared_library@v0.12.1') _ +@Library('xmos_jenkins_shared_library@v0.14.1') _ getApproval() From 948546e0d040a67eb16e1267177d28d273e1fac5 Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 22 Jun 2020 16:29:18 +0100 Subject: [PATCH 197/233] Bump! --- CHANGELOG.rst | 5 +++++ lib_xua/module_build_info | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0160f5d3..baca1c68 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ lib_xua Change Log ================== +1.1.1 +----- + + * ADDED: DELETE-ME - Version bump placeholder for develop branch + 1.1.0 ----- diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 6f454747..8259a798 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.1.0 +VERSION = 1.1.1 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ From 2164d8d023d970b3d567dc5b1e3f41723809fd76 Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 2 Sep 2020 11:56:05 +0100 Subject: [PATCH 198/233] Cherry pick decouple bug fix (v0.1.4) that solves the I2S timing pushout on startup --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 2093502f..9a995f8d 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -36,9 +36,10 @@ extern unsigned int g_curSamFreqMultiplier; #define SET_SHARED_GLOBAL0(x,y) SET_SHARED_GLOBAL(x,y) #endif - -/* Global var for speed. Related to feedback. Used by input stream to determine IN packet size */ -unsigned g_speed; +/* Initialise g_speed now so we get a sensible packet size until we start properly calculating feedback in the SoF case */ +/* Without this, zero size input packets fill the input FIFO and it takes a long time to clear out when feedback starts */ +/* This can cause a delay to the decouple ISR being serviced pushing our I2S timing. Initialising solves this */ +unsigned g_speed = (AUDIO_CLASS == 2) ? (DEFAULT_FREQ/8000) << 16 : (DEFAULT_FREQ/1000) << 16; unsigned g_freqChange = 0; unsigned feedbackValid = 0; From c4f32aceab4afffe940698df7ef0dcaeccd6bbfa Mon Sep 17 00:00:00 2001 From: Ed Date: Thu, 3 Sep 2020 17:19:01 +0100 Subject: [PATCH 199/233] Update changelog --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index baca1c68..e6bd462d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,8 @@ lib_xua Change Log 1.1.1 ----- - * ADDED: DELETE-ME - Version bump placeholder for develop branch + * RESOLVED: Zero length input packets generated before enumeration causing I2S + timing pushout at startup 1.1.0 ----- From e0b8cdf5f78b0fd75a8be2a36da1dab1302be34f Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 22 Sep 2020 09:00:36 +0100 Subject: [PATCH 200/233] Replace Pipfile --- Pipfile | 7 ------- python/setup.py | 19 +++++++++++++++++++ requirements.txt | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) delete mode 100644 Pipfile create mode 100644 python/setup.py create mode 100644 requirements.txt diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 6d52bfd2..00000000 --- a/Pipfile +++ /dev/null @@ -1,7 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -flake8 = "*" diff --git a/python/setup.py b/python/setup.py new file mode 100644 index 00000000..a6efe999 --- /dev/null +++ b/python/setup.py @@ -0,0 +1,19 @@ +# Copyright (c) 2020, XMOS Ltd, All rights reserved +import setuptools + +# Another repository might depend on python code defined in this one. The +# procedure to set up a suitable python environment for that repository may +# pip-install this one as editable using this setup.py file. To minimise the +# chance of version conflicts while ensuring a minimal degree of conformity, +# the 3rd-party modules listed here require the same major version and at +# least the same minor version as specified in the requirements.txt file. +# The same modules should appear in the requirements.txt file as given below. +setuptools.setup( + name='lib_xua', + packages=setuptools.find_packages(), + install_requires=[ + 'flake8~=3.8', + ], + dependency_links=[ + ], +) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..99e7dd7b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,34 @@ +# python_version 3.7.6 +# +# The parse_version_from_requirements() function in the installPipfile.groovy +# file of the Jenkins Shared Library uses the python_version comment to set +# the version of python used. + +# Distributed (released) dependencies +# +# The python modules listed below specify a known working combination required +# by the python code in this repository. The procedure used to set up a +# suitable python environment for it installs the version of each module in +# the list. Using a specific version ensures a controlled infrastructure for +# development, testing and release of this repository. +# +# Another repository might depend on python code defined in this one. The +# procedure to set up a suitable python environment for that repository may +# pip-install this one as editable using this repository's setup.py file. The +# same modules should appear in the setup.py list as given below. + +flake8==3.8.3 + +# Development dependencies +# +# Each link listed below specifies the path to a setup.py file which are +# installed in editable mode with '-e $PATH' (without the quotes). +# +# If python code in this repository depends on python code under development +# in another repository, then an entry for that other respository should +# appear in this list instead of the released dependencies list. +# +# If this repository uses the setup functionality (e.g., script entry points) +# of its own setup.py file, then this list must include an entry for that +# setup.py file, e.g., '-e .' or '-e ./python' (without the quotes). +-e ./python From 740f1250c75558973d6547669abda71d7bdf4210 Mon Sep 17 00:00:00 2001 From: lucianom Date: Fri, 2 Oct 2020 11:19:02 +0100 Subject: [PATCH 201/233] Update pinned version of xmos_jenkins_shared_library --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4f167c75..7be26239 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -@Library('xmos_jenkins_shared_library@v0.14.1') _ +@Library('xmos_jenkins_shared_library@v0.14.2') _ getApproval() From 0766275a9a045b73863c9d45af53eecdc35d9649 Mon Sep 17 00:00:00 2001 From: lucianom Date: Mon, 5 Oct 2020 13:21:08 +0100 Subject: [PATCH 202/233] Add entry --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e6bd462d..e78a7c62 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ lib_xua Change Log * RESOLVED: Zero length input packets generated before enumeration causing I2S timing pushout at startup + * CHANGED: Pin Python package versions 1.1.0 ----- From dde097b13016d101958bfdf967bbab290898a7fb Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 7 Oct 2020 14:31:15 +0100 Subject: [PATCH 203/233] Remove not necessary cpanfile --- CHANGELOG.rst | 1 + cpanfile | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 cpanfile diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e78a7c62..73122593 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ lib_xua Change Log * RESOLVED: Zero length input packets generated before enumeration causing I2S timing pushout at startup * CHANGED: Pin Python package versions + * REMOVED: not necessary cpanfile 1.1.0 ----- diff --git a/cpanfile b/cpanfile deleted file mode 100644 index 071f5e6a..00000000 --- a/cpanfile +++ /dev/null @@ -1,2 +0,0 @@ -requires 'File::Copy::Recursive'; -requires 'LWP::Simple' From baa853985b7471b3c25f73a516356f8754de88a0 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Wed, 21 Oct 2020 14:50:50 +0100 Subject: [PATCH 204/233] Fix compiler errors when HID_CONTROLS > 0 --- lib_xua/module_build_info | 1 + lib_xua/src/hid/hid.xc | 1 + 2 files changed, 2 insertions(+) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 8259a798..6d7b0185 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -45,6 +45,7 @@ INCLUDE_DIRS = $(EXPORT_INCLUDE_DIRS) \ src/core/user/audiostream \ src/core/user/hid \ src/core/user/hostactive \ + src/hid \ src/midi SOURCE_DIRS = src/core \ diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 906fd1ec..5d694c53 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,4 +1,5 @@ // Copyright (c) 2019, XMOS Ltd, All rights reserved +#include #include #include "descriptor_defs.h" #include "hid.h" From 3076bdffcf55641e05e97d23ab76e3fa285944e9 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 11:01:58 +0000 Subject: [PATCH 205/233] Update CHANGELOG and default BCD --- CHANGELOG.rst | 6 ++++++ lib_xua/api/xua_conf_default.h | 6 +++--- lib_xua/host/xmosdfu/Makefile.Win32 | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 73122593..d4a4b5e1 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ lib_xua Change Log ================== +1.2.0 +----- + + * ADDED: Makefile.Win32 for xmosdfu on Windows + * FIXED: Bump default BCD device number to v1.2.0 + 1.1.1 ----- diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index a1fc3514..fa769b20 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -526,21 +526,21 @@ * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. */ #ifndef BCD_DEVICE_J -#define BCD_DEVICE_J (0) +#define BCD_DEVICE_J (1) #endif /** * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. */ #ifndef BCD_DEVICE_M -#define BCD_DEVICE_M (1) +#define BCD_DEVICE_M (2) #endif /** * @brief Device firmware version number in Binary Coded Decimal format: 0xJJMN where JJ: major, M: minor, N: sub-minor version number. */ #ifndef BCD_DEVICE_N -#define BCD_DEVICE_N (1) +#define BCD_DEVICE_N (0) #endif /** diff --git a/lib_xua/host/xmosdfu/Makefile.Win32 b/lib_xua/host/xmosdfu/Makefile.Win32 index 9ab2fc40..2cf6b661 100644 --- a/lib_xua/host/xmosdfu/Makefile.Win32 +++ b/lib_xua/host/xmosdfu/Makefile.Win32 @@ -1,6 +1,9 @@ # Build tested with Visual Studio 2017 command prompt # # Run: nmake /f Makefile.Win32 +# +# NOTE: To run xmosdfu on Windows, libusbK drivers must be installed on the DFU endpoint +# We recommend using the third-party Zadig tool for this. COMMON_FLAGS = \ /D BECLEAR_HOST=1 \ From bf40fee27158c5057ee71334a3c228651c6391d1 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 11:12:43 +0000 Subject: [PATCH 206/233] Update version in module_build_info --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 8259a798..5a1d8d0a 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.1.1 +VERSION = 1.2.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ From b85cb8520578e7c3cd9ddb407b1eb3b85194f507 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 11:28:55 +0000 Subject: [PATCH 207/233] xmosdfu now compiles to bin/; Add more compile tests to Jenkinsfile --- Jenkinsfile | 36 +++++++++++++++++++++++++++ lib_xua/host/xmosdfu/Makefile.Linux32 | 3 ++- lib_xua/host/xmosdfu/Makefile.Linux64 | 3 ++- lib_xua/host/xmosdfu/Makefile.OSX32 | 3 ++- lib_xua/host/xmosdfu/Makefile.OSX64 | 3 ++- lib_xua/host/xmosdfu/Makefile.Pi | 3 ++- 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7be26239..dc391fa8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -84,6 +84,42 @@ pipeline { } } } + stage('Build Pi host app') { + agent { + label 'pi' + } + steps { + dir("${REPO}") { + checkout scm + dir("${REPO}/host/xmosdfu") { + sh 'make -f Makefile.Pi' + } + } + } + post { + cleanup { + xcoreCleanSandbox() + } + } + } + stage('Build Windows host app') { + agent { + label 'x86_64&&windows' + } + steps { + dir("${REPO}") { + checkout scm + dir("${REPO}/host/xmosdfu") { + runVS('nmake /f Makefile.Win32') + } + } + } + post { + cleanup { + xcoreCleanSandbox() + } + } + } } } stage('Update') { diff --git a/lib_xua/host/xmosdfu/Makefile.Linux32 b/lib_xua/host/xmosdfu/Makefile.Linux32 index 3800d4ab..891d1a57 100644 --- a/lib_xua/host/xmosdfu/Makefile.Linux32 +++ b/lib_xua/host/xmosdfu/Makefile.Linux32 @@ -1,2 +1,3 @@ all: - g++ -m32 -Wall -g -o xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0 + mkdir -p bin + g++ -m32 -Wall -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0 diff --git a/lib_xua/host/xmosdfu/Makefile.Linux64 b/lib_xua/host/xmosdfu/Makefile.Linux64 index dad6c9d8..e9ce426a 100644 --- a/lib_xua/host/xmosdfu/Makefile.Linux64 +++ b/lib_xua/host/xmosdfu/Makefile.Linux64 @@ -1,2 +1,3 @@ all: - g++ -Wall -g -o xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0 + mkdir -p bin + g++ -Wall -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/Linux32 -lusb-1.0 diff --git a/lib_xua/host/xmosdfu/Makefile.OSX32 b/lib_xua/host/xmosdfu/Makefile.OSX32 index a9c738a6..0ad48b0d 100644 --- a/lib_xua/host/xmosdfu/Makefile.OSX32 +++ b/lib_xua/host/xmosdfu/Makefile.OSX32 @@ -1,2 +1,3 @@ all: - g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX32 libusb/OSX32/libusb-1.0.0.dylib -m32 -Wall + mkdir -p bin + g++ -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/OSX32 libusb/OSX32/libusb-1.0.0.dylib -m32 -Wall diff --git a/lib_xua/host/xmosdfu/Makefile.OSX64 b/lib_xua/host/xmosdfu/Makefile.OSX64 index 07966069..54860178 100644 --- a/lib_xua/host/xmosdfu/Makefile.OSX64 +++ b/lib_xua/host/xmosdfu/Makefile.OSX64 @@ -1,2 +1,3 @@ all: - g++ -g -o xmosdfu xmosdfu.cpp -Ilibusb/OSX64 libusb/OSX64/libusb-1.0.0.dylib -Wall + mkdir -p bin + g++ -g -o bin/xmosdfu xmosdfu.cpp -Ilibusb/OSX64 libusb/OSX64/libusb-1.0.0.dylib -Wall diff --git a/lib_xua/host/xmosdfu/Makefile.Pi b/lib_xua/host/xmosdfu/Makefile.Pi index 6141746e..6996caa0 100644 --- a/lib_xua/host/xmosdfu/Makefile.Pi +++ b/lib_xua/host/xmosdfu/Makefile.Pi @@ -5,4 +5,5 @@ # vendor and product IDs xmosdfu: xmosdfu.cpp - g++ -D_GNU_SOURCE -Wall -g -o xmosdfu -Ilibusb/Rasp -lusb-1.0 -x c xmosdfu.cpp -std=c99 + mkdir -p bin + g++ -D_GNU_SOURCE -Wall -g -o bin/xmosdfu -Ilibusb/Rasp -lusb-1.0 -x c xmosdfu.cpp -std=c99 From a496040de07aa4de58731fa55569b47e5cc653a3 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 11:54:07 +0000 Subject: [PATCH 208/233] Fix compiler warning for xmosdfu on Linux --- lib_xua/host/xmosdfu/xmosdfu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index 2c33fcd4..b9b0a952 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -61,7 +61,7 @@ static int find_xmos_device(unsigned int id, unsigned int pid, unsigned int list libusb_device *dev; libusb_device **devs; int i = 0; - int found = 0; + unsigned int found = 0; size_t count = libusb_get_device_list(NULL, &devs); if ((int)count < 0) @@ -205,7 +205,7 @@ int xmos_dfu_restore_state(unsigned int interface) return 0; } -int dfu_download(unsigned int interface, unsigned int block_num, unsigned int size, unsigned char *data) +unsigned int dfu_download(unsigned int interface, unsigned int block_num, unsigned int size, unsigned char *data) { //printf("... Downloading block number %d size %d\r", block_num, size); /* Returns actual data size transferred */ @@ -222,7 +222,7 @@ int dfu_upload(unsigned int interface, unsigned int block_num, unsigned int size int write_dfu_image(char *file) { - int i = 0; + unsigned int i = 0; FILE* inFile = NULL; int image_size = 0; unsigned int num_blocks = 0; @@ -269,7 +269,7 @@ int write_dfu_image(char *file) { memset(block_data, 0x0, block_size); fread(block_data, 1, block_size, inFile); - int transferred = dfu_download(0, dfuBlockCount, block_size, block_data); + unsigned int transferred = dfu_download(0, dfuBlockCount, block_size, block_data); if(transferred != block_size) { /* Error */ @@ -344,7 +344,7 @@ int read_dfu_image(char *file) static void print_device_list(FILE *file, const char *indent) { - for (int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++) + for (long unsigned int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++) { fprintf(file, "%s%-30s (0x%0x)\n", indent, pidList[i].device_name, pidList[i].pid); } @@ -381,7 +381,7 @@ static unsigned int select_pid(char *device_pid) } // Otherwise do a lookup of names - for (int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++) + for (long unsigned int i = 0; i < sizeof(pidList)/sizeof(pidList[0]); i++) { if (strcmp(device_pid, pidList[i].device_name) == 0) { From 3a917e5161b90546b966242b6b7579e3cc0b75eb Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 13:14:34 +0000 Subject: [PATCH 209/233] Attempt to handle error case where input file is a directory --- lib_xua/host/xmosdfu/xmosdfu.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index b9b0a952..5e5c6051 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -2,8 +2,17 @@ #include #include #include +#include #ifdef _WIN32 #include + +// Used for checking if a file is a directory +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#define stat _stat +#define fstat _fstat + #else #include @@ -235,6 +244,7 @@ int write_dfu_image(char *file) unsigned int timeout = 0; unsigned char strIndex = 0; unsigned int dfuBlockCount = 0; + struct stat statbuf; inFile = fopen( file, "rb" ); if( inFile == NULL ) @@ -243,6 +253,19 @@ int write_dfu_image(char *file) return -1; } + /* Check if file is a directory */ + int status = fstat(fileno(inFile), &statbuf); + if (status != 0) + { + fprintf(stderr,"Error: Failed to get info on file.\n"); + return -1; + } + if ( S_ISDIR(statbuf.st_mode) ) + { + fprintf(stderr,"Error: Specified path is a directory.\n"); + return -1; + } + /* Discover the size of the image. */ if( 0 != fseek( inFile, 0, SEEK_END ) ) { From a57a45fd677539b102f6b3a1c96e0edce2094350 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 13:16:16 +0000 Subject: [PATCH 210/233] Add alias for _fileno (Windows xmosdfu) --- lib_xua/host/xmosdfu/xmosdfu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index 5e5c6051..01bcb9b2 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -10,8 +10,10 @@ #ifndef S_ISDIR #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif +// Aliases for Windows #define stat _stat #define fstat _fstat +#define fileno _fileno #else #include From 3920ab831c78ae2e9b7441b7189579fb783cc646 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 13:20:06 +0000 Subject: [PATCH 211/233] Add line to changelog (fix issue #119) --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d4a4b5e1..f966b6d3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ lib_xua Change Log * ADDED: Makefile.Win32 for xmosdfu on Windows * FIXED: Bump default BCD device number to v1.2.0 + * FIXED: xmosdfu now fails with an error when given a directory (Issue #119) 1.1.1 ----- From 7465bc057b957aaaa40542287d0654062e6d6f5c Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 13:45:59 +0000 Subject: [PATCH 212/233] Fix copyright notice; Fix CHANGELOG --- CHANGELOG.rst | 2 +- lib_xua/host/xmosdfu/xmosdfu.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f966b6d3..108b2362 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,7 @@ lib_xua Change Log * ADDED: Makefile.Win32 for xmosdfu on Windows * FIXED: Bump default BCD device number to v1.2.0 - * FIXED: xmosdfu now fails with an error when given a directory (Issue #119) + * FIXED: xmosdfu now fails with an error when given a directory (#119) 1.1.1 ----- diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index 01bcb9b2..b3acdef2 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2012-2020, XMOS Ltd, All rights reserved #include #include #include From 60e23eb5cdc331dcb61f57bfa562c5530951c7d1 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 14:19:17 +0000 Subject: [PATCH 213/233] Fix xmosdfu returning non-zero return code on success --- lib_xua/host/xmosdfu/xmosdfu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index b3acdef2..40c305da 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -607,5 +607,5 @@ int main(int argc, char **argv) libusb_close(devh); libusb_exit(NULL); - return 1; + return 0; } From eb9a90574e3b457666705906eee12f9a0cf779fc Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 27 Oct 2020 15:28:32 +0000 Subject: [PATCH 214/233] Update documentation and scripts to match xmosdfu changes --- doc_dfu/building_xmos_dfu.rst | 15 +++++++++++++++ doc_dfu/xmos_dfu.rst | 9 ++++++--- lib_xua/host/xmosdfu/testdfu.sh | 12 ++++++------ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc_dfu/building_xmos_dfu.rst b/doc_dfu/building_xmos_dfu.rst index 3ca54fdd..132c04d2 100644 --- a/doc_dfu/building_xmos_dfu.rst +++ b/doc_dfu/building_xmos_dfu.rst @@ -39,3 +39,18 @@ Raspberry Pi A makefile is provided for Raspbian. libusb is required and can be installed using the ``apt-get`` command from previous Linux section. .. literalinclude:: Makefile.Pi + +Windows +------- + +To build on Windows, you must first install Visual Studio 2019 Build Tools with +C++ support. `This is available from Microsoft's website. `_ + +To build, open a Developer Command Prompt via the start menu and navigate to the +xmosdfu folder. The command to build is as follows: + + ``nmake /f Makefile.Win32`` + +This Makefile contains the following: + +.. literalinclude:: Makefile.Win32 diff --git a/doc_dfu/xmos_dfu.rst b/doc_dfu/xmos_dfu.rst index 17f58662..750c206c 100644 --- a/doc_dfu/xmos_dfu.rst +++ b/doc_dfu/xmos_dfu.rst @@ -4,6 +4,9 @@ Using the DFU loader - macOS (via the XMOS DFU loader) The XMOS DFU loader is provided as source as part of the XMOS USB Audio software framework, see :ref:`usb_audiosec_building_xmos_dfu`. +NOTE: Windows requires the installation of libusbK drivers on the DFU endpoint. +We recommend using `Zadig `_. + Set up the image loader ----------------------- @@ -18,7 +21,7 @@ Download new firmware To program the new firmware run the command: - ``./xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin`` + ``./bin/xmosdfu XMOS_L2_AUDIO2_PID --download new_firmware.bin`` Replace ``XMOS_L2_AUDIO2_PID`` with product ID of your target device. Invoke ``xmosdfu`` with no arguments to get a list of all supported product IDs. @@ -35,7 +38,7 @@ present. Run the command: - ``./xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin`` + ``./bin/xmosdfu XMOS_L2_AUDIO2_PID --upload currentfirmware.bin`` The file ``currentfirmware.bin`` contains the latest upgrade image. This file is an exact copy of the data from the flash and can be downloaded to the device @@ -47,6 +50,6 @@ Reverting firmware to factory image To revert the device back to its factory (i.e XFLASH) installed state from the new firmware, run the command: - ``./xmosdfu XMOS_L2_AUDIO2_PID --revertfactory`` + ``./bin/xmosdfu XMOS_L2_AUDIO2_PID --revertfactory`` The device will now be running, and only contain the factory firmware. diff --git a/lib_xua/host/xmosdfu/testdfu.sh b/lib_xua/host/xmosdfu/testdfu.sh index 0fb53427..65a578a5 100755 --- a/lib_xua/host/xmosdfu/testdfu.sh +++ b/lib_xua/host/xmosdfu/testdfu.sh @@ -73,42 +73,42 @@ system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU download new firmware 1 ***" -$PROGDIR/xmosdfu $device_pid --download $update1 +$PROGDIR/bin/xmosdfu $device_pid --download $update1 sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU download new firmware 2 ***" -$PROGDIR/xmosdfu $device_pid --download $update2 +$PROGDIR/bin/xmosdfu $device_pid --download $update2 sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU upload existing firmware ***" -$PROGDIR/xmosdfu $device_pid --upload upload.bin +$PROGDIR/bin/xmosdfu $device_pid --upload upload.bin sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU revert to factory ***" -$PROGDIR/xmosdfu $device_pid --revertfactory +$PROGDIR/bin/xmosdfu $device_pid --revertfactory sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU download uploaded firmware ***" -$PROGDIR/xmosdfu $device_pid --download upload.bin +$PROGDIR/bin/xmosdfu $device_pid --download upload.bin sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version echo "" echo "*** DFU revert to factory ***" -$PROGDIR/xmosdfu $device_pid --revertfactory +$PROGDIR/bin/xmosdfu $device_pid --revertfactory sleep 2 echo "Version Read:" system_profiler SPUSBDataType|grep -A10 "$device_grep_string" |grep Version From 46a304d54547b864574e71e4b535f9c282f94a99 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Thu, 29 Oct 2020 10:22:04 +0000 Subject: [PATCH 215/233] Update LICENCE.txt --- doc_dfu/LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc_dfu/LICENSE.txt b/doc_dfu/LICENSE.txt index 9f9fc466..7f5e44ce 100644 --- a/doc_dfu/LICENSE.txt +++ b/doc_dfu/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2018, XMOS, All rights reserved. +Copyright (c) 2017-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From 6dbff06dced9db546ee67ea159267397a38d6a21 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 10 Nov 2020 14:35:54 +0000 Subject: [PATCH 216/233] Fix typo in pdm_mic.xc causing firmware crash --- lib_xua/src/core/pdm_mics/pdm_mic.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index b853f2d0..5b2b5142 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -115,7 +115,7 @@ void XUA_PdmBuffer(streaming chanend c_ds_output[2], chanend c_audio) dc[1].mic_gain_compensation[2]=0; dc[1].mic_gain_compensation[3]=0; dc[1].channel_count = 4; - dc[0].async_interface_enabled = 0; + dc[1].async_interface_enabled = 0; mic_array_decimator_configure(c_ds_output, decimatorCount, dc); From 7fc1f254b74a77ba0afa8895ecc5935c6818b7eb Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 24 Nov 2020 15:24:02 +0000 Subject: [PATCH 217/233] Update CHANGELOG --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 108b2362..9a8b1cf4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,8 @@ lib_xua Change Log * ADDED: Makefile.Win32 for xmosdfu on Windows * FIXED: Bump default BCD device number to v1.2.0 * FIXED: xmosdfu now fails with an error when given a directory (#119) + * FIXED: Compilation errors related to HID code + * FIXED: Runtime error when using mic array interface 1.1.1 ----- From 16a927d63b0ee1c0b28751d22182b4813a90a858 Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 24 Nov 2020 16:40:55 +0000 Subject: [PATCH 218/233] Fix copyright notices --- lib_xua/src/core/pdm_mics/pdm_mic.xc | 2 +- lib_xua/src/hid/hid.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index 5b2b5142..137f289c 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2015-2020, XMOS Ltd, All rights reserved #include "xua.h" diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 5d694c53..6a2e81f8 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2019, XMOS Ltd, All rights reserved +// Copyright (c) 2019-2020, XMOS Ltd, All rights reserved #include #include #include "descriptor_defs.h" From 23252ac3236fce0a843e94fba38870d02b82969b Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Tue, 8 Dec 2020 15:53:32 +0000 Subject: [PATCH 219/233] Update copyright notice --- lib_xua/src/core/mixer/fastmix.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 139f203a..0ab9c0ff 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -1,4 +1,4 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright (c) 2018-2020, XMOS Ltd, All rights reserved //#include "devicedefines.h" #define MAX_MIX_COUNT 8 From 5d66159b402110eb0f2b0b7f88c136993af23e11 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Tue, 8 Dec 2020 15:54:51 +0000 Subject: [PATCH 220/233] Update copyright notice --- lib_xua/src/core/buffer/decouple/interrupt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/decouple/interrupt.h b/lib_xua/src/core/buffer/decouple/interrupt.h index 44452d96..9c7b80f4 100644 --- a/lib_xua/src/core/buffer/decouple/interrupt.h +++ b/lib_xua/src/core/buffer/decouple/interrupt.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #ifndef __interrupt_h__ #define __interrupt_h__ From 9bdaf7ece6a42de016ca7bca18f3be5b672ad462 Mon Sep 17 00:00:00 2001 From: oscarbailey-xmos <40995889+oscarbailey-xmos@users.noreply.github.com> Date: Tue, 8 Dec 2020 15:57:39 +0000 Subject: [PATCH 221/233] Update CHANGELOG.rst --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9a8b1cf4..035c89e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,7 @@ lib_xua Change Log 1.2.0 ----- + * ADDED: Updates for xcore.ai/XS3 compatibility * ADDED: Makefile.Win32 for xmosdfu on Windows * FIXED: Bump default BCD device number to v1.2.0 * FIXED: xmosdfu now fails with an error when given a directory (#119) From 04a991b37ed26cfee5666ee2d46d1b1ecf74b8bd Mon Sep 17 00:00:00 2001 From: Oscar Bailey Date: Tue, 8 Dec 2020 16:02:57 +0000 Subject: [PATCH 222/233] Document 50 and 500 msec delays before DFU resets (sc_usb_audio 49e2ce9) --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 384aee2a..968a72e9 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -66,6 +66,22 @@ #include "xua_dfu.h" #define DFU_IF_NUM INPUT_INTERFACES + OUTPUT_INTERFACES + MIDI_INTERFACES + 1 extern void device_reboot(void); + +/* Windows core USB/device driver stack may not like device coming off bus for + * a very short period of less than 500ms. Enforce at least 500ms by stalling. + * This may not have the desired effect depending on whether 'off the bus' + * requires device terminations disabled (PHY off). In that case we would be + * better off doing the reboot to DFU and then delaying PHY initialisation + * instead. Suggest revisiting. + */ +#define DELAY_BEFORE_REBOOT_TO_DFU_MS 500 + +/* Similarly to the delay before reboot to DFU mode, this delay is meant to + * avoid shocking the Windows software stack. Suggest revisiting to establish + * if 50 or 500 is needed. + */ +#define DELAY_BEFORE_REBOOT_FROM_DFU_MS 50 + #endif #if( 0 < HID_CONTROLS ) @@ -814,7 +830,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 if(reset) { - DFUDelay(50000000); + DFUDelay(DELAY_BEFORE_REBOOT_TO_DFU_MS * 100000); device_reboot(); } } @@ -1035,7 +1051,7 @@ void XUA_Endpoint0_loop(XUD_Result_t result, USB_SetupPacket_t sp, chanend c_ep0 DFU_mode_active = 0; /* Send reboot command */ - DFUDelay(5000000); + DFUDelay(DELAY_BEFORE_REBOOT_FROM_DFU_MS * 100000); device_reboot(); } } From 90f8ede38779185c6f6af1b8b8f36dc821a58aaf Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 9 Mar 2021 14:42:16 +0000 Subject: [PATCH 223/233] Add XS3 support in reboot --- lib_xua/src/core/support/reboot.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index fbc11f6c..d94a9e43 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -74,7 +74,7 @@ void device_reboot(void) } } -#ifdef __XS2A__ +#if defined(__XS2A__) || defined(__XS3A__) /* Reset all even tiles, starting from the remote ones */ for(int tileNum = tileArrayLength-2; tileNum>=0; tileNum-=2) #else @@ -86,7 +86,7 @@ void device_reboot(void) tileId = get_tile_id(tile[tileNum]); /* Do not reboot local tile (or tiles residing on the same node) yet */ -#ifdef __XS2A__ +#if defined(__XS2A__) || defined(__XS3A__) if((localTileNum | 1) != (tileNum | 1)) #else From f3063fdfc37162ae3adbb2c1f681bc7e9738f623 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 9 Mar 2021 16:37:27 +0000 Subject: [PATCH 224/233] Update dates --- LICENSE.txt | 2 +- lib_xua/src/core/support/reboot.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index d4acef94..70ac29e5 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2011-2020, XMOS, All rights reserved. +Copyright (c) 2011-2021, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index d94a9e43..50522b48 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved #include #include #include From 2e86563274684c5adbd37c86034d539bce824371 Mon Sep 17 00:00:00 2001 From: Ed Date: Tue, 9 Mar 2021 16:47:45 +0000 Subject: [PATCH 225/233] License date --- lib_xua/LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 7f5e44ce..1bafc403 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2020, XMOS, All rights reserved. +Copyright (c) 2017-2021, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From d161ed168c3a1b16ccb1ea72df98bb0469a83bc6 Mon Sep 17 00:00:00 2001 From: Brennan Magee Date: Wed, 10 Mar 2021 10:26:05 +0000 Subject: [PATCH 226/233] Update Jenkins shared library This repo is still using an old version that is sensitive to brew upgrades of the python version seen here: http://srv-bri-jcim0:8080/view/sw_xvf3510_develop/job/XMOS/job/lib_xua/job/develop/404/ --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index dc391fa8..092948c7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -@Library('xmos_jenkins_shared_library@v0.14.2') _ +@Library('xmos_jenkins_shared_library@v0.16.2') _ getApproval() From 6f75a44d9cacca8f353eb97dfa4a16d122e314a2 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Thu, 22 Apr 2021 17:15:08 +0100 Subject: [PATCH 227/233] Use XMOS Public Licence Version 1 --- LICENSE.rst | 84 +++++++++++ LICENSE.txt | 135 ------------------ doc_dfu/LICENSE.rst | 84 +++++++++++ doc_dfu/LICENSE.txt | 135 ------------------ examples/AN00246_xua_example/LICENSE.rst | 84 +++++++++++ examples/AN00246_xua_example/LICENSE.txt | 135 ------------------ .../AN00247_xua_example_spdif_tx/LICENSE.rst | 84 +++++++++++ .../AN00247_xua_example_spdif_tx/LICENSE.txt | 135 ------------------ .../AN00248_xua_example_pdm_mics/LICENSE.rst | 84 +++++++++++ .../AN00248_xua_example_pdm_mics/LICENSE.txt | 135 ------------------ lib_xua/LICENSE.rst | 84 +++++++++++ lib_xua/LICENSE.txt | 135 ------------------ tests/app_test_i2s_loopback/LICENSE.rst | 84 +++++++++++ tests/app_test_i2s_loopback/LICENSE.txt | 135 ------------------ 14 files changed, 588 insertions(+), 945 deletions(-) create mode 100644 LICENSE.rst delete mode 100644 LICENSE.txt create mode 100644 doc_dfu/LICENSE.rst delete mode 100644 doc_dfu/LICENSE.txt create mode 100644 examples/AN00246_xua_example/LICENSE.rst delete mode 100644 examples/AN00246_xua_example/LICENSE.txt create mode 100644 examples/AN00247_xua_example_spdif_tx/LICENSE.rst delete mode 100644 examples/AN00247_xua_example_spdif_tx/LICENSE.txt create mode 100644 examples/AN00248_xua_example_pdm_mics/LICENSE.rst delete mode 100644 examples/AN00248_xua_example_pdm_mics/LICENSE.txt create mode 100644 lib_xua/LICENSE.rst delete mode 100644 lib_xua/LICENSE.txt create mode 100644 tests/app_test_i2s_loopback/LICENSE.rst delete mode 100644 tests/app_test_i2s_loopback/LICENSE.txt diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 70ac29e5..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2011-2021, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS lib_xua software diff --git a/doc_dfu/LICENSE.rst b/doc_dfu/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/doc_dfu/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/doc_dfu/LICENSE.txt b/doc_dfu/LICENSE.txt deleted file mode 100644 index 7f5e44ce..00000000 --- a/doc_dfu/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2017-2020, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS lib_xua software diff --git a/examples/AN00246_xua_example/LICENSE.rst b/examples/AN00246_xua_example/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00246_xua_example/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00246_xua_example/LICENSE.txt b/examples/AN00246_xua_example/LICENSE.txt deleted file mode 100644 index 8b37ec93..00000000 --- a/examples/AN00246_xua_example/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2018-2019, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00246 software diff --git a/examples/AN00247_xua_example_spdif_tx/LICENSE.rst b/examples/AN00247_xua_example_spdif_tx/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00247_xua_example_spdif_tx/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00247_xua_example_spdif_tx/LICENSE.txt b/examples/AN00247_xua_example_spdif_tx/LICENSE.txt deleted file mode 100644 index 381126d4..00000000 --- a/examples/AN00247_xua_example_spdif_tx/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2018-2019, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00247 software diff --git a/examples/AN00248_xua_example_pdm_mics/LICENSE.rst b/examples/AN00248_xua_example_pdm_mics/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00248_xua_example_pdm_mics/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00248_xua_example_pdm_mics/LICENSE.txt b/examples/AN00248_xua_example_pdm_mics/LICENSE.txt deleted file mode 100644 index bdf72741..00000000 --- a/examples/AN00248_xua_example_pdm_mics/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2018-2019, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00248 software diff --git a/lib_xua/LICENSE.rst b/lib_xua/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/lib_xua/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt deleted file mode 100644 index 1bafc403..00000000 --- a/lib_xua/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2017-2021, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS lib_xua software diff --git a/tests/app_test_i2s_loopback/LICENSE.rst b/tests/app_test_i2s_loopback/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/app_test_i2s_loopback/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/app_test_i2s_loopback/LICENSE.txt b/tests/app_test_i2s_loopback/LICENSE.txt deleted file mode 100644 index 5fee4f02..00000000 --- a/tests/app_test_i2s_loopback/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2016-2019, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS lib_xua software From 0aa60035a4fdc2f37144f774b53ee2661e19818f Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Thu, 22 Apr 2021 17:17:39 +0100 Subject: [PATCH 228/233] Update copyright notices and licence references --- examples/AN00246_xua_example/src/app_xua_simple.xc | 3 ++- examples/AN00246_xua_example/src/cs4384.h | 3 ++- examples/AN00246_xua_example/src/cs5368.h | 3 ++- examples/AN00246_xua_example/src/hwsupport.xc | 3 ++- examples/AN00246_xua_example/src/xua_conf.h | 3 ++- examples/AN00246_xua_example/src/xud_conf.h | 3 ++- examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc | 3 ++- examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc | 3 ++- examples/AN00247_xua_example_spdif_tx/src/xua_conf.h | 3 ++- examples/AN00247_xua_example_spdif_tx/src/xud_conf.h | 3 ++- examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc | 3 ++- examples/AN00248_xua_example_pdm_mics/src/audiohw.xc | 3 ++- examples/AN00248_xua_example_pdm_mics/src/xua_conf.h | 3 ++- examples/AN00248_xua_example_pdm_mics/src/xud_conf.h | 3 ++- lib_xua/api/xua.h | 3 ++- lib_xua/api/xua_audiohub.h | 3 ++- lib_xua/api/xua_buffer.h | 3 ++- lib_xua/api/xua_conf_default.h | 3 ++- lib_xua/api/xua_conf_full.h | 3 ++- lib_xua/api/xua_endpoint0.h | 3 ++- lib_xua/api/xua_pdm_mic.h | 3 ++- lib_xua/api/xua_usb_params_funcs.h | 3 ++- lib_xua/host/xmosdfu/xmosdfu.cpp | 3 ++- lib_xua/src/core/audiohub/audiohub_adat.h | 3 ++- lib_xua/src/core/audiohub/audiohub_dsd.h | 3 ++- lib_xua/src/core/audiohub/audiohub_initport.xc | 3 ++- lib_xua/src/core/audiohub/dsd_support.h | 3 ++- lib_xua/src/core/audiohub/xua_audiohub.xc | 3 ++- lib_xua/src/core/audiohub/xua_buffman_default.c | 3 ++- lib_xua/src/core/buffer/decouple/decouple.xc | 3 ++- lib_xua/src/core/buffer/decouple/decouple_interrupt.c | 3 ++- lib_xua/src/core/buffer/decouple/get_adc_counts.c | 3 ++- lib_xua/src/core/buffer/decouple/interrupt.h | 3 ++- lib_xua/src/core/buffer/ep/ep_buffer.xc | 3 ++- lib_xua/src/core/buffer/ep/testct_byref.h | 3 ++- lib_xua/src/core/buffer/ep/testct_byref.xc | 3 ++- lib_xua/src/core/clocking/clockgen.xc | 3 ++- lib_xua/src/core/clocking/clocking.h | 3 ++- lib_xua/src/core/endpoint0/chanstringgen.py | 3 ++- lib_xua/src/core/endpoint0/chanstrings.h | 3 ++- lib_xua/src/core/endpoint0/dbcalc.h | 3 ++- lib_xua/src/core/endpoint0/dbcalc.xc | 3 ++- lib_xua/src/core/endpoint0/descriptor_defs.h | 3 ++- lib_xua/src/core/endpoint0/vendorrequests.c | 3 ++- lib_xua/src/core/endpoint0/vendorrequests.h | 3 ++- lib_xua/src/core/endpoint0/xua_endpoint0.c | 3 ++- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 3 ++- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h | 3 ++- lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc | 3 ++- lib_xua/src/core/main.xc | 3 ++- lib_xua/src/core/mixer/fastmix.S | 3 ++- lib_xua/src/core/mixer/mixer.h | 3 ++- lib_xua/src/core/mixer/mixer.xc | 3 ++- lib_xua/src/core/mixer/repeat.h | 3 ++- lib_xua/src/core/pdm_mics/mic_array_conf.h | 3 ++- lib_xua/src/core/pdm_mics/pdm_mic.xc | 3 ++- lib_xua/src/core/pdm_mics/pdm_mic_user.c | 3 ++- lib_xua/src/core/ports/audioports.c | 3 ++- lib_xua/src/core/ports/audioports.h | 3 ++- lib_xua/src/core/ports/audioports.xc | 3 ++- lib_xua/src/core/support/powersave/archU_powerSaving.h | 3 ++- lib_xua/src/core/support/powersave/archU_powerSaving.xc | 3 ++- lib_xua/src/core/support/reboot.xc | 3 ++- lib_xua/src/core/support/xc_ptr.h | 3 ++- lib_xua/src/core/support/xc_ptr.xc | 3 ++- lib_xua/src/core/uac_hwresources.h | 3 ++- lib_xua/src/core/user/audiostream/audiostream.c | 3 ++- lib_xua/src/core/user/audiostream/audiostream.h | 3 ++- lib_xua/src/core/user/hid/user_hid.h | 3 ++- lib_xua/src/core/user/hostactive/hostactive.c | 3 ++- lib_xua/src/core/user/hostactive/hostactive.h | 3 ++- lib_xua/src/core/warnings.xc | 3 ++- lib_xua/src/core/xua_commands.h | 3 ++- lib_xua/src/core/xuduser/xuduser.c | 3 ++- lib_xua/src/dfu/dfu.xc | 3 ++- lib_xua/src/dfu/dfu_interface.h | 3 ++- lib_xua/src/dfu/dfu_types.h | 3 ++- lib_xua/src/dfu/flash_interface.c | 3 ++- lib_xua/src/dfu/flash_interface.h | 3 ++- lib_xua/src/dfu/flashlib_user.c | 3 ++- lib_xua/src/dfu/xua_dfu.h | 3 ++- lib_xua/src/hid/hid.xc | 3 ++- lib_xua/src/hid/xua_hid.h | 3 ++- lib_xua/src/midi/midi_descriptor.h | 3 ++- lib_xua/src/midi/midiinparse.h | 3 ++- lib_xua/src/midi/midiinparse.xc | 3 ++- lib_xua/src/midi/midioutparse.h | 3 ++- lib_xua/src/midi/midioutparse.xc | 3 ++- lib_xua/src/midi/queue.h | 3 ++- lib_xua/src/midi/queue.xc | 3 ++- lib_xua/src/midi/usb_midi.h | 3 ++- lib_xua/src/midi/usb_midi.xc | 3 ++- lib_xua/src/midi/usb_midi_support.xc | 3 ++- python/setup.py | 3 ++- tests/app_test_i2s_loopback/debug_conf.h | 3 ++- tests/app_test_i2s_loopback/main.xc | 3 ++- tests/app_test_i2s_loopback/simulation.xc | 3 ++- tests/app_test_i2s_loopback/usb_device.h | 3 ++- tests/app_test_i2s_loopback/usb_device.xc | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/audiohw.xc | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/cs2100.h | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/cs4384.h | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/cs5368.h | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/gpio_access.c | 3 ++- tests/app_test_i2s_loopback/xk_216_mc/gpio_access.h | 3 ++- tests/app_test_i2s_loopback/xua_conf.h | 3 ++- tests/runtests.py | 3 ++- tests/test_i2s_loopback.py | 3 ++- 108 files changed, 216 insertions(+), 108 deletions(-) diff --git a/examples/AN00246_xua_example/src/app_xua_simple.xc b/examples/AN00246_xua_example/src/app_xua_simple.xc index e53f0778..131a04db 100644 --- a/examples/AN00246_xua_example/src/app_xua_simple.xc +++ b/examples/AN00246_xua_example/src/app_xua_simple.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* A very simple *example* of a USB audio application (and as such is un-verified for production) * diff --git a/examples/AN00246_xua_example/src/cs4384.h b/examples/AN00246_xua_example/src/cs4384.h index 98defbe3..6de83e81 100644 --- a/examples/AN00246_xua_example/src/cs4384.h +++ b/examples/AN00246_xua_example/src/cs4384.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef CS4384_H_ #define CS4384_H_ diff --git a/examples/AN00246_xua_example/src/cs5368.h b/examples/AN00246_xua_example/src/cs5368.h index 945ae536..d2de278d 100644 --- a/examples/AN00246_xua_example/src/cs5368.h +++ b/examples/AN00246_xua_example/src/cs5368.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _CS5368_H_ #define _CS5368_H_ diff --git a/examples/AN00246_xua_example/src/hwsupport.xc b/examples/AN00246_xua_example/src/hwsupport.xc index f9ed5af7..7507ed8c 100644 --- a/examples/AN00246_xua_example/src/hwsupport.xc +++ b/examples/AN00246_xua_example/src/hwsupport.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00246_xua_example/src/xua_conf.h b/examples/AN00246_xua_example/src/xua_conf.h index c969f6cf..e0a0c36b 100644 --- a/examples/AN00246_xua_example/src/xua_conf.h +++ b/examples/AN00246_xua_example/src/xua_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ diff --git a/examples/AN00246_xua_example/src/xud_conf.h b/examples/AN00246_xua_example/src/xud_conf.h index c14d64a8..3fc13baf 100644 --- a/examples/AN00246_xua_example/src/xud_conf.h +++ b/examples/AN00246_xua_example/src/xud_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua_conf.h" diff --git a/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc b/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc index 9c9e3703..704479b8 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc +++ b/examples/AN00247_xua_example_spdif_tx/src/app_xua_simple.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* A very simple *example* of a USB audio application (and as such is un-verified for production) * diff --git a/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc b/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc index 33fc5bca..203fa38e 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc +++ b/examples/AN00247_xua_example_spdif_tx/src/hwsupport.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h index b2867ee7..8fee8c82 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xua_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ diff --git a/examples/AN00247_xua_example_spdif_tx/src/xud_conf.h b/examples/AN00247_xua_example_spdif_tx/src/xud_conf.h index c14d64a8..3fc13baf 100644 --- a/examples/AN00247_xua_example_spdif_tx/src/xud_conf.h +++ b/examples/AN00247_xua_example_spdif_tx/src/xud_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua_conf.h" diff --git a/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc b/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc index 93ee258d..6b7b299e 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc +++ b/examples/AN00248_xua_example_pdm_mics/src/app_xua_simple.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* A very simple *example* of a USB audio application (and as such is un-verified for production) * diff --git a/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc b/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc index 27325027..288b2d0b 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc +++ b/examples/AN00248_xua_example_pdm_mics/src/audiohw.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h index e2f0f84f..191d8953 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xua_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2019, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUA_CONF_H_ #define _XUA_CONF_H_ diff --git a/examples/AN00248_xua_example_pdm_mics/src/xud_conf.h b/examples/AN00248_xua_example_pdm_mics/src/xud_conf.h index c14d64a8..3fc13baf 100644 --- a/examples/AN00248_xua_example_pdm_mics/src/xud_conf.h +++ b/examples/AN00248_xua_example_pdm_mics/src/xud_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua_conf.h" diff --git a/lib_xua/api/xua.h b/lib_xua/api/xua.h index 92cdbe6f..c52ff1a7 100644 --- a/lib_xua/api/xua.h +++ b/lib_xua/api/xua.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_H__ #define __XUA_H__ diff --git a/lib_xua/api/xua_audiohub.h b/lib_xua/api/xua_audiohub.h index 9694cc10..e66296cb 100644 --- a/lib_xua/api/xua_audiohub.h +++ b/lib_xua/api/xua_audiohub.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_AUDIOHUB_H__ #define __XUA_AUDIOHUB_H__ diff --git a/lib_xua/api/xua_buffer.h b/lib_xua/api/xua_buffer.h index d351ddc1..302e3f67 100644 --- a/lib_xua/api/xua_buffer.h +++ b/lib_xua/api/xua_buffer.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_BUFFER_H__ #define __XUA_BUFFER_H__ diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index fa769b20..38db0d98 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Defines relating to device configuration and customisation of lib_xua * @author Ross Owen, XMOS Limited diff --git a/lib_xua/api/xua_conf_full.h b/lib_xua/api/xua_conf_full.h index e3696a6d..ff4bfd0b 100644 --- a/lib_xua/api/xua_conf_full.h +++ b/lib_xua/api/xua_conf_full.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_CONF_FULL_H__ #define __XUA_CONF_FULL_H__ diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 41281115..b7cfdfc6 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUA_ENDPOINT0_H_ #define _XUA_ENDPOINT0_H_ diff --git a/lib_xua/api/xua_pdm_mic.h b/lib_xua/api/xua_pdm_mic.h index 4b7704b6..a68dd142 100644 --- a/lib_xua/api/xua_pdm_mic.h +++ b/lib_xua/api/xua_pdm_mic.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef XUA_PDM_MIC_H #define XUA_PDM_MIC_H diff --git a/lib_xua/api/xua_usb_params_funcs.h b/lib_xua/api/xua_usb_params_funcs.h index 0a427046..dcc018db 100644 --- a/lib_xua/api/xua_usb_params_funcs.h +++ b/lib_xua/api/xua_usb_params_funcs.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2020, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_API_H__ #define __XUA_API_H__ diff --git a/lib_xua/host/xmosdfu/xmosdfu.cpp b/lib_xua/host/xmosdfu/xmosdfu.cpp index 40c305da..04c1a21a 100644 --- a/lib_xua/host/xmosdfu/xmosdfu.cpp +++ b/lib_xua/host/xmosdfu/xmosdfu.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 2012-2020, XMOS Ltd, All rights reserved +// Copyright 2012-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/lib_xua/src/core/audiohub/audiohub_adat.h b/lib_xua/src/core/audiohub/audiohub_adat.h index 41cd5a45..dd51e3ec 100644 --- a/lib_xua/src/core/audiohub/audiohub_adat.h +++ b/lib_xua/src/core/audiohub/audiohub_adat.h @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. unsigned adatCounter = 0; unsigned adatSamples[8]; diff --git a/lib_xua/src/core/audiohub/audiohub_dsd.h b/lib_xua/src/core/audiohub/audiohub_dsd.h index bea386bb..f101160b 100644 --- a/lib_xua/src/core/audiohub/audiohub_dsd.h +++ b/lib_xua/src/core/audiohub/audiohub_dsd.h @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if (DSD_CHANS_DAC != 0) extern buffered out port:32 p_dsd_dac[DSD_CHANS_DAC]; diff --git a/lib_xua/src/core/audiohub/audiohub_initport.xc b/lib_xua/src/core/audiohub/audiohub_initport.xc index fc8d4f9d..279250f8 100644 --- a/lib_xua/src/core/audiohub/audiohub_initport.xc +++ b/lib_xua/src/core/audiohub/audiohub_initport.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #include "dsd_support.h" diff --git a/lib_xua/src/core/audiohub/dsd_support.h b/lib_xua/src/core/audiohub/dsd_support.h index 97b126db..a5f750c8 100644 --- a/lib_xua/src/core/audiohub/dsd_support.h +++ b/lib_xua/src/core/audiohub/dsd_support.h @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _DSD_H_ #define _DSD_H_ diff --git a/lib_xua/src/core/audiohub/xua_audiohub.xc b/lib_xua/src/core/audiohub/xua_audiohub.xc index 8448879c..25ef5059 100755 --- a/lib_xua/src/core/audiohub/xua_audiohub.xc +++ b/lib_xua/src/core/audiohub/xua_audiohub.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @file xua_audiohub.xc * @brief XMOS USB 2.0 Audio Reference Design. Audio Functions. diff --git a/lib_xua/src/core/audiohub/xua_buffman_default.c b/lib_xua/src/core/audiohub/xua_buffman_default.c index eea225ce..20651682 100644 --- a/lib_xua/src/core/audiohub/xua_buffman_default.c +++ b/lib_xua/src/core/audiohub/xua_buffman_default.c @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xccompat.h" #include "xua_audiohub.h" diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index f217b0e4..f22f9582 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/core/buffer/decouple/decouple_interrupt.c b/lib_xua/src/core/buffer/decouple/decouple_interrupt.c index e91351dc..3344caea 100644 --- a/lib_xua/src/core/buffer/decouple/decouple_interrupt.c +++ b/lib_xua/src/core/buffer/decouple/decouple_interrupt.c @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN #include "interrupt.h" diff --git a/lib_xua/src/core/buffer/decouple/get_adc_counts.c b/lib_xua/src/core/buffer/decouple/get_adc_counts.c index 96680b43..85767a21 100644 --- a/lib_xua/src/core/buffer/decouple/get_adc_counts.c +++ b/lib_xua/src/core/buffer/decouple/get_adc_counts.c @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN #include "xud.h" diff --git a/lib_xua/src/core/buffer/decouple/interrupt.h b/lib_xua/src/core/buffer/decouple/interrupt.h index 9c7b80f4..1aec8cd9 100644 --- a/lib_xua/src/core/buffer/decouple/interrupt.h +++ b/lib_xua/src/core/buffer/decouple/interrupt.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __interrupt_h__ #define __interrupt_h__ diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 9a995f8d..50f475bd 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN #include diff --git a/lib_xua/src/core/buffer/ep/testct_byref.h b/lib_xua/src/core/buffer/ep/testct_byref.h index b3b82c1d..cb37b999 100644 --- a/lib_xua/src/core/buffer/ep/testct_byref.h +++ b/lib_xua/src/core/buffer/ep/testct_byref.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. //#pragma select handler #include diff --git a/lib_xua/src/core/buffer/ep/testct_byref.xc b/lib_xua/src/core/buffer/ep/testct_byref.xc index a48d3f86..0269998e 100644 --- a/lib_xua/src/core/buffer/ep/testct_byref.xc +++ b/lib_xua/src/core/buffer/ep/testct_byref.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include /* TODO Currently complier does not support inline select functions, hense this is in a seperate file to ensure this is not the case */ diff --git a/lib_xua/src/core/clocking/clockgen.xc b/lib_xua/src/core/clocking/clockgen.xc index 7c5da305..eb294057 100644 --- a/lib_xua/src/core/clocking/clockgen.xc +++ b/lib_xua/src/core/clocking/clockgen.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/lib_xua/src/core/clocking/clocking.h b/lib_xua/src/core/clocking/clocking.h index 39db3796..10dff9ee 100644 --- a/lib_xua/src/core/clocking/clocking.h +++ b/lib_xua/src/core/clocking/clocking.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _CLOCKING_H_ #define _CLOCKING_H_ diff --git a/lib_xua/src/core/endpoint0/chanstringgen.py b/lib_xua/src/core/endpoint0/chanstringgen.py index 49249f8a..de74c9d0 100644 --- a/lib_xua/src/core/endpoint0/chanstringgen.py +++ b/lib_xua/src/core/endpoint0/chanstringgen.py @@ -1,4 +1,5 @@ -# Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +# Copyright 2015-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. def genstrings(outputChanCount, chanString, portString, structureString, adc_dac): diff --git a/lib_xua/src/core/endpoint0/chanstrings.h b/lib_xua/src/core/endpoint0/chanstrings.h index 24b75bd2..68be3481 100644 --- a/lib_xua/src/core/endpoint0/chanstrings.h +++ b/lib_xua/src/core/endpoint0/chanstrings.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* AUTOGENERATED using chanstringgen.py */ /* Not very nice looking but the standard preprocessor is not very powerful diff --git a/lib_xua/src/core/endpoint0/dbcalc.h b/lib_xua/src/core/endpoint0/dbcalc.h index df2f3099..73a2875d 100644 --- a/lib_xua/src/core/endpoint0/dbcalc.h +++ b/lib_xua/src/core/endpoint0/dbcalc.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __dbcalc_h__ #define __dbcalc_h__ diff --git a/lib_xua/src/core/endpoint0/dbcalc.xc b/lib_xua/src/core/endpoint0/dbcalc.xc index 24e1e903..1967f35d 100644 --- a/lib_xua/src/core/endpoint0/dbcalc.xc +++ b/lib_xua/src/core/endpoint0/dbcalc.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include /* The coefficients of the chebychev polynomial to approximate 10^x in the interval [-1,1]. diff --git a/lib_xua/src/core/endpoint0/descriptor_defs.h b/lib_xua/src/core/endpoint0/descriptor_defs.h index 0a5a94fd..b4dc692b 100644 --- a/lib_xua/src/core/endpoint0/descriptor_defs.h +++ b/lib_xua/src/core/endpoint0/descriptor_defs.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __DESCRIPTOR_DEFS_H__ #define __DESCRIPTOR_DEFS_H__ diff --git a/lib_xua/src/core/endpoint0/vendorrequests.c b/lib_xua/src/core/endpoint0/vendorrequests.c index 0eae49a1..66a1ac09 100644 --- a/lib_xua/src/core/endpoint0/vendorrequests.c +++ b/lib_xua/src/core/endpoint0/vendorrequests.c @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/core/endpoint0/vendorrequests.h b/lib_xua/src/core/endpoint0/vendorrequests.h index 396ceef3..c241011d 100644 --- a/lib_xua/src/core/endpoint0/vendorrequests.h +++ b/lib_xua/src/core/endpoint0/vendorrequests.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _VENDORREQUESTS_H_ #define _VENDORREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 968a72e9..40064918 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Implements endpoint zero for an USB Audio 1.0/2.0 device * @author Ross Owen, XMOS Semiconductor diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index e0742f83..89d8ba3d 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @file xua_ep0_descriptors.h * @brief Device Descriptors diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h index f8c7cc33..60332730 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.h @@ -1,4 +1,5 @@ -// Copyright (c) 2014-2020, XMOS Ltd, All rights reserved +// Copyright 2014-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _AUDIOREQUESTS_H_ #define _AUDIOREQUESTS_H_ diff --git a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc index 2ce05108..89169336 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc +++ b/lib_xua/src/core/endpoint0/xua_ep0_uacreqs.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Implements relevant requests from the USB Audio 2.0 Specification * @author Ross Owen, XMOS Semiconductor diff --git a/lib_xua/src/core/main.xc b/lib_xua/src/core/main.xc index afc819c4..421793f2 100755 --- a/lib_xua/src/core/main.xc +++ b/lib_xua/src/core/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2012-2019, XMOS Ltd, All rights reserved +// Copyright 2012-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" /* Device specific defines */ #ifndef EXCLUDE_USB_AUDIO_MAIN diff --git a/lib_xua/src/core/mixer/fastmix.S b/lib_xua/src/core/mixer/fastmix.S index 0ab9c0ff..c8828a38 100644 --- a/lib_xua/src/core/mixer/fastmix.S +++ b/lib_xua/src/core/mixer/fastmix.S @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2020, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. //#include "devicedefines.h" #define MAX_MIX_COUNT 8 diff --git a/lib_xua/src/core/mixer/mixer.h b/lib_xua/src/core/mixer/mixer.h index 05225b40..38e89ec3 100644 --- a/lib_xua/src/core/mixer/mixer.h +++ b/lib_xua/src/core/mixer/mixer.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __mixer_h__ #define __mixer_h__ diff --git a/lib_xua/src/core/mixer/mixer.xc b/lib_xua/src/core/mixer/mixer.xc index fe9dc766..7f8b6e05 100644 --- a/lib_xua/src/core/mixer/mixer.xc +++ b/lib_xua/src/core/mixer/mixer.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/lib_xua/src/core/mixer/repeat.h b/lib_xua/src/core/mixer/repeat.h index 99ec3bea..2246a940 100644 --- a/lib_xua/src/core/mixer/repeat.h +++ b/lib_xua/src/core/mixer/repeat.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef N #error "N must be defined before including repeat.h" #endif diff --git a/lib_xua/src/core/pdm_mics/mic_array_conf.h b/lib_xua/src/core/pdm_mics/mic_array_conf.h index 10840331..d0164c28 100644 --- a/lib_xua/src/core/pdm_mics/mic_array_conf.h +++ b/lib_xua/src/core/pdm_mics/mic_array_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MIC_ARRAY_CONF_H_ #define MIC_ARRAY_CONF_H_ diff --git a/lib_xua/src/core/pdm_mics/pdm_mic.xc b/lib_xua/src/core/pdm_mics/pdm_mic.xc index 137f289c..a69115d7 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic.xc +++ b/lib_xua/src/core/pdm_mics/pdm_mic.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2020, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" diff --git a/lib_xua/src/core/pdm_mics/pdm_mic_user.c b/lib_xua/src/core/pdm_mics/pdm_mic_user.c index f7a35f78..6171cfca 100644 --- a/lib_xua/src/core/pdm_mics/pdm_mic_user.c +++ b/lib_xua/src/core/pdm_mics/pdm_mic_user.c @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" diff --git a/lib_xua/src/core/ports/audioports.c b/lib_xua/src/core/ports/audioports.c index f97538d3..64795ba0 100644 --- a/lib_xua/src/core/ports/audioports.c +++ b/lib_xua/src/core/ports/audioports.c @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #define __ASSEMBLER__ // Work around for bug #14118 diff --git a/lib_xua/src/core/ports/audioports.h b/lib_xua/src/core/ports/audioports.h index e207be09..5f01fd9c 100644 --- a/lib_xua/src/core/ports/audioports.h +++ b/lib_xua/src/core/ports/audioports.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _AUDIOPORTS_H_ #define _AUDIOPORTS_H_ diff --git a/lib_xua/src/core/ports/audioports.xc b/lib_xua/src/core/ports/audioports.xc index 6f1b7e82..330b7f96 100644 --- a/lib_xua/src/core/ports/audioports.xc +++ b/lib_xua/src/core/ports/audioports.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/lib_xua/src/core/support/powersave/archU_powerSaving.h b/lib_xua/src/core/support/powersave/archU_powerSaving.h index 93d436cc..51f8281d 100644 --- a/lib_xua/src/core/support/powersave/archU_powerSaving.h +++ b/lib_xua/src/core/support/powersave/archU_powerSaving.h @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef ARCH_U_POWER_SAVING_ #define ARCH_U_POWER_SAVING_ diff --git a/lib_xua/src/core/support/powersave/archU_powerSaving.xc b/lib_xua/src/core/support/powersave/archU_powerSaving.xc index 8fea9efd..e6cd04c5 100644 --- a/lib_xua/src/core/support/powersave/archU_powerSaving.xc +++ b/lib_xua/src/core/support/powersave/archU_powerSaving.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if (XUD_SERIES_SUPPORT==1) #include "archU_powerSaving.h" diff --git a/lib_xua/src/core/support/reboot.xc b/lib_xua/src/core/support/reboot.xc index 50522b48..d4c33d27 100644 --- a/lib_xua/src/core/support/reboot.xc +++ b/lib_xua/src/core/support/reboot.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/lib_xua/src/core/support/xc_ptr.h b/lib_xua/src/core/support/xc_ptr.h index d662eb8b..7168d196 100644 --- a/lib_xua/src/core/support/xc_ptr.h +++ b/lib_xua/src/core/support/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/lib_xua/src/core/support/xc_ptr.xc b/lib_xua/src/core/support/xc_ptr.xc index d337f4d5..7f75a53d 100644 --- a/lib_xua/src/core/support/xc_ptr.xc +++ b/lib_xua/src/core/support/xc_ptr.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved +// Copyright 2012-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xc_ptr.h" extern inline xc_ptr array_to_xc_ptr(const unsigned a[]); diff --git a/lib_xua/src/core/uac_hwresources.h b/lib_xua/src/core/uac_hwresources.h index 2e465aba..0142a2a9 100644 --- a/lib_xua/src/core/uac_hwresources.h +++ b/lib_xua/src/core/uac_hwresources.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _UAC_HWRESOURCES_H_ #define _UAC_HWRESOURCES_H_ diff --git a/lib_xua/src/core/user/audiostream/audiostream.c b/lib_xua/src/core/user/audiostream/audiostream.c index 863bb1a0..24c7fe82 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.c +++ b/lib_xua/src/core/user/audiostream/audiostream.c @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* Default implementations of AudioStreamStop() and AudioStreamStart() * callbacks. diff --git a/lib_xua/src/core/user/audiostream/audiostream.h b/lib_xua/src/core/user/audiostream/audiostream.h index bb218fd5..1f27774e 100644 --- a/lib_xua/src/core/user/audiostream/audiostream.h +++ b/lib_xua/src/core/user/audiostream/audiostream.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _AUDIOSTREAM_H_ #define _AUDIOSTREAM_H_ diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 91b32290..72d47abb 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2020, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __USER_HID_H__ #define __USER_HID_H__ diff --git a/lib_xua/src/core/user/hostactive/hostactive.c b/lib_xua/src/core/user/hostactive/hostactive.c index 6e0a91e6..e1cf546c 100644 --- a/lib_xua/src/core/user/hostactive/hostactive.c +++ b/lib_xua/src/core/user/hostactive/hostactive.c @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. void UserHostActive(int active) __attribute__ ((weak)); void UserHostActive(int active) diff --git a/lib_xua/src/core/user/hostactive/hostactive.h b/lib_xua/src/core/user/hostactive/hostactive.h index afa1c139..fa100d10 100644 --- a/lib_xua/src/core/user/hostactive/hostactive.h +++ b/lib_xua/src/core/user/hostactive/hostactive.h @@ -1,3 +1,4 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. void UserHostActive(int active); diff --git a/lib_xua/src/core/warnings.xc b/lib_xua/src/core/warnings.xc index 11ebb139..16ffc49e 100644 --- a/lib_xua/src/core/warnings.xc +++ b/lib_xua/src/core/warnings.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* Warnings relating to configuration defines located in this XC source file rather than the devicedefines.h header file in order to avoid multiple warnings being issued when the devicedefines.h header file is included in multiple files. diff --git a/lib_xua/src/core/xua_commands.h b/lib_xua/src/core/xua_commands.h index 54a76b9e..0e2bcb15 100644 --- a/lib_xua/src/core/xua_commands.h +++ b/lib_xua/src/core/xua_commands.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_INTERNAL_CMDS_H__ #define __XUA_INTERNAL_CMDS_H__ diff --git a/lib_xua/src/core/xuduser/xuduser.c b/lib_xua/src/core/xuduser/xuduser.c index 831acc1f..207906e7 100644 --- a/lib_xua/src/core/xuduser/xuduser.c +++ b/lib_xua/src/core/xuduser/xuduser.c @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if XUA_USB_EN #include "xua.h" #include "hostactive.h" diff --git a/lib_xua/src/dfu/dfu.xc b/lib_xua/src/dfu/dfu.xc index 6e370b6c..1570c7eb 100644 --- a/lib_xua/src/dfu/dfu.xc +++ b/lib_xua/src/dfu/dfu.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if (XUA_DFU_EN== 1) #include diff --git a/lib_xua/src/dfu/dfu_interface.h b/lib_xua/src/dfu/dfu_interface.h index 4025b3f1..ed0ebff4 100644 --- a/lib_xua/src/dfu/dfu_interface.h +++ b/lib_xua/src/dfu/dfu_interface.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __DFU_INTERFACE_H__ #define __DFU_INTERFACE_H__ diff --git a/lib_xua/src/dfu/dfu_types.h b/lib_xua/src/dfu/dfu_types.h index d4e809ee..63038c4b 100644 --- a/lib_xua/src/dfu/dfu_types.h +++ b/lib_xua/src/dfu/dfu_types.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // Default Command requests (from Spec) #define DFU_DETACH 0 #define DFU_DNLOAD 1 diff --git a/lib_xua/src/dfu/flash_interface.c b/lib_xua/src/dfu/flash_interface.c index 69d66b97..078f4b54 100755 --- a/lib_xua/src/dfu/flash_interface.c +++ b/lib_xua/src/dfu/flash_interface.c @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/lib_xua/src/dfu/flash_interface.h b/lib_xua/src/dfu/flash_interface.h index 1c16522c..51d6f8fc 100755 --- a/lib_xua/src/dfu/flash_interface.h +++ b/lib_xua/src/dfu/flash_interface.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _flash_interface_h_ #define _flash_interface_h_ diff --git a/lib_xua/src/dfu/flashlib_user.c b/lib_xua/src/dfu/flashlib_user.c index d3ffa205..2ef7e47a 100644 --- a/lib_xua/src/dfu/flashlib_user.c +++ b/lib_xua/src/dfu/flashlib_user.c @@ -1,4 +1,5 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved +// Copyright 2012-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if (XUA_DFU_EN == 1) #include "uac_hwresources.h" diff --git a/lib_xua/src/dfu/xua_dfu.h b/lib_xua/src/dfu/xua_dfu.h index 172f7f3b..00cd772d 100644 --- a/lib_xua/src/dfu/xua_dfu.h +++ b/lib_xua/src/dfu/xua_dfu.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUA_DFU_H_ #define _XUA_DFU_H_ 1 diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 6a2e81f8..f3c741a1 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2019-2020, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include "descriptor_defs.h" diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 9e620788..1344b5a2 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -1,4 +1,5 @@ -// Copyright (c) 2019, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUA_HID_H__ #define __XUA_HID_H__ diff --git a/lib_xua/src/midi/midi_descriptor.h b/lib_xua/src/midi/midi_descriptor.h index 277f3984..9f13c9b3 100644 --- a/lib_xua/src/midi/midi_descriptor.h +++ b/lib_xua/src/midi/midi_descriptor.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* This file contains the MID device descriptor It is intended to be included in the main device descriptor definition */ diff --git a/lib_xua/src/midi/midiinparse.h b/lib_xua/src/midi/midiinparse.h index cb045a91..257820fd 100644 --- a/lib_xua/src/midi/midiinparse.h +++ b/lib_xua/src/midi/midiinparse.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MIDIINPARSE_XH #define MIDIINPARSE_XH diff --git a/lib_xua/src/midi/midiinparse.xc b/lib_xua/src/midi/midiinparse.xc index 68b5999b..8265cdce 100644 --- a/lib_xua/src/midi/midiinparse.xc +++ b/lib_xua/src/midi/midiinparse.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @file midiinparse.xc * @brief Generates USB MIDI events from MIDI events diff --git a/lib_xua/src/midi/midioutparse.h b/lib_xua/src/midi/midioutparse.h index 08734015..d1dc5fa6 100644 --- a/lib_xua/src/midi/midioutparse.h +++ b/lib_xua/src/midi/midioutparse.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MIDIOUTPARSE_XH #define MIDIOUTPARSE_XH diff --git a/lib_xua/src/midi/midioutparse.xc b/lib_xua/src/midi/midioutparse.xc index 566df9bd..11bc8fbb 100644 --- a/lib_xua/src/midi/midioutparse.xc +++ b/lib_xua/src/midi/midioutparse.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @file midioutparse.xc * @brief Parses USB-MIDI events into set of MIDI bytes diff --git a/lib_xua/src/midi/queue.h b/lib_xua/src/midi/queue.h index 27d54c72..af67e6e5 100644 --- a/lib_xua/src/midi/queue.h +++ b/lib_xua/src/midi/queue.h @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef QUEUE_H_ #define QUEUE_H_ diff --git a/lib_xua/src/midi/queue.xc b/lib_xua/src/midi/queue.xc index 125cbecd..6cab55f7 100644 --- a/lib_xua/src/midi/queue.xc +++ b/lib_xua/src/midi/queue.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "queue.h" // Force external definitions of inline functions. diff --git a/lib_xua/src/midi/usb_midi.h b/lib_xua/src/midi/usb_midi.h index 8db4d663..d1a03adc 100644 --- a/lib_xua/src/midi/usb_midi.h +++ b/lib_xua/src/midi/usb_midi.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __usb_midi_h__ #define __usb_midi_h__ diff --git a/lib_xua/src/midi/usb_midi.xc b/lib_xua/src/midi/usb_midi.xc index 4971a9af..ecb5059d 100644 --- a/lib_xua/src/midi/usb_midi.xc +++ b/lib_xua/src/midi/usb_midi.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/lib_xua/src/midi/usb_midi_support.xc b/lib_xua/src/midi/usb_midi_support.xc index ffaaf109..1ee5d080 100644 --- a/lib_xua/src/midi/usb_midi_support.xc +++ b/lib_xua/src/midi/usb_midi_support.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #define __MIDI_IMPL #include "usb_midi.h" diff --git a/python/setup.py b/python/setup.py index a6efe999..98d3d6a5 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,4 +1,5 @@ -# Copyright (c) 2020, XMOS Ltd, All rights reserved +# Copyright 2020-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import setuptools # Another repository might depend on python code defined in this one. The diff --git a/tests/app_test_i2s_loopback/debug_conf.h b/tests/app_test_i2s_loopback/debug_conf.h index a7c079dd..aadb0014 100644 --- a/tests/app_test_i2s_loopback/debug_conf.h +++ b/tests/app_test_i2s_loopback/debug_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __debug_conf_h__ #define __debug_conf_h__ diff --git a/tests/app_test_i2s_loopback/main.xc b/tests/app_test_i2s_loopback/main.xc index d6885126..9d012a49 100644 --- a/tests/app_test_i2s_loopback/main.xc +++ b/tests/app_test_i2s_loopback/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/app_test_i2s_loopback/simulation.xc b/tests/app_test_i2s_loopback/simulation.xc index f963ac59..68541ca1 100644 --- a/tests/app_test_i2s_loopback/simulation.xc +++ b/tests/app_test_i2s_loopback/simulation.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifdef SIMULATION #include diff --git a/tests/app_test_i2s_loopback/usb_device.h b/tests/app_test_i2s_loopback/usb_device.h index 43c365e3..1f5aaa89 100644 --- a/tests/app_test_i2s_loopback/usb_device.h +++ b/tests/app_test_i2s_loopback/usb_device.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __usb_device_h__ #define __usb_device_h__ diff --git a/tests/app_test_i2s_loopback/usb_device.xc b/tests/app_test_i2s_loopback/usb_device.xc index ca74b48e..7a205735 100644 --- a/tests/app_test_i2s_loopback/usb_device.xc +++ b/tests/app_test_i2s_loopback/usb_device.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if 0 #include #include diff --git a/tests/app_test_i2s_loopback/xk_216_mc/audiohw.xc b/tests/app_test_i2s_loopback/xk_216_mc/audiohw.xc index ad2884cd..3a8cde53 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/audiohw.xc +++ b/tests/app_test_i2s_loopback/xk_216_mc/audiohw.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifdef HARDWARE #include diff --git a/tests/app_test_i2s_loopback/xk_216_mc/cs2100.h b/tests/app_test_i2s_loopback/xk_216_mc/cs2100.h index 447ec877..bc5a0cdd 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/cs2100.h +++ b/tests/app_test_i2s_loopback/xk_216_mc/cs2100.h @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #define CS2100_I2C_DEVICE_ADDR (0x9c>>1) #define CS2100_DEVICE_CONTROL 0x02 diff --git a/tests/app_test_i2s_loopback/xk_216_mc/cs4384.h b/tests/app_test_i2s_loopback/xk_216_mc/cs4384.h index 98defbe3..6de83e81 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/cs4384.h +++ b/tests/app_test_i2s_loopback/xk_216_mc/cs4384.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef CS4384_H_ #define CS4384_H_ diff --git a/tests/app_test_i2s_loopback/xk_216_mc/cs5368.h b/tests/app_test_i2s_loopback/xk_216_mc/cs5368.h index 945ae536..d2de278d 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/cs5368.h +++ b/tests/app_test_i2s_loopback/xk_216_mc/cs5368.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _CS5368_H_ #define _CS5368_H_ diff --git a/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.c b/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.c index d6fc22d1..6d302c55 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.c +++ b/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.c @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifdef HARDWARE #include #include "gpio_access.h" diff --git a/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.h b/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.h index 1beac06f..93f66fee 100644 --- a/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.h +++ b/tests/app_test_i2s_loopback/xk_216_mc/gpio_access.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __gpio_access_h__ #define __gpio_access_h__ diff --git a/tests/app_test_i2s_loopback/xua_conf.h b/tests/app_test_i2s_loopback/xua_conf.h index 70298c70..bec236b1 100644 --- a/tests/app_test_i2s_loopback/xua_conf.h +++ b/tests/app_test_i2s_loopback/xua_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __custom_defines_h__ #define __custom_defines_h__ diff --git a/tests/runtests.py b/tests/runtests.py index 7d419e66..0fbc7f5d 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -1,5 +1,6 @@ #!/usr/bin/env python2.7 -# Copyright (c) 2018, XMOS Ltd, All rights reserved +# Copyright 2018-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest import os.path diff --git a/tests/test_i2s_loopback.py b/tests/test_i2s_loopback.py index f56bdcf6..3e65e2f6 100644 --- a/tests/test_i2s_loopback.py +++ b/tests/test_i2s_loopback.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2018, XMOS Ltd, All rights reserved +# Copyright 2018-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest def runtest_one_config(env, format, i2s_role, num_chans_in, num_chans_out, sample_rate): From 7ca9bc22fd55acfa2b65f6115546ea25c0354d8c Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Thu, 22 Apr 2021 17:18:26 +0100 Subject: [PATCH 229/233] Add changelog entry --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 035c89e6..18cf55ea 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,7 @@ lib_xua Change Log * FIXED: xmosdfu now fails with an error when given a directory (#119) * FIXED: Compilation errors related to HID code * FIXED: Runtime error when using mic array interface + * CHANGED: Use XMOS Public Licence Version 1 1.1.1 ----- From 45c5f3516569e708bf9b944269226e7982c952a2 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Fri, 23 Apr 2021 10:52:15 +0100 Subject: [PATCH 230/233] Fix readme --- README.rst | 3 ++- examples/AN00246_xua_example/README.rst | 8 +++----- examples/AN00247_xua_example_spdif_tx/README.rst | 8 +++----- examples/AN00248_xua_example_pdm_mics/README.rst | 8 +++----- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/README.rst b/README.rst index a569b661..78c6145c 100644 --- a/README.rst +++ b/README.rst @@ -49,7 +49,8 @@ Note, not all features may be supported at all sample frequencies, simultaneousl Software version and dependencies ................................. -.. libdeps:: +The CHANGELOG contains information about the current and previous versions. +For a list of direct dependencies, look for DEPENDENT_MODULES in lib_xua/module_build_info. Related Application Notes ......................... diff --git a/examples/AN00246_xua_example/README.rst b/examples/AN00246_xua_example/README.rst index ef159ebf..abe685d4 100644 --- a/examples/AN00246_xua_example/README.rst +++ b/examples/AN00246_xua_example/README.rst @@ -2,15 +2,13 @@ Simple USB Audio Device using lib_xua ===================================== -.. version:: 0.1.0 - Summary ------- -Required tools and libraries -............................ +Software dependencies +..................... -.. appdeps:: +For a list of direct dependencies, look for USED_MODULES in the Makefile. Required hardware ................. diff --git a/examples/AN00247_xua_example_spdif_tx/README.rst b/examples/AN00247_xua_example_spdif_tx/README.rst index 2026272a..509e5fee 100644 --- a/examples/AN00247_xua_example_spdif_tx/README.rst +++ b/examples/AN00247_xua_example_spdif_tx/README.rst @@ -2,15 +2,13 @@ Using lib_xua with lib_spdif (transmit) ======================================= -.. version:: 0.1.0 - Summary ------- -Required tools and libraries -............................ +Software dependencies +..................... -.. appdeps:: +For a list of direct dependencies, look for USED_MODULES in the Makefile. Required hardware ................. diff --git a/examples/AN00248_xua_example_pdm_mics/README.rst b/examples/AN00248_xua_example_pdm_mics/README.rst index 22e3776e..391cadde 100644 --- a/examples/AN00248_xua_example_pdm_mics/README.rst +++ b/examples/AN00248_xua_example_pdm_mics/README.rst @@ -2,18 +2,16 @@ Using lib_xua with lib_mic_array ================================ -.. version:: 0.1.0 - Summary ------- This applicaition note describes how to use ``lib_mic_array`` in conjunction with ``lib_xua`` to implement a USB Audio device with the ability to record from multiple PDM microphones. -Required tools and libraries -............................ +Software dependencies +..................... -.. appdeps:: +For a list of direct dependencies, look for USED_MODULES in the Makefile. Required hardware ................. From 700ba975e7b655ceff1ed47488a7845e6b79b05f Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 27 Apr 2021 16:27:48 +0100 Subject: [PATCH 231/233] Use sizeof to set length of the HID Report Descriptor reported in AC1 HID descriptor. Add comments to #endif statements. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 89d8ba3d..4e219a58 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -87,7 +87,7 @@ typedef struct #if ADAT_RX STR_TABLE_ENTRY(adatClockSourceStr); /* iClockSource for external S/PDIF clock */ #endif -#endif +#endif // AUDIO_CLASS == 2 #if (XUA_DFU_EN == 1) STR_TABLE_ENTRY(dfuStr); /* iInterface for DFU interface */ #endif @@ -361,7 +361,7 @@ StringDescTable_t g_strTable = #if ADAT_RX .adatClockSourceStr = XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING, #endif -#endif +#endif // AUDIO_CLASS == 2 #if (XUA_DFU_EN == 1) .dfuStr = XUA_DFU_EMPTY_STRING, #endif @@ -746,7 +746,7 @@ typedef struct #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_2; #endif -#endif +#endif // OUTPUT_FORMAT_COUNT > 1 #if (OUTPUT_FORMAT_COUNT > 2) USB_Descriptor_Interface_t Audio_Out_StreamInterface_Alt3; USB_Descriptor_Audio_Interface_AS_t Audio_Out_ClassStreamInterface_3; @@ -756,8 +756,8 @@ typedef struct #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) USB_Descriptor_Endpoint_t Audio_Out_Fb_Endpoint_3; #endif -#endif -#endif +#endif // OUTPUT_FORMAT_COUNT > 2 +#endif // NUM_USB_CHAN_OUT > 0 #if (NUM_USB_CHAN_IN > 0) /* Audio Streaming: Input stream */ USB_Descriptor_Interface_t Audio_In_StreamInterface_Alt0; /* Zero bandwith alternative */ @@ -780,7 +780,7 @@ typedef struct USB_Descriptor_Endpoint_t Audio_In_Endpoint_3; USB_Descriptor_Audio_Class_AS_Endpoint_t Audio_In_ClassEndpoint_3; #endif -#endif +#endif // NUM_USB_CHAN_IN > 0 #ifdef MIDI /* MIDI descriptors currently handled as a single block */ unsigned char configDesc_Midi[MIDI_LENGTH]; @@ -804,7 +804,7 @@ typedef struct USB_Descriptor_Endpoint_t iAP_EANativeTransport_Out_Endpoint; USB_Descriptor_Endpoint_t iAP_EANativeTransport_In_Endpoint; #endif -#endif +#endif // IAP #if( 0 < HID_CONTROLS ) USB_Descriptor_Interface_t HID_Interface; @@ -1939,8 +1939,8 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= .wLockDelay = 0x0008, }, #endif /* (INPUT_FORMAT_COUNT > 2) */ - #endif /* #if(NUM_USB_CHAN_IN > 0) */ + #ifdef MIDI /* MIDI Descriptors */ /* Table B-3: MIDI Adapter Standard AC Interface Descriptor */ @@ -2059,7 +2059,7 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x01, /* 3 bNumEmbMIDIJack : Number of embedded MIDI OUT Jacks. (field size 1 bytes) */ 0x03, /* 4 BaAssocJackID(1) : ID of the Embedded MIDI OUT Jack. (field size 1 bytes) */ }, -#endif +#endif // MIDI #if (XUA_DFU_EN == 1) /* Standard DFU class Interface descriptor */ @@ -2506,7 +2506,7 @@ unsigned char cfgDesc_Audio1[] = #error NUM_USB_CHAN_OUT_FS > 8 currently supported #endif 0x00, /* String table index */ -#endif +#endif // OUTPUT_VOLUME_CONTROL == 1 /* CS_Interface Output Terminal Descriptor - Analogue out to speaker */ 0x09, @@ -2521,7 +2521,7 @@ unsigned char cfgDesc_Audio1[] = 0x01, /* sourceID - IT */ #endif 0x00, /* Unused */ -#endif +#endif // NUM_USB_CHAN_OUT > 0 #if (NUM_USB_CHAN_IN > 0) #define CHANNEL_CONFIG_IN (0xFF >> (8 - NUM_USB_CHAN_IN_FS)) @@ -2589,8 +2589,8 @@ unsigned char cfgDesc_Audio1[] = #error NUM_USB_CHAN_IN_FS > 8 currently supported #endif 0x00, /* String table index */ -#endif -#endif +#endif // INPUT_VOLUME_CONTROL == 1 +#endif // NUM_USB_CHAN_IN > 0 #if (NUM_USB_CHAN_OUT > 0) /* Standard AS Interface Descriptor (4.5.1) */ @@ -2738,7 +2738,7 @@ unsigned char cfgDesc_Audio1[] = 0x04, /* bRefresh 2^x */ 0x0, /* bSynchAddress */ #endif -#endif +#endif // NUM_USB_CHAN_OUT > 0 #if (NUM_USB_CHAN_IN > 0) /* Standard Interface Descriptor - Audio streaming IN */ @@ -2863,7 +2863,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* Undefined */ 0x00, 0x00, /* Not used */ #endif // XUA_ADAPTIVE -#endif +#endif // NUM_USB_CHAN_IN > 0 #if (XUA_DFU_EN == 1) && (FORCE_UAC1_DFU == 1) @@ -2925,8 +2925,8 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x2B, /* 7 wDescriptorLength[0] */ - 0x00, /* 8 wDescriptorLength[0] */ + sizeof(hidReportDescriptor) & 0xff, /* 7 wDescriptorLength[0] */ + sizeof(hidReportDescriptor) >> 8, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ 0x07, /* 0 bLength */ @@ -2939,6 +2939,6 @@ unsigned char cfgDesc_Audio1[] = #endif }; +#endif // (AUDIO_CLASS_FALLBACK) || (AUDIO_CLASS == 1) #endif -#endif -#endif +#endif // _DEVICE_DESCRIPTORS_ From 0f392ffbb6b7593db276fa201471c7488dae8023 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 27 Apr 2021 16:35:05 +0100 Subject: [PATCH 232/233] Update change log --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 18cf55ea..a0fed19f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,7 @@ lib_xua Change Log * FIXED: Compilation errors related to HID code * FIXED: Runtime error when using mic array interface * CHANGED: Use XMOS Public Licence Version 1 + * FIXED: Automate HID Report Descriptor length in AC1 HID Descriptor 1.1.1 ----- From 70748bd1069b934ebb8af4188f703104dc325e6d Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 5 May 2021 15:03:03 +0100 Subject: [PATCH 233/233] Remove license files in test folders --- tests/app_test_i2s_loopback/LICENSE.rst | 84 ------------------------- 1 file changed, 84 deletions(-) delete mode 100644 tests/app_test_i2s_loopback/LICENSE.rst diff --git a/tests/app_test_i2s_loopback/LICENSE.rst b/tests/app_test_i2s_loopback/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/app_test_i2s_loopback/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply.