Skip to content

Commit 54ec783

Browse files
committed
Release 6.1.9
1 parent 3574b6b commit 54ec783

File tree

71 files changed

+587
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+587
-218
lines changed

common/core/inc/ux_api.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* APPLICATION INTERFACE DEFINITION RELEASE */
2727
/* */
2828
/* ux_api.h PORTABLE C */
29-
/* 6.1.8 */
29+
/* 6.1.9 */
3030
/* AUTHOR */
3131
/* */
3232
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -96,6 +96,11 @@
9696
/* fixed spelling error, */
9797
/* fixed trace ID order error, */
9898
/* resulting in version 6.1.8 */
99+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
100+
/* improved assert macros, */
101+
/* added transfer size field, */
102+
/* improved traceX support, */
103+
/* resulting in version 6.1.9 */
99104
/* */
100105
/**************************************************************************/
101106

@@ -149,7 +154,11 @@ typedef signed char SCHAR;
149154
/* This defines the ASSERT and process on ASSERT fail. */
150155
#ifdef UX_ENABLE_ASSERT
151156
#ifndef UX_ASSERT_FAIL
157+
#ifdef TX_API_H
152158
#define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); }
159+
#else
160+
#define UX_ASSERT_FAIL for (;;) {}
161+
#endif
153162
#endif
154163
#define UX_ASSERT(s) if (!(s)) {UX_ASSERT_FAIL}
155164
#else
@@ -230,7 +239,7 @@ typedef signed char SCHAR;
230239
#define AZURE_RTOS_USBX
231240
#define USBX_MAJOR_VERSION 6
232241
#define USBX_MINOR_VERSION 1
233-
#define USBX_PATCH_VERSION 8
242+
#define USBX_PATCH_VERSION 9
234243

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

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

341350
#ifdef TX_ENABLE_EVENT_TRACE
342-
#ifndef UX_TRACE_INSERT_MACROS
343-
#error UX_TRACE_INSERT_MACROS must be defined to support TX_ENABLE_EVENT_TRACE
344-
#endif
345351

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

@@ -1912,6 +1918,7 @@ typedef struct UX_SLAVE_TRANSFER_STRUCT
19121918
ULONG ux_slave_transfer_request_requested_length;
19131919
ULONG ux_slave_transfer_request_actual_length;
19141920
ULONG ux_slave_transfer_request_in_transfer_length;
1921+
ULONG ux_slave_transfer_request_transfer_length;
19151922
ULONG ux_slave_transfer_request_completion_code;
19161923
ULONG ux_slave_transfer_request_phase;
19171924
VOID (*ux_slave_transfer_request_completion_function) (struct UX_SLAVE_TRANSFER_STRUCT *);

common/core/inc/ux_user_sample.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* PORT SPECIFIC C INFORMATION RELEASE */
2727
/* */
2828
/* ux_user.h PORTABLE C */
29-
/* 6.1.8 */
29+
/* 6.1.9 */
3030
/* */
3131
/* AUTHOR */
3232
/* */
@@ -65,6 +65,9 @@
6565
/* 08-02-2021 Wen Wang Modified comment(s), */
6666
/* fixed spelling error, */
6767
/* resulting in version 6.1.8 */
68+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
69+
/* added option for assert, */
70+
/* resulting in version 6.1.9 */
6871
/* */
6972
/**************************************************************************/
7073

@@ -387,6 +390,14 @@
387390
#define UX_DEBUG_LOG_SIZE (1024 * 16)
388391

389392

393+
/* Defined, this enables the assert checks inside usbx. */
394+
#define UX_ENABLE_ASSERT
395+
396+
/* Defined, this defines the assert action taken when failure detected. By default
397+
it halts without any output. */
398+
/* #define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); } */
399+
400+
390401
/* DEBUG includes and macros for a specific platform go here. */
391402
#ifdef UX_INCLUDE_USER_DEFINE_BSP
392403
#include "usb_bsp.h"

common/core/src/ux_dcd_sim_slave_initialize_complete.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/* FUNCTION RELEASE */
3535
/* */
3636
/* _ux_dcd_sim_slave_initialize_complete PORTABLE C */
37-
/* 6.1.6 */
37+
/* 6.1.9 */
3838
/* AUTHOR */
3939
/* */
4040
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
7272
/* 04-02-2021 Chaoqiong Xiao Modified comment(s), */
7373
/* added framework init cases, */
7474
/* resulting in version 6.1.6 */
75+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
76+
/* filled payload size, */
77+
/* resulting in version 6.1.9 */
7578
/* */
7679
/**************************************************************************/
7780
UINT _ux_dcd_sim_slave_initialize_complete(VOID)
@@ -137,6 +140,8 @@ UX_SLAVE_TRANSFER *transfer_request;
137140
/* On the control endpoint, always expect the maximum. */
138141
transfer_request -> ux_slave_transfer_request_requested_length =
139142
device -> ux_slave_device_descriptor.bMaxPacketSize0;
143+
transfer_request -> ux_slave_transfer_request_transfer_length =
144+
device -> ux_slave_device_descriptor.bMaxPacketSize0;
140145

141146
/* Attach the control endpoint to the transfer request. */
142147
transfer_request -> ux_slave_transfer_request_endpoint = &device -> ux_slave_device_control_endpoint;

