Skip to content

Commit

Permalink
Release 6.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxin-azrtos committed Oct 13, 2021
1 parent 3574b6b commit 54ec783
Show file tree
Hide file tree
Showing 71 changed files with 587 additions and 218 deletions.
17 changes: 12 additions & 5 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.1.8 */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -96,6 +96,11 @@
/* fixed spelling error, */
/* fixed trace ID order error, */
/* resulting in version 6.1.8 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* improved assert macros, */
/* added transfer size field, */
/* improved traceX support, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -149,7 +154,11 @@ typedef signed char SCHAR;
/* This defines the ASSERT and process on ASSERT fail. */
#ifdef UX_ENABLE_ASSERT
#ifndef UX_ASSERT_FAIL
#ifdef TX_API_H
#define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); }
#else
#define UX_ASSERT_FAIL for (;;) {}
#endif
#endif
#define UX_ASSERT(s) if (!(s)) {UX_ASSERT_FAIL}
#else
Expand Down Expand Up @@ -230,7 +239,7 @@ typedef signed char SCHAR;
#define AZURE_RTOS_USBX
#define USBX_MAJOR_VERSION 6
#define USBX_MINOR_VERSION 1
#define USBX_PATCH_VERSION 8
#define USBX_PATCH_VERSION 9

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

Expand Down Expand Up @@ -339,9 +348,6 @@ VOID _ux_utility_debug_log(UCHAR *debug_location, UCHAR *debug_message, ULONG de
/* Determine if tracing is enabled. */

#ifdef TX_ENABLE_EVENT_TRACE
#ifndef UX_TRACE_INSERT_MACROS
#error UX_TRACE_INSERT_MACROS must be defined to support TX_ENABLE_EVENT_TRACE
#endif

/* Trace is enabled. Remap calls so that interrupts can be disabled around the actual event logging. */

Expand Down Expand Up @@ -1912,6 +1918,7 @@ typedef struct UX_SLAVE_TRANSFER_STRUCT
ULONG ux_slave_transfer_request_requested_length;
ULONG ux_slave_transfer_request_actual_length;
ULONG ux_slave_transfer_request_in_transfer_length;
ULONG ux_slave_transfer_request_transfer_length;
ULONG ux_slave_transfer_request_completion_code;
ULONG ux_slave_transfer_request_phase;
VOID (*ux_slave_transfer_request_completion_function) (struct UX_SLAVE_TRANSFER_STRUCT *);
Expand Down
13 changes: 12 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.1.8 */
/* 6.1.9 */
/* */
/* AUTHOR */
/* */
Expand Down Expand Up @@ -65,6 +65,9 @@
/* 08-02-2021 Wen Wang Modified comment(s), */
/* fixed spelling error, */
/* resulting in version 6.1.8 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* added option for assert, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/

Expand Down Expand Up @@ -387,6 +390,14 @@
#define UX_DEBUG_LOG_SIZE (1024 * 16)


/* Defined, this enables the assert checks inside usbx. */
#define UX_ENABLE_ASSERT

/* Defined, this defines the assert action taken when failure detected. By default
it halts without any output. */
/* #define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); } */


/* DEBUG includes and macros for a specific platform go here. */
#ifdef UX_INCLUDE_USER_DEFINE_BSP
#include "usb_bsp.h"
Expand Down
7 changes: 6 additions & 1 deletion common/core/src/ux_dcd_sim_slave_initialize_complete.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_dcd_sim_slave_initialize_complete PORTABLE C */
/* 6.1.6 */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -72,6 +72,9 @@
/* 04-02-2021 Chaoqiong Xiao Modified comment(s), */
/* added framework init cases, */
/* resulting in version 6.1.6 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* filled payload size, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/
UINT _ux_dcd_sim_slave_initialize_complete(VOID)
Expand Down Expand Up @@ -137,6 +140,8 @@ UX_SLAVE_TRANSFER *transfer_request;
/* On the control endpoint, always expect the maximum. */
transfer_request -> ux_slave_transfer_request_requested_length =
device -> ux_slave_device_descriptor.bMaxPacketSize0;
transfer_request -> ux_slave_transfer_request_transfer_length =
device -> ux_slave_device_descriptor.bMaxPacketSize0;

/* Attach the control endpoint to the transfer request. */
transfer_request -> ux_slave_transfer_request_endpoint = &device -> ux_slave_device_control_endpoint;
Expand Down
32 changes: 30 additions & 2 deletions common/core/src/ux_device_stack_alternate_setting_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_alternate_setting_set PORTABLE C */
/* 6.1 */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -78,6 +78,9 @@
/* definitions, verified */
/* memset and memcpy cases, */
/* resulting in version 6.1 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* calculated payload size, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/
UINT _ux_device_stack_alternate_setting_set(ULONG interface_value, ULONG alternate_setting_value)
Expand All @@ -101,6 +104,7 @@ ULONG endpoints_pool_number;
UX_SLAVE_CLASS_COMMAND class_command;
UX_SLAVE_CLASS *class;
UINT status;
ULONG max_transfer_length, n_trans;
#endif

/* If trace is enabled, insert this event into the trace buffer. */
Expand Down Expand Up @@ -305,10 +309,34 @@ UINT status;
_ux_system_endpoint_descriptor_structure,
UX_ENDPOINT_DESCRIPTOR_ENTRIES,
(UCHAR *) &endpoint -> ux_slave_endpoint_descriptor);

