Skip to content

Commit

Permalink
Release 6.2.1 on 08 Mar 2023. Expand to see details.
Browse files Browse the repository at this point in the history
e180182e Update owners
a6785db8 Update for release.
bc77918b Improve host audio sampling set and check (fixed a memory issue).
97d66e5d Add optimization options to ux_user.h
eea2c732 USBX device printer error checking support.
1760cc8c USBX device audio error checking support
a39f2f26 Fixed a macro name issue in device audio 1.0
83278dd8 Supported multiple report IDs in host HID.
c548fe33 Fixed host CDC-ACM capability get.
b64f8cdb Fix vendor request handling.
  • Loading branch information
xiaocq2001 committed Mar 8, 2023
1 parent 813361a commit 2d357c5
Show file tree
Hide file tree
Showing 58 changed files with 1,694 additions and 148 deletions.
17 changes: 15 additions & 2 deletions common/core/inc/ux_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* ux_api.h PORTABLE C */
/* 6.2.0 */
/* 6.2.1 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -128,6 +128,11 @@
/* added interface instance */
/* creation strategy control, */
/* resulting in version 6.2.0 */
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* accepted UX_MAX_CLASSES as */
/* max class driver configure, */
/* added a new error code, */
/* resulting in version 6.2.1 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -255,6 +260,13 @@ typedef signed char SCHAR;
#define UX_MAX_SLAVE_INTERFACES 16
#endif

/* Define USBX max number of classes (1 ~ n). */
#ifndef UX_MAX_CLASSES
#define UX_MAX_CLASSES 2
#endif
#ifndef UX_MAX_CLASS_DRIVER
#define UX_MAX_CLASS_DRIVER UX_MAX_CLASSES
#endif

/* Define USBX max number of devices (1 ~ n). */
#ifndef UX_MAX_DEVICES
Expand Down Expand Up @@ -295,7 +307,7 @@ typedef signed char SCHAR;
#define AZURE_RTOS_USBX
#define USBX_MAJOR_VERSION 6
#define USBX_MINOR_VERSION 2
#define USBX_PATCH_VERSION 0
#define USBX_PATCH_VERSION 1

/* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */

Expand Down Expand Up @@ -1417,6 +1429,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_INVALID_PARAMETER 0xfa
#define UX_ABORTED 0xf9
#define UX_MATH_OVERFLOW 0xf8
#define UX_INVALID_BUILD_OPTION 0xf7

#define UX_TOO_MANY_DEVICES 0x11
#define UX_MEMORY_INSUFFICIENT 0x12
Expand Down
50 changes: 49 additions & 1 deletion common/core/inc/ux_user_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* ux_user.h PORTABLE C */
/* 6.2.0 */
/* 6.2.1 */
/* */
/* AUTHOR */
/* */
Expand Down Expand Up @@ -89,6 +89,16 @@
/* added host stack instance */
/* creation strategy control, */
/* resulting in version 6.2.0 */
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added option to disable dev */
/* alternate setting support, */
/* added option to disable dev */
/* framework initialize scan, */
/* added option to reference */
/* names by pointer to chars, */
/* added option to enable */
/* basic USBX error checking, */
/* resulting in version 6.2.1 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -409,6 +419,30 @@

/* #define UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT */

/* Defined, this macro disables interface alternate setting support.
Device stalls
*/
/* UX_DEVICE_ALTERNATE_SETTING_SUPPORT_DISABLE */


/* Defined, this macro disables device framework scan, where max number of endpoints (except EP0)
and max number of interfaces are calculated at runtime, as a base to allocate memory for
interfaces and endpoints structures and their buffers.
Undefined, the following two macros must be defined to initialize memory structures.
*/
/* #define UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE */

/* Works if UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined.
This value represents max number of endpoints (except EP0) activated at the same time.
*/
/* #define UX_MAX_DEVICE_ENDPOINTS 2 */

/* Works if UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined.
This value represents max number of interfaces activated at the same time.
*/
/* #define UX_MAX_DEVICE_INTERFACES 1 */


