summaryrefslogtreecommitdiff
path: root/common/usbx_device_classes/inc
diff options
context:
space:
mode:
authorChaoqiong Xiao <[email protected]>2023-10-23 05:31:40 +0000
committerChaoqiong Xiao <[email protected]>2023-10-23 05:31:40 +0000
commit26585e42dccf2e1ce954d8cdb4890fac72d04864 (patch)
treefea8480672351b161488e07c31e3d704d82ee10a /common/usbx_device_classes/inc
parent7c928b43db68b72970b3effd5a2582eb5a6869c7 (diff)
Update on 23 Oct 2023. Expand to see details.v6.3.0_rel
52c60057 Update headers and readme for 6.3.0 release. 5360ad52 Host H264 frame support. 4b097e80 Add javascript to codeql detection 70278ae3 Fixed use after free issues. 5560620e Improved standalone enum transfer flow. Turn off ASIX in standalone build. Im... 39a01206 Improved host HID clients (mouse/keyboard/remote control) deactivation sequence. be2c7fd5 Improved standalone host CDC ACM control and data instance link management (MSRC 81489,81570) c2368eb2 Improved AC AS management and error handing. b9c23b38 PIMA Host/device optional interrupt endpoint support and host unused semaphore removal. 34ca3af9 Removed interface link in class linked to device. 5d3c9dd0 Improved endpoints get error handling (host CDC-ECM/ACM, storage). Moved stor... 71b08ad1 Improved host audio descriptors validation 4717e3f1 Enable weekly pipeline build to avoid CodeQL expiration ca408b54 Checked XML tag nesting depth in Pictbridge object parsing c300a00c Limited pictbridge array element to hexa output array size. 0e644aaa Reject fake CDC-ECM data interface not located next to its control interface. 911007a9 Improved host HID usage handling. d0576877 Enable dummy check of python for CodeQL 2761e105 Fixed some split transfer issue. db0dbeda Added packet length validation for received nx packet. f5007249 Fix PIMA issues on data set extraction 3ec66399 Fixing device RNDIS bugs with zero copy 1ec77d6b Fix device HID issue when adding class memory man and zero copy. d52e55c0 Add zero copy support in device printer a5cb883f Added zero copy support in device CDC_ECM and RNDIS 1f967ae2 Enable codeql in onebranch pipeline de265dbc Enable zero copy for device audio and video 53aee275 Refined memory management to reduce overhead.
Diffstat (limited to 'common/usbx_device_classes/inc')
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_audio.h13
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_audio10.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_audio20.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_ccid.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_cdc_acm.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h26
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_dfu.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_hid.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_pima.h24
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_printer.h23
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_rndis.h27
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_storage.h6
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_video.h12
13 files changed, 112 insertions, 55 deletions
diff --git a/common/usbx_device_classes/inc/ux_device_class_audio.h b/common/usbx_device_classes/inc/ux_device_class_audio.h
index d6166cc..b0d2898 100644
--- a/common/usbx_device_classes/inc/ux_device_class_audio.h
+++ b/common/usbx_device_classes/inc/ux_device_class_audio.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_audio.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -65,10 +65,11 @@
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added a new mode to manage */
-/* endpoint buffer in classes, */
-/* resulting in version 6.x */
+/* endpoint buffer in classes */
+/* with zero copy enabled, */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -422,10 +423,6 @@ typedef struct UX_DEVICE_CLASS_AUDIO_STREAM_STRUCT
UX_SLAVE_INTERFACE *ux_device_class_audio_stream_interface;
UX_SLAVE_ENDPOINT *ux_device_class_audio_stream_endpoint;
-#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1
- UCHAR *ux_device_class_audio_stream_endpoint_buffer;
-#endif
-
#if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT)
UX_SLAVE_ENDPOINT *ux_device_class_audio_stream_feedback;
diff --git a/common/usbx_device_classes/inc/ux_device_class_audio10.h b/common/usbx_device_classes/inc/ux_device_class_audio10.h
index f0080dd..05c34bf 100644
--- a/common/usbx_device_classes/inc/ux_device_class_audio10.h
+++ b/common/usbx_device_classes/inc/ux_device_class_audio10.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_audio10.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -57,9 +57,9 @@
/* added error checks support, */
/* fixed a macro name, */
/* resulting in version 6.2.1 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* optimized USB descriptors, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_audio20.h b/common/usbx_device_classes/inc/ux_device_class_audio20.h
index 1a1c075..aef29e3 100644
--- a/common/usbx_device_classes/inc/ux_device_class_audio20.h
+++ b/common/usbx_device_classes/inc/ux_device_class_audio20.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_audio20.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -58,9 +58,9 @@
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* optimized USB descriptors, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_ccid.h b/common/usbx_device_classes/inc/ux_device_class_ccid.h
index 832422e..e56b16f 100644
--- a/common/usbx_device_classes/inc/ux_device_class_ccid.h
+++ b/common/usbx_device_classes/inc/ux_device_class_ccid.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_ccid.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -42,9 +42,9 @@
/* 03-08-2023 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.2.1 */
-/* xx-xx-xxxx Yajun xia, CQ Xiao Modified comment(s), */
+/* 10-31-2023 Yajun xia, CQ Xiao Modified comment(s), */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_cdc_acm.h b/common/usbx_device_classes/inc/ux_device_class_cdc_acm.h
index 748d345..569c10c 100644
--- a/common/usbx_device_classes/inc/ux_device_class_cdc_acm.h
+++ b/common/usbx_device_classes/inc/ux_device_class_cdc_acm.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_cdc_acm.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -58,12 +58,12 @@
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
/* added write auto ZLP, */
/* resulting in version 6.1.12 */
-/* xx-xx-xxxx Yajun xia, CQ Xiao Modified comment(s), */
+/* 10-31-2023 Yajun xia, CQ Xiao Modified comment(s), */
/* added zero copy support, */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h b/common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h
index d578136..457c592 100644
--- a/common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h
+++ b/common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_cdc_ecm.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,10 +55,11 @@
/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added wait definitions, */
/* resulting in version 6.2.0 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
+/* added zero copy support, */
/* added a new mode to manage */
/* endpoint buffer in classes, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -99,11 +100,26 @@ VOID _ux_network_driver_link_down(VOID *ux_network_handle);
#endif
+/* Option: defined, it enables zero copy support (works if CDC_ECM owns endpoint buffer).
+ Enabled, it requires that the NX packet pool is in cache safe area, and buffer max size is
+ larger than UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE (1536).
+ */
+/* #define UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY */
+
+
/* Bulk out endpoint buffer size, must be larger than endpoint and ethernet max packet size, and aligned in 4-bytes. */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY)
+#define UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE 0
+#else
#define UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE UX_DEVICE_CLASS_CDC_ECM_MAX_PACKET_LENGTH
+#endif
/* Bulk in endpoint buffer size, must be larger than endpoint and ethernet max packet size, and aligned in 4-bytes. */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY)
+#define UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE 0
+#else
#define UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE
+#endif
/* Interrupt in endpoint buffer size... */
#define UX_DEVICE_CLASS_CDC_ECM_INTERRUPTIN_BUFFER_SIZE UX_DEVICE_CLASS_CDC_ECM_INTERRUPT_RESPONSE_LENGTH
@@ -370,12 +386,16 @@ typedef struct UX_SLAVE_CLASS_CDC_ECM_STRUCT
} UX_SLAVE_CLASS_CDC_ECM;
/* Define CDC ECM endpoint buffer settings (when CDC ECM owns buffer). */
+#if defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY)
+#define UX_DEVICE_CLASS_CDC_ECM_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW 0 /* No calculation, no overflow */
+#else
#define UX_DEVICE_CLASS_CDC_ECM_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW \
(UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE, \
UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE) || \
UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE + \
UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE, \
UX_DEVICE_CLASS_CDC_ECM_INTERRUPTIN_BUFFER_SIZE))
+#endif
#define UX_DEVICE_CLASS_CDC_ECM_ENDPOINT_BUFFER_SIZE (UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE + UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE + UX_DEVICE_CLASS_CDC_ECM_INTERRUPTIN_BUFFER_SIZE)
#define UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER(ecm) ((ecm)->ux_device_class_cdc_ecm_endpoint_buffer)
#define UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER(ecm) (UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER(ecm) + UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE)
diff --git a/common/usbx_device_classes/inc/ux_device_class_dfu.h b/common/usbx_device_classes/inc/ux_device_class_dfu.h
index ee4770d..33a4be4 100644
--- a/common/usbx_device_classes/inc/ux_device_class_dfu.h
+++ b/common/usbx_device_classes/inc/ux_device_class_dfu.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_dfu.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -60,9 +60,9 @@
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
/* added macros for req types, */
/* resulting in version 6.1.12 */
-/* xx-xx-xxxx Yajun xia Modified comment(s), */
+/* 10-31-2023 Yajun xia Modified comment(s), */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_hid.h b/common/usbx_device_classes/inc/ux_device_class_hid.h
index ffadc24..ab0aee1 100644
--- a/common/usbx_device_classes/inc/ux_device_class_hid.h
+++ b/common/usbx_device_classes/inc/ux_device_class_hid.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_hid.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -64,12 +64,12 @@
/* 07-29-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone int out, */
/* resulting in version 6.1.12 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added zero copy support, */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* moved build option check, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_pima.h b/common/usbx_device_classes/inc/ux_device_class_pima.h
index 31278b1..5e09981 100644
--- a/common/usbx_device_classes/inc/ux_device_class_pima.h
+++ b/common/usbx_device_classes/inc/ux_device_class_pima.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_pima.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -58,11 +58,12 @@
/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
/* fixed standalone compile, */
/* resulting in version 6.1.11 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
+/* optimized PIMA data sets, */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -729,10 +730,11 @@ typedef struct UX_SLAVE_CLASS_PIMA_OBJECT_STRUCT
{
ULONG ux_device_class_pima_object_storage_id;
- ULONG ux_device_class_pima_object_format;
- ULONG ux_device_class_pima_object_protection_status;
+ USHORT ux_device_class_pima_object_format;
+ USHORT ux_device_class_pima_object_protection_status;
ULONG ux_device_class_pima_object_compressed_size;
- ULONG ux_device_class_pima_object_thumb_format;
+ USHORT ux_device_class_pima_object_thumb_format;
+ USHORT _align_thumb_compressed_size;
ULONG ux_device_class_pima_object_thumb_compressed_size;
ULONG ux_device_class_pima_object_thumb_pix_width;
ULONG ux_device_class_pima_object_thumb_pix_height;
@@ -740,7 +742,8 @@ typedef struct UX_SLAVE_CLASS_PIMA_OBJECT_STRUCT
ULONG ux_device_class_pima_object_image_pix_height;
ULONG ux_device_class_pima_object_image_bit_depth;
ULONG ux_device_class_pima_object_parent_object;
- ULONG ux_device_class_pima_object_association_type;
+ USHORT ux_device_class_pima_object_association_type;
+ USHORT _align_association_desc;
ULONG ux_device_class_pima_object_association_desc;
ULONG ux_device_class_pima_object_sequence_number;
UCHAR ux_device_class_pima_object_filename[UX_DEVICE_CLASS_PIMA_UNICODE_MAX_LENGTH];
@@ -798,9 +801,10 @@ typedef struct UX_SLAVE_CLASS_PIMA_DEVICE_STRUCT
typedef struct UX_SLAVE_CLASS_PIMA_STORAGE_STRUCT
{
- ULONG ux_device_class_pima_storage_type;
- ULONG ux_device_class_pima_storage_file_system_type;
- ULONG ux_device_class_pima_storage_access_capability;
+ USHORT ux_device_class_pima_storage_type;
+ USHORT ux_device_class_pima_storage_file_system_type;
+ USHORT ux_device_class_pima_storage_access_capability;
+ USHORT _align_max_capacity_low;
ULONG ux_device_class_pima_storage_max_capacity_low;
ULONG ux_device_class_pima_storage_max_capacity_high;
ULONG ux_device_class_pima_storage_free_space_bytes_low;
diff --git a/common/usbx_device_classes/inc/ux_device_class_printer.h b/common/usbx_device_classes/inc/ux_device_class_printer.h
index 9dcb458..c87cb38 100644
--- a/common/usbx_device_classes/inc/ux_device_class_printer.h
+++ b/common/usbx_device_classes/inc/ux_device_class_printer.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_printer.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -50,11 +50,11 @@
/* 03-08-2023 Yajun xia Modified comment(s), */
/* added error checks support, */
/* resulting in version 6.2.1 */
-/* xx-xx-xxxx Yajun Xia, CQ Xiao Modified comment(s), */
+/* 10-31-2023 Yajun Xia, CQ Xiao Modified comment(s), */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* fixed error checking issue, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -77,6 +77,16 @@ extern "C" {
#define UX_DEVICE_CLASS_PRINTER_ENABLE_ERROR_CHECKING
#endif
+
+/* Option: defined, it enables zero copy support (works if PRINTER owns endpoint buffer).
+ Defined, it enables zero copy for bulk in/out endpoints (write/read). In this case, the endpoint
+ buffer is not allocated in class, application must provide the buffer for read/write, and the
+ buffer must meet device controller driver (DCD) buffer requirements (e.g., aligned and cache
+ safe if buffer is for DMA).
+ */
+/* #define UX_DEVICE_CLASS_PRINTER_ZERO_COPY */
+
+
/* Defined, _write is pending ZLP automatically (complete transfer) after buffer is sent. */
/* #define UX_DEVICE_CLASS_PRINTER_WRITE_AUTO_ZLP */
@@ -93,6 +103,13 @@ extern "C" {
#endif
+/* Internal: check if class own endpoint buffer */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && \
+ (!defined(UX_DEVICE_CLASS_PRINTER_ZERO_COPY))
+#define UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER
+#endif
+
+
/* Define Printer Class USB Class constants. */
#define UX_DEVICE_CLASS_PRINTER_CLASS 7
diff --git a/common/usbx_device_classes/inc/ux_device_class_rndis.h b/common/usbx_device_classes/inc/ux_device_class_rndis.h
index d1263b7..8440cf5 100644
--- a/common/usbx_device_classes/inc/ux_device_class_rndis.h
+++ b/common/usbx_device_classes/inc/ux_device_class_rndis.h
@@ -24,7 +24,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_rndis.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,11 +55,12 @@
/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added wait and length DEFs, */
/* resulting in version 6.2.0 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
+/* added zero copy support, */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* improved error checking, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -76,11 +77,27 @@ extern "C" {
#endif
+
+/* Option: defined, it enables zero copy support (works if HID owns endpoint buffer).
+ Enabled, it requires that the NX packet pool is in cache safe area, and buffer max size is
+ larger than UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE (1600).
+ */
+/* #define UX_DEVICE_CLASS_RNDIS_ZERO_COPY */
+
+
/* Bulk out endpoint buffer size (UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE). */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY)
+#define UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE 0
+#else
#define UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE
+#endif
/* Bulk in endpoint buffer size (UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE). */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY)
+#define UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE 0
+#else
#define UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE
+#endif
/* Interrupt in endpoint buffer size (UX_DEVICE_CLASS_RNDIS_INTERRUPT_RESPONSE_LENGTH). */
#define UX_DEVICE_CLASS_RNDIS_INTERRUPTIN_BUFFER_SIZE UX_DEVICE_CLASS_RNDIS_INTERRUPT_RESPONSE_LENGTH
@@ -597,12 +614,16 @@ typedef struct UX_SLAVE_CLASS_RNDIS_STRUCT
} UX_SLAVE_CLASS_RNDIS;
/* Define RNDIS endpoint buffer settings (when RNDIS owns buffer). */
+#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY)
+#define UX_DEVICE_CLASS_RNDIS_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW 0 /* only one buffer, no calculation */
+#else
#define UX_DEVICE_CLASS_RNDIS_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW \
(UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE, \
UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE) || \
UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE + \
UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE, \
UX_DEVICE_CLASS_RNDIS_INTERRUPTIN_BUFFER_SIZE))
+#endif
#define UX_DEVICE_CLASS_RNDIS_ENDPOINT_BUFFER_SIZE (UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE + UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE + UX_DEVICE_CLASS_RNDIS_INTERRUPTIN_BUFFER_SIZE)
#define UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER(rndis) ((rndis)->ux_device_class_rndis_endpoint_buffer)
#define UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER(rndis) (UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER(rndis) + UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE)
diff --git a/common/usbx_device_classes/inc/ux_device_class_storage.h b/common/usbx_device_classes/inc/ux_device_class_storage.h
index 3ff31b5..57ece44 100644
--- a/common/usbx_device_classes/inc/ux_device_class_storage.h
+++ b/common/usbx_device_classes/inc/ux_device_class_storage.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_storage.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -57,11 +57,11 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
-/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */
+/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */
/* added a new mode to manage */
/* endpoint buffer in classes, */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
diff --git a/common/usbx_device_classes/inc/ux_device_class_video.h b/common/usbx_device_classes/inc/ux_device_class_video.h
index a7a4f72..89c16b1 100644
--- a/common/usbx_device_classes/inc/ux_device_class_video.h
+++ b/common/usbx_device_classes/inc/ux_device_class_video.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_device_class_video.h PORTABLE C */
-/* 6.x */
+/* 6.3.0 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -44,11 +44,12 @@
/* 10-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.2.0 */
-/* xx-xx-xxxx Yajun xia, CQ Xiao Modified comment(s), */
+/* 10-31-2023 Yajun xia, CQ Xiao Modified comment(s), */
/* added a new mode to manage */
-/* endpoint buffer in classes, */
+/* endpoint buffer in classes */
+/* with zero copy enabled, */
/* added error checks support, */
-/* resulting in version 6.x */
+/* resulting in version 6.3.0 */
/* */
/**************************************************************************/
@@ -588,9 +589,6 @@ typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT
struct UX_DEVICE_CLASS_VIDEO_STRUCT *ux_device_class_video_stream_video;
UX_SLAVE_INTERFACE *ux_device_class_video_stream_interface;
UX_SLAVE_ENDPOINT *ux_device_class_video_stream_endpoint;
-#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1
- UCHAR *ux_device_class_video_stream_endpoint_buffer;
-#endif
ULONG ux_device_class_video_stream_error;