/* Now we create a transfer request to accept transfer on this endpoint. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;

/* Validate descriptor wMaxPacketSize. */
UX_ASSERT(endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize != 0);

/* Calculate endpoint transfer payload max size. */
max_transfer_length =
endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
UX_MAX_PACKET_SIZE_MASK;
if ((_ux_system_slave -> ux_system_slave_speed == UX_HIGH_SPEED_DEVICE) &&
(endpoint -> ux_slave_endpoint_descriptor.bmAttributes & 0x1u))
{
n_trans = endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
UX_MAX_NUMBER_OF_TRANSACTIONS_MASK;
if (n_trans)
{
n_trans >>= UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT;
n_trans ++;
max_transfer_length *= n_trans;
}
}

/* Validate max transfer size and save it. */
UX_ASSERT(max_transfer_length <= UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
transfer_request -> ux_slave_transfer_request_transfer_length = max_transfer_length;

/* We store the endpoint in the transfer request as well. */
transfer_request -> ux_slave_transfer_request_endpoint = endpoint;

Expand Down
11 changes: 8 additions & 3 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 */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -80,6 +80,10 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* fixed possible buffer issue */
/* for control vendor request, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/
UINT _ux_device_stack_control_request_process(UX_SLAVE_TRANSFER *transfer_request)
Expand Down Expand Up @@ -138,6 +142,7 @@ ULONG application_data_length;

/* This is a Microsoft extended function. It happens before the device is configured.
The request is passed to the application directly. */
application_data_length = UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH;
status = _ux_system_slave -> ux_system_slave_device_vendor_request_function(request, request_value,
request_index, request_length,
transfer_request -> ux_slave_transfer_request_data_pointer,
Expand All @@ -155,9 +160,9 @@ ULONG application_data_length;

/* Set the direction to OUT. */
transfer_request -> ux_slave_transfer_request_phase = UX_TRANSFER_PHASE_DATA_OUT;

/* Perform the data transfer. */
_ux_device_stack_transfer_request(transfer_request, request_length, application_data_length);
_ux_device_stack_transfer_request(transfer_request, application_data_length, request_length);

/* We are done here. */
return(UX_SUCCESS);
Expand Down
30 changes: 29 additions & 1 deletion common/core/src/ux_device_stack_interface_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_interface_set PORTABLE C */
/* 6.1 */
/* 6.1.9 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
Expand Down Expand Up @@ -76,6 +76,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* calculated payload size, */
/* resulting in version 6.1.9 */
/* */
/**************************************************************************/
UINT _ux_device_stack_interface_set(UCHAR * device_framework, ULONG device_framework_length,
Expand All @@ -96,6 +99,7 @@ ULONG descriptor_length;
UCHAR descriptor_type;
ULONG endpoints_pool_number;
UINT status;
ULONG max_transfer_length, n_trans;

UX_PARAMETER_NOT_USED(alternate_setting_value);

Expand Down Expand Up @@ -226,6 +230,30 @@ UINT status;
/* Now we create a transfer request to accept transfer on this endpoint. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;

/* Validate endpoint descriptor wMaxPacketSize. */
UX_ASSERT(endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize != 0);

/* Calculate endpoint transfer payload max size. */
max_transfer_length =
endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
UX_MAX_PACKET_SIZE_MASK;
if ((_ux_system_slave -> ux_system_slave_speed == UX_HIGH_SPEED_DEVICE) &&
(endpoint -> ux_slave_endpoint_descriptor.bmAttributes & 0x1u))
{
n_trans = endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
UX_MAX_NUMBER_OF_TRANSACTIONS_MASK;
if (n_trans)
{
n_trans >>= UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT;
n_trans ++;
max_transfer_length *= n_trans;
}
}

/* Validate max transfer size and save it. */
UX_ASSERT(max_transfer_length <= UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
transfer_request -> ux_slave_transfer_request_transfer_length = max_transfer_length;

/* We store the endpoint in the transfer request as well. */
transfer_request -> ux_slave_transfer_request_endpoint = endpoint;

Expand Down
Loading

0 comments on commit 54ec783

Please sign in to comment.