common/core/src/ux_device_stack_alternate_setting_set.c

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/* FUNCTION RELEASE */
3535
/* */
3636
/* _ux_device_stack_alternate_setting_set PORTABLE C */
37-
/* 6.1 */
37+
/* 6.1.9 */
3838
/* AUTHOR */
3939
/* */
4040
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
7878
/* definitions, verified */
7979
/* memset and memcpy cases, */
8080
/* resulting in version 6.1 */
81+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
82+
/* calculated payload size, */
83+
/* resulting in version 6.1.9 */
8184
/* */
8285
/**************************************************************************/
8386
UINT _ux_device_stack_alternate_setting_set(ULONG interface_value, ULONG alternate_setting_value)
@@ -101,6 +104,7 @@ ULONG endpoints_pool_number;
101104
UX_SLAVE_CLASS_COMMAND class_command;
102105
UX_SLAVE_CLASS *class;
103106
UINT status;
107+
ULONG max_transfer_length, n_trans;
104108
#endif
105109

106110
/* If trace is enabled, insert this event into the trace buffer. */
@@ -305,10 +309,34 @@ UINT status;
305309
_ux_system_endpoint_descriptor_structure,
306310
UX_ENDPOINT_DESCRIPTOR_ENTRIES,
307311
(UCHAR *) &endpoint -> ux_slave_endpoint_descriptor);
308-
312+
309313
/* Now we create a transfer request to accept transfer on this endpoint. */
310314
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
311315

316+
/* Validate descriptor wMaxPacketSize. */
317+
UX_ASSERT(endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize != 0);
318+
319+
/* Calculate endpoint transfer payload max size. */
320+
max_transfer_length =
321+
endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
322+
UX_MAX_PACKET_SIZE_MASK;
323+
if ((_ux_system_slave -> ux_system_slave_speed == UX_HIGH_SPEED_DEVICE) &&
324+
(endpoint -> ux_slave_endpoint_descriptor.bmAttributes & 0x1u))
325+
{
326+
n_trans = endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
327+
UX_MAX_NUMBER_OF_TRANSACTIONS_MASK;
328+
if (n_trans)
329+
{
330+
n_trans >>= UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT;
331+
n_trans ++;
332+
max_transfer_length *= n_trans;
333+
}
334+
}
335+
336+
/* Validate max transfer size and save it. */
337+
UX_ASSERT(max_transfer_length <= UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
338+
transfer_request -> ux_slave_transfer_request_transfer_length = max_transfer_length;
339+
312340
/* We store the endpoint in the transfer request as well. */
313341
transfer_request -> ux_slave_transfer_request_endpoint = endpoint;
314342

common/core/src/ux_device_stack_control_request_process.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/* FUNCTION RELEASE */
3434
/* */
3535
/* _ux_device_stack_control_request_process PORTABLE C */
36-
/* 6.1 */
36+
/* 6.1.9 */
3737
/* AUTHOR */
3838
/* */
3939
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -80,6 +80,10 @@
8080
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
8181
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
8282
/* resulting in version 6.1 */
83+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
84+
/* fixed possible buffer issue */
85+
/* for control vendor request, */
86+
/* resulting in version 6.1.9 */
8387
/* */
8488
/**************************************************************************/
8589
UINT _ux_device_stack_control_request_process(UX_SLAVE_TRANSFER *transfer_request)
@@ -138,6 +142,7 @@ ULONG application_data_length;
138142

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

156161
/* Set the direction to OUT. */
157162
transfer_request -> ux_slave_transfer_request_phase = UX_TRANSFER_PHASE_DATA_OUT;
158-
163+
159164
/* Perform the data transfer. */
160-
_ux_device_stack_transfer_request(transfer_request, request_length, application_data_length);
165+
_ux_device_stack_transfer_request(transfer_request, application_data_length, request_length);
161166

162167
/* We are done here. */
163168
return(UX_SUCCESS);

common/core/src/ux_device_stack_interface_set.c

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/* FUNCTION RELEASE */
3535
/* */
3636
/* _ux_device_stack_interface_set PORTABLE C */
37-
/* 6.1 */
37+
/* 6.1.9 */
3838
/* AUTHOR */
3939
/* */
4040
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -76,6 +76,9 @@
7676
/* optimized based on compile */
7777
/* definitions, */
7878
/* resulting in version 6.1 */
79+
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
80+
/* calculated payload size, */
81+
/* resulting in version 6.1.9 */
7982
/* */
8083
/**************************************************************************/
8184
UINT _ux_device_stack_interface_set(UCHAR * device_framework, ULONG device_framework_length,
@@ -96,6 +99,7 @@ ULONG descriptor_length;
9699
UCHAR descriptor_type;
97100
ULONG endpoints_pool_number;
98101
UINT status;
102+
ULONG max_transfer_length, n_trans;
99103

100104
UX_PARAMETER_NOT_USED(alternate_setting_value);
101105

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

233+
/* Validate endpoint descriptor wMaxPacketSize. */
234+
UX_ASSERT(endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize != 0);
235+
236+
/* Calculate endpoint transfer payload max size. */
237+
max_transfer_length =
238+
endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
239+
UX_MAX_PACKET_SIZE_MASK;
240+
if ((_ux_system_slave -> ux_system_slave_speed == UX_HIGH_SPEED_DEVICE) &&
241+
(endpoint -> ux_slave_endpoint_descriptor.bmAttributes & 0x1u))
242+
{
243+
n_trans = endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize &
244+
UX_MAX_NUMBER_OF_TRANSACTIONS_MASK;
245+
if (n_trans)
246+
{
247+
n_trans >>= UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT;
248+
n_trans ++;
249+
max_transfer_length *= n_trans;
250+
}
251+
}
252+
253+
/* Validate max transfer size and save it. */
254+
UX_ASSERT(max_transfer_length <= UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
255+
transfer_request -> ux_slave_transfer_request_transfer_length = max_transfer_length;
256+
229257
/* We store the endpoint in the transfer request as well. */
230258
transfer_request -> ux_slave_transfer_request_endpoint = endpoint;
231259

0 commit comments

Comments
 (0)