diff options
Diffstat (limited to 'common/usbx_device_classes')
124 files changed, 1123 insertions, 510 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; diff --git a/common/usbx_device_classes/src/ux_device_class_audio_activate.c b/common/usbx_device_classes/src/ux_device_class_audio_activate.c index f6468fd..1afd5fb 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,10 +73,11 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_activate(UX_SLAVE_CLASS_COMMAND *command) @@ -127,8 +128,10 @@ ULONG stream_index; audio -> ux_device_class_audio_status_head = audio -> ux_device_class_audio_status_queue; audio -> ux_device_class_audio_status_tail = audio -> ux_device_class_audio_status_queue; #if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - audio -> ux_device_class_audio_interrupt -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer = audio -> ux_device_class_audio_interrupt_buffer; + if (audio -> ux_device_class_audio_interrupt) + audio -> ux_device_class_audio_interrupt -> + ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = + audio -> ux_device_class_audio_interrupt_buffer; #endif #endif } diff --git a/common/usbx_device_classes/src/ux_device_class_audio_change.c b/common/usbx_device_classes/src/ux_device_class_audio_change.c index 5ad1c8a..f2eba4e 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_change.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_change.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_change PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,10 +84,11 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_change(UX_SLAVE_CLASS_COMMAND *command) @@ -238,11 +239,11 @@ ULONG endpoint_dir; } #if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - stream -> ux_device_class_audio_stream_endpoint -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer = stream -> ux_device_class_audio_stream_endpoint_buffer; #if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT) - stream -> ux_device_class_audio_stream_feedback -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer = stream -> ux_device_class_audio_stream_feedback_buffer; + if (stream -> ux_device_class_audio_stream_feedback) + stream -> ux_device_class_audio_stream_feedback -> + ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = + stream -> ux_device_class_audio_stream_feedback_buffer; #endif #endif diff --git a/common/usbx_device_classes/src/ux_device_class_audio_initialize.c b/common/usbx_device_classes/src/ux_device_class_audio_initialize.c index 1a26182..830ada9 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,10 +87,11 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -259,16 +260,6 @@ ULONG i; { #if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - - /* Allocate memory for stream endpoint buffer. */ - stream -> ux_device_class_audio_stream_endpoint_buffer = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, - stream_parameter -> ux_device_class_audio_stream_parameter_max_frame_buffer_size); - if (stream -> ux_device_class_audio_stream_endpoint_buffer == UX_NULL) - { - status = UX_MEMORY_INSUFFICIENT; - break; - } - #if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT) /* Allocate memory for feedback endpoint buffer. */ @@ -303,7 +294,11 @@ ULONG i; stream_parameter -> ux_device_class_audio_stream_parameter_max_frame_buffer_nb; /* Create block of buffer buffer is cache safe for USB transfer. */ +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + stream -> ux_device_class_audio_stream_buffer = (UCHAR *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, memory_size); +#else stream -> ux_device_class_audio_stream_buffer = (UCHAR *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size); +#endif /* Check for successful allocation. */ if (stream -> ux_device_class_audio_stream_buffer == UX_NULL) @@ -466,10 +461,6 @@ ULONG i; _ux_utility_memory_free(stream -> ux_device_class_audio_stream_thread_stack); } #endif -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - if (stream -> ux_device_class_audio_stream_endpoint_buffer) - _ux_utility_memory_free(stream -> ux_device_class_audio_stream_endpoint_buffer); -#endif if (stream -> ux_device_class_audio_stream_buffer) _ux_utility_memory_free(stream -> ux_device_class_audio_stream_buffer); stream ++; @@ -505,7 +496,7 @@ ULONG i; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_audio_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -535,9 +526,9 @@ ULONG i; /* DATE NAME DESCRIPTION */ /* */ /* 03-08-2023 Chaoqiong Xiao Initial Version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ /* fixed error checking issue, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_audio_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_audio_interrupt_task_function.c b/common/usbx_device_classes/src/ux_device_class_audio_interrupt_task_function.c index eeac5c2..77127ef 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_interrupt_task_function.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_interrupt_task_function.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_interrupt_task_function PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -71,6 +71,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Yajun Xia Initial Version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* removed an error trap, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_interrupt_task_function(UX_DEVICE_CLASS_AUDIO *audio) @@ -100,13 +103,10 @@ UCHAR *buff; /* Get endpoint instance. */ endpoint = audio -> ux_device_class_audio_interrupt; - /* Endpoint not available, maybe it's alternate setting 0. */ + /* Endpoint not available, maybe it's alternate setting 0, + or not exist in framework (accepted use case). */ if (endpoint == UX_NULL) { - - /* Error trap. */ - _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ENDPOINT_HANDLE_UNKNOWN); - audio -> ux_device_class_audio_interrupt_task_state = UX_STATE_RESET; return(UX_STATE_IDLE); } diff --git a/common/usbx_device_classes/src/ux_device_class_audio_read_task_function.c b/common/usbx_device_classes/src/ux_device_class_audio_read_task_function.c index 03d43d8..f4f1301 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_read_task_function.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_read_task_function.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_read_task_function PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -71,6 +71,11 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Yajun Xia Initial Version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* added a new mode to manage */ +/* endpoint buffer in classes */ +/* with zero copy enabled, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_read_task_function(UX_DEVICE_CLASS_AUDIO_STREAM *stream) @@ -116,6 +121,13 @@ UINT status; /* Next state: transfer wait. */ stream -> ux_device_class_audio_stream_task_state = UX_DEVICE_CLASS_AUDIO_STREAM_RW_WAIT; +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use stream buffer for transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = + stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data; +#endif + /* Reset transfer state. */ UX_SLAVE_TRANSFER_STATE_RESET(transfer); } @@ -153,9 +165,14 @@ UINT status; /* Frame received, log it. */ stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_length = actual_length; stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_pos = 0; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0 + + /* Copy data from endpoint buffer. */ _ux_utility_memory_copy(stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data, transfer -> ux_slave_transfer_request_data_pointer, actual_length); /* Use case of memcpy is verified. */ +#endif /* For simple, do not advance the transfer position if there is overflow. */ next_pos = (UCHAR *)stream -> ux_device_class_audio_stream_transfer_pos; diff --git a/common/usbx_device_classes/src/ux_device_class_audio_read_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_audio_read_thread_entry.c index 8af97f0..17ee997 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_read_thread_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_read_thread_entry.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_read_thread_entry PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,6 +84,11 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* added a new mode to manage */ +/* endpoint buffer in classes */ +/* with zero copy enabled, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_audio_read_thread_entry(ULONG audio_stream) @@ -127,6 +132,13 @@ ULONG actual_length; /* Get transfer instance. */ transfer = &endpoint -> ux_slave_endpoint_transfer_request; +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use frame buffer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data; +#endif + /* Start frame transfer anyway. */ status = _ux_device_stack_transfer_request(transfer, max_packet_size, max_packet_size); @@ -146,9 +158,14 @@ ULONG actual_length; /* Frame received, log it. */ stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_length = actual_length; stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_pos = 0; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0 + + /* Copy data from endpoint buffer. */ _ux_utility_memory_copy(stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data, transfer -> ux_slave_transfer_request_data_pointer, actual_length); /* Use case of memcpy is verified. */ +#endif /* For simple, do not advance the transfer position if there is overflow. */ next_pos = (UCHAR *)stream -> ux_device_class_audio_stream_transfer_pos; diff --git a/common/usbx_device_classes/src/ux_device_class_audio_unitialize.c b/common/usbx_device_classes/src/ux_device_class_audio_unitialize.c index 0c59d53..6bc821d 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_unitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_unitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,10 +75,11 @@ /* 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), */ /* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_uninitialize(UX_SLAVE_CLASS_COMMAND *command) @@ -118,7 +119,6 @@ ULONG i; _ux_utility_memory_free(stream -> ux_device_class_audio_stream_buffer); #if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - _ux_utility_memory_free(stream -> ux_device_class_audio_stream_endpoint_buffer); #if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT) _ux_utility_memory_free(stream -> ux_device_class_audio_stream_feedback_buffer); #endif diff --git a/common/usbx_device_classes/src/ux_device_class_audio_write_task_function.c b/common/usbx_device_classes/src/ux_device_class_audio_write_task_function.c index 2c30a3c..269e97e 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_write_task_function.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_write_task_function.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_audio_write_task_function PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -72,6 +72,11 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Yajun Xia Initial Version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* added a new mode to manage */ +/* endpoint buffer in classes */ +/* with zero copy enabled, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_audio_write_task_function(UX_DEVICE_CLASS_AUDIO_STREAM *stream) @@ -119,9 +124,19 @@ UINT status; /* Start frame transfer anyway (even ZLP). */ transfer_length = stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0 + + /* Stack owns buffer, copy data to it. */ if (transfer_length) _ux_utility_memory_copy(transfer -> ux_slave_transfer_request_data_pointer, stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data, transfer_length); /* Use case of memcpy is verified. */ +#else + + /* Zero copy: directly use frame buffer to transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data; +#endif /* Reset transfer state. */ UX_SLAVE_TRANSFER_STATE_RESET(transfer); diff --git a/common/usbx_device_classes/src/ux_device_class_audio_write_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_audio_write_thread_entry.c index ce6bd7b..3178b0e 100644 --- a/common/usbx_device_classes/src/ux_device_class_audio_write_thread_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_audio_write_thread_entry.c @@ -78,6 +78,11 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* added a new mode to manage */ +/* endpoint buffer in classes */ +/* with zero copy enabled, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_audio_write_thread_entry(ULONG audio_stream) @@ -118,9 +123,19 @@ ULONG actual_length; /* Start frame transfer anyway (even ZLP). */ transfer_length = stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 0 + + /* Stack owns endpoint buffer, copy to buffer. */ if (transfer_length) _ux_utility_memory_copy(transfer -> ux_slave_transfer_request_data_pointer, stream -> ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data, transfer_length); /* Use case of memcpy is verified. */ +#else + + /* Zero copy: directly use frame buffer to transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_audio_stream_transfer_pos -> ux_device_class_audio_frame_data; +#endif /* Issue transfer request, thread blocked until transfer done. */ status = _ux_device_stack_transfer_request(transfer, transfer_length, transfer_length); diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_activate.c b/common/usbx_device_classes/src/ux_device_class_ccid_activate.c index a1bc865..f254dc7 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,10 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_activate(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c b/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c index ce7996c..143b2d1 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_auto_seq_done PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,8 +70,8 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_auto_seq_done(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG icc_status) @@ -109,7 +109,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_ccid_auto_seq_done PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -142,7 +142,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_ccid_auto_seq_done(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG icc_status) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c b/common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c index 3600c2b..f618132 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_hardware_error PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -67,8 +67,8 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_hardware_error(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG error) @@ -147,7 +147,7 @@ UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *rsp; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_ccid_hardware_error PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -178,7 +178,7 @@ UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *rsp; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_ccid_hardware_error(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG error) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c b/common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c index 632222b..e926f7a 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_icc_insert PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,8 +70,8 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_icc_insert(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq_start) @@ -134,7 +134,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_ccid_icc_insert PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -165,7 +165,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_ccid_icc_insert(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq_start) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c b/common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c index 6b0541b..5cd13c5 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_icc_remove PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -66,8 +66,8 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_icc_remove(UX_DEVICE_CLASS_CCID *ccid, ULONG slot) @@ -127,7 +127,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_ccid_icc_remove PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -157,7 +157,7 @@ UX_DEVICE_CLASS_CCID_SLOT *ccid_slot; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_ccid_icc_remove(UX_DEVICE_CLASS_CCID *ccid, ULONG slot) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_initialize.c b/common/usbx_device_classes/src/ux_device_class_ccid_initialize.c index dd732bd..037a639 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,10 +75,10 @@ /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ /* added standalone 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c b/common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c index 38ff23f..d097677 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_time_extension PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -64,8 +64,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_time_extension(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG wt) @@ -134,7 +134,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_ccid_icc_insert PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -167,7 +167,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_ccid_time_extension(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG wt) diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c index 2b970a2..d49b456 100644 --- a/common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_ccid_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -66,10 +66,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_ccid_uninitialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkin_thread.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkin_thread.c index 22c9b08..f665b75 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkin_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkin_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_bulkin_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -92,11 +92,11 @@ /* names conflict C++ keyword, */ /* added auto ZLP support, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_cdc_acm_bulkin_thread(ULONG cdc_acm_class) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkout_thread.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkout_thread.c index 707d7fc..7b71f77 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkout_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkout_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_bulkout_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,11 +83,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_cdc_acm_bulkout_thread(ULONG cdc_acm_class) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_initialize.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_initialize.c index 1ac48fd..c4e17c8 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_initialize.c @@ -37,7 +37,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,11 +87,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_ioctl.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_ioctl.c index fb0371a..32d62ee 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_ioctl.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_ioctl.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -96,8 +96,8 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_ioctl(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, ULONG ioctl_function, @@ -365,7 +365,7 @@ UX_SLAVE_TRANSFER *transfer_request; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -397,7 +397,7 @@ UX_SLAVE_TRANSFER *transfer_request; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_ioctl(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, ULONG ioctl_function, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_read.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_read.c index ef77298..702636c 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_read.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_read.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -90,11 +90,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_read(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, @@ -273,7 +273,7 @@ ULONG local_requested_length; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -308,7 +308,7 @@ ULONG local_requested_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_read(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_read_run.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_read_run.c index 0fac5bd..10e58b7 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_read_run.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_read_run.c @@ -37,7 +37,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,12 +83,12 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* fixed return code, */ /* 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 zero copy support, */ /* added a new mode to manage */ /* endpoint buffer in classes, */ /* fixed return code, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_read_run(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, @@ -322,7 +322,7 @@ UINT status = UX_SUCCESS; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -363,7 +363,7 @@ UINT status = UX_SUCCESS; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_read_run(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_tasks_run.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_tasks_run.c index ab86102..9b0673e 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_tasks_run.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_tasks_run.c @@ -43,7 +43,7 @@ static inline VOID _ux_device_class_cdc_acm_transmission_write_run(UX_SLAVE_CLAS /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_tasks_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,11 +86,11 @@ static inline VOID _ux_device_class_cdc_acm_transmission_write_run(UX_SLAVE_CLAS /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ /* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_tasks_run(VOID *instance) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_unitialize.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_unitialize.c index 36954f0..344fd8b 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_unitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_unitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,11 +82,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_uninitialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write.c index aee5590..8fd4ef3 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -92,11 +92,11 @@ /* names conflict C++ keyword, */ /* added auto ZLP support, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_write(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, @@ -305,7 +305,7 @@ UINT status = 0; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -340,7 +340,7 @@ UINT status = 0; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_write(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_run.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_run.c index 33db3f0..bb7ad16 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_run.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_run.c @@ -37,7 +37,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_write_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,12 +87,12 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* fixed return code, */ /* 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 zero copy support, */ /* added a new mode to manage */ /* endpoint buffer in classes, */ /* fixed return code, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_write_run(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, @@ -341,7 +341,7 @@ UINT zlp = UX_FALSE; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_write_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -381,7 +381,7 @@ UINT zlp = UX_FALSE; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_write_run(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_with_callback.c b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_with_callback.c index a8fb947..fba51e4 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_with_callback.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_acm_write_with_callback.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_acm_write_with_callback PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,8 +81,8 @@ /* resulting in version 6.1.10 */ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_acm_write_with_callback(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, @@ -172,7 +172,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_cdc_acm_write_with_callback PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -205,7 +205,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_cdc_acm_write_with_callback(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_activate.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_activate.c index 021e66e..e072455 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,10 +82,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_ecm_activate(UX_SLAVE_CLASS_COMMAND *command) @@ -200,7 +201,7 @@ ULONG physical_address_lsw; /* We have found the bulk in endpoint, save it. */ cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER(cdc_ecm); #endif @@ -215,7 +216,7 @@ ULONG physical_address_lsw; /* We have found the bulk out endpoint, save it. */ cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER(cdc_ecm); #endif @@ -240,11 +241,17 @@ ULONG physical_address_lsw; /* Wake up the Interrupt thread and send a network notification to the host. */ _ux_device_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NETWORK_NOTIFICATION_EVENT, UX_OR); +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) + + /* There is no endpoint buffer. */ +#else + /* Reset the endpoint buffers. */ _ux_utility_memory_set(cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE); /* Use case of memset is verified. */ _ux_utility_memory_set(cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE); /* Use case of memset is verified. */ +#endif /* Resume the endpoint threads. */ _ux_device_thread_resume(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread); diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkin_thread.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkin_thread.c index ca3bf1e..d1aef51 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkin_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkin_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_bulkin_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,10 +86,11 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* used NX API to copy data, */ /* 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 */ /* */ /**************************************************************************/ VOID _ux_device_class_cdc_ecm_bulkin_thread(ULONG cdc_ecm_class) @@ -104,6 +105,9 @@ ULONG actual_flags; NX_PACKET *current_packet; ULONG transfer_length; ULONG copied; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) && !defined(NX_DISABLE_PACKET_CHAIN) +NX_PACKET *packet; +#endif /* Cast properly the cdc_ecm instance. */ UX_THREAD_EXTENSION_PTR_GET(class_ptr, UX_SLAVE_CLASS, cdc_ecm_class) @@ -154,7 +158,84 @@ ULONG copied; /* If the link is down no need to rearm a packet. */ if (cdc_ecm -> ux_slave_class_cdc_ecm_link_state == UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_UP) { - +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) + + /* Default to success. */ + status = UX_SUCCESS; + +#ifndef NX_DISABLE_PACKET_CHAIN + + /* Check if packet is chained, allocate a new packet to fill the total data. */ + if (current_packet -> nx_packet_next) + { + + /* Check if collection of chained data can fit in one packet. */ + if (current_packet -> nx_packet_length > + current_packet -> nx_packet_pool_owner -> nx_packet_pool_payload_size) + status = UX_TRANSFER_BUFFER_OVERFLOW; + else + { + + /* Allocate a new packet for chain data collection. */ + status = nx_packet_allocate(cdc_ecm -> ux_slave_class_cdc_ecm_packet_pool, &packet, + NX_RECEIVE_PACKET, UX_MS_TO_TICK(UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_WAIT)); + if (status == UX_SUCCESS) + { + + /* Copy the packet to the buffer. */ + status = nx_packet_data_extract_offset(current_packet, 0, + packet -> nx_packet_prepend_ptr, + current_packet -> nx_packet_length, &copied); + if (status == NX_SUCCESS) + { + packet -> nx_packet_length = current_packet -> nx_packet_length; + + /* Release the chained packet. */ + nx_packet_transmit_release(current_packet); + + /* Use copied packet instead. */ + current_packet = packet; + } + } + } + + + /* Can not copy/buffer issue. */ + if (status != UX_SUCCESS) + status = UX_TRANSFER_BUFFER_OVERFLOW; + + } +#endif + if (status == UX_SUCCESS) + { + + /* Set the transfer request data pointer to the packet buffer. */ + transfer_request -> ux_slave_transfer_request_data_pointer = current_packet -> nx_packet_prepend_ptr; + + /* Calculate the transfer length. */ + transfer_length = current_packet -> nx_packet_length; + + /* If trace is enabled, insert this event into the trace buffer. */ + UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_CDC_ECM_PACKET_TRANSMIT, cdc_ecm, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0) + + /* Send the request to the device controller. */ + status = _ux_device_stack_transfer_request(transfer_request, transfer_length, transfer_length + 1); + } + + /* Check error code. */ + if (status != UX_SUCCESS) + { + + /* Is this not a transfer abort? (this is expected to happen) */ + if (status != UX_TRANSFER_BUS_RESET) + { + + /* Error trap. */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, status); + } + } +#else + /* Can the packet fit in the transfer requests data buffer? */ if (current_packet -> nx_packet_length <= UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE) { @@ -197,6 +278,7 @@ ULONG copied; /* Report error to application. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_BUFFER_OVERFLOW); } +#endif } /* Free the packet that was just sent. First do some housekeeping. */ diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkout_thread.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkout_thread.c index 0b266f7..f5a6528 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkout_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkout_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_bulkout_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,10 +88,11 @@ /* used pool from NX IP inst, */ /* used NX API to copy data, */ /* 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 */ /* */ /**************************************************************************/ VOID _ux_device_class_cdc_ecm_bulkout_thread(ULONG cdc_ecm_class) @@ -171,10 +172,20 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; /* Reset the queue pointer of this packet. */ packet -> nx_packet_queue_next = UX_NULL; - + +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) + + /* Send the request to the device controller. */ + transfer_request -> ux_slave_transfer_request_data_pointer = packet -> nx_packet_prepend_ptr + sizeof(USHORT); + status = _ux_device_stack_transfer_request(transfer_request, + packet -> nx_packet_pool_owner -> nx_packet_pool_payload_size - sizeof(USHORT), + packet -> nx_packet_pool_owner -> nx_packet_pool_payload_size - sizeof(USHORT)); +#else + /* Send the request to the device controller. */ status = _ux_device_stack_transfer_request(transfer_request, UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE, UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE); +#endif /* Check the completion code. */ if (status == UX_SUCCESS) @@ -188,6 +199,15 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; packet -> nx_packet_prepend_ptr += sizeof(USHORT); packet -> nx_packet_append_ptr += sizeof(USHORT); +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) + + /* Data already in packet. */ + packet -> nx_packet_length = transfer_request -> ux_slave_transfer_request_actual_length; + + /* Send that packet to the NetX USB broker. */ + _ux_network_driver_packet_received(cdc_ecm -> ux_slave_class_cdc_ecm_network_handle, packet); +#else + /* Copy the received packet in the IP packet data area. */ status = nx_packet_data_append(packet, transfer_request -> ux_slave_transfer_request_data_pointer, @@ -207,6 +227,7 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CLASS_MALFORMED_PACKET_RECEIVED_ERROR); nx_packet_release(packet); } +#endif } else diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_change.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_change.c index 6b472a0..37b76dc 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_change.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_change.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_change PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -85,10 +85,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_ecm_change(UX_SLAVE_CLASS_COMMAND *command) @@ -130,7 +131,7 @@ UX_SLAVE_ENDPOINT *endpoint; /* We have found the bulk in endpoint, save it. */ cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER(cdc_ecm); @@ -143,7 +144,7 @@ UX_SLAVE_ENDPOINT *endpoint; /* We have found the bulk out endpoint, save it. */ cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER(cdc_ecm); @@ -166,11 +167,17 @@ UX_SLAVE_ENDPOINT *endpoint; /* Communicate the state with the network driver. */ _ux_network_driver_link_up(cdc_ecm -> ux_slave_class_cdc_ecm_network_handle); +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY) + + /* There is no endpoint buffer. */ +#else + /* Reset the endpoint buffers. */ _ux_utility_memory_set(cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_CDC_ECM_BULKOUT_BUFFER_SIZE); /* Use case of memset is verified. */ _ux_utility_memory_set(cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_endpoint -> ux_slave_endpoint_transfer_request. ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_CDC_ECM_BULKIN_BUFFER_SIZE); /* Use case of memset is verified. */ +#endif /* Resume the endpoint threads. */ _ux_device_thread_resume(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread); diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_initialize.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_initialize.c index ba3e475..302b9ac 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -89,10 +89,10 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* removed internal NX pool, */ /* resulting in version 6.2.0 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_ecm_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_uninitialize.c index 36972dd..a198c29 100644 --- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_uninitialize.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_cdc_ecm_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -85,10 +85,10 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* removed internal NX pool, */ /* resulting in version 6.2.0 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_cdc_ecm_uninitialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_dfu_entry.c b/common/usbx_device_classes/src/ux_device_class_dfu_entry.c index be1f7d6..c7f3a10 100644 --- a/common/usbx_device_classes/src/ux_device_class_dfu_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_dfu_entry.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_dfu_entry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_dfu_entry(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_dfu_initialize.c b/common/usbx_device_classes/src/ux_device_class_dfu_initialize.c index 31f2b2c..ad0b00b 100644 --- a/common/usbx_device_classes/src/ux_device_class_dfu_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_dfu_initialize.c @@ -260,7 +260,7 @@ ULONG descriptor_length; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_dfu_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -291,7 +291,7 @@ ULONG descriptor_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_activate.c b/common/usbx_device_classes/src/ux_device_class_hid_activate.c index fb9fb12..4793def 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,11 +84,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_activate(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_entry.c b/common/usbx_device_classes/src/ux_device_class_hid_entry.c index 38b4afe..92c9743 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_entry.c @@ -73,9 +73,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_entry(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_event_get.c b/common/usbx_device_classes/src/ux_device_class_hid_event_get.c index b3d060b..4268651 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_event_get.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_event_get.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_event_check PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -65,7 +65,7 @@ /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_event_check(UX_SLAVE_CLASS_HID *hid, @@ -98,7 +98,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_event_free PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -125,7 +125,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_hid_event_free(UX_SLAVE_CLASS_HID *hid) @@ -145,7 +145,7 @@ UCHAR *pos; /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_event_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -180,9 +180,9 @@ UCHAR *pos; /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid, @@ -225,7 +225,7 @@ UINT status; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_event_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -255,7 +255,7 @@ UINT status; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_event_set.c b/common/usbx_device_classes/src/ux_device_class_hid_event_set.c index 5c3f923..80c0f4a 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_event_set.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_event_set.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_event_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,9 +79,9 @@ /* resulting in version 6.1.10 */ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid, @@ -184,7 +184,7 @@ UCHAR *next_position; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_event_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -214,7 +214,7 @@ UCHAR *next_position; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_initialize.c b/common/usbx_device_classes/src/ux_device_class_hid_initialize.c index fd87bd0..9abe4e8 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,12 +88,12 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed compile warnings, */ /* 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, */ /* checked compile options, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -382,7 +382,7 @@ UCHAR *buffer; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -411,7 +411,7 @@ UCHAR *buffer; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_interrupt_thread.c b/common/usbx_device_classes/src/ux_device_class_hid_interrupt_thread.c index 2cd10e0..1388e58 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_interrupt_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_interrupt_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_interrupt_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,9 +84,9 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* off for standalone compile, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_hid_interrupt_thread(ULONG hid_class) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_read.c b/common/usbx_device_classes/src/ux_device_class_hid_read.c index dbd85b1..e0d7c7b 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_read.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_read.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -80,9 +80,9 @@ /* resulting in version 6.1.11 */ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_read(UX_SLAVE_CLASS_HID *hid, UCHAR *buffer, @@ -238,7 +238,7 @@ ULONG local_requested_length; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -270,7 +270,7 @@ ULONG local_requested_length; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_read(UX_SLAVE_CLASS_HID *hid, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_read_run.c b/common/usbx_device_classes/src/ux_device_class_hid_read_run.c index 923c854..c71b5d0 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_read_run.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_read_run.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -74,9 +74,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 07-29-2022 Chaoqiong Xiao Initial Version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid, UCHAR *buffer, @@ -302,7 +302,7 @@ UINT status= UX_SUCCESS; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -334,7 +334,7 @@ UINT status= UX_SUCCESS; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_free.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_free.c index 5d16067..6cf22ad 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_free.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_free.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_event_free PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,9 +68,9 @@ /* 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), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid) @@ -123,7 +123,7 @@ UCHAR *next_pos; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_receiver_event_free PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -153,7 +153,7 @@ UCHAR *next_pos; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_get.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_get.c index e765a9d..2aad7d4 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_get.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_event_get.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_event_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -71,9 +71,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* cleaned compile with TRACE, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid, @@ -122,7 +122,7 @@ UX_DEVICE_CLASS_HID_RECEIVED_EVENT *pos; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_hid_receiver_event_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -153,7 +153,7 @@ UX_DEVICE_CLASS_HID_RECEIVED_EVENT *pos; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_initialize.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_initialize.c index ee1fc3b..02342bb 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -77,9 +77,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone receiver, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_tasks_run.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_tasks_run.c index a8b9bbb..a90e3cf 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_tasks_run.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_tasks_run.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_tasks_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -67,9 +67,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 07-29-2022 Chaoqiong Xiao Initial Version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_receiver_tasks_run(UX_SLAVE_CLASS_HID *hid) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_thread.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_thread.c index bf58348..a8231f3 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* added receiver callback, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_hid_receiver_thread(ULONG hid_instance) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_receiver_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_hid_receiver_uninitialize.c index b45e912..5abf47d 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_receiver_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_receiver_uninitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_receiver_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -66,9 +66,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_hid_receiver_uninitialize(UX_DEVICE_CLASS_HID_RECEIVER *receiver) diff --git a/common/usbx_device_classes/src/ux_device_class_hid_report_get.c b/common/usbx_device_classes/src/ux_device_class_hid_report_get.c index d08fa7a..458314a 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_report_get.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_report_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_report_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,8 +75,8 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_report_get(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_report_set.c b/common/usbx_device_classes/src/ux_device_class_hid_report_set.c index 10b9e44..f6e95f4 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_report_set.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_report_set.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_report_set PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,8 +73,8 @@ /* verified memset and memcpy */ /* cases, */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_report_set(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type, diff --git a/common/usbx_device_classes/src/ux_device_class_hid_tasks_run.c b/common/usbx_device_classes/src/ux_device_class_hid_tasks_run.c index 4f72f2f..ef9f23a 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_tasks_run.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_tasks_run.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_tasks_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -73,9 +73,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added zero copy support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_tasks_run(VOID *instance) @@ -107,6 +107,9 @@ UINT status; hid -> ux_device_class_hid_receiver -> ux_device_class_hid_receiver_tasks_run(hid); #endif + /* Get access to current event instance. */ + hid_event = &hid -> ux_device_class_hid_event; + /* Run HID state machine. */ switch(hid -> ux_device_class_hid_event_state) { @@ -180,7 +183,6 @@ UINT status; /* Run transfer state machine. */ trans = &hid -> ux_device_class_hid_interrupt_endpoint -> ux_slave_endpoint_transfer_request; - hid_event = &hid -> ux_device_class_hid_event; status = _ux_device_stack_transfer_run(trans, hid_event -> ux_device_class_hid_event_length, hid_event -> ux_device_class_hid_event_length); diff --git a/common/usbx_device_classes/src/ux_device_class_hid_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_hid_uninitialize.c index 4770532..3a83fbc 100644 --- a/common/usbx_device_classes/src/ux_device_class_hid_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_hid_uninitialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_hid_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -78,11 +78,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_hid_uninitialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_pima_activate.c b/common/usbx_device_classes/src/ux_device_class_pima_activate.c index 1bdf500..2e5c7c3 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -76,10 +76,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* supported optional INT EP, */ /* added a new mode to manage */ /* endpoint buffer in classes, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_activate(UX_SLAVE_CLASS_COMMAND *command) @@ -145,7 +146,9 @@ UX_SLAVE_ENDPOINT *endpoint_interrupt; UX_DEVICE_CLASS_PIMA_BULKIN_BUFFER(pima); endpoint_out -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_PIMA_BULKOUT_BUFFER(pima); - endpoint_interrupt -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = + if (endpoint_interrupt) + endpoint_interrupt -> ux_slave_endpoint_transfer_request. + ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_PIMA_INTERRUPTIN_BUFFER(pima); #endif diff --git a/common/usbx_device_classes/src/ux_device_class_pima_deactivate.c b/common/usbx_device_classes/src/ux_device_class_pima_deactivate.c index 7bf3fd3..2be45ec 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_deactivate.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_deactivate.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_deactivate PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,6 +70,9 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* supported optional INT EP, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_deactivate(UX_SLAVE_CLASS_COMMAND *command) @@ -87,7 +90,8 @@ UX_SLAVE_CLASS *class_ptr; /* Terminate the transactions pending on the endpoints. */ _ux_device_stack_transfer_all_request_abort(pima -> ux_device_class_pima_bulk_in_endpoint, UX_TRANSFER_BUS_RESET); _ux_device_stack_transfer_all_request_abort(pima -> ux_device_class_pima_bulk_out_endpoint, UX_TRANSFER_BUS_RESET); - _ux_device_stack_transfer_all_request_abort(pima -> ux_device_class_pima_interrupt_endpoint, UX_TRANSFER_BUS_RESET); + if (pima -> ux_device_class_pima_interrupt_endpoint) + _ux_device_stack_transfer_all_request_abort(pima -> ux_device_class_pima_interrupt_endpoint, UX_TRANSFER_BUS_RESET); /* Session is now closed. */ pima -> ux_device_class_pima_session_id = 0; diff --git a/common/usbx_device_classes/src/ux_device_class_pima_device_info_send.c b/common/usbx_device_classes/src/ux_device_class_pima_device_info_send.c index 244fa99..6636542 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_device_info_send.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_device_info_send.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_device_info_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -83,10 +83,10 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_device_info_send(UX_SLAVE_CLASS_PIMA *pima) diff --git a/common/usbx_device_classes/src/ux_device_class_pima_device_prop_value_get.c b/common/usbx_device_classes/src/ux_device_class_pima_device_prop_value_get.c index fa93952..33c4466 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_device_prop_value_get.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_device_prop_value_get.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_device_prop_value_get PORTABLE C */ -/* 6.X */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -85,10 +85,10 @@ /* updated status handling, */ /* improved sanity checks, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_device_prop_value_get(UX_SLAVE_CLASS_PIMA *pima, diff --git a/common/usbx_device_classes/src/ux_device_class_pima_entry.c b/common/usbx_device_classes/src/ux_device_class_pima_entry.c index f3e9600..251abf3 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_entry.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_entry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_entry(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_pima_event_set.c b/common/usbx_device_classes/src/ux_device_class_pima_event_set.c index 570a477..62cfcde 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_event_set.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_event_set.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_event_set PORTABLE C */ -/* 6.1.10 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,9 @@ /* refined macros names, */ /* added transaction ID, */ /* resulting in version 6.1.10 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* checked if INT EP exists, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_event_set(UX_SLAVE_CLASS_PIMA *pima, @@ -97,7 +100,13 @@ UX_SLAVE_DEVICE *device; return(UX_DEVICE_HANDLE_UNKNOWN); } - + + /* Check if interrupt endpoint is available. */ + if (pima -> ux_device_class_pima_interrupt_endpoint == UX_NULL) + { + return (UX_FUNCTION_NOT_SUPPORTED); + } + /* Current position of the head. */ current_pima_event = pima -> ux_device_class_pima_event_array_head; diff --git a/common/usbx_device_classes/src/ux_device_class_pima_initialize.c b/common/usbx_device_classes/src/ux_device_class_pima_initialize.c index c12ed51..f363617 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,10 +81,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -263,7 +263,7 @@ UX_SLAVE_CLASS *class_ptr; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_pima_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -292,7 +292,7 @@ UX_SLAVE_CLASS *class_ptr; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_pima_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_pima_interrupt_thread.c b/common/usbx_device_classes/src/ux_device_class_pima_interrupt_thread.c index 68da7f7..db93e51 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_interrupt_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_interrupt_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_interrupt_thread PORTABLE C */ -/* 6.1.12 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,6 +84,9 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* fixed event message size, */ /* resulting in version 6.1.12 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* improved INT EP management, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_pima_interrupt_thread(ULONG pima_class) @@ -122,13 +125,16 @@ UCHAR *buffer; /* Get the pointer to the device. */ device = &_ux_system_slave -> ux_system_slave_device; - /* All PIMA events are on the interrupt endpoint IN, from the host. */ - transfer_request_in = &pima -> ux_device_class_pima_interrupt_endpoint -> ux_slave_endpoint_transfer_request; /* As long as the device is in the CONFIGURED state. */ while (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED) { + /* All PIMA events are on the interrupt endpoint IN, from the host. */ + if (pima -> ux_device_class_pima_interrupt_endpoint == UX_NULL) + break; + transfer_request_in = &pima -> ux_device_class_pima_interrupt_endpoint -> ux_slave_endpoint_transfer_request; + /* Wait until something has awaken us. */ status = _ux_device_semaphore_get(&pima -> ux_device_class_pima_interrupt_thread_semaphore, UX_WAIT_FOREVER); diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_info_get.c b/common/usbx_device_classes/src/ux_device_class_pima_object_info_get.c index c990b22..9a4c224 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_object_info_get.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_object_info_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_object_info_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -80,10 +80,10 @@ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_object_info_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle) diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_prop_desc_get.c b/common/usbx_device_classes/src/ux_device_class_pima_object_prop_desc_get.c index 86ed781..15fc349 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_object_prop_desc_get.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_object_prop_desc_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_object_prop_desc_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,10 +81,10 @@ /* updated status handling, */ /* passed max length to app, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_object_prop_desc_get(UX_SLAVE_CLASS_PIMA *pima, diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_prop_value_get.c b/common/usbx_device_classes/src/ux_device_class_pima_object_prop_value_get.c index e52728d..66c1845 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_object_prop_value_get.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_object_prop_value_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_object_prop_value_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -84,10 +84,10 @@ /* updated status handling, */ /* passed max length to app, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_object_prop_value_get(UX_SLAVE_CLASS_PIMA *pima, diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_references_get.c b/common/usbx_device_classes/src/ux_device_class_pima_object_references_get.c index 42a4d4d..4018cd0 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_object_references_get.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_object_references_get.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_object_references_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -81,10 +81,10 @@ /* updated status handling, */ /* passed max length to app, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_object_references_get(UX_SLAVE_CLASS_PIMA *pima, diff --git a/common/usbx_device_classes/src/ux_device_class_pima_storage_id_send.c b/common/usbx_device_classes/src/ux_device_class_pima_storage_id_send.c index 2c6b3a3..7655265 100644 --- a/common/usbx_device_classes/src/ux_device_class_pima_storage_id_send.c +++ b/common/usbx_device_classes/src/ux_device_class_pima_storage_id_send.c @@ -42,7 +42,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_pima_storage_id_send PORTABLE C */ -/* 6.X */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -80,10 +80,10 @@ /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* improved sanity checks, */ /* resulting in version 6.1.10 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_pima_storage_id_send(UX_SLAVE_CLASS_PIMA *pima) diff --git a/common/usbx_device_classes/src/ux_device_class_printer_activate.c b/common/usbx_device_classes/src/ux_device_class_printer_activate.c index 9080a02..d90ac27 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_printer_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,10 +68,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_printer_activate(UX_SLAVE_CLASS_COMMAND *command) @@ -108,7 +108,7 @@ UX_SLAVE_ENDPOINT *endpoint; if (endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_IN) { printer -> ux_device_class_printer_endpoint_in = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_PRINTER_WRITE_BUFFER(printer); #endif @@ -118,7 +118,7 @@ UX_SLAVE_ENDPOINT *endpoint; else { printer -> ux_device_class_printer_endpoint_out = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_PRINTER_READ_BUFFER(printer); #endif diff --git a/common/usbx_device_classes/src/ux_device_class_printer_initialize.c b/common/usbx_device_classes/src/ux_device_class_printer_initialize.c index 1838542..e231665 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_printer_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,10 +72,10 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_printer_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -110,7 +110,7 @@ UINT status; printer -> ux_device_class_printer_parameter.ux_device_class_printer_instance_deactivate = printer_parameter -> ux_device_class_printer_instance_deactivate; printer -> ux_device_class_printer_parameter.ux_device_class_printer_soft_reset = printer_parameter -> ux_device_class_printer_soft_reset; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) /* Allocate endpoint buffer. */ UX_ASSERT(!UX_DEVICE_CLASS_PRINTER_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW); @@ -132,7 +132,7 @@ UINT status; { /* Free the resources. */ -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) _ux_utility_memory_free(printer -> ux_device_class_printer_endpoint_buffer); #endif _ux_utility_memory_free(printer); @@ -152,7 +152,7 @@ UINT status; _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex); /* Free the resources. */ -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) _ux_utility_memory_free(printer -> ux_device_class_printer_endpoint_buffer); #endif _ux_utility_memory_free(printer); diff --git a/common/usbx_device_classes/src/ux_device_class_printer_read.c b/common/usbx_device_classes/src/ux_device_class_printer_read.c index 2e51010..3fdded4 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_read.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_read.c @@ -116,6 +116,21 @@ ULONG local_requested_length; /* All Printer reading are on the endpoint OUT, from the host. */ transfer_request = &endpoint -> ux_slave_endpoint_transfer_request; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_PRINTER_ZERO_COPY) + + /* Check if device is configured. */ + if (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED) + { + + /* Issue the transfer request. */ + local_requested_length = requested_length; + transfer_request -> ux_slave_transfer_request_data_pointer = buffer; + status = _ux_device_stack_transfer_request(transfer_request, + local_requested_length, local_requested_length); + *actual_length = transfer_request -> ux_slave_transfer_request_actual_length; + } +#else + /* Reset the actual length. */ *actual_length = 0; @@ -179,6 +194,7 @@ ULONG local_requested_length; return(status); } } +#endif /* Free Mutex resource. */ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex); @@ -207,7 +223,7 @@ ULONG local_requested_length; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_printer_read PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -243,9 +259,9 @@ ULONG local_requested_length; /* DATE NAME DESCRIPTION */ /* */ /* 03-08-2023 Yajun Xia Initial Version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ /* fixed error checking issue, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_printer_read(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_printer_read_run.c b/common/usbx_device_classes/src/ux_device_class_printer_read_run.c index db7499b..bf57d0d 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_read_run.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_read_run.c @@ -120,6 +120,53 @@ UINT status = UX_SUCCESS; /* All Printer reading are on the endpoint OUT, from the host. */ transfer_request = &endpoint -> ux_slave_endpoint_transfer_request; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_PRINTER_ZERO_COPY) + + /* Run the transfer state machine. */ + if (printer -> ux_device_class_printer_read_state == UX_STATE_RESET) + { + + /* If trace is enabled, insert this event into the trace buffer. */ + UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PRINTER_READ, printer, buffer, requested_length, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0) + + printer -> ux_device_class_printer_read_state = UX_DEVICE_CLASS_PRINTER_READ_START; + printer -> ux_device_class_printer_read_status = UX_TRANSFER_NO_ANSWER; + transfer_request -> ux_slave_transfer_request_data_pointer = buffer; + UX_SLAVE_TRANSFER_STATE_RESET(transfer_request); + } + + /* Issue the transfer request. */ + max_transfer_length = requested_length; + status = _ux_device_stack_transfer_run(transfer_request, max_transfer_length, max_transfer_length); + + /* Error case. */ + if (status < UX_STATE_NEXT) + { + + printer -> ux_device_class_printer_read_state = UX_STATE_RESET; + printer -> ux_device_class_printer_read_status = + transfer_request -> ux_slave_transfer_request_completion_code; + return(UX_STATE_ERROR); + } + + /* Success case. */ + if (status == UX_STATE_NEXT) + { + + /* Last transfer status. */ + printer -> ux_device_class_printer_read_status = + transfer_request -> ux_slave_transfer_request_completion_code; + + /* Update actual length. */ + *actual_length = transfer_request -> ux_slave_transfer_request_actual_length; + + /* It's done. */ + printer -> ux_device_class_printer_read_state = UX_STATE_RESET; + } + + return(status); +#else + /* Handle state cases. */ switch(printer -> ux_device_class_printer_read_state) { @@ -230,6 +277,7 @@ UINT status = UX_SUCCESS; printer -> ux_device_class_printer_read_status = UX_INVALID_STATE; break; } +#endif /* Error cases. */ return(UX_STATE_EXIT); @@ -240,7 +288,7 @@ UINT status = UX_SUCCESS; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_printer_read_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -281,7 +329,7 @@ UINT status = UX_SUCCESS; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_printer_read_run(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_printer_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_printer_uninitialize.c index 89f5c37..0a84a34 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_uninitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_printer_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,10 +75,10 @@ /* 10-31-2022 Yajun Xia Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_printer_uninitialize(UX_SLAVE_CLASS_COMMAND *command) @@ -104,7 +104,7 @@ UX_SLAVE_CLASS *class_ptr; _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_out_mutex); #endif /* Free the resources. */ -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if defined(UX_DEVICE_CLASS_PRINTER_OWN_ENDPOINT_BUFFER) _ux_utility_memory_free(printer -> ux_device_class_printer_endpoint_buffer); #endif _ux_utility_memory_free(printer); diff --git a/common/usbx_device_classes/src/ux_device_class_printer_write.c b/common/usbx_device_classes/src/ux_device_class_printer_write.c index f2df267..a955cd2 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_write.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_write.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_printer_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,10 +79,10 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* added auto ZLP support, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_printer_write(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, @@ -146,6 +146,28 @@ UINT status = 0; return(status); } +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_PRINTER_ZERO_COPY) + + /* Check if device is configured. */ + if (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED) + { + +#if defined(UX_DEVICE_CLASS_PRINTER_WRITE_AUTO_ZLP) + + /* Issue with larger host length to append zlp if necessary. */ + local_host_length = requested_length + 1; +#else + local_host_length = requested_length; +#endif + local_requested_length = requested_length; + + /* Issue the transfer request. */ + transfer_request -> ux_slave_transfer_request_data_pointer = buffer; + status = _ux_device_stack_transfer_request(transfer_request, local_requested_length, local_host_length); + *actual_length = transfer_request -> ux_slave_transfer_request_actual_length; + } +#else + /* Check if we need more transactions. */ local_host_length = UX_DEVICE_CLASS_PRINTER_WRITE_BUFFER_SIZE; while (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED && @@ -207,6 +229,7 @@ UINT status = 0; return(status); } } +#endif /* Free Mutex resource. */ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex); @@ -235,7 +258,7 @@ UINT status = 0; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_printer_write PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -271,9 +294,9 @@ UINT status = 0; /* DATE NAME DESCRIPTION */ /* */ /* 03-08-2023 Yajun Xia Initial Version 6.2.1 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ /* fixed error checking issue, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_printer_write(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_printer_write_run.c b/common/usbx_device_classes/src/ux_device_class_printer_write_run.c index 034fcd7..a5dbd1d 100644 --- a/common/usbx_device_classes/src/ux_device_class_printer_write_run.c +++ b/common/usbx_device_classes/src/ux_device_class_printer_write_run.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_printer_write_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -78,10 +78,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Yajun Xia Initial Version 6.2.0 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_printer_write_run(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, @@ -91,8 +91,10 @@ UINT _ux_device_class_printer_write_run(UX_DEVICE_CLASS_PRINTER *printer, UCHAR UX_SLAVE_ENDPOINT *endpoint; UX_SLAVE_DEVICE *device; UX_SLAVE_TRANSFER *transfer_request; -UINT zlp = UX_FALSE; UINT status = 0; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER != 1) || !defined(UX_DEVICE_CLASS_CDC_ACM_ZERO_COPY) +UINT zlp = UX_FALSE; +#endif /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_PRINTER_WRITE, printer, buffer, requested_length, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0) @@ -135,6 +137,54 @@ UINT status = 0; /* We are writing to the IN endpoint. */ transfer_request = &endpoint -> ux_slave_endpoint_transfer_request; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_PRINTER_ZERO_COPY) + + /* Run the transfer state machine. */ + if (printer -> ux_device_class_printer_write_state == UX_STATE_RESET) + { + + /* Set the state to WRITE_WAIT. */ + printer -> ux_device_class_printer_write_state = UX_DEVICE_CLASS_PRINTER_WRITE_WAIT; + printer -> ux_device_class_printer_write_status = UX_TRANSFER_NO_ANSWER; + transfer_request -> ux_slave_transfer_request_data_pointer = buffer; + UX_SLAVE_TRANSFER_STATE_RESET(transfer_request); + } + + /* Issue the transfer request. */ +#if defined(UX_DEVICE_CLASS_PRINTER_WRITE_AUTO_ZLP) + status = _ux_device_stack_transfer_run(transfer_request, requested_length, requested_length + 1); +#else + status = _ux_device_stack_transfer_run(transfer_request, requested_length, requested_length); +#endif + + /* Error case. */ + if (status < UX_STATE_NEXT) + { + + printer -> ux_device_class_printer_write_state = UX_STATE_RESET; + printer -> ux_device_class_printer_write_status = + transfer_request -> ux_slave_transfer_request_completion_code; + return(UX_STATE_ERROR); + } + + /* Success case. */ + if (status == UX_STATE_NEXT) + { + + /* Last transfer status. */ + printer -> ux_device_class_printer_write_status = + transfer_request -> ux_slave_transfer_request_completion_code; + + /* Update actual length. */ + *actual_length = transfer_request -> ux_slave_transfer_request_actual_length; + + /* It's done. */ + printer -> ux_device_class_printer_write_state = UX_STATE_RESET; + } + return(status); + +#else + /* Handle state cases. */ switch(printer -> ux_device_class_printer_write_state) { @@ -254,6 +304,7 @@ UINT status = 0; printer -> ux_device_class_printer_write_state = UX_STATE_RESET; break; } +#endif /* Error case. */ return(UX_STATE_EXIT); @@ -264,7 +315,7 @@ UINT status = 0; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_printer_write_run PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -305,7 +356,7 @@ UINT status = 0; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun xia Initial Version 6.x */ +/* 10-31-2023 Yajun xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_printer_write_run(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer, diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_activate.c b/common/usbx_device_classes/src/ux_device_class_rndis_activate.c index 141cc2e..d8d946c 100644 --- a/common/usbx_device_classes/src/ux_device_class_rndis_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_rndis_activate.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_rndis_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,10 +79,11 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_rndis_activate(UX_SLAVE_CLASS_COMMAND *command) @@ -157,7 +158,7 @@ ULONG physical_address_lsw; /* We have found the bulk in endpoint, save it. */ rndis -> ux_slave_class_rndis_bulkin_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER(rndis); #endif @@ -171,7 +172,7 @@ ULONG physical_address_lsw; /* We have found the bulk out endpoint, save it. */ rndis -> ux_slave_class_rndis_bulkout_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer = UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER(rndis); #endif @@ -209,12 +210,14 @@ ULONG physical_address_lsw; physical_address_lsw); /* Reset the endpoint buffers. */ +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && !defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) _ux_utility_memory_set(rndis -> ux_slave_class_rndis_bulkout_endpoint -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer, 0, UX_SLAVE_REQUEST_DATA_MAX_LENGTH); /* Use case of memset is verified. */ + ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE); /* Use case of memset is verified. */ _ux_utility_memory_set(rndis -> ux_slave_class_rndis_bulkin_endpoint -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer, 0, UX_SLAVE_REQUEST_DATA_MAX_LENGTH); /* Use case of memset is verified. */ + ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE); /* Use case of memset is verified. */ +#endif _ux_utility_memory_set(rndis -> ux_slave_class_rndis_interrupt_endpoint -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer, 0, UX_SLAVE_REQUEST_DATA_MAX_LENGTH); /* Use case of memset is verified. */ + ux_slave_transfer_request_data_pointer, 0, UX_DEVICE_CLASS_RNDIS_INTERRUPTIN_BUFFER_SIZE); /* Use case of memset is verified. */ /* Resume the endpoint threads. */ _ux_device_thread_resume(&rndis -> ux_slave_class_rndis_interrupt_thread); diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_bulkin_thread.c b/common/usbx_device_classes/src/ux_device_class_rndis_bulkin_thread.c index c2c0e61..e0e7de9 100644 --- a/common/usbx_device_classes/src/ux_device_class_rndis_bulkin_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_rndis_bulkin_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_rndis_bulkin_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,10 +88,11 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* used NX API to copy data, */ /* 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 */ /* */ /**************************************************************************/ VOID _ux_device_class_rndis_bulkin_thread(ULONG rndis_class) @@ -106,6 +107,10 @@ ULONG actual_flags; NX_PACKET *current_packet; ULONG transfer_length; ULONG copied; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) && !defined(NX_DISABLE_PACKET_CHAIN) +NX_PACKET *packet; +UINT do_copy; +#endif /* Cast properly the rndis instance. */ UX_THREAD_EXTENSION_PTR_GET(class_ptr, UX_SLAVE_CLASS, rndis_class) @@ -156,10 +161,125 @@ ULONG copied; /* If the link is down no need to rearm a packet. */ if (rndis -> ux_slave_class_rndis_link_state == UX_DEVICE_CLASS_RNDIS_LINK_STATE_UP) { - + + /* Input packet mapping: + * | <----- nx_packet_length -----> | + * .. NX_PHYSICAL_HEADER? | NX_ETHERNET_SIZE | Packet ... | + * start prepend append + */ + /* Calculate the transfer length. */ transfer_length = current_packet -> nx_packet_length + UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH; +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) + + /* Default to success. */ + status = UX_SUCCESS; + + /* Check if there was enough space for RNDIS header, if not data should be copied. */ + do_copy = (current_packet -> nx_packet_data_start + UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH > current_packet -> nx_packet_prepend_ptr); + +#ifndef NX_DISABLE_PACKET_CHAIN + + /* Check if packet is chained, chained packets must be joined (copied). */ + if (current_packet -> nx_packet_next) + do_copy = 1; +#endif + + /* Check if data is being copied to new packet. */ + if (do_copy) + { + + /* Check if packet pool is good for data collection. */ + if (transfer_length > current_packet -> nx_packet_pool_owner -> nx_packet_pool_payload_size) + status = UX_TRANSFER_BUFFER_OVERFLOW; + + /* Allocate a new packet for data collection. */ + if (status == UX_SUCCESS) + { + status = nx_packet_allocate(current_packet -> nx_packet_pool_owner, + &packet, UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH, + UX_MS_TO_TICK(UX_DEVICE_CLASS_RNDIS_PACKET_POOL_WAIT)); + + /* Reserve space for RNDIS header. */ + packet -> nx_packet_append_ptr = packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH; + + } + + /* Copy the data to allocated. */ + if (status == UX_SUCCESS) + { + + /* RNDIS packet header already reserved. */ + + /* Copy the data to allocated. */ + status = nx_packet_data_extract_offset(current_packet, 0, + packet -> nx_packet_append_ptr, + current_packet -> nx_packet_length, &copied); + if (status == NX_SUCCESS) + { + packet -> nx_packet_length = copied; + + /* Release the chained packet. */ + current_packet -> nx_packet_length = current_packet -> nx_packet_length - UX_DEVICE_CLASS_RNDIS_ETHERNET_SIZE; + nx_packet_transmit_release(current_packet); + + /* Use copied packet to transfer. */ + current_packet = packet; + } + } + + /* Can not copy/buffer issue. */ + if (status != UX_SUCCESS) + status = UX_TRANSFER_BUFFER_OVERFLOW; + } + else + { + + /* There is enough space for RNDIS header, move prepend_ptr for it. */ + current_packet -> nx_packet_prepend_ptr -= UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH; + } + + if (status == UX_SUCCESS) + { + + /* Add the RNDIS header to this packet. */ + + /* Reset the RNDIS header. */ + _ux_utility_memory_set(current_packet -> nx_packet_prepend_ptr, 0x00, UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH); /* Use case of memset is verified. */ + + /* Initialize fields in header. */ + _ux_utility_long_put(current_packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_PACKET_MESSAGE_TYPE, UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_MSG); + _ux_utility_long_put(current_packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_PACKET_MESSAGE_LENGTH, transfer_length); + _ux_utility_long_put(current_packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_PACKET_DATA_OFFSET, + UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH - UX_DEVICE_CLASS_RNDIS_PACKET_DATA_OFFSET); + _ux_utility_long_put(current_packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_PACKET_DATA_LENGTH, current_packet -> nx_packet_length); + + /* Set the transfer request data pointer to the packet buffer. */ + transfer_request -> ux_slave_transfer_request_data_pointer = current_packet -> nx_packet_prepend_ptr; + + /* If trace is enabled, insert this event into the trace buffer. */ + UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_RNDIS_PACKET_TRANSMIT, rndis, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0) + + /* Send the request to the device controller. */ + status = _ux_device_stack_transfer_request(transfer_request, transfer_length, transfer_length + 1); + } + + /* Check error code. */ + if (status != UX_SUCCESS) + { + + /* Is this not a transfer abort? (it's fine to be aborted) */ + if (status != UX_TRANSFER_BUS_RESET) + { + + /* Error trap. */ + _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, status); + } + + } +#else + /* Is there enough space for this packet in the transfer buffer? */ if (transfer_length <= UX_DEVICE_CLASS_RNDIS_BULKIN_BUFFER_SIZE) { @@ -200,6 +320,7 @@ ULONG copied; /* Report error to application. */ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_MEMORY_INSUFFICIENT); } +#endif } /* Free the packet that was just sent. First do some housekeeping. */ diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_bulkout_thread.c b/common/usbx_device_classes/src/ux_device_class_rndis_bulkout_thread.c index e4c3b50..43b6aee 100644 --- a/common/usbx_device_classes/src/ux_device_class_rndis_bulkout_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_rndis_bulkout_thread.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_rndis_bulkout_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -88,10 +88,11 @@ /* used NX API to copy data, */ /* used linked NX IP pool, */ /* 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 */ /* */ /**************************************************************************/ VOID _ux_device_class_rndis_bulkout_thread(ULONG rndis_class) @@ -165,10 +166,41 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; /* Reset the queue pointer of this packet. */ packet -> nx_packet_queue_next = UX_NULL; - + +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) + + /* Adjust the prepend pointer to take into account the RNDIS header and + non 3 bit alignment of the ethernet header. */ + packet -> nx_packet_append_ptr += UX_DEVICE_CLASS_RNDIS_PACKET_BUFFER; + switch(((ALIGN_TYPE)packet -> nx_packet_append_ptr) & 0x3) + { + case 0: + packet -> nx_packet_append_ptr += 2; + break; + case 1: + packet -> nx_packet_append_ptr += 1; + break; + case 3: + packet -> nx_packet_append_ptr += 3; + break; + default: + break; + } + packet -> nx_packet_prepend_ptr = packet -> nx_packet_append_ptr - UX_DEVICE_CLASS_RNDIS_PACKET_BUFFER; + + /* Get actual size of transfer buffer. */ + packet_payload = (ULONG)(packet -> nx_packet_data_end - packet -> nx_packet_prepend_ptr); + + /* Send the request to the device controller. */ + transfer_request -> ux_slave_transfer_request_data_pointer = packet -> nx_packet_prepend_ptr; + status = _ux_device_stack_transfer_request(transfer_request, + packet_payload, packet_payload); +#else + /* Send the request to the device controller. */ status = _ux_device_stack_transfer_request(transfer_request, UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE, UX_DEVICE_CLASS_RNDIS_BULKOUT_BUFFER_SIZE); +#endif /* Check the completion code. */ if (status == UX_SUCCESS) @@ -195,6 +227,17 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; if (packet_payload <= transfer_request -> ux_slave_transfer_request_actual_length - UX_DEVICE_CLASS_RNDIS_PACKET_HEADER_LENGTH) { +#if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_RNDIS_ZERO_COPY) + + /* Data already in buffer, adjust packet start and save length. */ + packet -> nx_packet_prepend_ptr += UX_DEVICE_CLASS_RNDIS_PACKET_BUFFER; + packet -> nx_packet_length = packet_payload; + packet -> nx_packet_append_ptr += packet -> nx_packet_length; + + /* Send that packet to the NetX USB broker. */ + _ux_network_driver_packet_received(rndis -> ux_slave_class_rndis_network_handle, packet); +#else + /* Adjust the prepend pointer to take into account the non 3 bit alignment of the ethernet header. */ packet -> nx_packet_prepend_ptr += sizeof(USHORT); packet -> nx_packet_append_ptr += sizeof(USHORT); @@ -219,6 +262,7 @@ USB_NETWORK_DEVICE_TYPE *ux_nx_device; _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CLASS_ETH_PACKET_ERROR); nx_packet_release(packet); } +#endif } else { diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_control_request.c b/common/usbx_device_classes/src/ux_device_class_rndis_control_request.c index a358e86..d804186 100644 --- a/common/usbx_device_classes/src/ux_device_class_rndis_control_request.c +++ b/common/usbx_device_classes/src/ux_device_class_rndis_control_request.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_rndis_control_request PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -94,10 +94,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_rndis_control_request(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_initialize.c b/common/usbx_device_classes/src/ux_device_class_rndis_initialize.c index 582b774..52bc74a 100644 --- a/common/usbx_device_classes/src/ux_device_class_rndis_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_rndis_initialize.c @@ -78,7 +78,7 @@ ULONG ux_device_class_rndis_oid_supported_list[UX_DEVICE_CLASS_RNDIS_OID_SUPPORT /* FUNCTION RELEASE */ /* */ /* _ux_device_class_rndis_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -139,11 +139,11 @@ ULONG ux_device_class_rndis_oid_supported_list[UX_DEVICE_CLASS_RNDIS_OID_SUPPORT /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* removed internal NX pool, */ /* resulting in version 6.2.0 */ -/* 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, */ /* checked compile options, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_rndis_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -156,7 +156,7 @@ UINT _ux_device_class_rndis_initialize(UX_SLAVE_CLASS_COMMAND *command) UX_SLAVE_CLASS_RNDIS *rndis; UX_SLAVE_CLASS_RNDIS_PARAMETER *rndis_parameter; UX_SLAVE_CLASS *class_ptr; -UINT status; +UINT status = UX_SUCCESS; /* Compile option checks. */ diff --git a/common/usbx_device_classes/src/ux_device_class_storage_activate.c b/common/usbx_device_classes/src/ux_device_class_storage_activate.c index 6b34c2a..d9be6df 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_activate.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_activate.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_activate PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -74,10 +74,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_activate(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_storage_csw_send.c b/common/usbx_device_classes/src/ux_device_class_storage_csw_send.c index 8366314..66e2a50 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_csw_send.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_csw_send.c @@ -39,7 +39,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_csw_send PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -90,10 +90,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_csw_send(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_entry.c b/common/usbx_device_classes/src/ux_device_class_storage_entry.c index 5d00a9d..d36472f 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_entry.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_entry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,9 +75,9 @@ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ /* resulting in version 6.1 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* added error checks support, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_entry(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_storage_get_configuration.c b/common/usbx_device_classes/src/ux_device_class_storage_get_configuration.c index 3ebf4fd..cd5f5c0 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_get_configuration.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_get_configuration.c @@ -303,7 +303,7 @@ UCHAR usbx_device_class_storage_configuration_active_profile[] = { /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_get_configuration PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -349,10 +349,10 @@ UCHAR usbx_device_class_storage_configuration_active_profile[] = { /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_get_configuration(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_get_performance.c b/common/usbx_device_classes/src/ux_device_class_storage_get_performance.c index be84a58..2bc8c12 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_get_performance.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_get_performance.c @@ -45,7 +45,7 @@ UCHAR usbx_device_class_storage_performance[] = { /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_get_performance PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -90,10 +90,10 @@ UCHAR usbx_device_class_storage_performance[] = { /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_get_performance(UX_SLAVE_CLASS_STORAGE *storage, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_initialize.c b/common/usbx_device_classes/src/ux_device_class_storage_initialize.c index b9e46e9..95e8a47 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_initialize.c @@ -41,7 +41,7 @@ UCHAR _ux_system_slave_class_storage_product_serial[] = "123 /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -82,10 +82,10 @@ UCHAR _ux_system_slave_class_storage_product_serial[] = "123 /* 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, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -249,7 +249,7 @@ ULONG lun_index; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_storage_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -278,7 +278,7 @@ ULONG lun_index; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */ +/* 10-31-2023 Chaoqiong Xiao Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_storage_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_storage_inquiry.c b/common/usbx_device_classes/src/ux_device_class_storage_inquiry.c index 74784a6..f55da6d 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_inquiry.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_inquiry.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_inquiry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -92,10 +92,10 @@ /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ /* updated dCSWDataResidue, */ /* resulting in version 6.1.12 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_inquiry(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, UX_SLAVE_ENDPOINT *endpoint_in, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_mode_sense.c b/common/usbx_device_classes/src/ux_device_class_storage_mode_sense.c index 64ea671..7b77c3b 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_mode_sense.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_mode_sense.c @@ -66,7 +66,7 @@ UCHAR usbx_device_class_storage_mode_sense_page_cdrom[USBX_DEVICE_CLASS_STORAGE_ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_mode_sense PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -116,10 +116,10 @@ UCHAR usbx_device_class_storage_mode_sense_page_cdrom[USBX_DEVICE_CLASS_STORAGE_ /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ /* internal clean up, */ /* resulting in version 6.1.11 */ -/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_mode_sense(UX_SLAVE_CLASS_STORAGE *storage, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_read_capacity.c b/common/usbx_device_classes/src/ux_device_class_storage_read_capacity.c index 528e496..dc23299 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_read_capacity.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_read_capacity.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_read_capacity PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,10 +86,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_read_capacity(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_read_disk_information.c b/common/usbx_device_classes/src/ux_device_class_storage_read_disk_information.c index f5029c6..7c53186 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_read_disk_information.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_read_disk_information.c @@ -65,7 +65,7 @@ UCHAR usbx_device_class_storage_disk_information[] = { /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_read_disk_information PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -109,10 +109,10 @@ UCHAR usbx_device_class_storage_disk_information[] = { /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_read_disk_information(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_read_format_capacity.c b/common/usbx_device_classes/src/ux_device_class_storage_read_format_capacity.c index 795778b..07ebefd 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_read_format_capacity.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_read_format_capacity.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_read_format_capacity PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -85,10 +85,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_read_format_capacity(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_read_toc.c b/common/usbx_device_classes/src/ux_device_class_storage_read_toc.c index 5f5a390..394fb72 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_read_toc.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_read_toc.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_read_toc PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,10 +86,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_read_toc(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_report_key.c b/common/usbx_device_classes/src/ux_device_class_storage_report_key.c index 3478e6c..1a63274 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_report_key.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_report_key.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_report_key PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -86,10 +86,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_report_key(UX_SLAVE_CLASS_STORAGE *storage, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_request_sense.c b/common/usbx_device_classes/src/ux_device_class_storage_request_sense.c index c1536d5..9bcb0cd 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_request_sense.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_request_sense.c @@ -40,7 +40,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_request_sense PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -87,10 +87,10 @@ /* 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), */ /* checked compiling options */ /* by runtime UX_ASSERT, */ -/* resulting in version 6.x */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_request_sense(UX_SLAVE_CLASS_STORAGE *storage, ULONG lun, UX_SLAVE_ENDPOINT *endpoint_in, diff --git a/common/usbx_device_classes/src/ux_device_class_storage_thread.c b/common/usbx_device_classes/src/ux_device_class_storage_thread.c index 6a2e873..ad60a15 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_thread.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_thread.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_thread PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -127,10 +127,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_storage_thread(ULONG storage_class) diff --git a/common/usbx_device_classes/src/ux_device_class_storage_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_storage_uninitialize.c index 59a7453..763a680 100644 --- a/common/usbx_device_classes/src/ux_device_class_storage_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_storage_uninitialize.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_storage_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -75,10 +75,10 @@ /* fixed parameter/variable */ /* names conflict C++ keyword, */ /* resulting in version 6.1.12 */ -/* 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 */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_storage_uninitialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_video_change.c b/common/usbx_device_classes/src/ux_device_class_video_change.c index 443fb9f..56d3777 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_change.c +++ b/common/usbx_device_classes/src/ux_device_class_video_change.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_change PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,11 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_change(UX_SLAVE_CLASS_COMMAND *command) @@ -149,11 +150,6 @@ ULONG stream_index; /* Save it. */ stream -> ux_device_class_video_stream_endpoint = endpoint; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - endpoint -> ux_slave_endpoint_transfer_request. - ux_slave_transfer_request_data_pointer = - stream -> ux_device_class_video_stream_endpoint_buffer; -#endif break; } diff --git a/common/usbx_device_classes/src/ux_device_class_video_entry.c b/common/usbx_device_classes/src/ux_device_class_video_entry.c index d0c5359..610bee8 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_video_entry.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_entry PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,9 +72,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_entry(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_video_initialize.c b/common/usbx_device_classes/src/ux_device_class_video_initialize.c index 12e39bc..94d2f87 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_initialize.c +++ b/common/usbx_device_classes/src/ux_device_class_video_initialize.c @@ -33,7 +33,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -70,10 +70,11 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command) @@ -153,7 +154,11 @@ ULONG i; stream_parameter -> ux_device_class_video_stream_parameter_max_payload_buffer_nb; /* Create block of buffer buffer is cache safe for USB transfer. */ +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + stream -> ux_device_class_video_stream_buffer = (UCHAR *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, memory_size); +#else stream -> ux_device_class_video_stream_buffer = (UCHAR *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size); +#endif /* Check for successful allocation. */ if (stream -> ux_device_class_video_stream_buffer == UX_NULL) @@ -166,17 +171,6 @@ ULONG i; stream -> ux_device_class_video_stream_transfer_pos = (UX_DEVICE_CLASS_VIDEO_PAYLOAD *)stream -> ux_device_class_video_stream_buffer; stream -> ux_device_class_video_stream_access_pos = stream -> ux_device_class_video_stream_transfer_pos; -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - stream -> ux_device_class_video_stream_endpoint_buffer = _ux_utility_memory_allocate( - UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, - stream -> ux_device_class_video_stream_payload_buffer_size); - if (stream -> ux_device_class_video_stream_endpoint_buffer == UX_NULL) - { - status = UX_MEMORY_INSUFFICIENT; - break; - } -#endif - #if !defined(UX_DEVICE_STANDALONE) /* Create memory block for streaming thread stack in addition. */ @@ -262,10 +256,6 @@ ULONG i; if (stream -> ux_device_class_video_stream_thread_stack) _ux_utility_memory_free(stream -> ux_device_class_video_stream_thread_stack); #endif -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - if (stream -> ux_device_class_video_stream_endpoint_buffer) - _ux_utility_memory_free(stream -> ux_device_class_video_stream_endpoint_buffer); -#endif if (stream -> ux_device_class_video_stream_buffer) _ux_utility_memory_free(stream -> ux_device_class_video_stream_buffer); stream ++; @@ -280,7 +270,7 @@ ULONG i; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_initialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -309,7 +299,7 @@ ULONG i; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command) diff --git a/common/usbx_device_classes/src/ux_device_class_video_ioctl.c b/common/usbx_device_classes/src/ux_device_class_video_ioctl.c index 517fa15..79b4625 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_ioctl.c +++ b/common/usbx_device_classes/src/ux_device_class_video_ioctl.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -66,8 +66,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function, @@ -111,7 +111,7 @@ VOID **pptr_parameter; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_ioctl PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -143,7 +143,7 @@ VOID **pptr_parameter; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function, diff --git a/common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c b/common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c index 03ce518..f6248d9 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c +++ b/common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c @@ -96,7 +96,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_max_payload_length PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -129,7 +129,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ ULONG _uxe_device_class_video_max_payload_length(UX_DEVICE_CLASS_VIDEO_STREAM *stream) diff --git a/common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c b/common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c index 5fd4e51..c9abd3b 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c +++ b/common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_read_payload_free PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -64,8 +64,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *stream) @@ -129,7 +129,7 @@ UCHAR *next_payload; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_read_payload_free PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -161,7 +161,7 @@ UCHAR *next_payload; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *stream) diff --git a/common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c b/common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c index 3244528..385d776 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c +++ b/common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_read_payload_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,8 +68,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream, @@ -118,7 +118,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_read_payload_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -154,7 +154,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream, diff --git a/common/usbx_device_classes/src/ux_device_class_video_read_task_function.c b/common/usbx_device_classes/src/ux_device_class_video_read_task_function.c index a7422cc..fc48006 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_read_task_function.c +++ b/common/usbx_device_classes/src/ux_device_class_video_read_task_function.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_read_task_function PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -71,6 +71,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Chaoqiong Xiao Initial Version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* useed zero copy when class */ +/* owns endpoint buffer, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_read_task_function(UX_DEVICE_CLASS_VIDEO_STREAM *stream) @@ -116,6 +120,13 @@ UINT status; /* Next state: transfer wait. */ stream -> ux_device_class_video_stream_task_state = UX_DEVICE_CLASS_VIDEO_STREAM_RW_WAIT; +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use frame buffer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data; +#endif + /* Reset transfer state. */ UX_SLAVE_TRANSFER_STATE_RESET(transfer); } @@ -153,9 +164,17 @@ UINT status; /* Frame received, log it. */ stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length = actual_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: data already in frame buffer. */ +#else + + /* Copy data from endpoint buffer. */ _ux_utility_memory_copy(stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data, transfer -> ux_slave_transfer_request_data_pointer, actual_length); /* Use case of memcpy is verified. */ +#endif /* For simple, do not advance the transfer position if there is overflow. */ next_pos = (UCHAR *)stream -> ux_device_class_video_stream_transfer_pos; diff --git a/common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c index 060723d..e7267cd 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_read_thread_entry PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added error statistics, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* useed zero copy when class */ +/* owns endpoint buffer, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_video_read_thread_entry(ULONG video_stream) @@ -115,6 +119,13 @@ ULONG actual_length; /* Get transfer instance. */ transfer = &endpoint -> ux_slave_endpoint_transfer_request; +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use frame buffer for transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data; +#endif + /* Start payload transfer anyway. */ status = _ux_device_stack_transfer_request(transfer, max_packet_size, max_packet_size); @@ -132,9 +143,17 @@ ULONG actual_length; /* Frame received, log it. */ stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length = actual_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: data already in frame buffer. */ +#else + + /* Copy data from endpoint buffer. */ _ux_utility_memory_copy(stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data, transfer -> ux_slave_transfer_request_data_pointer, actual_length); /* Use case of memcpy is verified. */ +#endif /* For simple, do not advance the transfer position if there is overflow. */ next_pos = (UCHAR *)stream -> ux_device_class_video_stream_transfer_pos; diff --git a/common/usbx_device_classes/src/ux_device_class_video_reception_start.c b/common/usbx_device_classes/src/ux_device_class_video_reception_start.c index 3928da3..939af79 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_reception_start.c +++ b/common/usbx_device_classes/src/ux_device_class_video_reception_start.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,8 +68,8 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream) @@ -122,7 +122,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_reception_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -153,7 +153,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream) diff --git a/common/usbx_device_classes/src/ux_device_class_video_transmission_start.c b/common/usbx_device_classes/src/ux_device_class_video_transmission_start.c index 4216ac5..246a13a 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_transmission_start.c +++ b/common/usbx_device_classes/src/ux_device_class_video_transmission_start.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_transmission_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,8 +68,8 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.2.0 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream) @@ -123,7 +123,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_transmission_start PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -155,7 +155,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream) diff --git a/common/usbx_device_classes/src/ux_device_class_video_uninitialize.c b/common/usbx_device_classes/src/ux_device_class_video_uninitialize.c index 1feb1aa..4eb262c 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_uninitialize.c +++ b/common/usbx_device_classes/src/ux_device_class_video_uninitialize.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_uninitialize PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -65,10 +65,11 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* 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 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_uninitialize(UX_SLAVE_CLASS_COMMAND *command) @@ -98,9 +99,6 @@ ULONG i; _ux_utility_thread_delete(&stream -> ux_device_class_video_stream_thread); _ux_utility_memory_free(stream -> ux_device_class_video_stream_thread_stack); #endif -#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 - _ux_utility_memory_free(stream -> ux_device_class_video_stream_endpoint_buffer); -#endif _ux_utility_memory_free(stream -> ux_device_class_video_stream_buffer); /* Next stream instance. */ diff --git a/common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c b/common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c index da182c8..1bfaaf2 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c +++ b/common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_write_payload_commit PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -65,8 +65,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *stream, ULONG length) @@ -129,7 +129,7 @@ UCHAR *next_pos; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_write_payload_commit PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -162,7 +162,7 @@ UCHAR *next_pos; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *stream, ULONG length) diff --git a/common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c b/common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c index 86431e7..6fd2a5f 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c +++ b/common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c @@ -34,7 +34,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_write_payload_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -68,8 +68,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */ -/* xx-xx-xxxx Yajun Xia Modified comment(s), */ -/* resulting in version 6.x */ +/* 10-31-2023 Yajun Xia Modified comment(s), */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream, UCHAR **payload, ULONG *length) @@ -118,7 +118,7 @@ UX_SLAVE_DEVICE *device; /* FUNCTION RELEASE */ /* */ /* _uxe_device_class_video_write_payload_get PORTABLE C */ -/* 6.x */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Yajun Xia, Microsoft Corporation */ @@ -154,7 +154,7 @@ UX_SLAVE_DEVICE *device; /* */ /* DATE NAME DESCRIPTION */ /* */ -/* xx-xx-xxxx Yajun Xia Initial Version 6.x */ +/* 10-31-2023 Yajun Xia Initial Version 6.3.0 */ /* */ /**************************************************************************/ UINT _uxe_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream, UCHAR **payload, ULONG *length) diff --git a/common/usbx_device_classes/src/ux_device_class_video_write_task_function.c b/common/usbx_device_classes/src/ux_device_class_video_write_task_function.c index 55dba42..0fe5b8c 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_write_task_function.c +++ b/common/usbx_device_classes/src/ux_device_class_video_write_task_function.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_write_task_function PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* DATE NAME DESCRIPTION */ /* */ /* 10-31-2022 Chaoqiong Xiao Initial Version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* useed zero copy when class */ +/* owns endpoint buffer, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ UINT _ux_device_class_video_write_task_function(UX_DEVICE_CLASS_VIDEO_STREAM *stream) @@ -119,9 +123,19 @@ UINT status; /* Start payload transfer anyway (even ZLP). */ transfer_length = stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use frame buffer for transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data; +#else + + /* Copy frame buffer to transfer buffer. */ if (transfer_length) _ux_utility_memory_copy(transfer -> ux_slave_transfer_request_data_pointer, stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data, transfer_length); /* Use case of memcpy is verified. */ +#endif /* Reset transfer state. */ UX_SLAVE_TRANSFER_STATE_RESET(transfer); diff --git a/common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c index 3dce636..e28de0c 100644 --- a/common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c +++ b/common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c @@ -35,7 +35,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_device_class_video_write_thread_entry PORTABLE C */ -/* 6.2.0 */ +/* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -72,6 +72,10 @@ /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added error statistics, */ /* resulting in version 6.2.0 */ +/* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ +/* useed zero copy when class */ +/* owns endpoint buffer, */ +/* resulting in version 6.3.0 */ /* */ /**************************************************************************/ VOID _ux_device_class_video_write_thread_entry(ULONG video_stream) @@ -112,9 +116,19 @@ ULONG actual_length; /* Start payload transfer anyway (even ZLP). */ transfer_length = stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length; + +#if UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1 + + /* Zero copy: directly use frame buffer for transfer. */ + transfer -> ux_slave_transfer_request_data_pointer = stream -> + ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data; +#else + + /* Copy frame buffer to transfer buffer. */ if (transfer_length) _ux_utility_memory_copy(transfer -> ux_slave_transfer_request_data_pointer, stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_data, transfer_length); /* Use case of memcpy is verified. */ +#endif /* Issue transfer request, thread blocked until transfer done. */ status = _ux_device_stack_transfer_request(transfer, transfer_length, transfer_length); |