/* Defined, this macro enables device/host PIMA MTP support. */

/* #define UX_PIMA_WITH_MTP_SUPPORT */
Expand All @@ -421,6 +455,7 @@

/* #define UX_HOST_DEVICE_CLASS_CODE_VALIDATION_ENABLE */


/* Defined, host HID interrupt OUT transfer is supported. */

/* #define UX_HOST_CLASS_HID_INTERRUPT_OUT_SUPPORT */
Expand Down Expand Up @@ -448,6 +483,12 @@
*/
/* #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED */

/* Defined, the _name in structs are referenced by pointer instead of by contents.
By default the _name is an array of string that saves characters, the contents are compared to confirm match.
If referenced by pointer the address pointer to const string is saved, the pointers are compared to confirm match.
*/
/* #define UX_NAME_REFERENCED_BY_POINTER */

/* Defined, this value will only enable the host side of usbx. */
/* #define UX_HOST_SIDE_ONLY */

Expand Down Expand Up @@ -522,6 +563,13 @@
/* #define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); } */


/* Defined, this option enables the basic USBX error checking. This define is typically used
when the application is debugging and removed after the application is fully debugged. */
/*
#define UX_ENABLE_ERROR_CHECKING
*/


/* DEBUG includes and macros for a specific platform go here. */
#ifdef UX_INCLUDE_USER_DEFINE_BSP
#include "usb_bsp.h"
Expand Down
8 changes: 6 additions & 2 deletions common/core/src/ux_device_stack_control_request_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_control_request_process PORTABLE C */
/* 6.1.12 */
/* 6.2.1 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -91,6 +91,9 @@
/* fixed parameter/variable */
/* names conflict C++ keyword, */
/* resulting in version 6.1.12 */
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* fixed vendor request issue, */
/* resulting in version 6.2.1 */
/* */
/**************************************************************************/
UINT _ux_device_stack_control_request_process(UX_SLAVE_TRANSFER *transfer_request)
Expand Down Expand Up @@ -144,7 +147,8 @@ ULONG application_data_length;
{

/* Check the request demanded and compare it to the application registered one. */
if (request == _ux_system_slave -> ux_system_slave_device_vendor_request)
if (_ux_system_slave -> ux_system_slave_device_vendor_request_function != UX_NULL &&
request == _ux_system_slave -> ux_system_slave_device_vendor_request)
{

/* This is a Microsoft extended function. It happens before the device is configured.
Expand Down
91 changes: 88 additions & 3 deletions common/usbx_device_classes/inc/ux_device_class_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_audio.h PORTABLE C */
/* 6.2.0 */
/* 6.2.1 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -62,6 +62,9 @@
/* 10-31-2022 Yajun Xia Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.2.0 */
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
/* */
/**************************************************************************/

Expand All @@ -85,6 +88,13 @@ extern "C" {
/* Compile option: if defined, audio interrupt endpoint is supported. */
/* #define UX_DEVICE_CLASS_AUDIO_INTERRUPT_SUPPORT */

/* Internal option: enable the basic USBX error checking. This define is typically used
while debugging application. */
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING)
#define UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING
#endif



/* Define Audio Class OS related constants. */
#define UX_DEVICE_CLASS_AUDIO_FEEDBACK_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE
Expand Down Expand Up @@ -514,12 +524,85 @@ VOID _ux_device_class_audio_interrupt_thread_entry(ULONG audio_inst);
UINT _ux_device_class_audio_interrupt_task_function(UX_DEVICE_CLASS_AUDIO *audio);
UINT _ux_device_class_audio_interrupt_send(UX_DEVICE_CLASS_AUDIO *audio, UCHAR *int_data);

#if defined(UX_DEVICE_STANDALONE)
UINT _ux_device_class_audio_tasks_run(VOID *instance);
#endif


UINT _uxe_device_class_audio_initialize(UX_SLAVE_CLASS_COMMAND *command);

UINT _uxe_device_class_audio_ioctl(UX_DEVICE_CLASS_AUDIO *audio, ULONG ioctl_function,
VOID *parameter);

UINT _uxe_device_class_audio_stream_get(UX_DEVICE_CLASS_AUDIO *audio, ULONG stream_index, UX_DEVICE_CLASS_AUDIO_STREAM **stream);

VOID _uxe_device_class_audio_write_thread_entry(ULONG audio_stream);
VOID _uxe_device_class_audio_read_thread_entry(ULONG audio_stream);
UINT _uxe_device_class_audio_write_task_function(UX_DEVICE_CLASS_AUDIO_STREAM *stream);
UINT _uxe_device_class_audio_read_task_function(UX_DEVICE_CLASS_AUDIO_STREAM *stream);
UINT _uxe_device_class_audio_reception_start(UX_DEVICE_CLASS_AUDIO_STREAM *audio);
UINT _uxe_device_class_audio_sample_read8(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR *sample);
UINT _uxe_device_class_audio_sample_read16(UX_DEVICE_CLASS_AUDIO_STREAM *audio, USHORT *sample);
UINT _uxe_device_class_audio_sample_read24(UX_DEVICE_CLASS_AUDIO_STREAM *audio, ULONG *sample);
UINT _uxe_device_class_audio_sample_read32(UX_DEVICE_CLASS_AUDIO_STREAM *audio, ULONG *sample);

UINT _uxe_device_class_audio_read_frame_get(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR **frame_data, ULONG *frame_length);
UINT _uxe_device_class_audio_read_frame_free(UX_DEVICE_CLASS_AUDIO_STREAM *audio);

UINT _uxe_device_class_audio_transmission_start(UX_DEVICE_CLASS_AUDIO_STREAM *audio);
UINT _uxe_device_class_audio_frame_write(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR *frame, ULONG length);

UINT _uxe_device_class_audio_write_frame_get(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR **buffer, ULONG *max_length);
UINT _uxe_device_class_audio_write_frame_commit(UX_DEVICE_CLASS_AUDIO_STREAM *audio, ULONG length);

UINT _uxe_device_class_audio_feedback_set(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR *encoded_feedback);
UINT _uxe_device_class_audio_feedback_get(UX_DEVICE_CLASS_AUDIO_STREAM *audio, UCHAR *encoded_feedback);
ULONG _uxe_device_class_audio_speed_get(UX_DEVICE_CLASS_AUDIO_STREAM *audio);

VOID _uxe_device_class_audio_interrupt_thread_entry(ULONG audio_inst);
UINT _uxe_device_class_audio_interrupt_task_function(UX_DEVICE_CLASS_AUDIO *audio);
UINT _uxe_device_class_audio_interrupt_send(UX_DEVICE_CLASS_AUDIO *audio, UCHAR *int_data);


/* Define Device Class Audio API prototypes. */

#if defined(UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING)

#define ux_device_class_audio_entry _ux_device_class_audio_entry

#define ux_device_class_audio_read_thread_entry _ux_device_class_audio_read_thread_entry
#define ux_device_class_audio_write_thread_entry _ux_device_class_audio_write_thread_entry

#define ux_device_class_audio_read_task_function _ux_device_class_audio_read_task_function
#define ux_device_class_audio_write_task_function _ux_device_class_audio_write_task_function

#define ux_device_class_audio_stream_get _uxe_device_class_audio_stream_get

#define ux_device_class_audio_reception_start _uxe_device_class_audio_reception_start
#define ux_device_class_audio_sample_read8 _uxe_device_class_audio_sample_read8
#define ux_device_class_audio_sample_read16 _uxe_device_class_audio_sample_read16
#define ux_device_class_audio_sample_read24 _uxe_device_class_audio_sample_read24
#define ux_device_class_audio_sample_read32 _uxe_device_class_audio_sample_read32

#define ux_device_class_audio_read_frame_get _uxe_device_class_audio_read_frame_get
#define ux_device_class_audio_read_frame_free _uxe_device_class_audio_read_frame_free

#define ux_device_class_audio_transmission_start _uxe_device_class_audio_transmission_start
#define ux_device_class_audio_frame_write _uxe_device_class_audio_frame_write

#define ux_device_class_audio_write_frame_get _uxe_device_class_audio_write_frame_get
#define ux_device_class_audio_write_frame_commit _uxe_device_class_audio_write_frame_commit

#define ux_device_class_audio_ioctl _uxe_device_class_audio_ioctl

#define ux_device_class_audio_speed_get _ux_device_class_audio_speed_get
#define ux_device_class_audio_feedback_thread_entry _ux_device_class_audio_feedback_thread_entry
#define ux_device_class_audio_feedback_task_function _ux_device_class_audio_feedback_task_function
#define ux_device_class_audio_feedback_get _uxe_device_class_audio_feedback_get
#define ux_device_class_audio_feedback_set _uxe_device_class_audio_feedback_set

#define ux_device_class_audio_interrupt_send _uxe_device_class_audio_interrupt_send

#else

#define ux_device_class_audio_entry _ux_device_class_audio_entry

#define ux_device_class_audio_read_thread_entry _ux_device_class_audio_read_thread_entry
Expand Down Expand Up @@ -555,6 +638,8 @@ UINT _ux_device_class_audio_tasks_run(VOID *instance);

#define ux_device_class_audio_interrupt_send _ux_device_class_audio_interrupt_send

#endif

/* Determine if a C++ compiler is being used. If so, complete the standard
C conditional started above. */
#ifdef __cplusplus
Expand Down
27 changes: 25 additions & 2 deletions common/usbx_device_classes/inc/ux_device_class_audio10.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_audio10.h PORTABLE C */
/* 6.1.12 */
/* 6.2.1 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand All @@ -53,6 +53,10 @@
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
/* added sampling control, */
/* resulting in version 6.1.12 */
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* fixed a macro name, */
/* resulting in version 6.2.1 */
/* */
/**************************************************************************/

Expand All @@ -70,6 +74,13 @@ extern "C" {
#endif


/* Internal option: enable the basic USBX error checking. This define is typically used
while debugging application. */
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING)
#define UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING
#endif


/* Define Audio Class specific AC interface descriptor subclasses. */

#define UX_DEVICE_CLASS_AUDIO10_AC_UNDEFINED 0x00
Expand Down Expand Up @@ -377,7 +388,7 @@ typedef struct UX_DEVICE_CLASS_AUDIO10_CONTROL_STRUCT

#define UX_DEVICE_CLASS_AUDIO10_CONTROL_MUTE_CHANGED 1u
#define UX_DEVICE_CLASS_AUDIO10_CONTROL_VOLUME_CHANGED 2u
#define UX_DEVICE_CLASS_AUDIO20_CONTROL_FREQUENCY_CHANGED 4u
#define UX_DEVICE_CLASS_AUDIO10_CONTROL_FREQUENCY_CHANGED 4u

typedef struct UX_DEVICE_CLASS_AUDIO10_CONTROL_GROUP_STRUCT
{
Expand All @@ -389,8 +400,20 @@ UINT _ux_device_class_audio10_control_process(UX_DEVICE_CLASS_AUDIO *audio,
UX_SLAVE_TRANSFER *transfer_request,
UX_DEVICE_CLASS_AUDIO10_CONTROL_GROUP *group);

UINT _uxe_device_class_audio10_control_process(UX_DEVICE_CLASS_AUDIO *audio,
UX_SLAVE_TRANSFER *transfer_request,
UX_DEVICE_CLASS_AUDIO10_CONTROL_GROUP *group);

#if defined(UX_DEVICE_CLASS_AUDIO_ENABLE_ERROR_CHECKING)

#define ux_device_class_audio10_control_process _uxe_device_class_audio10_control_process

#else

#define ux_device_class_audio10_control_process _ux_device_class_audio10_control_process

#endif

/* Determine if a C++ compiler is being used. If so, complete the standard
C conditional started above. */
#ifdef __cplusplus
Expand Down
Loading

0 comments on commit 2d357c5

Please sign in to comment.