summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuxin Zhou <[email protected]>2022-04-20 05:09:21 +0000
committerYuxin Zhou <[email protected]>2022-04-20 05:09:21 +0000
commitb693cdd782f1dc0742d6b1915cdc3d08f6d0959c (patch)
tree03881d21bea4d34cb61fa5596bd6ba90f7b22639
parent388e9732d1ae4b6f98906ae29deec2af88fee8b0 (diff)
Release 6.1.11v6.1.11_rel
-rwxr-xr-xcommon/core/inc/ux_api.h45
-rw-r--r--common/core/inc/ux_system.h6
-rw-r--r--common/core/inc/ux_utility.h11
-rw-r--r--common/core/src/ux_device_stack_descriptor_send.c7
-rw-r--r--common/core/src/ux_device_stack_initialize.c8
-rw-r--r--common/core/src/ux_host_class_dpump_activate.c9
-rw-r--r--common/core/src/ux_host_class_dpump_write.c7
-rw-r--r--common/core/src/ux_host_stack_device_configuration_deactivate.c12
-rw-r--r--common/core/src/ux_host_stack_new_endpoint_create.c9
-rw-r--r--common/core/src/ux_host_stack_rh_device_insertion.c7
-rw-r--r--common/core/src/ux_utility_event_flags_create.c8
-rw-r--r--common/core/src/ux_utility_event_flags_delete.c8
-rw-r--r--common/core/src/ux_utility_event_flags_get.c8
-rw-r--r--common/core/src/ux_utility_event_flags_set.c8
-rw-r--r--common/core/src/ux_utility_memory_allocate.c7
-rw-r--r--common/core/src/ux_utility_mutex_create.c8
-rw-r--r--common/core/src/ux_utility_mutex_delete.c8
-rw-r--r--common/core/src/ux_utility_mutex_off.c8
-rw-r--r--common/core/src/ux_utility_mutex_on.c8
-rw-r--r--common/core/src/ux_utility_semaphore_create.c8
-rw-r--r--common/core/src/ux_utility_semaphore_delete.c8
-rw-r--r--common/core/src/ux_utility_semaphore_get.c8
-rw-r--r--common/core/src/ux_utility_semaphore_put.c8
-rw-r--r--common/core/src/ux_utility_thread_create.c8
-rw-r--r--common/core/src/ux_utility_thread_delete.c8
-rw-r--r--common/core/src/ux_utility_thread_identify.c10
-rw-r--r--common/core/src/ux_utility_thread_relinquish.c8
-rw-r--r--common/core/src/ux_utility_thread_resume.c8
-rw-r--r--common/core/src/ux_utility_thread_schedule_other.c8
-rw-r--r--common/core/src/ux_utility_thread_sleep.c8
-rw-r--r--common/core/src/ux_utility_thread_suspend.c8
-rw-r--r--common/core/src/ux_utility_timer_create.c8
-rw-r--r--common/core/src/ux_utility_timer_delete.c7
-rw-r--r--common/usbx_device_classes/CMakeLists.txt35
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_audio.h9
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_ccid.h1055
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_cdc_ecm.h40
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_hid.h7
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_pima.h7
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_printer.h7
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_rndis.h41
-rw-r--r--common/usbx_device_classes/inc/ux_device_class_video.h673
-rw-r--r--common/usbx_device_classes/src/ux_device_class_audio10_control_process.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_audio_change.c12
-rw-r--r--common/usbx_device_classes/src/ux_device_class_audio_initialize.c10
-rw-r--r--common/usbx_device_classes/src/ux_device_class_audio_unitialize.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_audio_write_frame_commit.c2
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_activate.c155
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c100
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_start.c92
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_control_abort.c141
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_control_request.c167
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_deactivate.c110
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_entry.c146
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c133
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c120
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c113
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_initialize.c439
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_notify_thread_entry.c227
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_response.c101
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_runner_thread_entry.c232
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_thread_entry.c365
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c128
-rw-r--r--common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c114
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_bulkin_thread.c10
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_initialize.c12
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_read.c14
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_unitialize.c10
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_write.c16
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_acm_write_with_callback.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_activate.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkin_thread.c20
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_bulkout_thread.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_change.c13
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_deactivate.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_initialize.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_interrupt_thread.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_uninitialize.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_cdc_ecm_write.c23
-rw-r--r--common/usbx_device_classes/src/ux_device_class_dfu_control_request.c46
-rw-r--r--common/usbx_device_classes/src/ux_device_class_dfu_initialize.c8
-rwxr-xr-xcommon/usbx_device_classes/src/ux_device_class_hid_control_request.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_event_set.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_initialize.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_read.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_receiver_event_free.c7
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_receiver_initialize.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_receiver_thread.c19
-rw-r--r--common/usbx_device_classes/src/ux_device_class_hid_uninitialize.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_activate.c10
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_device_info_send.c10
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_initialize.c11
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_interrupt_thread.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_object_info_get.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_thread.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_printer_initialize.c14
-rw-r--r--common/usbx_device_classes/src/ux_device_class_printer_read.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_printer_uninitialize.c11
-rw-r--r--common/usbx_device_classes/src/ux_device_class_printer_write.c17
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_activate.c13
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_bulkin_thread.c20
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_bulkout_thread.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_control_request.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_deactivate.c9
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_initialize.c15
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_interrupt_thread.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_rndis_write.c24
-rw-r--r--common/usbx_device_classes/src/ux_device_class_storage_mode_sense.c6
-rw-r--r--common/usbx_device_classes/src/ux_device_class_storage_thread.c8
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_activate.c165
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_change.c191
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_control_request.c240
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_deactivate.c116
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_entry.c157
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_initialize.c243
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_ioctl.c105
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c92
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c123
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c112
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c164
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_reception_start.c109
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_stream_get.c93
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_transmission_start.c109
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_uninitialize.c109
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c126
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c113
-rw-r--r--common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c173
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_asix.h16
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h14
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_hid_keyboard.h11
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_hid_mouse.h11
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_hid_remote_control.h13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_deactivate.c11
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_entry.c10
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_reception_callback.c12
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_thread.c21
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c10
-rw-r--r--common/usbx_host_classes/src/ux_host_class_asix_write.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_configure.c16
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_control_get.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_read.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c19
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c11
-rw-r--r--common/usbx_host_classes/src/ux_host_class_audio_write.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c8
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_deactivate.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_entry.c10
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_interrupt_notification.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c12
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmission_callback.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmit_queue_clean.c10
-rw-r--r--common/usbx_host_classes/src/ux_host_class_cdc_ecm_write.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_gser_activate.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_gser_read.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_gser_write.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_configure.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_idle_get.c2
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_keyboard_activate.c42
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_mouse_activate.c32
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_remote_control_activate.c29
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hub_configure.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_pima_endpoints_get.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_prolific_endpoints_get.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_prolific_setup.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_storage_device_reset.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c204
-rw-r--r--common/usbx_host_classes/src/ux_host_class_storage_thread_entry.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_storage_transport_cb.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_storage_transport_cbi.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_swar_read.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_swar_write.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_activate.c10
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_channel_start.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_configure.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_control_get.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_control_value_get.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_control_value_set.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c13
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_read.c7
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_stop.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c9
-rw-r--r--common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c9
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_done_queue_process.c17
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ehci_initialize.c19
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c15
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_destroy.c13
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c15
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_destroy.c13
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ehci_regular_td_obtain.c15
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ehci_request_isochronous_transfer.c13
-rwxr-xr-xcommon/usbx_host_controllers/src/ux_hcd_ehci_transfer_abort.c13
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_create.c8
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_destroy.c8
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ohci_initialize.c15
-rw-r--r--common/usbx_host_controllers/src/ux_hcd_ohci_regular_td_obtain.c15
-rw-r--r--common/usbx_network/src/ux_network_driver.c18
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c7
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c7
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c8
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c7
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c19
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c9
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c8
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c7
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c8
-rw-r--r--common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c14
-rw-r--r--ports/arm9/gnu/inc/ux_port.h2
-rw-r--r--ports/arm9/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_a15/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_a5/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_a5/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_a5x/ac6/inc/ux_port.h2
-rw-r--r--ports/cortex_a7/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_a7/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_a8/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_a8/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_a9/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_a9/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_m0/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_m0/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_m3/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_m3/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_m4/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_m4/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_m7/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_m7/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_r4/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_r4/iar/inc/ux_port.h2
-rw-r--r--ports/cortex_r5/gnu/inc/ux_port.h2
-rw-r--r--ports/cortex_r5/iar/inc/ux_port.h2
-rw-r--r--ports/generic/inc/ux_port.h2
-rw-r--r--ports/linux/gnu/inc/ux_port.h2
237 files changed, 8816 insertions, 591 deletions
diff --git a/common/core/inc/ux_api.h b/common/core/inc/ux_api.h
index 9f12ac2..86613b0 100755
--- a/common/core/inc/ux_api.h
+++ b/common/core/inc/ux_api.h
@@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* ux_api.h PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -110,6 +110,11 @@
/* added some general errors, */
/* added printer trace IDs, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* assumed OS types to avoid */
+/* standalone compiling error, */
+/* added CCID trace IDs, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -277,7 +282,7 @@ typedef signed char SCHAR;
#define AZURE_RTOS_USBX
#define USBX_MAJOR_VERSION 6
#define USBX_MINOR_VERSION 1
-#define USBX_PATCH_VERSION 10
+#define USBX_PATCH_VERSION 11
/* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */
@@ -764,6 +769,32 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_TRACE_DEVICE_CLASS_PRINTER_READ (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 102) /* I1 = class instance , I2 = buffer , I3 = requested_length */
#define UX_TRACE_DEVICE_CLASS_PRINTER_WRITE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 103) /* I1 = class instance , I2 = buffer , I3 = requested_length */
+#define UX_TRACE_DEVICE_CLASS_CCID_ACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 110) /* I1 = class instance */
+#define UX_TRACE_DEVICE_CLASS_CCID_DEACTIVATE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 111) /* I1 = class instance */
+#define UX_TRACE_DEVICE_CLASS_CCID_REQ_ABORT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 112) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 113) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_OFF (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 114) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_GET_SLOT_STATUS (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 115) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 116) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_GET_PARAMETERS (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 117) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_RESET_PARAMETERS (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 118) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 119) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ESCAPE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 120) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 121) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 122) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 123) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 124) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 125) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_PC_TO_RDR_SET_RATE_CLOCK (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 126) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_RDR_TO_PC_RESPONSE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 127) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_ICC_INSERT (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 128) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_ICC_REMOVE (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 129) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_AUTO_SEQ_START (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 130) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_AUTO_SEQ_STOP (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 131) /* I1 = class instance , I2 = slot */
+#define UX_TRACE_DEVICE_CLASS_CCID_TIME_EXTENSION (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 132) /* I1 = class instance , I2 = slot , I3 = time */
+#define UX_TRACE_DEVICE_CLASS_CCID_HARDWARE_ERROR (UX_TRACE_DEVICE_CLASS_EVENTS_BASE + 133) /* I1 = class instance , I2 = slot */
+
+
/* Define the USBX Error Event. */
#define UX_TRACE_ERROR 999
@@ -858,12 +889,16 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#ifndef UX_TIMER
#ifdef TX_API_H
#define UX_TIMER TX_TIMER
+#else
+#define UX_TIMER VOID* /* Dummy type for standalone compile. */
#endif
#endif
#ifndef UX_THREAD
#ifdef TX_API_H
#define UX_THREAD TX_THREAD
+#else
+#define UX_THREAD VOID* /* Dummy type for standalone compile. */
#endif
#endif
@@ -933,6 +968,8 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#ifndef UX_SEMAPHORE
#ifdef TX_API_H
#define UX_SEMAPHORE TX_SEMAPHORE
+#else
+#define UX_SEMAPHORE VOID* /* Dummy type for standalone compile. */
#endif
#endif
@@ -942,6 +979,8 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#ifndef UX_MUTEX
#ifdef TX_API_H
#define UX_MUTEX TX_MUTEX
+#else
+#define UX_MUTEX VOID* /* Dummy type for standalone compile. */
#endif
#endif
@@ -951,6 +990,8 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#ifndef UX_EVENT_FLAGS_GROUP
#ifdef TX_API_H
#define UX_EVENT_FLAGS_GROUP TX_EVENT_FLAGS_GROUP
+#else
+#define UX_EVENT_FLAGS_GROUP VOID* /* Dummy type for standalone compile. */
#endif
#endif
diff --git a/common/core/inc/ux_system.h b/common/core/inc/ux_system.h
index e0e2087..012da6b 100644
--- a/common/core/inc/ux_system.h
+++ b/common/core/inc/ux_system.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_system.h PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -50,6 +50,9 @@
/* added standalone support, */
/* added device printer name, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added device CCID name, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -145,6 +148,7 @@ extern UCHAR _ux_system_slave_class_cdc_ecm_name[];
extern UCHAR _ux_system_slave_class_dfu_name[];
extern UCHAR _ux_system_device_class_printer_name[];
+extern UCHAR _ux_system_device_class_ccid_name[];
#if defined(UX_HOST_SIDE_ONLY)
#define _ux_system_host_tasks_run _ux_host_stack_tasks_run
diff --git a/common/core/inc/ux_utility.h b/common/core/inc/ux_utility.h
index fcd7e4f..3b25f70 100644
--- a/common/core/inc/ux_utility.h
+++ b/common/core/inc/ux_utility.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_utility.h PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -50,6 +50,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -186,6 +189,7 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
#if !defined(UX_DEVICE_STANDALONE)
#define _ux_device_thread_create _ux_utility_thread_create
#define _ux_device_thread_delete _ux_utility_thread_delete
+#define _ux_device_thread_entry(t) ((t)->tx_thread_entry)
#define _ux_device_thread_suspend _ux_utility_thread_suspend
#define _ux_device_thread_resume _ux_utility_thread_resume
#define _ux_device_thread_relinquish _ux_utility_thread_relinquish
@@ -206,6 +210,7 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
#else
#define _ux_device_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS)
#define _ux_device_thread_delete(t) do{}while(0)
+#define _ux_device_thread_entry(t) ((UX_THREAD_ENTRY)t)
#define _ux_device_thread_suspend(t) do{}while(0)
#define _ux_device_thread_resume(t) do{}while(0)
#define _ux_device_thread_relinquish(t) do{}while(0)
@@ -230,6 +235,7 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
#define _ux_host_thread_create _ux_utility_thread_create
#define _ux_host_thread_created(thr) ((thr)->tx_thread_id != 0)
#define _ux_host_thread_delete _ux_utility_thread_delete
+#define _ux_host_thread_entry(thr) ((thr)->tx_thread_entry)
#define _ux_host_thread_resume _ux_utility_thread_resume
#define _ux_host_thread_sleep _ux_utility_thread_sleep
#define _ux_host_thread_schedule_other _ux_utility_thread_schedule_other
@@ -255,6 +261,7 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
#define _ux_host_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS)
#define _ux_host_thread_created(t) (UX_FALSE)
#define _ux_host_thread_delete(t) do{}while(0)
+#define _ux_host_thread_entry(thr) (UX_NULL)
#define _ux_host_thread_resume(t) do{}while(0)
#define _ux_host_thread_sleep(t) do{}while(0)
#define _ux_host_thread_schedule_other(t) do{}while(0)
@@ -266,7 +273,7 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
#define _ux_host_semaphore_get_norc(sem,t) do{}while(0)
#define _ux_host_semaphore_put(sem) do{}while(0)
#define _ux_host_semaphore_put_rc(sem) (UX_SUCCESS)
-#define _ux_host_mutex_create(mutex,name) do{}while(0)
+#define _ux_host_mutex_create(mutex,name) (UX_SUCCESS)
#define _ux_host_mutex_delete(mutex) do{}while(0)
#define _ux_host_mutex_off(mutex) do{}while(0)
#define _ux_host_mutex_on(mutex) do{}while(0)
diff --git a/common/core/src/ux_device_stack_descriptor_send.c b/common/core/src/ux_device_stack_descriptor_send.c
index 3bf18ec..f6ad0cf 100644
--- a/common/core/src/ux_device_stack_descriptor_send.c
+++ b/common/core/src/ux_device_stack_descriptor_send.c
@@ -40,7 +40,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_descriptor_send PORTABLE C */
-/* 6.1.3 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -85,6 +85,9 @@
/* 12-31-2020 Chaoqiong Xiao Modified comment(s), */
/* added BOS support, */
/* resulting in version 6.1.3 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_stack_descriptor_send(ULONG descriptor_type, ULONG request_index, ULONG host_length)
@@ -104,7 +107,7 @@ UCHAR *device_framework;
UCHAR *device_framework_end;
ULONG device_framework_length;
ULONG descriptor_length;
-ULONG target_descriptor_length;
+ULONG target_descriptor_length = 0;
UINT status = UX_ERROR;
ULONG length;
UCHAR *string_memory;
diff --git a/common/core/src/ux_device_stack_initialize.c b/common/core/src/ux_device_stack_initialize.c
index c06ed61..728c293 100644
--- a/common/core/src/ux_device_stack_initialize.c
+++ b/common/core/src/ux_device_stack_initialize.c
@@ -43,6 +43,8 @@ UCHAR _ux_system_slave_class_dfu_name[] = "ux_
UCHAR _ux_system_slave_class_audio_name[] = "ux_slave_class_audio";
UCHAR _ux_system_device_class_printer_name[] = "ux_device_class_printer";
+UCHAR _ux_system_device_class_ccid_name[] = "ux_device_class_ccid";
+UCHAR _ux_system_device_class_video_name[] = "ux_device_class_video";
/* Define USBX Host variable. */
UX_SYSTEM_SLAVE *_ux_system_slave;
@@ -52,7 +54,7 @@ UX_SYSTEM_SLAVE *_ux_system_slave;
/* FUNCTION RELEASE */
/* */
/* _ux_device_stack_initialize PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -103,6 +105,10 @@ UX_SYSTEM_SLAVE *_ux_system_slave;
/* added standalone support, */
/* added printer support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added CCID support, */
+/* added video support, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_stack_initialize(UCHAR * device_framework_high_speed, ULONG device_framework_length_high_speed,
diff --git a/common/core/src/ux_host_class_dpump_activate.c b/common/core/src/ux_host_class_dpump_activate.c
index 14edf6c..fa281ee 100644
--- a/common/core/src/ux_host_class_dpump_activate.c
+++ b/common/core/src/ux_host_class_dpump_activate.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_dpump_activate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_dpump_activate(UX_HOST_CLASS_COMMAND *command)
@@ -107,7 +110,7 @@ UINT status;
interface -> ux_interface_class_instance = (VOID *) dpump;
/* Create this class instance. */
- status = _ux_host_stack_class_instance_create(dpump -> ux_host_class_dpump_class, (VOID *) dpump);
+ _ux_host_stack_class_instance_create(dpump -> ux_host_class_dpump_class, (VOID *) dpump);
/* Configure the dpump. */
status = _ux_host_class_dpump_configure(dpump);
@@ -120,7 +123,7 @@ UINT status;
/* Get the dpump endpoint(s). We will need to search for Bulk Out and Bulk In endpoints. Do not check for errors
here as the alternate setting for this interface may be 0 which has no endpoints. */
- status = _ux_host_class_dpump_endpoints_get(dpump);
+ _ux_host_class_dpump_endpoints_get(dpump);
/* Create the semaphore to protect 2 threads from accessing the same dpump instance. */
status = _ux_host_semaphore_create(&dpump -> ux_host_class_dpump_semaphore, "ux_dpump_semaphore", 1);
diff --git a/common/core/src/ux_host_class_dpump_write.c b/common/core/src/ux_host_class_dpump_write.c
index 3d39857..cbb5cc8 100644
--- a/common/core/src/ux_host_class_dpump_write.c
+++ b/common/core/src/ux_host_class_dpump_write.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_dpump_write PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_dpump_write(UX_HOST_CLASS_DPUMP *dpump, UCHAR * data_pointer,
@@ -218,7 +221,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put_rc(&dpump -> ux_host_class_dpump_semaphore);
+ _ux_host_semaphore_put(&dpump -> ux_host_class_dpump_semaphore);
/* Return success. */
return(UX_SUCCESS);
diff --git a/common/core/src/ux_host_stack_device_configuration_deactivate.c b/common/core/src/ux_host_stack_device_configuration_deactivate.c
index 88071a6..36b338e 100644
--- a/common/core/src/ux_host_stack_device_configuration_deactivate.c
+++ b/common/core/src/ux_host_stack_device_configuration_deactivate.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_device_configuration_deactivate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,6 +74,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_stack_device_configuration_deactivate(UX_DEVICE *device)
@@ -101,11 +104,8 @@ UINT status;
return(UX_DEVICE_HANDLE_UNKNOWN);
}
- /* Get the configuration. */
- configuration = device -> ux_device_current_configuration;
-
/* If trace is enabled, insert this event into the trace buffer. */
- UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_DEACTIVATE, device, configuration, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0)
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_STACK_DEVICE_CONFIGURATION_DEACTIVATE, device, device -> ux_device_current_configuration, 0, 0, UX_TRACE_HOST_STACK_EVENTS, 0, 0)
#if defined(UX_HOST_STANDALONE)
@@ -132,7 +132,7 @@ UINT status;
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_ENUMERATOR, UX_SEMAPHORE_ERROR);
/* If trace is enabled, insert this event into the trace buffer. */
- UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_SEMAPHORE_ERROR, configuration, 0, 0, UX_TRACE_ERRORS, 0, 0)
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_SEMAPHORE_ERROR, device -> ux_device_current_configuration, 0, 0, UX_TRACE_ERRORS, 0, 0)
return(UX_SEMAPHORE_ERROR);
}
diff --git a/common/core/src/ux_host_stack_new_endpoint_create.c b/common/core/src/ux_host_stack_new_endpoint_create.c
index 83ff852..539871a 100644
--- a/common/core/src/ux_host_stack_new_endpoint_create.c
+++ b/common/core/src/ux_host_stack_new_endpoint_create.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_new_endpoint_create PORTABLE C */
-/* 6.1.9 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +77,10 @@
/* 10-15-2021 Chaoqiong Xiao Modified comment(s), */
/* added descriptor validate, */
/* resulting in version 6.1.9 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed size calculation, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_stack_new_endpoint_create(UX_INTERFACE *interface,
@@ -143,7 +147,7 @@ ULONG n_tran;
}
/* Interrupt/isochronous endpoint, max 1024 and 3 transactions can be accepted. */
- if (endpoint_type == UX_INTERRUPT_ENDPOINT || endpoint_type == UX_ISOCHRONOUS_ENDPOINT)
+ else
{
/* Max size over 1024 is not allowed. */
@@ -181,6 +185,7 @@ ULONG n_tran;
}
/* Save final packet size. */
+ n_tran >>= UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT;
packet_size *= (n_tran + 1);
}
diff --git a/common/core/src/ux_host_stack_rh_device_insertion.c b/common/core/src/ux_host_stack_rh_device_insertion.c
index c7d9477..3e61025 100644
--- a/common/core/src/ux_host_stack_rh_device_insertion.c
+++ b/common/core/src/ux_host_stack_rh_device_insertion.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_rh_device_insertion PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -84,6 +84,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_stack_rh_device_insertion(UX_HCD *hcd, UINT port_index)
@@ -116,7 +119,7 @@ UINT status;
}
#else
-UX_DEVICE *device;
+UX_DEVICE *device = UX_NULL;
UINT index_loop;
UINT device_speed;
ULONG port_status;
diff --git a/common/core/src/ux_utility_event_flags_create.c b/common/core/src/ux_utility_event_flags_create.c
index bb7d72f..4010950 100644
--- a/common/core/src/ux_utility_event_flags_create.c
+++ b/common/core/src/ux_utility_event_flags_create.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_event_flags_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +70,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_event_flags_create(UX_EVENT_FLAGS_GROUP*group_ptr, CHAR *name)
@@ -93,4 +97,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_event_flags_delete.c b/common/core/src/ux_utility_event_flags_delete.c
index f7b4628..30e0e59 100644
--- a/common/core/src/ux_utility_event_flags_delete.c
+++ b/common/core/src/ux_utility_event_flags_delete.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_event_flags_delete PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_event_flags_delete(UX_EVENT_FLAGS_GROUP*group_ptr)
@@ -81,4 +85,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_event_flags_get.c b/common/core/src/ux_utility_event_flags_get.c
index 2ec5c45..2f0920d 100644
--- a/common/core/src/ux_utility_event_flags_get.c
+++ b/common/core/src/ux_utility_event_flags_get.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_event_flags_get PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -73,6 +74,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags,
@@ -91,4 +95,4 @@ ULONG local_actual_flags_ptr;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_event_flags_set.c b/common/core/src/ux_utility_event_flags_set.c
index 1449745..f9514ae 100644
--- a/common/core/src/ux_utility_event_flags_set.c
+++ b/common/core/src/ux_utility_event_flags_set.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_event_flags_set PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +72,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_event_flags_set(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG flags_to_set,
@@ -85,4 +89,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_memory_allocate.c b/common/core/src/ux_utility_memory_allocate.c
index f4423ee..48d8620 100644
--- a/common/core/src/ux_utility_memory_allocate.c
+++ b/common/core/src/ux_utility_memory_allocate.c
@@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_utility_memory_allocate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,6 +74,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID *_ux_utility_memory_allocate(ULONG memory_alignment, ULONG memory_cache_flag,
@@ -303,7 +306,7 @@ ALIGN_TYPE int_memory_buffer;
{
/* Setup the leftover memory block. */
- leftover_memory_block = (UX_MEMORY_BLOCK *) ((ALIGN_TYPE) new_memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested);
+ leftover_memory_block = (UX_MEMORY_BLOCK *) (((ALIGN_TYPE) new_memory_block + sizeof(UX_MEMORY_BLOCK) + memory_size_requested) & 0xFFFFFFFFu);
leftover_memory_block -> ux_memory_block_next = new_memory_block -> ux_memory_block_next;
leftover_memory_block -> ux_memory_block_previous = new_memory_block;
leftover_memory_block -> ux_memory_block_size = leftover - (ULONG)sizeof(UX_MEMORY_BLOCK);
diff --git a/common/core/src/ux_utility_mutex_create.c b/common/core/src/ux_utility_mutex_create.c
index c262290..bce4e7d 100644
--- a/common/core/src/ux_utility_mutex_create.c
+++ b/common/core/src/ux_utility_mutex_create.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_mutex_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +70,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_mutex_create(UX_MUTEX *mutex, CHAR *mutex_name)
@@ -94,4 +98,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_mutex_delete.c b/common/core/src/ux_utility_mutex_delete.c
index f2b2ced..12d9d44 100644
--- a/common/core/src/ux_utility_mutex_delete.c
+++ b/common/core/src/ux_utility_mutex_delete.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_mutex_delete PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_mutex_delete(UX_MUTEX *mutex)
@@ -82,4 +86,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_mutex_off.c b/common/core/src/ux_utility_mutex_off.c
index 839ebc0..1afd198 100644
--- a/common/core/src/ux_utility_mutex_off.c
+++ b/common/core/src/ux_utility_mutex_off.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_mutex_off PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_utility_mutex_off(UX_MUTEX *mutex)
@@ -79,4 +83,4 @@ VOID _ux_utility_mutex_off(UX_MUTEX *mutex)
/* Return to caller. */
return;
}
-
+#endif
diff --git a/common/core/src/ux_utility_mutex_on.c b/common/core/src/ux_utility_mutex_on.c
index bbb17b1..84da137 100644
--- a/common/core/src/ux_utility_mutex_on.c
+++ b/common/core/src/ux_utility_mutex_on.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_mutex_on PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_utility_mutex_on(UX_MUTEX *mutex)
@@ -89,4 +93,4 @@ UINT status;
/* Return to caller. */
return;
}
-
+#endif
diff --git a/common/core/src/ux_utility_semaphore_create.c b/common/core/src/ux_utility_semaphore_create.c
index db380d8..32c062f 100644
--- a/common/core/src/ux_utility_semaphore_create.c
+++ b/common/core/src/ux_utility_semaphore_create.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_semaphore_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +71,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_semaphore_create(UX_SEMAPHORE *semaphore, CHAR *semaphore_name, UINT initial_count)
@@ -95,4 +99,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_semaphore_delete.c b/common/core/src/ux_utility_semaphore_delete.c
index fdc3a4e..f9fc876 100644
--- a/common/core/src/ux_utility_semaphore_delete.c
+++ b/common/core/src/ux_utility_semaphore_delete.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_semaphore_delete PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_semaphore_delete(UX_SEMAPHORE *semaphore)
@@ -81,4 +85,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_semaphore_get.c b/common/core/src/ux_utility_semaphore_get.c
index 4fc1188..e640b17 100644
--- a/common/core/src/ux_utility_semaphore_get.c
+++ b/common/core/src/ux_utility_semaphore_get.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_semaphore_get PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +71,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_semaphore_get(UX_SEMAPHORE *semaphore, ULONG semaphore_signal)
@@ -109,4 +113,4 @@ UX_THREAD *suspended_thread;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_semaphore_put.c b/common/core/src/ux_utility_semaphore_put.c
index 8502dad..a453ed0 100644
--- a/common/core/src/ux_utility_semaphore_put.c
+++ b/common/core/src/ux_utility_semaphore_put.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_semaphore_put PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_semaphore_put(UX_SEMAPHORE *semaphore)
@@ -81,4 +85,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_create.c b/common/core/src/ux_utility_thread_create.c
index c7cdcd6..6adbb93 100644
--- a/common/core/src/ux_utility_thread_create.c
+++ b/common/core/src/ux_utility_thread_create.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +78,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_create(UX_THREAD *thread_ptr, CHAR *name,
@@ -107,4 +111,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_delete.c b/common/core/src/ux_utility_thread_delete.c
index b6b90ca..d1eea27 100644
--- a/common/core/src/ux_utility_thread_delete.c
+++ b/common/core/src/ux_utility_thread_delete.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_delete PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +70,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_delete(UX_THREAD *thread_ptr)
@@ -86,4 +90,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_identify.c b/common/core/src/ux_utility_thread_identify.c
index 36a67d6..1c86f2a 100644
--- a/common/core/src/ux_utility_thread_identify.c
+++ b/common/core/src/ux_utility_thread_identify.c
@@ -26,15 +26,16 @@
#define UX_SOURCE_CODE
#include "ux_api.h"
-#include "tx_thread.h"
+#if !defined(UX_STANDALONE)
+#include "tx_thread.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_identify PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +70,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UX_THREAD *_ux_utility_thread_identify(VOID)
@@ -79,4 +83,4 @@ UX_THREAD *_ux_utility_thread_identify(VOID)
is the thread running prior to the ISR. Instead, we set it to null. */
return(UX_THREAD_GET_SYSTEM_STATE() ? UX_NULL : tx_thread_identify());
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_relinquish.c b/common/core/src/ux_utility_thread_relinquish.c
index 5875fd7..3649066 100644
--- a/common/core/src/ux_utility_thread_relinquish.c
+++ b/common/core/src/ux_utility_thread_relinquish.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_relinquish PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -63,6 +64,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_utility_thread_relinquish(VOID)
@@ -72,4 +76,4 @@ VOID _ux_utility_thread_relinquish(VOID)
tx_thread_relinquish();
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_resume.c b/common/core/src/ux_utility_thread_resume.c
index c440516..ae4bf74 100644
--- a/common/core/src/ux_utility_thread_resume.c
+++ b/common/core/src/ux_utility_thread_resume.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_resume PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_resume(UX_THREAD *thread_ptr)
@@ -82,4 +86,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_schedule_other.c b/common/core/src/ux_utility_thread_schedule_other.c
index aa6537c..bf78654 100644
--- a/common/core/src/ux_utility_thread_schedule_other.c
+++ b/common/core/src/ux_utility_thread_schedule_other.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_schedule_other PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +71,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_schedule_other(UINT caller_priority)
@@ -102,4 +106,4 @@ UX_THREAD *my_thread;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_sleep.c b/common/core/src/ux_utility_thread_sleep.c
index 337e604..b4ffe48 100644
--- a/common/core/src/ux_utility_thread_sleep.c
+++ b/common/core/src/ux_utility_thread_sleep.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_sleep PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -66,6 +67,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_sleep(ULONG ticks)
@@ -78,4 +82,4 @@ UINT status;
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_thread_suspend.c b/common/core/src/ux_utility_thread_suspend.c
index 6ea47c0..d5498df 100644
--- a/common/core/src/ux_utility_thread_suspend.c
+++ b/common/core/src/ux_utility_thread_suspend.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_thread_suspend PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -68,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_thread_suspend(UX_THREAD *thread_ptr)
@@ -82,4 +86,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_timer_create.c b/common/core/src/ux_utility_timer_create.c
index 1bb973f..a7d6dd8 100644
--- a/common/core/src/ux_utility_timer_create.c
+++ b/common/core/src/ux_utility_timer_create.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_timer_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -66,6 +67,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_timer_create(TX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG),
@@ -89,4 +93,4 @@ UINT status;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/core/src/ux_utility_timer_delete.c b/common/core/src/ux_utility_timer_delete.c
index 7e384ef..030516e 100644
--- a/common/core/src/ux_utility_timer_delete.c
+++ b/common/core/src/ux_utility_timer_delete.c
@@ -28,12 +28,13 @@
#include "ux_api.h"
+#if !defined(UX_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_utility_timer_delete PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -63,6 +64,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 Chaoqiong Xiao Initial Version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* off in standalone build, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_utility_timer_delete(TX_TIMER *timer)
@@ -77,3 +81,4 @@ UINT status;
/* Return completion status. */
return(status);
}
+#endif
diff --git a/common/usbx_device_classes/CMakeLists.txt b/common/usbx_device_classes/CMakeLists.txt
index f7e3cc6..d4dbe5c 100644
--- a/common/usbx_device_classes/CMakeLists.txt
+++ b/common/usbx_device_classes/CMakeLists.txt
@@ -28,6 +28,23 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_audio_write_frame_commit.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_audio_write_frame_get.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_audio_write_thread_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_activate.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_auto_seq_done.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_auto_seq_start.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_control_abort.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_control_request.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_deactivate.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_hardware_error.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_icc_insert.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_icc_remove.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_initialize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_notify_thread_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_response.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_runner_thread_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_thread_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_time_extension.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_ccid_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_cdc_acm_activate.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_cdc_acm_bulkin_thread.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_cdc_acm_bulkout_thread.c
@@ -170,6 +187,24 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_verify.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_storage_write.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_activate.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_change.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_control_request.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_deactivate.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_initialize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_ioctl.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_max_payload_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_read_payload_free.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_read_payload_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_read_thread_entry.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_reception_start.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_stream_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_transmission_start.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_uninitialize.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_write_payload_commit.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_write_payload_get.c
+ ${CMAKE_CURRENT_LIST_DIR}/src/ux_device_class_video_write_thread_entry.c
# {{END_TARGET_SOURCES}}
)
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 3067584..6959a7c 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -53,6 +53,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added feedback support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -365,14 +368,18 @@ typedef struct UX_DEVICE_CLASS_AUDIO_STREAM_STRUCT
#if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT)
UX_SLAVE_ENDPOINT *ux_device_class_audio_stream_feedback;
+#if !defined(UX_DEVICE_STANDALONE)
UCHAR *ux_device_class_audio_stream_feedback_thread_stack;
UX_THREAD ux_device_class_audio_stream_feedback_thread;
#endif
+#endif
UX_DEVICE_CLASS_AUDIO_STREAM_CALLBACKS ux_device_class_audio_stream_callbacks;
+#if !defined(UX_DEVICE_STANDALONE)
UCHAR *ux_device_class_audio_stream_thread_stack;
UX_THREAD ux_device_class_audio_stream_thread;
+#endif
UCHAR *ux_device_class_audio_stream_buffer;
ULONG ux_device_class_audio_stream_buffer_size;
diff --git a/common/usbx_device_classes/inc/ux_device_class_ccid.h b/common/usbx_device_classes/inc/ux_device_class_ccid.h
new file mode 100644
index 0000000..dd4534a
--- /dev/null
+++ b/common/usbx_device_classes/inc/ux_device_class_ccid.h
@@ -0,0 +1,1055 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* ux_device_class_ccid.h PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file defines the equivalences for the USBX Device Class CCID */
+/* (Smart-Card Integrated Circuit(s) Card) component. */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+
+#ifndef UX_DEVICE_CLASS_CCID_H
+#define UX_DEVICE_CLASS_CCID_H
+
+/* Determine if a C++ compiler is being used. If so, ensure that standard
+ C is used to process the API information. */
+
+#ifdef __cplusplus
+
+/* Yes, C++ compiler is present. Use standard C. */
+extern "C" {
+
+#endif
+
+
+/* Define CCID max number of slots, 32 for 32 bit data width. */
+#define UX_DEVICE_CLASS_CCID_MAX_N_SLOTS (sizeof(ALIGN_TYPE)*8)
+
+#define UX_DEVICE_CLASS_CCID_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE
+#define UX_DEVICE_CLASS_CCID_NOTIFY_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE
+#define UX_DEVICE_CLASS_CCID_RUNNER_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE
+
+/* Define CCID Class USB Class constants. */
+#define UX_DEVICE_CLASS_CCID_CLASS 0x0B
+
+#define UX_DEVICE_CLASS_CCID_SUBCLASS 0
+
+#define UX_DEVICE_CLASS_CCID_PROTOCOL 0
+
+#define UX_DEVICE_CLASS_CCID_BCD_CCID_1_10 0x0110
+
+#define UX_DEVICE_CLASS_CCID_VOLTAGE_SUPPORT_5_0 1u
+#define UX_DEVICE_CLASS_CCID_VOLTAGE_SUPPORT_3_0 2u
+#define UX_DEVICE_CLASS_CCID_VOLTAGE_SUPPORT_1_8 4u
+
+#define UX_DEVICE_CLASS_CCID_PROTOCOLS_T0 1u
+#define UX_DEVICE_CLASS_CCID_PROTOCOLS_T1 2u
+
+#define UX_DEVICE_CLASS_CCID_SYNCH_PROTOCOLS_2_WIRE 1u
+#define UX_DEVICE_CLASS_CCID_SYNCH_PROTOCOLS_3_WIRE 2u
+#define UX_DEVICE_CLASS_CCID_SYNCH_PROTOCOLS_I2C 4u
+
+#define UX_DEVICE_CLASS_CCID_MECHANICAL_NO_SPECIAL 0u
+#define UX_DEVICE_CLASS_CCID_MECHANICAL_ACCEPT 1u
+#define UX_DEVICE_CLASS_CCID_MECHANICAL_EJECT 2u
+#define UX_DEVICE_CLASS_CCID_MECHANICAL_CAPTURE 4u
+#define UX_DEVICE_CLASS_CCID_MECHANICAL_LOCK_UNLOCK 8u
+
+#define UX_DEVICE_CLASS_CCID_FEATURES_NO_SPECIAL 0u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_PARAMETER_ATR 2u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_ACTIVATION 4u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_VOLTAGE 8u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_CLOCK_FREQUENCY 0x10u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_BAUD_RATE 0x20u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_PARAMETER_NEGOTIATION 0x40u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_PPS 0x80u
+#define UX_DEVICE_CLASS_CCID_FEATURES_CAN_SET_ICC_IN_CLOCK_STOP 0x100u
+#define UX_DEVICE_CLASS_CCID_FEATURES_NAD_NOT_0_ACCEPTED 0x200u
+#define UX_DEVICE_CLASS_CCID_FEATURES_AUTO_IFSD_EXCHANGE_1ST 0x400u
+#define UX_DEVICE_CLASS_CCID_FEATURES_TPUD_EXCHANGES 0x10000u
+#define UX_DEVICE_CLASS_CCID_FEATURES_SHORT_APUD_EXCHANGES 0x20000u
+#define UX_DEVICE_CLASS_CCID_FEATURES_SHORT_AND_EXTENDED_APUD_EXCHANGES 0x40000u
+#define UX_DEVICE_CLASS_CCID_FEATURES_WAKEUP_ON_INSERTION_REMOVAL 0x100000u
+
+#define UX_DEVICE_CLASS_CCID_LCD_LAYOUT_NO_LCD 0
+#define UX_DEVICE_CLASS_CCID_LCD_LAYOUT(n_lines,n_per_line) (((n_lines) << 8) | (n_per_line))
+
+#define UX_DEVICE_CLASS_CCID_PIN_SUPPORT_VERIFICATION 1u
+#define UX_DEVICE_CLASS_CCID_PIN_SUPPORT_MODIFICATION 2u
+
+#define UX_DEVICE_CLASS_CCID_MAX_CCID_MESSAGE_EXT_APDU_MIN (261+10)
+#define UX_DEVICE_CLASS_CCID_MAX_CCID_MESSAGE_EXT_APDU_MAX (65544+10)
+
+
+/* Device CCID Requests */
+#define UX_DEVICE_CLASS_CCID_ABORT 0x01
+#define UX_DEVICE_CLASS_CCID_GET_CLOCK_FREQUENCIES 0x02
+#define UX_DEVICE_CLASS_CCID_GET_DATA_RATES 0x03
+
+
+/* CCID message offsets, values. */
+
+/* General. */
+#define UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH 10
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE 0
+#define UX_DEVICE_CLASS_CCID_OFFSET_LENGTH 1
+#define UX_DEVICE_CLASS_CCID_OFFSET_SLOT 5
+#define UX_DEVICE_CLASS_CCID_OFFSET_SEQ 6
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_DATA 10
+
+/* PC_to_RDR_IccPowerOn. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_POWER_SELECT 7
+#define UX_DEVICE_CLASS_CCID_POWER_SELECT_AUTO 0
+#define UX_DEVICE_CLASS_CCID_POWER_SELECT_5_0_V 1
+#define UX_DEVICE_CLASS_CCID_POWER_SELECT_3_0_V 2
+#define UX_DEVICE_CLASS_CCID_POWER_SELECT_1_8_V 3
+
+/* PC_to_RDR_XfrBlock/PC_to_RDR_Secure. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_BWI 7
+#define UX_DEVICE_CLASS_CCID_OFFSET_LEVEL_PARAMETER 8
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_RFU 0x00u
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_BEGIN_END 0x00u
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_BEGIN_CONTINUE 0x01u
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_CONTINUE_END 0x02u
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_CONTINUE 0x03u
+#define UX_DEVICE_CLASS_CCID_LEVEL_PARAMETER_EMPTY_DATA 0x10u
+
+/* PC_to_RDR_SetParameters. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_SET_PARAMETERS_PROTOCOL_NUM 7
+
+#define UX_DEVICE_CLASS_CCID_PROTOCOL_T_0 0
+#define UX_DEVICE_CLASS_CCID_PROTOCOL_T_1 1
+#define UX_DEVICE_CLASS_CCID_PROTOCOL_2_WIRE 0x80
+#define UX_DEVICE_CLASS_CCID_PROTOCOL_3_WIRE 0x81
+#define UX_DEVICE_CLASS_CCID_PROTOCOL_I2C 0x82
+
+/* Parameters. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_FI_DI 10
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_TCCKS_T0 11
+#define UX_DEVICE_CLASS_CCID_OFFSET_GUARD_TIME_T0 12
+#define UX_DEVICE_CLASS_CCID_OFFSET_WAITING_INTEGER_T0 13
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLOCK_STOP_T0 14
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_TCCKS_T1 11
+#define UX_DEVICE_CLASS_CCID_OFFSET_GUARD_TIME_T1 12
+#define UX_DEVICE_CLASS_CCID_OFFSET_WAITING_INTEGERS_T1 13
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLOCK_STOP_T1 14
+#define UX_DEVICE_CLASS_CCID_OFFSET_IFSC 15
+#define UX_DEVICE_CLASS_CCID_OFFSET_NAD_VALUE 16
+
+/* PC_to_RDR_IccClock. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLOCK_COMMAND 7
+#define UX_DEVICE_CLASS_CCID_CLOCK_COMMAND_RESTART 0
+#define UX_DEVICE_CLASS_CCID_CLOCK_COMMAND_STOP 1
+
+/* PC_to_RDR_T0APDU. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_CHANGES 7
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLASS_GET_RESPONSE 8
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLASS_ENVELOPE 9
+#define UX_DEVICE_CLASS_CCID_CHANGE_CLASS_GET_RESPONSE (1u << 0)
+#define UX_DEVICE_CLASS_CCID_CHANGE_CLASS_ENVELOPE (1u << 1)
+
+/* PC_to_RDR_Secure. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_OPERATION 10
+#define UX_DEVICE_CLASS_CCID_PIN_VERIFICATION 0
+#define UX_DEVICE_CLASS_CCID_PIN_MODIFICATION 1
+#define UX_DEVICE_CLASS_CCID_PIN_TRANSFER 2
+#define UX_DEVICE_CLASS_CCID_PIN_WAIT_ICC_RESP 3
+#define UX_DEVICE_CLASS_CCID_PIN_CANCEL 4
+#define UX_DEVICE_CLASS_CCID_PIN_RESEND_I_BLOCK 5
+#define UX_DEVICE_CLASS_CCID_PIN_NEXT_APDU 6
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_DATA 11
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_TIME_OUT 11
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_FORMAT_STRING 12
+
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_FORMAT_TYPE_MASK (0x3u << 0)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_BINARY (0x0u << 0)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_BCD (0x1u << 0)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_ASCII (0x2u << 0)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_JUSTIFICATION (0x1u << 2)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_LEFT_JUSTIFY (0x0u << 2)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_RIGHT_JUSTIFY (0x1u << 2)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_POSITION_MASK (0xFu << 3)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_POSITION(v) (((v) >> 3) & 0xFu)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_UNIT_TYPE (0x1u << 7)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_UNIT_BITS (0x0u << 7)
+#define UX_DEVICE_CLASS_CCID_FORMAT_STRING_UNIT_BYTES (0x1u << 7)
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_PIN_BLOCK_STRING 13
+#define UX_DEVICE_CLASS_CCID_PIN_BLOCK_STRING_PIN_LENGTH_BITS_MASK (0xFu << 3)
+#define UX_DEVICE_CLASS_CCID_PIN_BLOCK_STRING_PIN_BLOCK_SIZE_BYTES_MASK (0xFu << 0)
+#define UX_DEVICE_CLASS_CCID_PIN_BLOCK_STRING_PIN_LENGTH_BITS(v) ((v) >> 4) & 0xFu)
+#define UX_DEVICE_CLASS_CCID_PIN_BLOCK_STRING_PIN_BLOCK_SIZE_BYTES(v) ((v) >> 0) & 0xFu)
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_PIN_LENGTH_FORMAT 14
+#define UX_DEVICE_CLASS_CCID_PIN_LENGTH_FORMAT_UNIT_TYPE (1u << 4)
+#define UX_DEVICE_CLASS_CCID_PIN_LENGTH_FORMAT_UNIT_BITS (0u << 4)
+#define UX_DEVICE_CLASS_CCID_PIN_LENGTH_FORMAT_UNIT_BYTES (1u << 4)
+#define UX_DEVICE_CLASS_CCID_PIN_LENGTH_FORMAT_POSITION_MASK (0xFu << 0)
+#define UX_DEVICE_CLASS_CCID_PIN_LENGTH_FORMAT_POSITION(v) (((v) << 0) & 0xFu)
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_TIME_OUT 11
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_FORMAT_STRING 12
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_BLOCK_STRING 13
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_LENGTH_FORMAT 14
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_MAX_EXTRA_DIGIT 15
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_MAX_EXTRA_DIGIT_MIN 16
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_MAX_EXTRA_DIGIT_MAX 15
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_ENTRY_VALIDATION_CONDITION 17
+#define UX_DEVICE_CLASS_CCID_PIN_ENTRY_VALIDATION_MAX_SIZE 1u
+#define UX_DEVICE_CLASS_CCID_PIN_ENTRY_VALIDATION_KEY_PRESS 2u
+#define UX_DEVICE_CLASS_CCID_PIN_ENTRY_VALIDATION_TIMEOUT 4u
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_NUMBER_MESSAGE 18
+#define UX_DEVICE_CLASS_CCID_PIN_NUMBER_MESSAGE_NO 0
+#define UX_DEVICE_CLASS_CCID_PIN_NUMBER_MESSAGE_1 0
+#define UX_DEVICE_CLASS_CCID_PIN_NUMBER_MESSAGE_2 0
+#define UX_DEVICE_CLASS_CCID_PIN_NUMBER_MESSAGE_3 0
+#define UX_DEVICE_CLASS_CCID_PIN_NUMBER_MESSAGE_DEFAULT 0xFF
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_LANG_ID 19
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_MSG_INDEX 21
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_TEO_PROLOGUE 22
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_VERIFI_PIN_APDU 25
+
+#define UX_DEVICE_CLASS_CCID_PIN_MESSAGE_INSERT_PROMPT 0
+#define UX_DEVICE_CLASS_CCID_PIN_MESSAGE_MODIFY_PROMPT 1
+#define UX_DEVICE_CLASS_CCID_PIN_MESSAGE_NEW_CONFIRM_PROMPT 2
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_TIME_OUT 11
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_FORMAT_STRING 12
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_BLOCK_STRING 13
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_LENGTH_FORMAT 14
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_INSERTION_OFFSET_OLD 15
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_INSERTION_OFFSET_NEW 16
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_MAX_EXTRA_DIGIT 17
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_MAX_EXTRA_DIGIT_MIN 18
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_MAX_EXTRA_DIGIT_MAX 17
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_CONFIRM_PIN 19
+#define UX_DEVICE_CLASS_CCID_CONFIRM_PIN_CONFIRM_REQUESTED (1u << 0)
+#define UX_DEVICE_CLASS_CCID_CONFIRM_PIN_ENTRY_REQUESTED (1u << 1)
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_ENTRY_VALIDATION_CONDITION 20
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_NUMBER_MESSAGE 21
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_LANG_ID 22
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_MSG_INDEX1 24
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_MSG_INDEX2 25
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_MSG_INDEX3 26
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_TEO_PROLOGUE1 25
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_TEO_PROLOGUE2 26
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_TEO_PROLOGUE3 27
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_APDU1 28
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_APDU2 29
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_MODIFI_PIN_APDU3 30
+
+#define UX_DEVICE_CLASS_CCID_OFFSET_PIN_NEXT_APDU_TEO_PROLOGUE 11
+
+/* PC_to_RDR_Mechanical. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_FUNCTION 7
+#define UX_DEVICE_CLASS_CCID_FUNCTION_ACCEPT_CARD 0x01
+#define UX_DEVICE_CLASS_CCID_FUNCTION_EJECT_CARD 0x02
+#define UX_DEVICE_CLASS_CCID_FUNCTION_CAPTURE_CARD 0x03
+#define UX_DEVICE_CLASS_CCID_FUNCTION_LOCK_CARD 0x04
+#define UX_DEVICE_CLASS_CCID_FUNCTION_UNLOCK_CARD 0x05
+
+/* PC_to_RDR_SetDataRateAndClockFrequency/RDR_to_PC_DataRateAndClockFrequency. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLOCK_FREQUENCY 10
+#define UX_DEVICE_CLASS_CCID_OFFSET_DATA_RATE 14
+
+/* RDR_to_PC_ */
+#define UX_DEVICE_CLASS_CCID_OFFSET_STATUS 7
+#define UX_DEVICE_CLASS_CCID_OFFSET_ERROR 8
+
+/* RDR_to_PC_DataBlock. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_CHAIN_PARAMETER 9
+#define UX_DEVICE_CLASS_CCID_CHAIN_PARAMETER_BEGIN_END 0x00
+#define UX_DEVICE_CLASS_CCID_CHAIN_PARAMETER_BEGIN_CONTINUE 0x01
+#define UX_DEVICE_CLASS_CCID_CHAIN_PARAMETER_CONTINUE_END 0x02
+#define UX_DEVICE_CLASS_CCID_CHAIN_PARAMETER_CONTINUE 0x03
+#define UX_DEVICE_CLASS_CCID_CHAIN_PARAMETER_EMPTY 0x10
+
+/* RDR_to_PC_SlotStatus. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_CLOCK_STATUS 9
+
+/* RDR_to_PC_Parameters. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_PARAMETERS_PROTOCOL_NUM 9
+
+#define UX_DEVICE_CLASS_CCID_PARAMETERS_T0_LENGTH 5
+#define UX_DEVICE_CLASS_CCID_PARAMETERS_T1_LENGTH 7
+
+/* RDR_to_PC_NotifySlotChange. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_SLOT_ICC_STATE 1
+
+/* RDR_to_PC_HardwareError. */
+#define UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_SLOT 1
+#define UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_SEQ 2
+#define UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_CODE 3
+#define UX_DEVICE_CLASS_CCID_HW_ERROR_OVERCURRENT 1
+
+
+/* CCID bMessageTypes. */
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON 0x62
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_OFF 0x63
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_GET_SLOT_STATUS 0x64
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK 0x6F
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_GET_PARAMETERS 0x6C
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_RESET_PARAMETERS 0x6D
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS 0x61
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_ESCAPE 0x6B
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK 0x6E
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU 0x6A
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE 0x69
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL 0x71
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT 0x72
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQ 0x73
+
+#define UX_DEVICE_CLASS_CCID_N_COMMANDS 14
+
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_BLOCK 0x80
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS 0x81
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS 0x82
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_ESCAPE 0x83
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQ 0x84
+
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_NOTIFY_SLOT_CHANGE 0x50
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_HARDWARE_ERROR 0x51
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_ABORTABLE(bMessageType) \
+ (((bMessageType) == 0x62) || ((bMessageType) == 0x6F) || \
+ ((bMessageType) == 0x6B) || ((bMessageType) == 0x69) || \
+ ((bMessageType) == 0x71) || ((bMessageType) == 0x72))
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_HW_ERROR_CHECK(bMessageType) \
+ (((bMessageType) != 0x63) && ((bMessageType) != 0x6B) && \
+ ((bMessageType) != 0x6A) && ((bMessageType) != 0x72) && \
+ ((bMessageType) != 0x73))
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_AUTO_SEQUENCE_CHECK(bMessageType) \
+ (((bMessageType) != 0x62) && ((bMessageType) != 0x65) && \
+ ((bMessageType) != 0x6B) && ((bMessageType) != 0x6A) && \
+ ((bMessageType) != 0x72) && ((bMessageType) != 0x73))
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_DATA_BLOCK(m) \
+ ((m) == 0x62 || (m) == 0x6F || (m) == 0x69)
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_SLOT_STATUS(m) \
+ ((m) == 0x63 || (m) == 0x64 || (m) == 0x6E || (m) == 0x6A || \
+ (m) == 0x71 || (m) == 0x72 || (m) == 0x65)
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_PARAMETERS(m) \
+ ((m) == 0x6C || (m) == 0x6D || (m) == 0x61)
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_ESCAPE(m) \
+ ((m) == 0x6B)
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_DATA_RATE_AND_CLOCK_FREQ(m) \
+ ((m) == 0x73)
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(m) \
+ (UX_DEVICE_CLASS_CCID_COMMAND_RESP_DATA_BLOCK(m) ? 0x80 : \
+ UX_DEVICE_CLASS_CCID_COMMAND_RESP_SLOT_STATUS(m) ? 0x81 : \
+ UX_DEVICE_CLASS_CCID_COMMAND_RESP_PARAMETERS(m) ? 0x82 : \
+ UX_DEVICE_CLASS_CCID_COMMAND_RESP_ESCAPE(m) ? 0x83 : \
+ UX_DEVICE_CLASS_CCID_COMMAND_RESP_DATA_RATE_AND_CLOCK_FREQ(m) ? 0x84 : \
+ 0)
+
+/* CCID Slot error binary code. */
+#define UX_DEVICE_CLASS_CCID_CMD_ABORTED 0xFF
+#define UX_DEVICE_CLASS_CCID_ICC_MUTE 0xFE
+#define UX_DEVICE_CLASS_CCID_XFR_PARITY_ERROR 0xFD
+#define UX_DEVICE_CLASS_CCID_XFR_OVERRUN 0xFC
+#define UX_DEVICE_CLASS_CCID_HW_ERROR 0xFB
+#define UX_DEVICE_CLASS_CCID_BAD_ATR_TS 0xF8
+#define UX_DEVICE_CLASS_CCID_BAD_ATR_TCK 0xF7
+#define UX_DEVICE_CLASS_CCID_ICC_PROTOCOL_NOT_SUPPORTED 0xF6
+#define UX_DEVICE_CLASS_CCID_ICC_CLASS_NOT_SUPPORTED 0xF5
+#define UX_DEVICE_CLASS_CCID_PROCEDURE_BYTE_CONFLICT 0xF4
+#define UX_DEVICE_CLASS_CCID_DEACTIVATED_PROTOCOL 0xF3
+#define UX_DEVICE_CLASS_CCID_BUSY_WITH_AUTO_SEQUENCE 0xF2
+#define UX_DEVICE_CLASS_CCID_PIN_TIMEOUT 0xF0
+#define UX_DEVICE_CLASS_CCID_PIN_CANCELLED 0xEF
+#define UX_DEVICE_CLASS_CCID_CMD_SLOT_BUSY 0xE0
+
+
+/* CCID bStatus. */
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_TIME_EXTENSION 0x80
+
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_ACTIVE (0x0u)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_INACTIVE (0x1u)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_NOT_PRESENT (0x2u)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_MASK (0x3u)
+
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_CMD_NO_ERROR (0x0u << 6)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_CMD_FAILED (0x1u << 6)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_CMD_TIME_EXTENSION (0x2u << 6)
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS_CMD_MASK (0x3u << 6)
+
+#define UX_DEVICE_CLASS_CCID_SLOT_STATUS(bmICCStatus, bmCommandStatus) ((bmICCStatus) | ((bmCommandStatus) << 6))
+#define UX_DEVICE_CLASS_CCID_ICC_ACTIVE 0
+#define UX_DEVICE_CLASS_CCID_ICC_INACTIVE 1
+#define UX_DEVICE_CLASS_CCID_ICC_NOT_PRESENT 2
+#define UX_DEVICE_CLASS_CCID_CMD_NO_ERROR 0
+#define UX_DEVICE_CLASS_CCID_CMD_FAILED 1
+#define UX_DEVICE_CLASS_CCID_CMD_TIME_EXTENSION 2
+
+
+/* CCID events. */
+#define UX_DEVICE_CLASS_CCID_EVENT_SLOT(n) (1u<<(n))
+
+
+/* CCID flags. */
+#define UX_DEVICE_CLASS_CCID_FLAG_ABORTABLE 0x80u
+#define UX_DEVICE_CLASS_CCID_FLAG_BUSY 0x40u
+
+#define UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE 0x01u
+#define UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_HW_ERROR 0x02u
+
+#define UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING 0x04u
+#define UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR 0x08u
+
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_FLAG_ABORTABLE(bMessageType) \
+ (UX_DEVICE_CLASS_CCID_COMMAND_ABORTABLE(bMessageType) ? \
+ UX_DEVICE_CLASS_CCID_FLAG_ABORTABLE : 0)
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_FLAG_AUTO_SEQUENCE_CHECK(bMessageType) \
+ (UX_DEVICE_CLASS_CCID_COMMAND_AUTO_SEQUENCE_CHECK(bMessageType) ? \
+ UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING : 0)
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_FLAG_HW_ERROR_CHECK(bMessageType) \
+ (UX_DEVICE_CLASS_CCID_COMMAND_HW_ERROR_CHECK(bMessageType) ? \
+ UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR : 0)
+
+#define UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(bMessageType) \
+ (UX_DEVICE_CLASS_CCID_COMMAND_FLAG_ABORTABLE(bMessageType) | \
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAG_AUTO_SEQUENCE_CHECK(bMessageType) | \
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAG_HW_ERROR_CHECK(bMessageType))
+
+
+/* CCID message structures. */
+
+/* General message for both PC_to_RDR and RDR_to_PC. */
+typedef struct UX_DEVICE_CLASS_CCID_MESSAGES_STRUCT
+{
+ UCHAR *ux_device_class_ccid_messages_pc_to_rdr;
+ UCHAR *ux_device_class_ccid_messages_rdr_to_pc;
+ ULONG ux_device_class_ccid_messages_rdr_to_pc_length; /* Total buffer length including header. */
+} UX_DEVICE_CLASS_CCID_MESSAGES;
+
+/* Define CCID message header. */
+typedef struct UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bRFU[3];
+} UX_DEVICE_CLASS_CCID_MESSAGE_HEADER;
+#define UX_DEVICE_CLASS_CCID_MESSAGE_TYPE(msg) (((UX_DEVICE_CLASS_CCID_MESSAGE_HEADER*)(msg))->bMessageType)
+#define UX_DEVICE_CLASS_CCID_MESSAGE_LENGTH_GET(msg) _ux_utility_long_get(((UX_DEVICE_CLASS_CCID_MESSAGE_HEADER*)(msg))->dwLength)
+#define UX_DEVICE_CLASS_CCID_MESSAGE_LENGTH_SET(msg,len) _ux_utility_long_put(((UX_DEVICE_CLASS_CCID_MESSAGE_HEADER*)(msg))->dwLength, (len))
+#define UX_DEVICE_CLASS_CCID_MESSAGE_SLOT(msg) (((UX_DEVICE_CLASS_CCID_MESSAGE_HEADER*)(msg))->bSlot)
+#define UX_DEVICE_CLASS_CCID_MESSAGE_SEQ(msg) (((UX_DEVICE_CLASS_CCID_MESSAGE_HEADER*)(msg))->bSeq)
+#define UX_DEVICE_CLASS_CCID_MESSAGE_DATA(msg) (((UCHAR *)(msg) + UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH))
+
+/* Define CCID PC_to_RDR_IccPowerOn. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bPowerSelect;
+ UCHAR bRFU[2];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_POWER_SELECT(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_ON_HEADER*)(msg))->bPowerSelect)
+
+/* Define CCID PC_to_RDR_IccPowerOff. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_POWER_OFF_HEADER;
+
+/* Define CCID PC_to_RDR_GetSlotStatus. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_GET_SLOT_STATUS_HEADER;
+
+/* Define CCID PC_to_RDR_XfrBlock. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_BWI(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK_HEADER*)(msg))->bBWI)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_LEVEL_PARAMETER(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK_HEADER*)(msg))->wLevelParameter)
+
+/* Define CCID PC_to_RDR_GetParameters. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_GET_PARAMETERS_HEADER;
+
+/* Define CCID PC_to_RDR_ResetParameters. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_RESET_PARAMETERS_HEADER;
+
+/* Define CCID PC_to_RDR_SetParameters. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bProtocolNum;
+ UCHAR bRFU[2];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PROTOCOL_NUM(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_HEADER*)(msg))->bProtocolNum)
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T0_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bProtocolNum;
+ UCHAR bRFU[2];
+ UCHAR bmFindexDindex;
+ UCHAR bmTCCKST0;
+ UCHAR bGuardTimeT0;
+ UCHAR bWaitingIntegerT0;
+ UCHAR bClockStop;
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T0;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T0_LENGTH 5
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T1_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bProtocolNum;
+ UCHAR bRFU[2];
+ UCHAR bmFindexDindex;
+ UCHAR bmTCCKST1;
+ UCHAR bGuardTimeT1;
+ UCHAR bmWaitingIntegersT1;
+ UCHAR bClockStop;
+ UCHAR bIFSC;
+ UCHAR bNadValue;
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T1;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_PARAMETERS_T1_LENGTH 7
+
+/* Define CCID PC_to_RDR_Escape. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_ESCAPE_HEADER;
+
+/* Define CCID PC_to_RDR_IccClock. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bClockCommand;
+ UCHAR bRFU[2];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_CLOCK_COMMAND(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_ICC_CLOCK_HEADER*)(msg))->bClockCommand)
+
+/* Define CCID PC_to_RDR_T0APDU. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bmChanges;
+ UCHAR bClassGetResponse;
+ UCHAR bClassEnvelope;
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_CHANGES(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_HEADER*)(msg))->bmChanges)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_CLASS_GET_RESP(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_HEADER*)(msg))->bClassGetResponse)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_CLASS_ENVELOPE(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_T0_APDU_HEADER*)(msg))->bClassEnvelope)
+
+/* Define CCID PC_to_RDR_Secure. */
+typedef UX_DEVICE_CLASS_CCID_PC_TO_RDR_XFR_BLOCK_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_HEADER;
+
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+ UCHAR bPINOperation;
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_BWI(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_HEADER*)(msg))->bBWI)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_LEVEL_PARAMETER(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_HEADER*)(msg))->wLevelParameter)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_OPERATION(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_HEADER*)(msg))->bPINOperation)
+
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+ UCHAR bPINOperation;
+
+ UCHAR bTimeOut;
+ UCHAR bmFormatString;
+ UCHAR bmPINBlockString;
+ UCHAR bmPINLengthFormat;
+
+ UCHAR wPINMaxExtraDigit[2]; /* XXYY, XX: min size, YY: max size. */
+ UCHAR bEntryValidationCondition;
+ UCHAR bNumberMessage;
+ UCHAR wLangId[2];
+ UCHAR bMsgIndex;
+ UCHAR bTeoPrologue[3];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_TIMEOUT(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION*)(msg))->bTimeOut)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_FORMAT_STRING(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION*)(msg))->bmFormatString)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_BLOCK_STRING(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION*)(msg))->bmPINBlockString)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_LENGTH_FORMAT(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION*)(msg))->bmPINLengthFormat)
+
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_PIN_MAX_EXTRA_DIGIT(msg) _ux_utility_short_get(((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->wPINMaxExtraDigit)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_PIN_MIN_PIN_SIZE(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->wPINMaxExtraDigit[1])
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_PIN_MAX_PIN_SIZE(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->wPINMaxExtraDigit[0])
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_ENTRY_VALIDATION_CONDITION(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->bEntryValidationCondition)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_NUMBER_MESSAGE(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->bNumberMessage)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_LANG_ID(msg) _ux_utility_short_get(((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->wLangId)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_MESSAGE_INDEX(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->bMsgIndex)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_TEO_PROLOGUE(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SECURE_PIN_VERIFICATION*)(msg))->bTeoPrologue)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_DATA(msg) ((UCHAR*)(msg) + 25)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_VERIFICATION_APDU(msg) ((UCHAR*)(msg) + 25)
+
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+ UCHAR bPINOperation;
+
+ UCHAR bTimeOut;
+ UCHAR bmFormatString;
+ UCHAR bmPINBlockString;
+ UCHAR bmPINLengthFormat;
+
+ UCHAR bInsertionOffsetOld;
+ UCHAR bInsertionOffsetNew;
+ UCHAR wPINMaxExtraDigit[2]; /* XXYY, XX: min size, YY: max size. */
+ UCHAR bConfirmPIN;
+ UCHAR bEntryValidationCondition;
+ UCHAR bNumberMessage;
+ UCHAR wLangId[2];
+ UCHAR bMsgIndex1;
+ UCHAR bTeoPrologue[3];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION;
+typedef UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION1;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION1_TEO_PROLOGUE(msg) ((UCHAR*)(msg) + 25)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION1_DATA(msg) ((UCHAR*)(msg) + 28)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION1_APDU(msg) ((UCHAR*)(msg) + 28)
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION2_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+ UCHAR bPINOperation;
+ UCHAR bTimeOut;
+ UCHAR bmFormatString;
+ UCHAR bmPINBlockString;
+ UCHAR bmPINLengthFormat;
+ UCHAR bInsertionOffsetOld;
+ UCHAR bInsertionOffsetNew;
+ UCHAR wPINMaxExtraDigit[2]; /* XXYY, XX: min size, YY: max size. */
+ UCHAR bConfirmPIN;
+ UCHAR bEntryValidationCondition;
+ UCHAR bNumberMessage;
+ UCHAR wLangId[2];
+ UCHAR bMsgIndex1;
+ UCHAR bMsgIndex2;
+ UCHAR bTeoPrologue[3];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION2;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION2_TEO_PROLOGUE(msg) ((UCHAR*)(msg) + 26)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION2_DATA(msg) ((UCHAR*)(msg) + 29)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION2_APDU(msg) ((UCHAR*)(msg) + 29)
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION3_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bBWI;
+ USHORT wLevelParameter;
+ UCHAR bPINOperation;
+ UCHAR bTimeOut;
+ UCHAR bmFormatString;
+ UCHAR bmPINBlockString;
+ UCHAR bmPINLengthFormat;
+ UCHAR bInsertionOffsetOld;
+ UCHAR bInsertionOffsetNew;
+ UCHAR wPINMaxExtraDigit[2]; /* XXYY, XX: min size, YY: max size. */
+ UCHAR bConfirmPIN;
+ UCHAR bEntryValidationCondition;
+ UCHAR bNumberMessage;
+ UCHAR wLangId[2];
+ UCHAR bMsgIndex1;
+ UCHAR bMsgIndex2;
+ UCHAR bMsgIndex3;
+ UCHAR bTeoPrologue[3];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION3;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION3_TEO_PROLOGUE(msg) ((UCHAR*)(msg) + 27)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION3_DATA(msg) ((UCHAR*)(msg) + 30)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_PIN_MODIFICATION3_APDU(msg) ((UCHAR*)(msg) + 30)
+
+
+/* Define CCID PC_to_RDR_Mechanical. */
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bFunction;
+ UCHAR bRFU[2];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL_HEADER;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL_FUNCTION(msg) (((UX_DEVICE_CLASS_CCID_PC_TO_RDR_MECHANICAL_HEADER*)(msg))->bFunction)
+
+/* Define CCID PC_to_RDR_Abort. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT_HEADER;
+
+/* Define CCID PC_to_RDR_SetDataRateAndClockFrequency. */
+typedef UX_DEVICE_CLASS_CCID_MESSAGE_HEADER UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQUENCY_HEADER;
+typedef struct UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQUENCY_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bRFU[3];
+ UCHAR dwClockFrequency[4];
+ UCHAR dwDataRate[4];
+} UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQUENCY;
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_CLOCK_FREQUENCY_GET(msg) _ux_utility_long_get(((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQUENCY*)(msg))->dwClockFrequency)
+#define UX_DEVICE_CLASS_CCID_PC_TO_RDR_DATA_RATE_GET(msg) _ux_utility_long_get(((UX_DEVICE_CLASS_CCID_PC_TO_RDR_SET_DATA_RATE_AND_CLOCK_FREQUENCY*)(msg))->dwDataRate)
+
+/* Define CCID RDR_to_PC_ header. */
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bRFU;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_STATUS(msg) (((UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER*)(msg))->bStatus)
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_ERROR(msg) (((UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER*)(msg))->bError)
+
+/* Define CCID Slot Status Register. */
+typedef struct UX_DEVICE_CLASS_CCID_SLOT_STATUS_REGISTER_BITMAP_STRUCT
+{
+ UCHAR bmICCStatus:2;
+ UCHAR bmRFU:4;
+ UCHAR bmCommandStatus:2;
+} UX_DEVICE_CLASS_CCID_SLOT_STATUS_REGISTER_BITMAP;
+
+/* Define CCID RDR_to_PC_DataBlock. */
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_BLOCK_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bChainParameter;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_BLOCK_HEADER;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_CHAIN_PARAMETER(msg) (((UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_BLOCK_HEADER*)(msg))->bChainParameter)
+
+/* Define CCID RDR_to_PC_SlotStatus. */
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bClockStatus;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_CLOCK_STATUS(msg) (((UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER*)(msg))->bClockStatus)
+
+/* Define CCID RDR_to_PC_Parameters. */
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_HEADER_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bProtocolNum;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_HEADER;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_PROTOCOL_NUM(msg) (((UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_HEADER*)(msg))->bProtocolNum)
+
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T0_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bProtocolNum;
+ UCHAR bmFindexDindex;
+ UCHAR bmTCCKST0;
+ UCHAR bGuardTimeT0;
+ UCHAR bWaitingIntegerT0;
+ UCHAR bClockStop;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T0;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T0_LENGTH 5
+
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T1_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bProtocolNum;
+ UCHAR bmFindexDindex;
+ UCHAR bmTCCKST1;
+ UCHAR bGuardTimeT1;
+ UCHAR bmWaitingIntegersT1;
+ UCHAR bClockStop;
+ UCHAR bIFSC;
+ UCHAR bNadValue;
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T1;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_PARAMETERS_T1_LENGTH 7
+
+/* Define CCID RDR_to_PC_Escape. */
+typedef UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER UX_DEVICE_CLASS_CCID_RDR_TO_PC_ESCAPE_HEADER;
+
+/* Define CCID RDR_to_PC_DataRateAndClockFrequency. */
+typedef UX_DEVICE_CLASS_CCID_RDR_TO_PC_HEADER UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQUENCY_HEADER;
+typedef struct UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQUENCY_STRUCT
+{
+ UCHAR bMessageType;
+ UCHAR dwLength[4];
+ UCHAR bSlot;
+ UCHAR bSeq;
+ UCHAR bStatus;
+ UCHAR bError;
+ UCHAR bRFU;
+ UCHAR dwClockFrequency[4];
+ UCHAR dwDataRate[4];
+} UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQUENCY;
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_CLOCK_FREQUENCY_SET(msg,v) _ux_utility_long_put(((UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQUENCY*)(msg))->dwClockFrequency,(v))
+#define UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_SET(msg,v) _ux_utility_long_put(((UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQUENCY*)(msg))->dwDataRate,(v))
+
+
+/* Define CCID message command handles, if command handle is not defined device
+ reports command not supported to host. */
+typedef UINT (*UX_DEVICE_CLASS_CCID_HANDLE)(ULONG slot, UX_DEVICE_CLASS_CCID_MESSAGES*);
+typedef struct UX_DEVICE_CLASS_CCID_HANDLES_STRUCT
+{
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_icc_power_on;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_icc_power_off;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_get_slot_status;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_xfr_block;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_get_parameters;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_reset_parameters;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_set_parameters;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_escape;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_icc_clock;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_t0_apdu;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_secure;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_mechanical;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_abort;
+ UX_DEVICE_CLASS_CCID_HANDLE ux_device_class_ccid_handles_set_data_rate_and_clock_frequency;
+} UX_DEVICE_CLASS_CCID_HANDLES;
+
+typedef struct UX_DEVICE_CLASS_CCID_COMMAND_SETT_STRUCT
+{
+ UCHAR ux_device_class_ccid_command_sett_command_type;
+ UCHAR ux_device_class_ccid_command_sett_response_type;
+ UCHAR ux_device_class_ccid_command_sett_flags;
+ CHAR ux_device_class_ccid_command_sett_handle_index;
+} UX_DEVICE_CLASS_CCID_COMMAND_SETT;
+
+
+/* Define CCID slot structure. */
+typedef struct UX_DEVICE_CLASS_CCID_SLOT_STRUCT
+{
+ CHAR ux_device_class_ccid_slot_runner;
+ UCHAR ux_device_class_ccid_slot_flags;
+
+ UCHAR ux_device_class_ccid_slot_icc_status;
+ UCHAR ux_device_class_ccid_slot_clock_status;
+
+ UCHAR ux_device_class_ccid_slot_hw_error;
+ UCHAR ux_device_class_ccid_slot_hw_error_seq;
+
+ UCHAR ux_device_class_ccid_slot_aborting_seq;
+ UCHAR ux_device_class_ccid_slot_aborting;
+} UX_DEVICE_CLASS_CCID_SLOT;
+
+/* Define CCID runner structure. */
+typedef struct UX_DEVICE_CLASS_CCID_RUNNER_STRUCT
+{
+ struct UX_DEVICE_CLASS_CCID_STRUCT
+ *ux_device_class_ccid_runner_ccid;
+ UCHAR *ux_device_class_ccid_runner_command;
+ UCHAR *ux_device_class_ccid_runner_response;
+
+ CHAR ux_device_class_ccid_runner_slot;
+ CHAR ux_device_class_ccid_runner_id;
+ CHAR ux_device_class_ccid_runner_command_index;
+ UCHAR reserved;
+
+#if !defined(UX_DEVICE_STANDALONE)
+ UX_THREAD ux_device_class_ccid_runner_thread;
+ UCHAR *ux_device_class_ccid_runner_thread_stack;
+#endif
+} UX_DEVICE_CLASS_CCID_RUNNER;
+
+/* Define Device CCID Class Calling Parameter structure */
+typedef struct UX_DEVICE_CLASS_CCID_PARAMETER_STRUCT
+{
+ VOID (*ux_device_class_ccid_instance_activate)(VOID *);
+ VOID (*ux_device_class_ccid_instance_deactivate)(VOID *);
+ UX_DEVICE_CLASS_CCID_HANDLES
+ *ux_device_class_ccid_handles;
+ ULONG *ux_device_class_ccid_clocks;
+ ULONG *ux_device_class_ccid_data_rates;
+ ULONG ux_device_class_ccid_max_transfer_length;
+ UCHAR ux_device_class_ccid_max_n_slots;
+ UCHAR ux_device_class_ccid_max_n_busy_slots;
+ UCHAR ux_device_class_ccid_n_clocks;
+ UCHAR ux_device_class_ccid_n_data_rates;
+} UX_DEVICE_CLASS_CCID_PARAMETER;
+
+
+/* Define CCID Class structure. */
+
+typedef struct UX_DEVICE_CLASS_CCID_STRUCT
+{
+ UX_SLAVE_INTERFACE *ux_device_class_ccid_interface;
+ UX_SLAVE_ENDPOINT *ux_device_class_ccid_endpoint_out;
+ UX_SLAVE_ENDPOINT *ux_device_class_ccid_endpoint_in;
+ UX_SLAVE_ENDPOINT *ux_device_class_ccid_endpoint_notify;
+
+ UX_DEVICE_CLASS_CCID_PARAMETER
+ ux_device_class_ccid_parameter;
+
+ UX_DEVICE_CLASS_CCID_RUNNER
+ *ux_device_class_ccid_runners;
+ UX_DEVICE_CLASS_CCID_SLOT
+ *ux_device_class_ccid_slots;
+
+ UCHAR ux_device_class_ccid_header[UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH];
+ SHORT ux_device_class_ccid_n_busy;
+
+#if !defined(UX_DEVICE_STANDALONE)
+ UX_THREAD ux_device_class_ccid_thread;
+ UCHAR *ux_device_class_ccid_thread_stack;
+
+ UX_THREAD ux_device_class_ccid_notify_thread;
+ UCHAR *ux_device_class_ccid_notify_thread_stack;
+
+ UX_EVENT_FLAGS_GROUP ux_device_class_ccid_events;
+ UX_MUTEX ux_device_class_ccid_mutex;
+ UX_MUTEX ux_device_class_ccid_response_mutex;
+ UX_SEMAPHORE ux_device_class_ccid_notify_semaphore;
+#endif
+} UX_DEVICE_CLASS_CCID;
+
+/* Define Device CCID command settings. */
+extern const UX_DEVICE_CLASS_CCID_COMMAND_SETT _ux_device_class_ccid_command_sett[];
+
+/* Define Device CCID Class prototypes. */
+UINT _ux_device_class_ccid_initialize(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_ccid_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_ccid_activate(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_ccid_deactivate(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_ccid_control_request(UX_SLAVE_CLASS_COMMAND *command);
+
+VOID _ux_device_class_ccid_thread_entry(ULONG ccid_instance);
+VOID _ux_device_class_ccid_notify_thread_entry(ULONG ccid_instance);
+VOID _ux_device_class_ccid_runner_thread_entry(ULONG runner_instance);
+
+UINT _ux_device_class_ccid_control_abort(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq);
+
+UINT _ux_device_class_ccid_response(UX_DEVICE_CLASS_CCID *ccid, UCHAR *buffer, ULONG length);
+
+UINT _ux_device_class_ccid_entry(UX_SLAVE_CLASS_COMMAND *command);
+
+UINT _ux_device_class_ccid_icc_insert(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq_start);
+UINT _ux_device_class_ccid_icc_remove(UX_DEVICE_CLASS_CCID *ccid, ULONG slot);
+UINT _ux_device_class_ccid_auto_seq_start(UX_DEVICE_CLASS_CCID *ccid, ULONG slot);
+UINT _ux_device_class_ccid_auto_seq_done(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG icc_status);
+UINT _ux_device_class_ccid_time_extension(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG wt);
+UINT _ux_device_class_ccid_hardware_error(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG error);
+
+/* Define Device CCID Class API prototypes. */
+
+#define ux_device_class_ccid_entry _ux_device_class_ccid_entry
+
+#define ux_device_class_ccid_icc_insert _ux_device_class_ccid_icc_insert
+#define ux_device_class_ccid_icc_remove _ux_device_class_ccid_icc_remove
+#define ux_device_class_ccid_auto_seq_done _ux_device_class_ccid_auto_seq_done
+#define ux_device_class_ccid_time_extension _ux_device_class_ccid_time_extension
+#define ux_device_class_ccid_hardware_error _ux_device_class_ccid_hardware_error
+
+
+/* Determine if a C++ compiler is being used. If so, complete the standard
+ C conditional started above. */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* UX_DEVICE_CLASS_CCID_H */
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 6f787e4..3f662d8 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.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -49,6 +49,9 @@
/* added extern "C" keyword */
/* for compatibility with C++, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -65,8 +68,28 @@ extern "C" {
#endif
+#if !defined(UX_DEVICE_STANDALONE)
#include "nx_api.h"
#include "ux_network_driver.h"
+#else
+
+/* Assume NX definitions for compiling. */
+#define NX_PACKET VOID*
+/*
+UINT _ux_network_driver_deactivate(VOID *ux_instance, VOID *ux_network_handle);
+VOID _ux_network_driver_link_up(VOID *ux_network_handle);
+VOID _ux_network_driver_link_down(VOID *ux_network_handle);
+*/
+#ifndef _ux_network_driver_deactivate
+#define _ux_network_driver_deactivate(a,b) do {} while(0)
+#endif
+#ifndef _ux_network_driver_link_up
+#define _ux_network_driver_link_up(a) do {} while(0)
+#endif
+#ifndef _ux_network_driver_link_down
+#define _ux_network_driver_link_down(a) do {} while(0)
+#endif
+#endif
/* Define generic CDC_ECM equivalences. */
#define UX_DEVICE_CLASS_CDC_ECM_CLASS_COMMUNICATION_CONTROL 0x02
@@ -289,26 +312,33 @@ typedef struct UX_SLAVE_CLASS_CDC_ECM_STRUCT
ULONG ux_slave_class_cdc_ecm_ethernet_multicast_filter;
ULONG ux_slave_class_cdc_ecm_ethernet_power_management_filter;
ULONG ux_slave_class_cdc_ecm_ethernet_packet_filter;
- UX_EVENT_FLAGS_GROUP ux_slave_class_cdc_ecm_event_flags_group;
UCHAR ux_slave_class_cdc_ecm_local_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
UCHAR ux_slave_class_cdc_ecm_remote_node_id[UX_DEVICE_CLASS_CDC_ECM_NODE_ID_LENGTH];
- NX_IP *ux_slave_class_cdc_ecm_nx_ip;
ULONG ux_slave_class_cdc_ecm_nx_ip_address;
ULONG ux_slave_class_cdc_ecm_nx_ip_network_mask;
+ UCHAR *ux_slave_class_cdc_ecm_pool_memory;
+
+#if !defined(UX_DEVICE_STANDALONE)
+ NX_IP *ux_slave_class_cdc_ecm_nx_ip;
NX_INTERFACE *ux_slave_class_cdc_ecm_nx_interface;
NX_PACKET *ux_slave_class_cdc_ecm_xmit_queue;
NX_PACKET *ux_slave_class_cdc_ecm_xmit_queue_tail;
NX_PACKET *ux_slave_class_cdc_ecm_receive_queue;
- UCHAR *ux_slave_class_cdc_ecm_pool_memory;
NX_PACKET_POOL ux_slave_class_cdc_ecm_packet_pool;
+#endif
+
+#if !defined(UX_DEVICE_STANDALONE)
+ UX_EVENT_FLAGS_GROUP ux_slave_class_cdc_ecm_event_flags_group;
UX_THREAD ux_slave_class_cdc_ecm_bulkin_thread;
UX_THREAD ux_slave_class_cdc_ecm_bulkout_thread;
UX_THREAD ux_slave_class_cdc_ecm_interrupt_thread;
+ UX_MUTEX ux_slave_class_cdc_ecm_mutex;
UCHAR *ux_slave_class_cdc_ecm_bulkin_thread_stack;
UCHAR *ux_slave_class_cdc_ecm_bulkout_thread_stack;
UCHAR *ux_slave_class_cdc_ecm_interrupt_thread_stack;
+#endif
+
ULONG ux_slave_class_cdc_ecm_link_state;
- UX_MUTEX ux_slave_class_cdc_ecm_mutex;
VOID *ux_slave_class_cdc_ecm_network_handle;
} UX_SLAVE_CLASS_CDC_ECM;
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 0d53f79..47eb842 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -58,6 +58,9 @@
/* added standalone support, */
/* added interrupt OUT support,*/
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added receiver callback, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -215,6 +218,7 @@ typedef struct UX_DEVICE_CLASS_HID_RECEIVER_STRUCT
{
VOID (*ux_device_class_hid_receiver_uninitialize)(struct UX_DEVICE_CLASS_HID_RECEIVER_STRUCT *receiver);
+ VOID (*ux_device_class_hid_receiver_event_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid);
ULONG ux_device_class_hid_receiver_event_buffer_size;
UX_DEVICE_CLASS_HID_RECEIVED_EVENT
@@ -250,6 +254,7 @@ typedef struct UX_SLAVE_CLASS_HID_PARAMETER_STRUCT
UINT (*ux_device_class_hid_parameter_receiver_initialize)(UX_SLAVE_CLASS_HID *hid, struct UX_SLAVE_CLASS_HID_PARAMETER_STRUCT *parameter, UX_DEVICE_CLASS_HID_RECEIVER **receiver);
ULONG ux_device_class_hid_parameter_receiver_event_max_number;
ULONG ux_device_class_hid_parameter_receiver_event_max_length;
+ VOID (*ux_device_class_hid_parameter_receiver_event_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid);
#endif
} UX_SLAVE_CLASS_HID_PARAMETER;
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 00242b1..9910c80 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,6 +55,9 @@
/* improved internal function, */
/* added cancel callback, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -819,10 +822,12 @@ typedef struct UX_SLAVE_CLASS_PIMA_STRUCT
ULONG ux_device_class_pima_storage_free_space_image;
UCHAR *ux_device_class_pima_storage_description;
UCHAR *ux_device_class_pima_storage_volume_label;
+#if !defined(UX_DEVICE_STANDALONE)
UX_SEMAPHORE ux_device_class_pima_semaphore;
UX_THREAD ux_device_class_pima_interrupt_thread;
UCHAR *ux_device_class_pima_interrupt_thread_stack;
UX_SEMAPHORE ux_device_class_pima_interrupt_thread_semaphore;
+#endif
UX_SLAVE_CLASS_PIMA_EVENT
*ux_device_class_pima_event_array;
UX_SLAVE_CLASS_PIMA_EVENT
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 d434bce..6f29b93 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -39,6 +39,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -105,8 +108,10 @@ typedef struct UX_DEVICE_CLASS_PRINTER_STRUCT
ULONG ux_device_class_printer_port_status;
UX_DEVICE_CLASS_PRINTER_PARAMETER
ux_device_class_printer_parameter;
+#if !defined(UX_DEVICE_STANDALONE)
UX_MUTEX ux_device_class_printer_endpoint_out_mutex;
UX_MUTEX ux_device_class_printer_endpoint_in_mutex;
+#endif
} UX_DEVICE_CLASS_PRINTER;
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 b5ff974..7ac55d8 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.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -49,6 +49,9 @@
/* added extern "C" keyword */
/* for compatibility with C++, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -65,8 +68,29 @@ extern "C" {
#endif
+#if !defined(UX_DEVICE_STANDALONE)
#include "nx_api.h"
#include "ux_network_driver.h"
+#else
+
+/* Assume NX definitions for compiling. */
+#define NX_PACKET VOID*
+#define NX_IP VOID*
+/*
+UINT _ux_network_driver_deactivate(VOID *ux_instance, VOID *ux_network_handle);
+VOID _ux_network_driver_link_up(VOID *ux_network_handle);
+VOID _ux_network_driver_link_down(VOID *ux_network_handle);
+*/
+#ifndef _ux_network_driver_deactivate
+#define _ux_network_driver_deactivate(a,b) do {} while(0)
+#endif
+#ifndef _ux_network_driver_link_up
+#define _ux_network_driver_link_up(a) do {} while(0)
+#endif
+#ifndef _ux_network_driver_link_down
+#define _ux_network_driver_link_down(a) do {} while(0)
+#endif
+#endif
/* Define generic RNDIS equivalences. */
#define UX_DEVICE_CLASS_RNDIS_CLASS_COMMUNICATION_CONTROL 0x02
@@ -518,25 +542,32 @@ typedef struct UX_SLAVE_CLASS_RNDIS_STRUCT
ULONG ux_slave_class_rndis_statistics_rcv_error_alignment;
ULONG ux_slave_class_rndis_statistics_xmit_one_collision;
ULONG ux_slave_class_rndis_statistics_xmit_more_collisions;
- UX_EVENT_FLAGS_GROUP ux_slave_class_rndis_event_flags_group;
UCHAR ux_slave_class_rndis_local_node_id[UX_DEVICE_CLASS_RNDIS_NODE_ID_LENGTH];
UCHAR ux_slave_class_rndis_remote_node_id[UX_DEVICE_CLASS_RNDIS_NODE_ID_LENGTH];
- NX_IP *ux_slave_class_rndis_nx_ip;
+ UCHAR *ux_slave_class_rndis_pool_memory;
ULONG ux_slave_class_rndis_nx_ip_address;
ULONG ux_slave_class_rndis_nx_ip_network_mask;
+
+#if !defined(UX_DEVICE_STANDALONE)
+ NX_IP *ux_slave_class_rndis_nx_ip;
NX_INTERFACE *ux_slave_class_rndis_nx_interface;
NX_PACKET *ux_slave_class_rndis_xmit_queue;
NX_PACKET *ux_slave_class_rndis_receive_queue;
- UCHAR *ux_slave_class_rndis_pool_memory;
NX_PACKET_POOL ux_slave_class_rndis_packet_pool;
+#endif
+
+#if !defined(UX_DEVICE_STANDALONE)
+ UX_EVENT_FLAGS_GROUP ux_slave_class_rndis_event_flags_group;
UX_THREAD ux_slave_class_rndis_interrupt_thread;
UX_THREAD ux_slave_class_rndis_bulkin_thread;
UX_THREAD ux_slave_class_rndis_bulkout_thread;
+ UX_MUTEX ux_slave_class_rndis_mutex;
UCHAR *ux_slave_class_rndis_interrupt_thread_stack;
UCHAR *ux_slave_class_rndis_bulkin_thread_stack;
UCHAR *ux_slave_class_rndis_bulkout_thread_stack;
+#endif
+
ULONG ux_slave_class_rndis_link_state;
- UX_MUTEX ux_slave_class_rndis_mutex;
VOID *ux_slave_class_rndis_network_handle;
} UX_SLAVE_CLASS_RNDIS;
diff --git a/common/usbx_device_classes/inc/ux_device_class_video.h b/common/usbx_device_classes/inc/ux_device_class_video.h
new file mode 100644
index 0000000..4c6d3e8
--- /dev/null
+++ b/common/usbx_device_classes/inc/ux_device_class_video.h
@@ -0,0 +1,673 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+
+/**************************************************************************/
+/* */
+/* COMPONENT DEFINITION RELEASE */
+/* */
+/* ux_device_class_video.h PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This file contains all the header and extern functions used by the */
+/* USBX device video class. */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+
+#ifndef UX_DEVICE_CLASS_VIDEO_H
+#define UX_DEVICE_CLASS_VIDEO_H
+
+/* Determine if a C++ compiler is being used. If so, ensure that standard
+ C is used to process the API information. */
+
+#ifdef __cplusplus
+
+/* Yes, C++ compiler is present. Use standard C. */
+extern "C" {
+
+#endif
+
+/* Define options. */
+
+#define UX_DEVICE_CLASS_VIDEO_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE
+
+/* Define external static data. */
+
+extern UCHAR _ux_system_device_class_video_name[];
+
+
+/* Define IOCTL code.
+ ux_device_class_video_ioctl(video, IOCTL_CODE, parameter).
+ */
+
+#define UX_DEVICE_CLASS_VIDEO_IOCTL_GET_ARG 0x01
+
+
+/* Define Video Class main constants. */
+
+#define UX_DEVICE_CLASS_VIDEO_CLASS 0x0e
+#define UX_DEVICE_CLASS_VIDEO_SUBCLASS_UNDEFINED 0
+#define UX_DEVICE_CLASS_VIDEO_SUBCLASS_CONTROL 1
+#define UX_DEVICE_CLASS_VIDEO_SUBCLASS_STREAMING 2
+#define UX_DEVICE_CLASS_VIDEO_SUBCLASS_INTERFACE_COLLECTION 3
+
+/* Class Code (CC). */
+#define UX_DEVICE_CLASS_VIDEO_CC_VIDEO 0x0e
+
+/* Subclass Code (SC). */
+#define UX_DEVICE_CLASS_VIDEO_SC_UNDEFINED 0
+#define UX_DEVICE_CLASS_VIDEO_SC_CONTROL 1
+#define UX_DEVICE_CLASS_VIDEO_SC_STREAMING 2
+#define UX_DEVICE_CLASS_VIDEO_SC_INTERFACE_COLLECTION 3
+
+/* Protocol Code. */
+#define UX_DEVICE_CLASS_VIDEO_PC_PROTOCOL_UNDEFINED 0
+#define UX_DEVICE_CLASS_VIDEO_PC_PROTOCOL_15 0
+
+
+/* Define Video Class-Specific (CS) descriptor types. */
+#define UX_DEVICE_CLASS_VIDEO_CS_UNDEFINED 0x20
+#define UX_DEVICE_CLASS_VIDEO_CS_DEVICE 0x21
+#define UX_DEVICE_CLASS_VIDEO_CS_CONFIGURATION 0x22
+#define UX_DEVICE_CLASS_VIDEO_CS_STRING 0x23
+#define UX_DEVICE_CLASS_VIDEO_CS_INTERFACE 0x24
+#define UX_DEVICE_CLASS_VIDEO_CS_ENDPOINT 0x25
+
+
+/* Define Video Class specific Video Control (VC) interface descriptor subtypes. */
+#define UX_DEVICE_CLASS_VIDEO_VC_DESCRIPTOR_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_VC_HEADER 0x01
+#define UX_DEVICE_CLASS_VIDEO_VC_INPUT_TERMINAL 0x02
+#define UX_DEVICE_CLASS_VIDEO_VC_OUTPUT_TERMINAL 0x03
+#define UX_DEVICE_CLASS_VIDEO_VC_SELECTOR_UNIT 0x04
+#define UX_DEVICE_CLASS_VIDEO_VC_PROCESSING_UNIT 0x05
+#define UX_DEVICE_CLASS_VIDEO_VC_EXTENSION_UNIT 0x06
+#define UX_DEVICE_CLASS_VIDEO_VC_ENCODING_UNIT 0x07
+
+
+/* Define Video Class specific Video Stream (VS) interface descriptor subtypes. */
+#define UX_DEVICE_CLASS_VIDEO_VS_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_VS_INPUT_HEADER 0x01
+#define UX_DEVICE_CLASS_VIDEO_VS_OUTPUT_HEADER 0x02
+#define UX_DEVICE_CLASS_VIDEO_VS_STILL_IMAGE_FRAME 0x03
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_UNCOMPRESSED 0x04
+#define UX_DEVICE_CLASS_VIDEO_VS_FRAME_UNCOMPRESSED 0x05
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_MJPEG 0x06
+#define UX_DEVICE_CLASS_VIDEO_VS_FRAME_MJPEG 0x07
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_MPEG2TS 0x0A
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_DV 0x0C
+#define UX_DEVICE_CLASS_VIDEO_VS_COLORFORMAT 0x0D
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_FRAME_BASED 0x10
+#define UX_DEVICE_CLASS_VIDEO_VS_FRAME_FRAME_BASED 0x11
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_STREAM_BASED 0x12
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_H264 0x13
+#define UX_DEVICE_CLASS_VIDEO_VS_FRAME_H264 0x14
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_H264_SIMULCAST 0x15
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_VP8 0x16
+#define UX_DEVICE_CLASS_VIDEO_VS_FRAME_VP8 0x17
+#define UX_DEVICE_CLASS_VIDEO_VS_FORMAT_VP8_SIMULCAST 0x18
+
+
+/* Define Video Class specific Endpoint (EP) descriptor subtypes. */
+#define UX_DEVICE_CLASS_VIDEO_EP_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_EP_GENERAL 0x01
+#define UX_DEVICE_CLASS_VIDEO_EP_ENDPOINT 0x02
+#define UX_DEVICE_CLASS_VIDEO_EP_INTERRUPT 0x03
+
+
+/* Define Video Control Selector Codes. */
+
+/* Define VideoControl (VC) Interface Control Selector Codes. */
+#define UX_DEVICE_CLASS_VIDEO_VC_CONTROL_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_VC_VIDEO_POWER_MODE_CONTROL 0x01
+#define UX_DEVICE_CLASS_VIDEO_VC_REQUEST_ERROR_CODE_CONTROL 0x02
+
+/* Define Terminal Control (TE) Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_TE_CONTROL_UNDEFINED 0x00
+
+/* Define Selector Unit (SU) Control Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_SU_CONTROL_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_SU_INPUT_SELECT_CONTROL 0x01
+
+/* Define Camera Terminal (CT) Control Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_CT_CONTROL_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_CT_SCANNING_MODE_CONTROL 0x01
+#define UX_DEVICE_CLASS_VIDEO_CT_AE_MODE_CONTROL 0x02
+#define UX_DEVICE_CLASS_VIDEO_CT_AE_PRIORITY_CONTROL 0x03
+#define UX_DEVICE_CLASS_VIDEO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
+#define UX_DEVICE_CLASS_VIDEO_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
+#define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_ABSOLUTE_CONTROL 0x06
+#define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_RELATIVE_CONTROL 0x07
+#define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_AUTO_CONTROL 0x08
+#define UX_DEVICE_CLASS_VIDEO_CT_IRIS_ABSOLUTE_CONTROL 0x09
+#define UX_DEVICE_CLASS_VIDEO_CT_IRIS_RELATIVE_CONTROL 0x0A
+#define UX_DEVICE_CLASS_VIDEO_CT_ZOOM_ABSOLUTE_CONTROL 0x0B
+#define UX_DEVICE_CLASS_VIDEO_CT_ZOOM_RELATIVE_CONTROL 0x0C
+#define UX_DEVICE_CLASS_VIDEO_CT_PANTILT_ABSOLUTE_CONTROL 0x0D
+#define UX_DEVICE_CLASS_VIDEO_CT_PANTILT_RELATIVE_CONTROL 0x0E
+#define UX_DEVICE_CLASS_VIDEO_CT_ROLL_ABSOLUTE_CONTROL 0x0F
+#define UX_DEVICE_CLASS_VIDEO_CT_ROLL_RELATIVE_CONTROL 0x10
+#define UX_DEVICE_CLASS_VIDEO_CT_PRIVACY_CONTROL 0x11
+#define UX_DEVICE_CLASS_VIDEO_CT_FOCUS_SIMPLE_CONTROL 0x12
+#define UX_DEVICE_CLASS_VIDEO_CT_WINDOW_CONTROL 0x13
+#define UX_DEVICE_CLASS_VIDEO_CT_REGION_OF_INTEREST_CONTROL 0x14
+
+/* Define Processing Unit (PU) Control Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_PU_CONTROL_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
+#define UX_DEVICE_CLASS_VIDEO_PU_BRIGHTNESS_CONTROL 0x02
+#define UX_DEVICE_CLASS_VIDEO_PU_CONTRAST_CONTROL 0x03
+#define UX_DEVICE_CLASS_VIDEO_PU_GAIN_CONTROL 0x04
+#define UX_DEVICE_CLASS_VIDEO_PU_POWER_LINE_FREQUENCY_CONTROL 0x05
+#define UX_DEVICE_CLASS_VIDEO_PU_HUE_CONTROL 0x06
+#define UX_DEVICE_CLASS_VIDEO_PU_SATURATION_CONTROL 0x07
+#define UX_DEVICE_CLASS_VIDEO_PU_SHARPNESS_CONTROL 0x08
+#define UX_DEVICE_CLASS_VIDEO_PU_GAMMA_CONTROL 0x09
+#define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0A
+#define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0B
+#define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0C
+#define UX_DEVICE_CLASS_VIDEO_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0D
+#define UX_DEVICE_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_CONTROL 0x0E
+#define UX_DEVICE_CLASS_VIDEO_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0F
+#define UX_DEVICE_CLASS_VIDEO_PU_HUE_AUTO_CONTROL 0x10
+#define UX_DEVICE_CLASS_VIDEO_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
+#define UX_DEVICE_CLASS_VIDEO_PU_ANALOG_LOCK_STATUS_CONTROL 0x12
+#define UX_DEVICE_CLASS_VIDEO_PU_CONTRAST_AUTO_CONTROL 0x13
+
+/* Define eXtension Unit (XU) Control Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_XU_CONTROL_UNDEFINED 0x00
+
+/* Define VideoStreaming (VS) Interface Control Selectors. */
+#define UX_DEVICE_CLASS_VIDEO_VS_CONTROL_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_VS_PROBE_CONTROL 0x01
+#define UX_DEVICE_CLASS_VIDEO_VS_COMMIT_CONTROL 0x02
+#define UX_DEVICE_CLASS_VIDEO_VS_STILL_PROBE_CONTROL 0x03
+#define UX_DEVICE_CLASS_VIDEO_VS_STILL_COMMIT_CONTROL 0x04
+#define UX_DEVICE_CLASS_VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
+#define UX_DEVICE_CLASS_VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06
+#define UX_DEVICE_CLASS_VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07
+#define UX_DEVICE_CLASS_VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
+#define UX_DEVICE_CLASS_VIDEO_VS_SYNCH_DELAY_CONTROL 0x09
+
+
+/* Define USB Video Class terminal types. */
+
+/* Define USB Terminal Types (TT). */
+#define UX_DEVICE_CLASS_VIDEO_TT_VENDOR_SPECIFIC 0x0100
+#define UX_DEVICE_CLASS_VIDEO_TT_STREAMING 0x0101
+
+/* Define USB Input Terminal Types (ITT). */
+#define UX_DEVICE_CLASS_VIDEO_ITT_VENDOR_SPECIFIC 0x0200
+#define UX_DEVICE_CLASS_VIDEO_ITT_CAMERA 0x0201
+#define UX_DEVICE_CLASS_VIDEO_ITT_MEDIA_TRANSPORT_INPUT 0x0202
+
+/* Define USB Output Terminal Types (OTT). */
+#define UX_DEVICE_CLASS_VIDEO_OTT_VENDOR_SPECIFIC 0x0300
+#define UX_DEVICE_CLASS_VIDEO_OTT_DISPLAY 0x0301
+#define UX_DEVICE_CLASS_VIDEO_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
+
+/* Define USB External Terminal Types (XTT). */
+#define UX_DEVICE_CLASS_VIDEO_XTT_EXTERNAL_VENDOR_SPECIFIC 0x0400
+#define UX_DEVICE_CLASS_VIDEO_XTT_COMPOSITE_CONNECTOR 0x0401
+#define UX_DEVICE_CLASS_VIDEO_XTT_SVIDEO_CONNECTOR 0x0402
+#define UX_DEVICE_CLASS_VIDEO_XTT_COMPONENT_CONNECTOR 0x0403
+
+
+/* Video Class GET_INFO Capabilities and status structs and definitions. */
+
+#define UX_DEVICE_CLASS_VIDEO_INFO_GET_REQUEST_SUPPORT (1u << 0)
+#define UX_DEVICE_CLASS_VIDEO_INFO_SET_REQUEST_SUPPORT (1u << 1)
+#define UX_DEVICE_CLASS_VIDEO_INFO_DISABLED_DUE_TO_AUTO_MODE (1u << 2)
+#define UX_DEVICE_CLASS_VIDEO_INFO_AUTOUPDATE_CONTROL (1u << 3)
+#define UX_DEVICE_CLASS_VIDEO_INFO_ASYNCHRONOUS_CONTROL (1u << 4)
+#define UX_DEVICE_CLASS_VIDEO_INFO_DISABLED_DUE_TO_STATE (1u << 5)
+
+
+/* Video Class Probe and Commit Controls structs and definitions. */
+typedef struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_STRUCT
+{
+ union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmHint_UNION {
+ USHORT value;
+ struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmHint_STRUCT {
+ USHORT dwFrameInterval:1;
+ USHORT wKeyFrameRate:1;
+ USHORT wPFrameRate:1;
+ USHORT wCompQuality:1;
+ USHORT wCompWindowSize:1;
+ } bm;
+ } bmHint;
+ UCHAR bFormatIndex;
+ UCHAR bFrameIndex;
+ ULONG dwFrameInterval;
+ USHORT wKeyFrameRate;
+ USHORT wPFrameRate;
+ USHORT wCompQuality;
+ USHORT wCompWindowSize;
+ USHORT wDelay;
+ UCHAR dwMaxVideoFrameSize[4]; /* Not alignend from now on. */
+ UCHAR dwMaxPayloadTransferSize[4];
+ UCHAR dwClockFrequency[4];
+ union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmFramingInfo_UNION {
+ UCHAR value;
+ struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmFramingInfo_STRUCT {
+ UCHAR FID_required:1;
+ UCHAR EOF_may_present:1;
+ UCHAR EOS_may_present:1;
+ } bm;
+ } bmFramingInfo;
+ UCHAR bPreferedVersion;
+ UCHAR bMinVersion;
+ UCHAR bMaxVersion;
+
+ /* Start from offset 34, additional fields introduced in UVC 1.5. */
+ UCHAR bUsage;
+ UCHAR bBitDepthLuma;
+ UCHAR bmSettings;
+ UCHAR bMaxNumberOfRefFramesPlus1;
+ union UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmRateControlModes_UNION {
+ USHORT value;
+ struct UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_bmRateControlModes_STRUCT {
+ USHORT rate_ctrl_mode_0:4;
+ USHORT rate_ctrl_mode_1:4;
+ USHORT rate_ctrl_mode_2:4;
+ USHORT rate_ctrl_mode_3:4;
+ } bm;
+ } bmRateControlModes;
+ UCHAR bmLayoutPerStream;
+} UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL;
+
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_OFFSET 0
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_FRAME_INTERVAL (1U<<0)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_KEY_FRAME_RATE (1U<<1)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_KEY_P_FRAME_RATE (1U<<2)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_COMP_QUALITY (1U<<3)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_HINT_COMP_WINDOW_SIZE (1U<<4)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FORMAT_INDEX_OFFSET 2
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAME_INDEX_OFFSET 3
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAME_INTERVAL_OFFSET 4
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_KEY_FRAME_RATE_OFFSET 8
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_P_FRAME_RATE_OFFSET 10
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_COMP_QUALITY_OFFSET 12
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_COMP_WINDOW_SIZE_OFFSET 14
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_DELAY_OFFSET 16
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_VIDEO_FRAME_SIZE_OFFSET 18
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET 22
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_CLOCK_FREQUENCY_OFFSET 26
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_OFFSET 30
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_FID_REQUIRED (1U<<0)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_EOF_MAY_PRESENT (1U<<1)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_FRAMING_INFO_EOS_MAY_PRESENT (1U<<2)
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_PREFERED_VERSION_OFFSET 31
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MIN_VERSION_OFFSET 32
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_VERSION_OFFSET 33
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_USAGE_OFFSET 34
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_BIT_DEPTH_LUMA_OFFSET 35
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_SETTINGS_OFFSET 36
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_MAX_N_OF_FRAMES_PLUS1_OFFSET 37
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODES_OFFSET 38
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_NOT_APPLICABLE 0U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_VBR_WITH_UNDERFLOW 1U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_CBR 2U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_CONSTANT_QP 3U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_GLOBAL_VBR_WITH_UNDERFLOW 4U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_VBR 5U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_RATE_CONTROL_MODE_GLOBAL_VBR 6U
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CONTROL_LAYOUT_PER_STREAM_OFFSET 40
+
+
+/* Video Class Still Probe and Commit Controls structs and definitions. */
+typedef struct UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_STRUCT
+{
+ UCHAR bFormatIndex;
+ UCHAR bFrameIndex;
+ UCHAR bCompressionIndex;
+ UCHAR dwMaxVideoFrameSize[4]; /* Not aligned from now. */
+ UCHAR dwMaxPayloadTransferSize[4];
+} UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL;
+#define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_FORMAT_INDEX_OFFSET 0
+#define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_FRAME_INDEX_OFFSET 1
+#define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_COMPRESSION_INDEX_OFFSET 2
+#define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_MAX_VIDEO_FRAME_SIZE_OFFSET 3
+#define UX_DEVICE_CLASS_VIDEO_STILL_PROBE_COMMIT_CONTROL_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET 7
+
+
+/* Video Class Status Packet structs and definitions. */
+
+/* Offsets and possible values. */
+typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_HEADER_STRUCT
+{
+ UCHAR bStatusType;
+ UCHAR bOriginator;
+} UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_HEADER;
+typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_STRUCT
+{
+ UCHAR bStatusType;
+ UCHAR bOriginator;
+ UCHAR bEvent;
+ UCHAR bSelector;
+ UCHAR bAttribute;
+ UCHAR bValue[1]; /* varies on bAttribute. */
+} UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC;
+typedef struct UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS_STRUCT
+{
+ UCHAR bStatusType;
+ UCHAR bOriginator;
+ UCHAR bEvent;
+ UCHAR bValue[1]; /* varies on bEvent. */
+} UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS;
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_OFFSET 0
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_VC 1
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_TYPE_VS 2
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_ORIGINATOR_OFFSET 1
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_EVENT_OFFSET 2
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_SELECTOR_OFFSET 3
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_ATTRIBUTE_OFFSET 4
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VC_VALUE_OFFSET 5
+#define UX_DEVICE_CLASS_VIDEO_STATUS_PACKET_VS_VALUE_OFFSET 3
+
+
+/* Define Video Class Payload Header structs and definitions. */
+typedef struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_STRUCT
+{
+ UCHAR bHeaderLength;
+ union UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_UNION {
+ UCHAR value;
+ struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_STRUCT {
+ UCHAR bFID:1; /* Frame ID. */
+ UCHAR bEOF:1; /* End of Frame. */
+ UCHAR bPTS:1; /* Presentation Time. */
+ UCHAR bSCR:1; /* Source Clock Reference. */
+ UCHAR bRES:1; /* Reserved, Payload Specific. */
+ UCHAR bSTI:1; /* Still Image. */
+ UCHAR bERR:1; /* Error. */
+ UCHAR bEOH:1; /* End of Header. */
+ } bm;
+ } bmHeaderInfo;
+ UCHAR dwPresentationTime[4];
+ union UX_DEVICE_CLASS_VIDEO_PAYLOAD_SCR_UNION {
+ UCHAR byte_array[6];
+ struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_SCR_STRUCT {
+ UCHAR STC[4]; /* SourceTimeClock. */
+ USHORT SCR; /* 1KHz SOF token counter. */
+ } bm;
+ } scrSourceClock;
+} UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER;
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_LENGTH_OFFSET 0
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_INFO_OFFSET 1
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_PRESENTATION_TIME_OFFSET 4
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_PTS_OFFSET 4
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_SCR_SOURCE_CLOCK_OFFSET 6
+#define UX_DEVICE_CLASS_VIDEO_PAYLOAD_HEADER_SCR_OFFSET 6
+
+
+/* Define Video Class specific request codes. */
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_CODE_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_RC_UNDEFINED 0x00
+#define UX_DEVICE_CLASS_VIDEO_SET_CUR 0x01
+#define UX_DEVICE_CLASS_VIDEO_GET_CUR 0x81
+#define UX_DEVICE_CLASS_VIDEO_GET_MIN 0x82
+#define UX_DEVICE_CLASS_VIDEO_GET_MAX 0x83
+#define UX_DEVICE_CLASS_VIDEO_GET_RES 0x84
+#define UX_DEVICE_CLASS_VIDEO_GET_INFO 0x86
+#define UX_DEVICE_CLASS_VIDEO_GET_DEF 0x87
+#define UX_DEVICE_CLASS_VIDEO_GET_CUR_ALL 0x91
+#define UX_DEVICE_CLASS_VIDEO_GET_MIN_ALL 0x92
+#define UX_DEVICE_CLASS_VIDEO_GET_MAX_ALL 0x93
+#define UX_DEVICE_CLASS_VIDEO_GET_RES_ALL 0x94
+#define UX_DEVICE_CLASS_VIDEO_GET_GET_DEF_ALL 0x97
+
+
+/* Define Video Class Device Power Modes. */
+#define UX_DEVICE_CLASS_VIDEO_POWER_MODE_MASK 0x0Fu
+#define UX_DEVICE_CLASS_VIDEO_POWER_MODE_FULL 0x00u
+#define UX_DEVICE_CLASS_VIDEO_POWER_MODE_DEVICE_DEPENDENT 0x01u
+#define UX_DEVICE_CLASS_VIDEO_POWER_DEPENDENT_MODE_SUPPORTED 0x10u
+#define UX_DEVICE_CLASS_VIDEO_POWER_USES_USB 0x20u
+#define UX_DEVICE_CLASS_VIDEO_POWER_USES_BATTERY 0x40u
+#define UX_DEVICE_CLASS_VIDEO_POWER_USES_AC 0x80u
+
+
+/* Define Video Class Request Error Codes. */
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_NO_ERROR 0x00
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_NOT_READY 0x01
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_WRONG_STATE 0x02
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_POWER 0x03
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_OUT_OF_RANGE 0x04
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_INPUT 0x05
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_CONTROL 0x06
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_REQUEST 0x07
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_INVALID_VALUE_WITHIN_RANGE 0x08
+#define UX_DEVICE_CLASS_VIDEO_REQUEST_ERROR_CODE_UNKNOWN 0xFF
+
+
+/* Define Video Class Probe and Commit Controls */
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LENGTH_1_1 34
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LENGTH_1_5 48
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_HINT_OFFSET 0
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FORMAT_INDEX_OFFSET 2
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAME_INDEX_OFFSET 3
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAME_INTERVAL_OFFSET 4
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_KEY_FRAME_RATE_OFFSET 8
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_PFRAME_RAE_OFFSET 10
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_COMP_QUALITY_OFFSET 12
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_COMP_WINDOW_SIZE_OFFSET 14
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_DELAY_OFFSET 16
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_VIDEO_FRAME_SIZE_OFFSET 18
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_PAYLOAD_TRANSFER_SIZE_OFFSET 22
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_CLOCK_FREQUENCY_OFFSET 26
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_FRAMING_INFO_OFFSET 30
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_PREFERED_VERSION_OFFSET 31
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MIN_VERSION_OFFSET 32
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_VERSION_OFFSET 33
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_USAGE_OFFSET 34
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_BIT_DEPTH_LUMA_OFFSET 35
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_SETTINGS_OFFSET 36
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_MAX_NUMBER_OF_REF_FRAMES_PLUS1_OFFSET 37
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_RATE_CONTROL_MODES_OFFSET 38
+#define UX_DEVICE_CLASS_VIDEO_PROBE_COMMIT_LAYOUT_PER_STREAM_OFFSET 40
+
+
+/* Define Video Class Stream Error Codes. */
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_NO_ERROR 0
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_PROTECTED_CONTENT 1
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_INPUT_BUFFER_UNDERRUN 2
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_DATA_DISCONTINUITY 3
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_OUTPUT_BUFFER_UNDERRUN 4
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_OUTPUT_BUFFER_OVERRUN 5
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_FORMAT_CHANGE 6
+#define UX_DEVICE_CLASS_VIDEO_STREAM_ERROR_CODE_STILL_IMAGE_CAPTURE_ERROR 7
+
+
+/* Define Video Class callback structure. */
+
+struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT;
+struct UX_DEVICE_CLASS_VIDEO_STRUCT;
+
+typedef struct UX_DEVICE_CLASS_VIDEO_CALLBACKS_STRUCT
+{
+
+ VOID (*ux_slave_class_video_instance_activate)(VOID *);
+ VOID (*ux_slave_class_video_instance_deactivate)(VOID *);
+ UINT (*ux_device_class_video_request)(struct UX_DEVICE_CLASS_VIDEO_STRUCT *, UX_SLAVE_TRANSFER *);
+ VOID *ux_device_class_video_arg;
+} UX_DEVICE_CLASS_VIDEO_CALLBACKS;
+
+typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS_STRUCT
+{
+ VOID (*ux_device_class_video_stream_change)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, ULONG);
+ UINT (*ux_device_class_video_stream_request)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, UX_SLAVE_TRANSFER *);
+ VOID (*ux_device_class_video_stream_payload_done)(struct UX_DEVICE_CLASS_VIDEO_STREAM_STRUCT *, ULONG);
+} UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS;
+
+
+/* Define Video Class Calling Parameter structure */
+
+typedef struct UX_DEVICE_CLASS_VIDEO_PAYLOAD_STRUCT
+{
+
+ ULONG ux_device_class_video_payload_length;
+ UCHAR ux_device_class_video_payload_data[4]; /* Actually size of length. */
+} UX_DEVICE_CLASS_VIDEO_PAYLOAD;
+
+typedef struct UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER_STRUCT
+{
+ ULONG ux_device_class_video_stream_parameter_thread_stack_size;
+ VOID (*ux_device_class_video_stream_parameter_thread_entry)(ULONG id);
+ UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS ux_device_class_video_stream_parameter_callbacks;
+
+ ULONG ux_device_class_video_stream_parameter_max_payload_buffer_size;
+ ULONG ux_device_class_video_stream_parameter_max_payload_buffer_nb;
+} UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER;
+
+typedef struct UX_DEVICE_CLASS_VIDEO_PARAMETER_STRUCT
+{
+ ULONG ux_device_class_video_parameter_master_interface;
+ UX_DEVICE_CLASS_VIDEO_CALLBACKS ux_device_class_video_parameter_callbacks;
+
+ ULONG ux_device_class_video_parameter_streams_nb;
+ UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER *ux_device_class_video_parameter_streams;
+} UX_DEVICE_CLASS_VIDEO_PARAMETER;
+
+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;
+
+ ULONG ux_device_class_video_stream_error;
+
+ UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS ux_device_class_video_stream_callbacks;
+
+#if !defined(UX_DEVICE_STANDALONE)
+ UCHAR *ux_device_class_video_stream_thread_stack;
+ UX_THREAD ux_device_class_video_stream_thread;
+#endif
+
+ UCHAR *ux_device_class_video_stream_buffer;
+ ULONG ux_device_class_video_stream_buffer_size;
+ ULONG ux_device_class_video_stream_payload_buffer_size;
+
+ UX_DEVICE_CLASS_VIDEO_PAYLOAD *ux_device_class_video_stream_transfer_pos;
+ UX_DEVICE_CLASS_VIDEO_PAYLOAD *ux_device_class_video_stream_access_pos;
+} UX_DEVICE_CLASS_VIDEO_STREAM;
+#define _ux_device_class_video_stream_error_set(s,e) do { \
+ (s)->ux_device_class_video_stream_error = (e); \
+} while(0)
+
+typedef struct UX_DEVICE_CLASS_VIDEO_STRUCT
+{
+
+ UX_SLAVE_CLASS *ux_device_class_video_class;
+ UX_SLAVE_DEVICE *ux_device_class_video_device;
+ UX_SLAVE_INTERFACE *ux_device_class_video_interface;
+
+ ULONG ux_device_class_video_error;
+
+ UX_DEVICE_CLASS_VIDEO_CALLBACKS ux_device_class_video_callbacks;
+
+ ULONG ux_device_class_video_streams_nb;
+ UX_DEVICE_CLASS_VIDEO_STREAM *ux_device_class_video_streams;
+
+} UX_DEVICE_CLASS_VIDEO;
+#define _ux_device_class_video_request_error_set(v,e) do { \
+ (v)->ux_device_class_video_error = (e); \
+} while(0)
+
+
+/* Define Video Class function prototypes. */
+
+UINT _ux_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_video_uninitialize(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_video_activate(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_video_change(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_video_deactivate(UX_SLAVE_CLASS_COMMAND *command);
+UINT _ux_device_class_video_control_request(UX_SLAVE_CLASS_COMMAND *command);
+
+UINT _ux_device_class_video_entry(UX_SLAVE_CLASS_COMMAND *command);
+
+UINT _ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function,
+ VOID *parameter);
+
+UINT _ux_device_class_video_stream_get(UX_DEVICE_CLASS_VIDEO *video, ULONG stream_index, UX_DEVICE_CLASS_VIDEO_STREAM **stream);
+
+VOID _ux_device_class_video_write_thread_entry(ULONG video_stream);
+VOID _ux_device_class_video_read_thread_entry(ULONG video_stream);
+
+ULONG _ux_device_class_video_max_payload_length(UX_DEVICE_CLASS_VIDEO_STREAM *video);
+
+UINT _ux_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
+
+UINT _ux_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **payload_data, ULONG *payload_length);
+UINT _ux_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *video);
+
+UINT _ux_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *video);
+
+UINT _ux_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *video, UCHAR **buffer, ULONG *max_length);
+UINT _ux_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *video, ULONG length);
+
+
+/* Define Video Class API prototypes. */
+
+#define ux_device_class_video_entry _ux_device_class_video_entry
+
+#define ux_device_class_video_read_thread_entry _ux_device_class_video_read_thread_entry
+#define ux_device_class_video_write_thread_entry _ux_device_class_video_write_thread_entry
+
+#define ux_device_class_video_request_error_set _ux_device_class_video_request_error_set
+#define ux_device_class_video_stream_error_set _ux_device_class_video_stream_error_set
+
+#define ux_device_class_video_stream_get _ux_device_class_video_stream_get
+
+#define ux_device_class_video_max_payload_length _ux_device_class_video_max_payload_length
+
+#define ux_device_class_video_reception_start _ux_device_class_video_reception_start
+
+#define ux_device_class_video_read_payload_get _ux_device_class_video_read_payload_get
+#define ux_device_class_video_read_payload_free _ux_device_class_video_read_payload_free
+
+#define ux_device_class_video_transmission_start _ux_device_class_video_transmission_start
+
+#define ux_device_class_video_write_payload_get _ux_device_class_video_write_payload_get
+#define ux_device_class_video_write_payload_commit _ux_device_class_video_write_payload_commit
+
+#define ux_device_class_video_ioctl _ux_device_class_video_ioctl
+
+
+/* Determine if a C++ compiler is being used. If so, complete the standard
+ C conditional started above. */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/usbx_device_classes/src/ux_device_class_audio10_control_process.c b/common/usbx_device_classes/src/ux_device_class_audio10_control_process.c
index f8091ba..d2d9190 100644
--- a/common/usbx_device_classes/src/ux_device_class_audio10_control_process.c
+++ b/common/usbx_device_classes/src/ux_device_class_audio10_control_process.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_audio10_control_process PORTABLE C */
-/* 6.1.6 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
/* 04-02-2021 Chaoqiong Xiao Modified comment(s), */
/* added volume RES support, */
/* resulting in version 6.1.6 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_audio10_control_process(UX_DEVICE_CLASS_AUDIO *audio,
@@ -221,6 +224,7 @@ ULONG i;
default:
break;
}
+ break;
default:
break;
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 aff9cdc..c2389e3 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added feedback support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_audio_change(UX_SLAVE_CLASS_COMMAND *command)
@@ -126,9 +129,16 @@ ULONG endpoint_dir;
endpoint = interface -> ux_slave_interface_first_endpoint;
/* Parse all endpoints. */
+#if defined(UX_DEVICE_STANDALONE)
+
+ /* Standalone mode not supported. */
+ endpoint_dir = 0;
+#else
+
endpoint_dir = (stream -> ux_device_class_audio_stream_thread.tx_thread_entry ==
_ux_device_class_audio_read_thread_entry) ?
UX_ENDPOINT_OUT : UX_ENDPOINT_IN;
+#endif
stream -> ux_device_class_audio_stream_endpoint = UX_NULL;
#if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT)
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 97e9df5..88e6fef 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,10 +77,17 @@
/* refined macros names, */
/* added feedback support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_audio_initialize(UX_SLAVE_CLASS_COMMAND *command)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UINT status = UX_SUCCESS;
UX_DEVICE_CLASS_AUDIO *audio;
@@ -286,4 +293,5 @@ ULONG i;
_ux_utility_memory_free(audio);
return(status);
+#endif
}
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 c9df828..ca1da22 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* added feedback support, */
/* fixed stream uninitialize, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_audio_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -97,15 +100,17 @@ ULONG i;
stream = (UX_DEVICE_CLASS_AUDIO_STREAM *)((UCHAR *)audio + sizeof(UX_DEVICE_CLASS_AUDIO));
for (i = 0; i < audio -> ux_device_class_audio_streams_nb; i ++)
{
+#if !defined(UX_DEVICE_STANDALONE)
_ux_device_thread_delete(&stream -> ux_device_class_audio_stream_thread);
#if defined(UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT)
if (stream -> ux_device_class_audio_stream_feedback_thread_stack)
{
- _ux_utility_thread_delete(&stream -> ux_device_class_audio_stream_feedback_thread);
+ _ux_device_thread_delete(&stream -> ux_device_class_audio_stream_feedback_thread);
_ux_utility_memory_free(stream -> ux_device_class_audio_stream_feedback_thread_stack);
}
#endif
_ux_utility_memory_free(stream -> ux_device_class_audio_stream_thread_stack);
+#endif
_ux_utility_memory_free(stream -> ux_device_class_audio_stream_buffer);
/* Next stream instance. */
diff --git a/common/usbx_device_classes/src/ux_device_class_audio_write_frame_commit.c b/common/usbx_device_classes/src/ux_device_class_audio_write_frame_commit.c
index 90ff1ff..f772e0f 100644
--- a/common/usbx_device_classes/src/ux_device_class_audio_write_frame_commit.c
+++ b/common/usbx_device_classes/src/ux_device_class_audio_write_frame_commit.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_audio_write_frame_commit PORTABLE C */
-/* 6.X */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
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
new file mode 100644
index 0000000..096efec
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_activate.c
@@ -0,0 +1,155 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_activate PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function activates the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to ccid command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Device CCID */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_activate(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_SLAVE_INTERFACE *interface;
+UX_DEVICE_CLASS_CCID *ccid;
+UX_SLAVE_CLASS *ccid_class;
+UX_SLAVE_ENDPOINT *endpoint;
+ULONG endpoint_type;
+UINT i;
+
+ /* Get the class container. */
+ ccid_class = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ ccid = (UX_DEVICE_CLASS_CCID *) ccid_class -> ux_slave_class_instance;
+
+ /* Get the interface that owns this instance. */
+ interface = (UX_SLAVE_INTERFACE *) command -> ux_slave_class_command_interface;
+
+ /* Store the class instance into the interface. */
+ interface -> ux_slave_interface_class_instance = (VOID *)ccid;
+
+ /* Now the opposite, store the interface in the class instance. */
+ ccid -> ux_device_class_ccid_interface = interface;
+
+ /* Save endpoints. */
+ ccid -> ux_device_class_ccid_endpoint_notify = UX_NULL;
+ endpoint = interface -> ux_slave_interface_first_endpoint;
+ while(endpoint)
+ {
+ endpoint_type = endpoint -> ux_slave_endpoint_descriptor.bmAttributes;
+ endpoint_type &= UX_MASK_ENDPOINT_TYPE;
+ if (endpoint_type == UX_INTERRUPT_ENDPOINT)
+ {
+ ccid -> ux_device_class_ccid_endpoint_notify = endpoint;
+ }
+ if (endpoint_type == UX_BULK_ENDPOINT)
+ {
+ if (endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_IN)
+ ccid -> ux_device_class_ccid_endpoint_in = endpoint;
+ else
+ ccid -> ux_device_class_ccid_endpoint_out = endpoint;
+ }
+ endpoint = endpoint -> ux_slave_endpoint_next_endpoint;
+ }
+
+ /* Initialize slots. */
+ for (i = 0;
+ i < ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots;
+ i ++)
+ {
+ ccid -> ux_device_class_ccid_slots[i].ux_device_class_ccid_slot_runner = -1;
+ ccid -> ux_device_class_ccid_slots[i].ux_device_class_ccid_slot_icc_status =
+ UX_DEVICE_CLASS_CCID_ICC_NOT_PRESENT;
+ }
+
+ /* Activate thread for Bulk-OUT command messages. */
+ _ux_device_thread_resume(&ccid -> ux_device_class_ccid_thread);
+
+ /* Activate thread for Interrupt-IN notification messages. */
+ _ux_device_thread_resume(&ccid -> ux_device_class_ccid_notify_thread);
+
+ /* Activate threads for runners. */
+ for (i = 0;
+ i < ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_busy_slots;
+ i ++)
+ {
+ _ux_device_thread_resume(&ccid -> ux_device_class_ccid_runners[i].
+ ux_device_class_ccid_runner_thread);
+ }
+
+ /* If there is a activate function call it. */
+ if (ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_instance_activate != UX_NULL)
+ {
+
+ /* Invoke the application callback. */
+ ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_instance_activate(ccid);
+ }
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_CCID_ACTIVATE, ccid, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
+
+ /* If trace is enabled, register this object. */
+ UX_TRACE_OBJECT_REGISTER(UX_TRACE_DEVICE_OBJECT_TYPE_INTERFACE, ccid, 0, 0, 0)
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..8874092
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_done.c
@@ -0,0 +1,100 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_auto_seq_done PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function indicates card auto sequencing done of the USB CCID */
+/* device. */
+/* */
+/* Note it must be used after _icc_insert with seq_start TRUE. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot inserted */
+/* icc_status Final card status */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_auto_seq_done(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG icc_status)
+{
+
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+
+ /* Sanity check. */
+ if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Get slot instance. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Lock states. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Check sequencing. */
+ if (ccid_slot -> ux_device_class_ccid_slot_flags & UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING)
+ {
+ ccid_slot -> ux_device_class_ccid_slot_icc_status = (UCHAR)icc_status;
+ ccid_slot -> ux_device_class_ccid_slot_flags &= (UCHAR)~UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING;
+ }
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return transfer status. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_start.c b/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_start.c
new file mode 100644
index 0000000..62d23a1
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_auto_seq_start.c
@@ -0,0 +1,92 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_auto_seq_start PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function indicates auto sequence start of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot inserted */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_auto_seq_start(UX_DEVICE_CLASS_CCID *ccid, ULONG slot)
+{
+
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+
+ /* Sanity check. */
+ if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Get slot instance. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Lock states. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Set state of auto sequencing. */
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING;
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return transfer status. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_control_abort.c b/common/usbx_device_classes/src/ux_device_class_ccid_control_abort.c
new file mode 100644
index 0000000..cec17e5
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_control_abort.c
@@ -0,0 +1,141 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_control_abort PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function handles control request Abort of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot to abort */
+/* seq Sequence number of message */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_control_abort(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq)
+{
+
+UX_DEVICE_CLASS_CCID_PARAMETER *parameter;
+UX_DEVICE_CLASS_CCID_HANDLES *handles;
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+UX_SLAVE_TRANSFER *transfer_in, *transfer_out;
+UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *msg;
+
+ /* Get parameter. */
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+ handles = parameter -> ux_device_class_ccid_handles;
+
+ /* Check if slot is available. */
+ if (slot >= parameter -> ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Check if command is supported. */
+ if (handles -> ux_device_class_ccid_handles_abort == UX_NULL)
+ return(UX_FUNCTION_NOT_SUPPORTED);
+
+ /* Get slot to process. */
+ ccid_slot = &ccid -> ux_device_class_ccid_slots[slot];
+
+ /* Check if message header received. */
+ transfer_out = &ccid -> ux_device_class_ccid_endpoint_out ->
+ ux_slave_endpoint_transfer_request;
+ if (transfer_out -> ux_slave_transfer_request_actual_length <
+ UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH)
+ {
+
+ /* Message header not available, cancel current bulk OUT transfer. */
+ _ux_device_stack_transfer_abort(transfer_out, UX_ABORTED);
+ }
+ else
+ {
+
+ /* Message header available, check message. */
+ msg = (UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *)
+ transfer_out -> ux_slave_transfer_request_data_pointer;
+
+ /* Check if abort applies to the slot. */
+ if (msg -> bSlot == (UCHAR)slot)
+ {
+
+ /* Yes, aborting current message, cancel current bulk OUT transfer. */
+ _ux_device_stack_transfer_abort(transfer_out, UX_ABORTED);
+ }
+ else
+ {
+
+ /* Aborting another slot. */
+
+ /* Check slot busy. */
+ if ((signed char)ccid_slot -> ux_device_class_ccid_slot_runner >= 0)
+ {
+
+ /* Possible sending something, abort IN transfer. */
+ transfer_in = &ccid -> ux_device_class_ccid_endpoint_in ->
+ ux_slave_endpoint_transfer_request;
+ _ux_device_stack_transfer_abort(transfer_in, UX_ABORTED);
+ }
+ }
+ }
+
+ /* Set aborting state. */
+ ccid_slot -> ux_device_class_ccid_slot_aborting = UX_TRUE;
+ ccid_slot -> ux_device_class_ccid_slot_aborting_seq = (UCHAR)seq;
+
+ /* Invoke control abort to let application do something. */
+ handles -> ux_device_class_ccid_handles_abort(slot, UX_NULL);
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_control_request.c b/common/usbx_device_classes/src/ux_device_class_ccid_control_request.c
new file mode 100644
index 0000000..1cb5ff1
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_control_request.c
@@ -0,0 +1,167 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_control_request PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function manages the requests sent by the host on the control */
+/* endpoints with a CLASS or VENDOR SPECIFIC type. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid class */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_request Transfer request */
+/* _ux_device_class_ccid_request_abort Abort slot */
+/* _ux_utility_memory_copy Copy memory */
+/* */
+/* CALLED BY */
+/* */
+/* CCID Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_control_request(UX_SLAVE_CLASS_COMMAND *command)
+{
+UX_DEVICE_CLASS_CCID *ccid;
+UX_DEVICE_CLASS_CCID_PARAMETER *parameter;
+UX_SLAVE_CLASS *ccid_class;
+UX_SLAVE_TRANSFER *transfer_request;
+UX_SLAVE_DEVICE *device;
+ULONG request;
+UCHAR seq, slot;
+ULONG request_length;
+ULONG transmit_length;
+UCHAR *transmit_buffer;
+
+ /* Get the class container. */
+ ccid_class = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ ccid = (UX_DEVICE_CLASS_CCID *) ccid_class -> ux_slave_class_instance;
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* Get the pointer to the transfer request associated with the control endpoint. */
+ transfer_request = &device -> ux_slave_device_control_endpoint.ux_slave_endpoint_transfer_request;
+
+ /* Extract all necessary fields of the request. */
+ request = *(transfer_request -> ux_slave_transfer_request_setup + UX_SETUP_REQUEST);
+
+ /* Pickup the request length. */
+ request_length = _ux_utility_short_get(transfer_request -> ux_slave_transfer_request_setup + UX_SETUP_LENGTH);
+
+ /* Here we proceed only the standard request we know of at the device level. */
+ switch (request)
+ {
+
+ case UX_DEVICE_CLASS_CCID_ABORT:
+ slot = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_VALUE];
+ seq = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_VALUE + 1];
+ return _ux_device_class_ccid_control_abort(ccid, slot, seq);
+
+ case UX_DEVICE_CLASS_CCID_GET_CLOCK_FREQUENCIES:
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+
+ /* Check bNumClockSuppored. */
+ if (parameter -> ux_device_class_ccid_clocks == UX_NULL ||
+ parameter -> ux_device_class_ccid_n_clocks == 0)
+ return(UX_ERROR);
+
+ /* Calculate transmit length. */
+ transmit_length = parameter -> ux_device_class_ccid_n_clocks;
+ if (UX_OVERFLOW_CHECK_MULC_ULONG(transmit_length, 4))
+ return(UX_ERROR);
+ transmit_length <<= 2;
+
+ /* Update transmit buffer. */
+ transmit_buffer = (UCHAR *)parameter -> ux_device_class_ccid_clocks;
+ break;
+
+ case UX_DEVICE_CLASS_CCID_GET_DATA_RATES:
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+
+ /* Check bNumDataRateSuppored. */
+ if (parameter -> ux_device_class_ccid_data_rates == UX_NULL ||
+ parameter -> ux_device_class_ccid_n_data_rates == 0)
+ return(UX_ERROR);
+
+ /* Calculate transmit length. */
+ transmit_length = parameter -> ux_device_class_ccid_n_data_rates;
+ if (UX_OVERFLOW_CHECK_MULC_ULONG(transmit_length, 4))
+ return(UX_ERROR);
+ transmit_length <<= 2;
+
+ /* Update transmit buffer. */
+ transmit_buffer = (UCHAR *)parameter -> ux_device_class_ccid_data_rates;
+ break ;
+
+ default:
+
+ /* Unknown function. It's not handled. */
+ return(UX_ERROR);
+ }
+
+ /* Limit transmit length. */
+ transmit_length = UX_MIN(transmit_length, UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH);
+ transmit_length = UX_MIN(transmit_length, request_length);
+
+ /* Copy data to transmit. */
+ _ux_utility_memory_copy(transfer_request -> ux_slave_transfer_request_data_pointer,
+ transmit_buffer, transmit_length); /* Use case of memcpy is verified. */
+
+ /* Transmit. */
+ _ux_device_stack_transfer_request(transfer_request, transmit_length, request_length);
+
+ /* It's handled. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_deactivate.c b/common/usbx_device_classes/src/ux_device_class_ccid_deactivate.c
new file mode 100644
index 0000000..1adbfd1
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_deactivate.c
@@ -0,0 +1,110 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_deactivate PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function deactivate an instance of the ccid class. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to a class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_all_request_abort */
+/* Abort all transfers */
+/* */
+/* CALLED BY */
+/* */
+/* CCID Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_deactivate(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_DEVICE_CLASS_CCID *ccid;
+UX_SLAVE_CLASS *ccid_class;
+UX_SLAVE_ENDPOINT *endpoint;
+
+ /* Get the class container. */
+ ccid_class = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ ccid = (UX_DEVICE_CLASS_CCID *) ccid_class -> ux_slave_class_instance;
+
+ /* Terminate the transactions pending on the endpoints. */
+ endpoint = ccid -> ux_device_class_ccid_endpoint_out;
+ _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET);
+
+ endpoint = ccid -> ux_device_class_ccid_endpoint_in;
+ _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET);
+
+ endpoint = ccid -> ux_device_class_ccid_endpoint_notify;
+ if (endpoint)
+ _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET);
+
+ /* If there is a deactivate function call it. */
+ if (ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_instance_deactivate != UX_NULL)
+ {
+
+ /* Invoke the application. */
+ ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_instance_deactivate(ccid);
+ }
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_DEVICE_CLASS_CCID_DEACTIVATE, ccid, 0, 0, 0, UX_TRACE_DEVICE_CLASS_EVENTS, 0, 0)
+
+ /* If trace is enabled, register this object. */
+ UX_TRACE_OBJECT_UNREGISTER(ccid);
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_entry.c b/common/usbx_device_classes/src/ux_device_class_ccid_entry.c
new file mode 100644
index 0000000..e17602a
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_entry.c
@@ -0,0 +1,146 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is the entry point of the device CCID class. It */
+/* will be called by the device stack enumeration module when the */
+/* host has sent a SET_CONFIGURATION command and the ccid interface */
+/* needs to be mounted. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_class_ccid_initialize Initialize ccid class */
+/* _ux_device_class_ccid_uninitialize Uninitialize ccid class */
+/* _ux_device_class_ccid_activate Activate ccid class */
+/* _ux_device_class_ccid_deactivate Deactivate ccid class */
+/* _ux_device_class_ccid_control_request Request control */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Device Stack */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_entry(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UINT status;
+
+
+ /* The command request will tell us we need to do here, either a enumeration
+ query, an activation or a deactivation. */
+ switch (command -> ux_slave_class_command_request)
+ {
+
+ case UX_SLAVE_CLASS_COMMAND_INITIALIZE:
+
+ /* Call the init function of the CCID class. */
+ status = _ux_device_class_ccid_initialize(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
+
+ /* Call the init function of the CCID class. */
+ status = _ux_device_class_ccid_uninitialize(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_QUERY:
+
+ /* Check the CLASS definition in the interface descriptor. */
+ if (command -> ux_slave_class_command_class == UX_DEVICE_CLASS_CCID_CLASS)
+ return(UX_SUCCESS);
+ else
+ return(UX_NO_CLASS_MATCH);
+
+ case UX_SLAVE_CLASS_COMMAND_ACTIVATE:
+
+ /* The activate command is used when the host has sent a SET_CONFIGURATION command
+ and this interface has to be mounted. Both Bulk endpoints have to be mounted
+ and the ccid thread needs to be activated. */
+ status = _ux_device_class_ccid_activate(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_DEACTIVATE:
+
+ /* The deactivate command is used when the device has been extracted.
+ The device endpoints have to be dismounted and the ccid thread canceled. */
+ status = _ux_device_class_ccid_deactivate(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_REQUEST:
+
+ /* The request command is used when the host sends a command on the control endpoint. */
+ status = _ux_device_class_ccid_control_request(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ default:
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_FUNCTION_NOT_SUPPORTED, 0, 0, 0, UX_TRACE_ERRORS, 0, 0)
+
+ /* Return an error. */
+ return(UX_FUNCTION_NOT_SUPPORTED);
+ }
+}
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
new file mode 100644
index 0000000..680df28
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_hardware_error.c
@@ -0,0 +1,133 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_hardware_error PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function indicates hardware error of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot inserted */
+/* error Error code */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_hardware_error(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG error)
+{
+
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+UX_DEVICE_CLASS_CCID_RUNNER *runner;
+UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *rsp;
+
+ /* Sanity check. */
+ if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Get slot instance. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Lock states. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Check error. */
+ if (!(ccid_slot -> ux_device_class_ccid_slot_flags & UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR))
+ {
+
+ /* Save error and error code. */
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR;
+ ccid_slot -> ux_device_class_ccid_slot_hw_error = (UCHAR)error;
+ ccid_slot -> ux_device_class_ccid_slot_hw_error_seq = 0;
+
+ /* Slot deactivated. */
+ ccid_slot -> ux_device_class_ccid_slot_icc_status = UX_DEVICE_CLASS_CCID_ICC_INACTIVE;
+
+ /* Check if command is pending, update response buffer. */
+ if ((signed char)ccid_slot -> ux_device_class_ccid_slot_runner >= 0)
+ {
+
+ /* Get running things. */
+ runner = ccid -> ux_device_class_ccid_runners;
+ runner += ccid_slot -> ux_device_class_ccid_slot_runner;
+ rsp = (UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *)
+ runner -> ux_device_class_ccid_runner_response;
+
+ /* Response: (1,1,HW_ERROR). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(1, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_HW_ERROR;
+ }
+ }
+
+ /* Notify if interrupt endpoint exists. */
+ if (ccid -> ux_device_class_ccid_endpoint_notify)
+ {
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE;
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Wakeup interrupt notification. */
+ _ux_device_semaphore_put(&ccid -> ux_device_class_ccid_notify_semaphore);
+ return(UX_SUCCESS);
+ }
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return transfer status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..4c9de6b
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_icc_insert.c
@@ -0,0 +1,120 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_icc_insert PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function indicates card insertion of the USB CCID device. */
+/* */
+/* Note if seq_start is TRUE, application must invoke _auto_seq_done */
+/* later to indicate the sequence end, with final card status. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot inserted */
+/* seq_start Auto activation sequence on */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_icc_insert(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG seq_start)
+{
+
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+
+ /* Sanity check. */
+ if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Get slot instance. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Lock states. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return success if already card inserted. */
+ if (ccid_slot -> ux_device_class_ccid_slot_icc_status != UX_DEVICE_CLASS_CCID_ICC_NOT_PRESENT)
+ {
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ return(UX_SUCCESS);
+ }
+
+ /* Update card status (INACTIVE). */
+ ccid_slot -> ux_device_class_ccid_slot_icc_status = UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_INACTIVE;
+
+ /* Auto sequencing started? */
+ if (seq_start)
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING;
+
+ /* Notify if interrupt endpoint exists. */
+ if (ccid -> ux_device_class_ccid_endpoint_notify)
+ {
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE;
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Wakeup interrupt notification. */
+ _ux_device_semaphore_put(&ccid -> ux_device_class_ccid_notify_semaphore);
+ return(UX_SUCCESS);
+ }
+
+ /* Unlock states. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return transfer status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..89f9234
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_icc_remove.c
@@ -0,0 +1,113 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_icc_remove PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function indicates card removal of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot removed */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_icc_remove(UX_DEVICE_CLASS_CCID *ccid, ULONG slot)
+{
+
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+
+ /* Sanity check. */
+ if (slot >= ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_slots)
+ return(UX_INVALID_PARAMETER);
+
+ /* Get slot instance. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Lock states. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return success if already card removed. */
+ if (ccid_slot -> ux_device_class_ccid_slot_icc_status == UX_DEVICE_CLASS_CCID_ICC_NOT_PRESENT)
+ {
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ return(UX_SUCCESS);
+ }
+
+ /* Update card status (NOT_PRESENT). */
+ ccid_slot -> ux_device_class_ccid_slot_icc_status = UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_NOT_PRESENT;
+
+ /* Clear sequencing. */
+ ccid_slot -> ux_device_class_ccid_slot_flags &= (UCHAR)~UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING;
+
+ /* Clear errors. */
+ ccid_slot -> ux_device_class_ccid_slot_hw_error = 0;
+ ccid_slot -> ux_device_class_ccid_slot_flags &= (UCHAR)~UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR;
+
+ /* Notify if interrupt endpoint exists. */
+ if (ccid -> ux_device_class_ccid_endpoint_notify)
+ {
+ ccid_slot -> ux_device_class_ccid_slot_flags |= UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE;
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ _ux_device_semaphore_put(&ccid -> ux_device_class_ccid_notify_semaphore);
+ return(UX_SUCCESS);
+ }
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Return transfer status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..b816148
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_initialize.c
@@ -0,0 +1,439 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_initialize PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function initializes the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to ccid command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_memory_allocate Allocate memory */
+/* _ux_utility_memory_free Free memory */
+/* _ux_utility_semaphore_create Create semaphore */
+/* _ux_utility_semaphore_delete Delete semaphore */
+/* _ux_utility_mutex_create Create mutex */
+/* _ux_device_mutex_delete Delete mutex */
+/* _ux_utility_thread_create Create thread */
+/* _ux_utility_thread_delete Delete thread */
+/* _ux_utility_event_flags_create Create event flags */
+/* _ux_utility_event_flags_delete Delete event flags */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_initialize(UX_SLAVE_CLASS_COMMAND *command)
+{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+UX_DEVICE_CLASS_CCID *ccid;
+UX_DEVICE_CLASS_CCID_RUNNER *runner;
+UX_DEVICE_CLASS_CCID_SLOT *slot;
+UX_DEVICE_CLASS_CCID_PARAMETER *ccid_parameter;
+UX_SLAVE_CLASS *ccid_class;
+UINT status;
+ULONG memory_size;
+ULONG ccid_size, runners_size, slots_size;
+ULONG buffer_size, buffers_size;
+ULONG stacks_size;
+UCHAR *memory;
+ULONG i;
+
+ /* Get the class container. */
+ ccid_class = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the pointer to the application parameters for the ccid class. */
+ ccid_parameter = command -> ux_slave_class_command_parameter;
+
+ /* Sanity check for parameters.
+ - number slots < 32
+ - number busy <= number slots
+ - message length < max request buffer size
+ */
+ UX_ASSERT(ccid_parameter -> ux_device_class_ccid_max_n_slots <= UX_DEVICE_CLASS_CCID_MAX_N_SLOTS);
+ UX_ASSERT(ccid_parameter -> ux_device_class_ccid_max_n_busy_slots != 0);
+ UX_ASSERT(ccid_parameter -> ux_device_class_ccid_max_n_busy_slots <=
+ ccid_parameter -> ux_device_class_ccid_max_n_slots)
+ UX_ASSERT(ccid_parameter -> ux_device_class_ccid_max_transfer_length <=
+ UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
+ UX_ASSERT(ccid_parameter->ux_device_class_ccid_handles != UX_NULL);
+
+ /* Calculate size for instance (structures already aligned). */
+ /* Max n_slots 32, considering struct size, no overflow case. */
+ ccid_size = sizeof(UX_DEVICE_CLASS_CCID);
+ memory_size = ccid_size;
+
+ runners_size = sizeof(UX_DEVICE_CLASS_CCID_RUNNER);
+ runners_size *= ccid_parameter->ux_device_class_ccid_max_n_busy_slots;
+ memory_size += runners_size;
+
+ slots_size = sizeof(UX_DEVICE_CLASS_CCID_SLOT);
+ slots_size *= ccid_parameter->ux_device_class_ccid_max_n_slots;
+ memory_size += slots_size;
+
+ buffer_size = ccid_parameter->ux_device_class_ccid_max_transfer_length;
+ buffer_size += 3u;
+ buffer_size &= ~3u;
+ ccid_parameter->ux_device_class_ccid_max_transfer_length = buffer_size;
+ if (UX_OVERFLOW_CHECK_MULC_ULONG(buffer_size, 2))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ buffers_size = (buffer_size << 1) & 0xFFFFFFFFu;
+ if (UX_OVERFLOW_CHECK_MULV_ULONG(buffers_size, ccid_parameter->ux_device_class_ccid_max_n_busy_slots))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ buffers_size = (buffers_size * ccid_parameter->ux_device_class_ccid_max_n_busy_slots) & 0xFFFFFFFFu;
+ if (UX_OVERFLOW_CHECK_ADD_ULONG(memory_size, buffer_size))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ memory_size = (memory_size + buffers_size) & 0xFFFFFFFFu;
+
+ stacks_size = ccid_parameter->ux_device_class_ccid_max_n_busy_slots;
+ if (UX_OVERFLOW_CHECK_MULC_ULONG(stacks_size, UX_DEVICE_CLASS_CCID_RUNNER_THREAD_STACK_SIZE))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ stacks_size *= UX_DEVICE_CLASS_CCID_RUNNER_THREAD_STACK_SIZE;
+ if (UX_OVERFLOW_CHECK_ADD_ULONG(stacks_size, UX_DEVICE_CLASS_CCID_THREAD_STACK_SIZE))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ stacks_size += UX_DEVICE_CLASS_CCID_THREAD_STACK_SIZE;
+ if (UX_OVERFLOW_CHECK_ADD_ULONG(stacks_size, UX_DEVICE_CLASS_CCID_NOTIFY_THREAD_STACK_SIZE))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ stacks_size += UX_DEVICE_CLASS_CCID_NOTIFY_THREAD_STACK_SIZE;
+ if (UX_OVERFLOW_CHECK_ADD_ULONG(memory_size, stacks_size))
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_ERROR);
+ return(UX_ERROR);
+ }
+ memory_size = (memory_size + stacks_size) & 0xFFFFFFFFu;
+
+ /* Allocate memory for instance and other resources of the device ccid class. */
+ memory = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size);
+
+ /* Check for successful allocation. */
+ if (memory == UX_NULL)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Create and save resources for ccid, runners, slots, buffers. */
+
+ /* CCID. */
+ ccid = (UX_DEVICE_CLASS_CCID *)memory;
+ memory += ccid_size;
+
+ /* CCID thread. */
+ status = _ux_utility_thread_create(
+ &ccid -> ux_device_class_ccid_thread,
+ "ux_device_class_ccid_thread",
+ _ux_device_class_ccid_thread_entry,
+ (ULONG) (ALIGN_TYPE) ccid,
+ (VOID *) memory,
+ UX_DEVICE_CLASS_CCID_THREAD_STACK_SIZE, UX_THREAD_PRIORITY_CLASS,
+ UX_THREAD_PRIORITY_CLASS, UX_NO_TIME_SLICE, UX_DONT_START);
+ if (status != UX_SUCCESS)
+ status = UX_THREAD_ERROR;
+ else
+ {
+ ccid -> ux_device_class_ccid_thread_stack = memory;
+ memory += UX_DEVICE_CLASS_CCID_THREAD_STACK_SIZE;
+ UX_THREAD_EXTENSION_PTR_SET(&(ccid -> ux_device_class_ccid_thread), ccid);
+ }
+
+ /* CCID Notify thread. */
+ if (status == UX_SUCCESS)
+ {
+ status = _ux_utility_thread_create(
+ &ccid -> ux_device_class_ccid_notify_thread,
+ "ux_device_class_ccid_notify_thread",
+ _ux_device_class_ccid_notify_thread_entry,
+ (ULONG) (ALIGN_TYPE) ccid,
+ (VOID *) memory,
+ UX_DEVICE_CLASS_CCID_NOTIFY_THREAD_STACK_SIZE, UX_THREAD_PRIORITY_CLASS,
+ UX_THREAD_PRIORITY_CLASS, UX_NO_TIME_SLICE, UX_DONT_START);
+ if (status != UX_SUCCESS)
+ status = UX_THREAD_ERROR;
+ else
+ {
+ ccid -> ux_device_class_ccid_notify_thread_stack = memory;
+ memory += UX_DEVICE_CLASS_CCID_NOTIFY_THREAD_STACK_SIZE;
+ UX_THREAD_EXTENSION_PTR_SET(&(ccid -> ux_device_class_ccid_notify_thread), ccid);
+ }
+ }
+
+ /* CCID runners. */
+ if (status == UX_SUCCESS)
+ {
+
+ ccid -> ux_device_class_ccid_runners = (UX_DEVICE_CLASS_CCID_RUNNER *)memory;
+ memory += runners_size;
+
+ runner = ccid -> ux_device_class_ccid_runners;
+ for (i = 0; i < ccid_parameter -> ux_device_class_ccid_max_n_busy_slots; i ++)
+ {
+
+ /* Save CCID for runner. */
+ runner -> ux_device_class_ccid_runner_ccid = ccid;
+
+ /* Save runner ID. */
+ runner -> ux_device_class_ccid_runner_id = (CHAR)i;
+
+ /* Runner is free. */
+ runner -> ux_device_class_ccid_runner_slot = -1;
+
+ /* Runner command buffer. */
+ runner -> ux_device_class_ccid_runner_command = memory;
+ memory += buffer_size;
+
+ /* Runner response buffer. */
+ runner -> ux_device_class_ccid_runner_response = memory;
+ memory += buffer_size;
+
+ /* CCID runners threads. */
+ status = _ux_utility_thread_create(
+ &runner -> ux_device_class_ccid_runner_thread,
+ "ux_device_class_ccid_runner_thread",
+ _ux_device_class_ccid_runner_thread_entry,
+ (ULONG) (ALIGN_TYPE) runner,
+ (VOID *)memory,
+ UX_DEVICE_CLASS_CCID_RUNNER_THREAD_STACK_SIZE, UX_THREAD_PRIORITY_CLASS,
+ UX_THREAD_PRIORITY_CLASS, UX_NO_TIME_SLICE, UX_DONT_START);
+ if (status != UX_SUCCESS)
+ {
+ status = UX_THREAD_ERROR;
+ break;
+ }
+ else
+ {
+ runner -> ux_device_class_ccid_runner_thread_stack = memory;
+ memory += UX_DEVICE_CLASS_CCID_RUNNER_THREAD_STACK_SIZE;
+ UX_THREAD_EXTENSION_PTR_SET(&(runner -> ux_device_class_ccid_runner_thread), runner);
+ }
+
+ /* Next runner. */
+ runner ++;
+ }
+ }
+
+ /* CCID slots. */
+ if (status == UX_SUCCESS)
+ {
+
+ ccid -> ux_device_class_ccid_slots = (UX_DEVICE_CLASS_CCID_SLOT *)memory;
+
+ slot = ccid -> ux_device_class_ccid_slots;
+ for (i = 0; i < ccid_parameter -> ux_device_class_ccid_max_n_slots; i ++)
+ {
+
+ /* Slot not busy. */
+ slot -> ux_device_class_ccid_slot_runner = -1;
+
+ /* Slot ICC no card. */
+ slot -> ux_device_class_ccid_slot_icc_status = UX_DEVICE_CLASS_CCID_ICC_NOT_PRESENT;
+
+ /* Next slot. */
+ slot ++;
+ }
+ }
+
+ /* CCID mutexes, semaphore and event flags. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Create Event Flags. */
+ status = _ux_utility_event_flags_create(&ccid -> ux_device_class_ccid_events,
+ "ux_device_class_ccid_events");
+ if (status == UX_SUCCESS)
+ {
+
+ /* Bulk IN mutex. */
+ status = _ux_utility_mutex_create(&ccid -> ux_device_class_ccid_response_mutex,
+ "ux_device_class_ccid_response_mutex");
+ if (status == UX_SUCCESS)
+ {
+
+ /* Interrupt IN semaphore. */
+ status = _ux_utility_semaphore_create(&ccid -> ux_device_class_ccid_notify_semaphore,
+ "ux_device_class_ccid_notify_semaphore", 0);
+ if (status == UX_SUCCESS)
+ {
+
+ /* Resource access Mutex. */
+ status = _ux_utility_mutex_create(&ccid -> ux_device_class_ccid_mutex,
+ "ux_device_class_ccid_mutex");
+ if (status != UX_SUCCESS)
+ status = UX_MUTEX_ERROR;
+
+ /* If there is error, allocated semaphore should be deleted. */
+ if (status != UX_SUCCESS)
+ _ux_utility_semaphore_delete(&ccid -> ux_device_class_ccid_notify_semaphore);
+ }
+ else
+ status = UX_MUTEX_ERROR;
+
+ /* If there is error, allocated mutex should be deleted. */
+ if (status != UX_SUCCESS)
+ _ux_device_mutex_delete(&ccid -> ux_device_class_ccid_response_mutex);
+ }
+ else
+ status = UX_MUTEX_ERROR;
+
+ /* If there is error, allocated event should be deleted. */
+ if (status != UX_SUCCESS)
+ _ux_utility_event_flags_delete(&ccid -> ux_device_class_ccid_events);
+ }
+ else
+ status = UX_EVENT_ERROR;
+ }
+
+ /* Success case. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Save the address of the CDC instance inside the CDC container. */
+ ccid_class -> ux_slave_class_instance = (VOID *) ccid;
+
+ /* Store parameters. */
+ _ux_utility_memory_copy(&ccid -> ux_device_class_ccid_parameter, ccid_parameter,
+ sizeof(UX_DEVICE_CLASS_CCID_PARAMETER)); /* Use case of memcpy is verified. */
+
+ /* Return success status. */
+ return(UX_SUCCESS);
+ }
+
+ /* Error cases. */
+
+ /* In this case, mutexes and events are not created or has been handled. */
+
+ /* Check thread states and free them. */
+ if (ccid -> ux_device_class_ccid_thread_stack)
+ _ux_utility_thread_delete(&ccid -> ux_device_class_ccid_thread);
+ for (i = 0; i < ccid_parameter -> ux_device_class_ccid_max_n_busy_slots; i ++)
+ {
+ runner = &ccid -> ux_device_class_ccid_runners[i];
+ if (runner -> ux_device_class_ccid_runner_thread_stack)
+ _ux_utility_thread_delete(&runner -> ux_device_class_ccid_runner_thread);
+ }
+ if (ccid -> ux_device_class_ccid_notify_thread_stack)
+ _ux_utility_thread_delete(&ccid -> ux_device_class_ccid_notify_thread);
+
+ /* Free the memory. */
+ _ux_utility_memory_free(ccid);
+
+ /* Return completion status. */
+ return(status);
+#endif
+}
+
+const UX_DEVICE_CLASS_CCID_COMMAND_SETT
+_ux_device_class_ccid_command_sett[UX_DEVICE_CLASS_CCID_N_COMMANDS + 1] =
+{
+ {0x62, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x62),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x62), 0},
+ {0x63, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x63),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x63), 1},
+ {0x65, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x65),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x65), 2},
+ {0x6F, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6F),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6F), 3},
+ {0x6C, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6C),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6C), 4},
+ {0x6D, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6D),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6D), 5},
+ {0x61, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x61),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x61), 6},
+ {0x6B, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6B),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6B), 7},
+ {0x6E, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6E),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6E), 8},
+ {0x6A, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x6A),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x6A), 9},
+ {0x69, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x69),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x69), 10},
+ {0x71, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x71),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x71), 11},
+ {0x72, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x72),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x72), 12},
+ {0x73, UX_DEVICE_CLASS_CCID_COMMAND_RESP_TYPE(0x73),
+ UX_DEVICE_CLASS_CCID_COMMAND_FLAGS(0x73), 13},
+ {0, 0, 0, -1}, /* Command not supported. */
+};
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_notify_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_ccid_notify_thread_entry.c
new file mode 100644
index 0000000..32a740c
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_notify_thread_entry.c
@@ -0,0 +1,227 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+
+#if !defined(UX_DEVICE_STANDALONE)
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_notify_thread_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is the thread of the CCID interrupt IN endpoint. It */
+/* is waiting for the application event to start interrupt IN. */
+/* */
+/* INPUT */
+/* */
+/* ccid_inst Address of ccid class */
+/* container (32-bit) */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_request Request transfer */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+VOID _ux_device_class_ccid_notify_thread_entry(ULONG ccid_inst)
+{
+
+UX_SLAVE_DEVICE *device;
+UX_DEVICE_CLASS_CCID *ccid;
+UX_DEVICE_CLASS_CCID_SLOT *slot;
+UX_DEVICE_CLASS_CCID_PARAMETER *parameter;
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer;
+UCHAR *buffer;
+ULONG length;
+INT i;
+UCHAR icc_mask;
+UINT byte_pos, bits_pos;
+UINT status;
+
+ /* Cast properly the ccid instance. */
+ UX_THREAD_EXTENSION_PTR_GET(ccid, UX_DEVICE_CLASS_CCID, ccid_inst)
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* This thread runs forever but can be suspended or resumed by the user application. */
+ status = UX_SUCCESS;
+ while(1)
+ {
+
+ /* Error cases. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* We need to suspend ourselves. We will be resumed by the
+ application if needed. */
+ _ux_utility_thread_suspend(&ccid -> ux_device_class_ccid_notify_thread);
+ status = UX_SUCCESS;
+ continue;
+ }
+ status = UX_ERROR;
+
+ /* Check device state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ continue;
+
+ /* Check endpoint. */
+ endpoint = ccid -> ux_device_class_ccid_endpoint_notify;
+ if (endpoint == UX_NULL)
+ continue;
+ transfer = &endpoint -> ux_slave_endpoint_transfer_request;
+
+ /* Wait event. */
+ status = _ux_utility_semaphore_get(&ccid -> ux_device_class_ccid_notify_semaphore,
+ UX_WAIT_FOREVER);
+ if (status != UX_SUCCESS)
+ continue;
+
+ /* Build slot change/hardware error message. */
+ buffer = transfer -> ux_slave_transfer_request_data_pointer;
+ length = 0;
+
+ /* By default no message. */
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] = 0;
+
+ /* Build slot hardware error message. */
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ slot = ccid -> ux_device_class_ccid_slots;
+ for (i = 0; i < parameter -> ux_device_class_ccid_max_n_slots; i ++)
+ {
+
+ /* Check if there is hardware error notification. */
+ if (slot -> ux_device_class_ccid_slot_flags &
+ UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_HW_ERROR)
+ {
+ slot -> ux_device_class_ccid_slot_flags &=
+ (UCHAR)~UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_HW_ERROR;
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] =
+ UX_DEVICE_CLASS_CCID_RDR_TO_PC_HARDWARE_ERROR;
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_SLOT] = (UCHAR)i;
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_SEQ] =
+ slot -> ux_device_class_ccid_slot_hw_error_seq;
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_HW_ERROR_CODE] =
+ slot -> ux_device_class_ccid_slot_hw_error;
+ length = 4;
+ break;
+ }
+
+ /* Next slot. */
+ slot ++;
+ }
+
+ /* Build slot changes message. */
+ if (buffer[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] == 0)
+ {
+
+ /* Scan slots. */
+ slot = ccid -> ux_device_class_ccid_slots;
+ for (i = 0, byte_pos = 1; ; byte_pos ++)
+ {
+ /* Reset bits. */
+ buffer[byte_pos] = 0;
+
+ /* Scan 4 slots. */
+ for(bits_pos = 0; bits_pos < 8; bits_pos += 2)
+ {
+
+ /* Slot state bit. */
+ icc_mask = (UCHAR)((slot -> ux_device_class_ccid_slot_icc_status ==
+ UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_NOT_PRESENT) ?
+ 0u : 1u);
+
+ /* Check if there is change notification. */
+ if (slot -> ux_device_class_ccid_slot_flags &
+ UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE)
+ {
+ slot -> ux_device_class_ccid_slot_flags &=
+ (UCHAR)~UX_DEVICE_CLASS_CCID_FLAG_NOTIFY_CHANGE;
+
+ /* Message type. */
+ buffer[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] =
+ UX_DEVICE_CLASS_CCID_RDR_TO_PC_NOTIFY_SLOT_CHANGE;
+
+ /* Slot change bit. */
+ icc_mask |= (UCHAR)0x02u;
+ }
+
+ /* Modify bits. */
+ buffer[byte_pos] |= (UCHAR)(icc_mask << bits_pos);
+
+ /* Next slot. */
+ i ++;
+ if (i >= parameter -> ux_device_class_ccid_max_n_slots)
+ break;
+ slot ++;
+ }
+ if (i >= parameter -> ux_device_class_ccid_max_n_slots)
+ break;
+ }
+
+ /* Buffer length should include last byte. */
+ length = byte_pos + 1;
+ }
+
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Check message to see if there is message to send. */
+ if (buffer[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] == 0)
+ continue;
+
+ /* Send request. */
+ status = _ux_device_stack_transfer_request(transfer, length, length);
+ }
+}
+#endif
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_response.c b/common/usbx_device_classes/src/ux_device_class_ccid_response.c
new file mode 100644
index 0000000..41dafdd
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_response.c
@@ -0,0 +1,101 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_response PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sends bulk IN response of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* buffer Pointer to data buffer */
+/* length Data length */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_response(UX_DEVICE_CLASS_CCID *ccid, UCHAR *buffer, ULONG length)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer;
+UINT status;
+
+ /* Get bulk IN endpoint. */
+ endpoint = ccid -> ux_device_class_ccid_endpoint_in;
+
+ /* Get transfer request. */
+ transfer = &endpoint -> ux_slave_endpoint_transfer_request;
+
+ /* Lock bulk IN. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_response_mutex);
+
+ /* Prepare data to transfer. */
+ if (length > 0 && buffer != UX_NULL &&
+ transfer -> ux_slave_transfer_request_data_pointer != buffer)
+ {
+ _ux_utility_memory_copy(transfer -> ux_slave_transfer_request_data_pointer,
+ buffer, length); /* Use case of memcpy is verified. */
+ }
+
+ /* Transfer data. */
+ status = _ux_device_stack_transfer_request(transfer, length, length);
+
+ /* Unlock bulk IN. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_response_mutex);
+
+ /* Return transfer status. */
+ return(status);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_runner_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_ccid_runner_thread_entry.c
new file mode 100644
index 0000000..5a7aa1c
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_runner_thread_entry.c
@@ -0,0 +1,232 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+#if !defined(UX_DEVICE_STANDALONE)
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_runner_thread_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is the thread of the CCID command handling. It */
+/* is waiting for the event to start command processing. */
+/* */
+/* INPUT */
+/* */
+/* ccid_runner Address of CCID runner (32b) */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_request Request transfer */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+VOID _ux_device_class_ccid_runner_thread_entry(ULONG ccid_runner)
+{
+
+UX_SLAVE_DEVICE *device;
+UX_DEVICE_CLASS_CCID *ccid;
+UX_DEVICE_CLASS_CCID_PARAMETER *parameter;
+UX_DEVICE_CLASS_CCID_HANDLE *handles;
+UX_DEVICE_CLASS_CCID_HANDLE handle;
+UX_DEVICE_CLASS_CCID_RUNNER *runner;
+UX_DEVICE_CLASS_CCID_SLOT *slot;
+UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *cmd;
+UX_DEVICE_CLASS_CCID_COMMAND_SETT *cmd_sett;
+UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *rsp;
+UX_DEVICE_CLASS_CCID_MESSAGES messages;
+ULONG event_mask, flags;
+ULONG cmd_checks;
+UINT status;
+
+ /* Cast properly the ccid runner. */
+ UX_THREAD_EXTENSION_PTR_GET(runner, UX_DEVICE_CLASS_CCID_RUNNER, ccid_runner)
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* Get CCID instance. */
+ ccid = runner -> ux_device_class_ccid_runner_ccid;
+
+ /* Get CCID parameter. */
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+
+ /* Get event mask to wait. */
+ event_mask = 1u << runner -> ux_device_class_ccid_runner_id;
+
+ /* This thread runs forever but can be suspended or resumed by the user application. */
+ status = UX_SUCCESS;
+ while(1)
+ {
+
+ /* Check device state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+ _ux_utility_thread_suspend(&runner -> ux_device_class_ccid_runner_thread);
+ continue;
+ }
+
+ /* Wait signal. */
+ status = _ux_utility_event_flags_get(&ccid -> ux_device_class_ccid_events,
+ event_mask, UX_OR_CLEAR, &flags, UX_WAIT_FOREVER);
+ if (status != UX_SUCCESS)
+ {
+ _ux_utility_thread_suspend(&runner -> ux_device_class_ccid_runner_thread);
+ continue;
+ }
+
+ /* We have a command to process. */
+ cmd = (UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *)
+ runner -> ux_device_class_ccid_runner_command;
+ rsp = (UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *)
+ runner -> ux_device_class_ccid_runner_response;
+
+ /* Slot to handle. */
+ slot = ccid -> ux_device_class_ccid_slots;
+ slot += runner -> ux_device_class_ccid_runner_slot;
+
+ /* Command settings. */
+ cmd_sett = (UX_DEVICE_CLASS_CCID_COMMAND_SETT *)_ux_device_class_ccid_command_sett;
+ cmd_sett += runner -> ux_device_class_ccid_runner_command_index;
+
+ /* Message to pass to application. */
+ messages.ux_device_class_ccid_messages_pc_to_rdr = (UCHAR *)cmd;
+ messages.ux_device_class_ccid_messages_rdr_to_pc = (UCHAR *)rsp;
+
+ /* Internal checks. */
+ cmd_checks = (ULONG)cmd_sett -> ux_device_class_ccid_command_sett_flags;
+ cmd_checks &= (ULONG)slot -> ux_device_class_ccid_slot_flags;
+
+ /* Check hardware error! */
+ if (cmd_checks & UX_DEVICE_CLASS_CCID_FLAG_HW_ERROR)
+ {
+
+ /* Response: (1,1,HW_ERROR). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(1, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_HW_ERROR;
+ }
+
+ /* Check auto sequencing! */
+ else if (cmd_checks & UX_DEVICE_CLASS_CCID_FLAG_AUTO_SEQUENCING)
+ {
+
+ /* Response: (1,1,BUSY_WITH_AUTO_SEQUENCE). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(1, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_BUSY_WITH_AUTO_SEQUENCE;
+ }
+
+ /* Process command, application can fill status. */
+ else
+ {
+
+ handles = (UX_DEVICE_CLASS_CCID_HANDLE *)parameter -> ux_device_class_ccid_handles;
+ handle = handles[(INT)cmd_sett -> ux_device_class_ccid_command_sett_handle_index];
+
+ /* Initialize response length based on type. */
+ switch(rsp -> bMessageType)
+ {
+ case UX_DEVICE_CLASS_CCID_RDR_TO_PC_DATA_RATE_AND_CLOCK_FREQ:
+
+ /* Length fixed to 10+8. */
+ messages.ux_device_class_ccid_messages_rdr_to_pc_length = 18;
+ UX_DEVICE_CLASS_CCID_MESSAGE_LENGTH_SET(rsp, 8);
+ break;
+
+ case UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS:
+
+ /* Length fixed to 10. */
+ messages.ux_device_class_ccid_messages_rdr_to_pc_length =
+ UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH;
+ break;
+
+ default:
+
+ /* There is possible data, set length to max transfer length. */
+ messages.ux_device_class_ccid_messages_rdr_to_pc_length =
+ parameter -> ux_device_class_ccid_max_transfer_length;
+ break;
+ }
+
+ /* Invoke application callback. */
+ status = handle(cmd -> bSlot, &messages);
+
+ /* Save application status updates. */
+
+ /* Save bmICCStatus. */
+ slot -> ux_device_class_ccid_slot_icc_status = rsp->bStatus &
+ UX_DEVICE_CLASS_CCID_SLOT_STATUS_ICC_MASK;
+
+ /* Save bClockStatus. */
+ slot -> ux_device_class_ccid_slot_clock_status = rsp->bClockStatus;
+ }
+
+ /* If failed (aborted), no response. */
+ if (status != UX_SUCCESS)
+ continue;
+ if (slot -> ux_device_class_ccid_slot_aborting)
+ continue;
+
+ /* Send response. */
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp,
+ messages.ux_device_class_ccid_messages_rdr_to_pc_length);
+
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Free runner. */
+ runner -> ux_device_class_ccid_runner_slot = -1;
+ ccid -> ux_device_class_ccid_n_busy --;
+
+ /* Clear slot busy. */
+ slot -> ux_device_class_ccid_slot_runner = -1;
+
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ }
+}
+#endif
diff --git a/common/usbx_device_classes/src/ux_device_class_ccid_thread_entry.c b/common/usbx_device_classes/src/ux_device_class_ccid_thread_entry.c
new file mode 100644
index 0000000..c30b5e8
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_thread_entry.c
@@ -0,0 +1,365 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+#if !defined(UX_DEVICE_STANDALONE)
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_thread_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is the thread of the CCID bulk out endpoint. It */
+/* is waiting for the host to send message on the bulk out endpoint to */
+/* the device. */
+/* */
+/* INPUT */
+/* */
+/* ccid_inst Address of ccid class */
+/* container (32-bit) */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_request Request transfer */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+VOID _ux_device_class_ccid_thread_entry(ULONG ccid_inst)
+{
+
+UX_SLAVE_DEVICE *device;
+UX_DEVICE_CLASS_CCID *ccid;
+UX_DEVICE_CLASS_CCID_SLOT *slot;
+UX_DEVICE_CLASS_CCID_RUNNER *runner = UX_NULL;
+UX_DEVICE_CLASS_CCID_PARAMETER *parameter;
+UX_DEVICE_CLASS_CCID_MESSAGES messages;
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer_cmd;
+UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *cmd;
+UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *rsp;
+UX_DEVICE_CLASS_CCID_COMMAND_SETT *cmd_sett;
+CHAR cmd_index;
+UX_DEVICE_CLASS_CCID_HANDLE *handles;
+INT i;
+UINT status;
+
+ /* Cast properly the ccid instance. */
+ UX_THREAD_EXTENSION_PTR_GET(ccid, UX_DEVICE_CLASS_CCID, ccid_inst)
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* This thread runs forever but can be suspended or resumed by the user application. */
+ status = UX_SUCCESS;
+ while(1)
+ {
+
+ /* Error cases. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* We need to suspend ourselves. We will be resumed by the
+ application if needed. */
+ _ux_utility_thread_suspend(&ccid -> ux_device_class_ccid_thread);
+ }
+
+ status = UX_ERROR;
+
+ /* Check device state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ continue;
+
+ /* Check endpoint. */
+ endpoint = ccid -> ux_device_class_ccid_endpoint_out;
+ if (endpoint == UX_NULL)
+ continue;
+ transfer_cmd = &endpoint -> ux_slave_endpoint_transfer_request;
+ endpoint = ccid -> ux_device_class_ccid_endpoint_in;
+ if (endpoint == UX_NULL)
+ continue;
+
+ /* Send the request to the device controller. */
+ parameter = &ccid -> ux_device_class_ccid_parameter;
+ status = _ux_device_stack_transfer_request(transfer_cmd,
+ parameter -> ux_device_class_ccid_max_transfer_length,
+ parameter -> ux_device_class_ccid_max_transfer_length);
+
+ /* Access to CCID command message header. */
+ cmd = (UX_DEVICE_CLASS_CCID_MESSAGE_HEADER *)
+ transfer_cmd -> ux_slave_transfer_request_data_pointer;
+
+ /* Check the completion code and message length. */
+ if ((status != UX_SUCCESS) ||
+ (transfer_cmd -> ux_slave_transfer_request_completion_code != UX_SUCCESS) ||
+ (transfer_cmd -> ux_slave_transfer_request_actual_length <
+ UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH) ||
+ (transfer_cmd -> ux_slave_transfer_request_actual_length >
+ parameter -> ux_device_class_ccid_max_transfer_length))
+ {
+
+ /* Re-check device state and try transfer again. */
+ status = UX_SUCCESS;
+ continue;
+ }
+
+ /* Get command setting. */
+ cmd_sett = (UX_DEVICE_CLASS_CCID_COMMAND_SETT *)_ux_device_class_ccid_command_sett;
+ for (cmd_index = 0; cmd_index < UX_DEVICE_CLASS_CCID_N_COMMANDS;)
+ {
+ if (cmd -> bMessageType ==
+ cmd_sett -> ux_device_class_ccid_command_sett_command_type)
+ break;
+
+ /* Next command setting. */
+ cmd_sett ++;
+ cmd_index ++;
+ }
+ handles = (UX_DEVICE_CLASS_CCID_HANDLE *)parameter -> ux_device_class_ccid_handles;
+
+ /* Lock global status resources. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Initialize response. */
+ rsp = (UX_DEVICE_CLASS_CCID_RDR_TO_PC_SLOT_STATUS_HEADER *)
+ ccid -> ux_device_class_ccid_header;
+ _ux_utility_memory_set(rsp, 0, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH); /* Use case of memset is verified. */
+ rsp -> bMessageType = cmd_sett -> ux_device_class_ccid_command_sett_response_type;
+ rsp -> bSlot = cmd -> bSlot;
+ rsp -> bSeq = cmd -> bSeq;
+
+ /* Check command support (0,1,0). */
+ if (rsp -> bMessageType == 0 ||
+ handles[(INT)cmd_sett -> ux_device_class_ccid_command_sett_handle_index] == UX_NULL)
+ {
+
+ /* Response: command not supported (0,1,0). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(0, 1);
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+ continue;
+ }
+
+ /* check Slot exist (2,1,5). */
+ if (cmd -> bSlot >= parameter -> ux_device_class_ccid_max_n_slots)
+ {
+
+ /* Response: Slot not exist. */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(2, 1);
+ rsp -> bError = 5;
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+ continue;
+ }
+
+ /* Get slot instance for later usage. */
+ slot = &ccid -> ux_device_class_ccid_slots[cmd -> bSlot];
+
+ /* Initialize response status from slot status. */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 0);
+
+ /* Initialize response clock status. */
+ if (cmd_sett -> ux_device_class_ccid_command_sett_response_type == 0x81)
+ rsp -> bClockStatus = slot -> ux_device_class_ccid_slot_clock_status;
+
+ /* Abort command
+ - return slot status(OK) anyway
+ - clear aborting status
+ Aborting
+ - return slot status(ABORTED)
+ Other command (except SetDataRateAndClockFrequency)
+ - Check busy */
+
+ /* Abort command is handled differently. */
+ if (cmd -> bMessageType != UX_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT ||
+ !slot -> ux_device_class_ccid_slot_aborting)
+ {
+
+ /* Check if slot is idle. */
+ if ((signed char)slot -> ux_device_class_ccid_slot_runner < 0)
+ {
+
+ /* Slot is idle, check if free runner available. */
+ if (ccid -> ux_device_class_ccid_n_busy <
+ parameter -> ux_device_class_ccid_max_n_busy_slots)
+ {
+
+ /* Get a free runner for the command. */
+ runner = ccid -> ux_device_class_ccid_runners;
+ for(i = 0;
+ i < parameter -> ux_device_class_ccid_max_n_busy_slots;
+ i ++)
+ {
+
+ /* Check if runner is free. */
+ if ((signed char)runner -> ux_device_class_ccid_runner_slot < 0)
+ break;
+
+ /* Check next runner. */
+ runner ++;
+ }
+
+ /* It's not possible no runner found here, just execute runner. */
+
+ /* Runner is busy now. */
+ runner -> ux_device_class_ccid_runner_slot = (CHAR)cmd->bSlot;
+ runner -> ux_device_class_ccid_runner_command_index = cmd_index;
+ ccid -> ux_device_class_ccid_n_busy ++;
+ slot -> ux_device_class_ccid_slot_runner = (CHAR)i;
+
+ /* Create a copy of command and response header. */
+ _ux_utility_memory_copy(runner -> ux_device_class_ccid_runner_command,
+ cmd,
+ transfer_cmd -> ux_slave_transfer_request_actual_length); /* Use case of memcpy is verified. */
+ _ux_utility_memory_copy(runner -> ux_device_class_ccid_runner_response,
+ rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH); /* Use case of memcpy is verified. */
+
+ /* Pre-process of command done. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Signal event to runner thread. */
+ _ux_utility_thread_resume(&runner -> ux_device_class_ccid_runner_thread);
+ _ux_device_event_flags_set(&ccid -> ux_device_class_ccid_events,
+ 1u << i, UX_OR);
+ continue;
+ }
+
+ /* We are here if there is no runner available. */
+ /* It's busy! */
+ }
+
+ /* Response: Slot Status(busy). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_CMD_SLOT_BUSY;
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+ continue;
+ }
+
+ /* We are here when we see Abort command, or aborting.
+ - Abort command : slot status (ok/fail)
+ - Aborting : slot status (CMD_ABORTED)
+ */
+
+ /* Abort command. */
+ if (cmd -> bMessageType == UX_DEVICE_CLASS_CCID_PC_TO_RDR_ABORT)
+ {
+
+ /* Check sequence. */
+ if (cmd -> bSeq != slot -> ux_device_class_ccid_slot_aborting_seq)
+ {
+
+ /* Response: sequence error. */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 1);
+ rsp -> bError = 6;
+ }
+ else
+ {
+
+ /* Aborting. */
+ if (slot -> ux_device_class_ccid_slot_aborting)
+ {
+
+ /* Call abort handle. */
+ messages.ux_device_class_ccid_messages_pc_to_rdr = (VOID *)cmd;
+ messages.ux_device_class_ccid_messages_rdr_to_pc = (VOID *)rsp;
+ messages.ux_device_class_ccid_messages_rdr_to_pc_length = 0;
+ parameter -> ux_device_class_ccid_handles ->
+ ux_device_class_ccid_handles_abort(cmd -> bSlot, &messages);
+
+ /* Status(OK) */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 0);
+ }
+ else
+ {
+
+ /* Status(CMD_NOT_ABORTED)? */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_CMD_SLOT_BUSY;
+ }
+ }
+
+ /* Free runner. */
+ if ((signed char)slot -> ux_device_class_ccid_slot_runner >= 0)
+ {
+ runner = ccid -> ux_device_class_ccid_runners + slot -> ux_device_class_ccid_slot_runner;
+
+ runner -> ux_device_class_ccid_runner_slot = -1;
+
+ ccid -> ux_device_class_ccid_n_busy --;
+
+ /* Clear slot busy and aborting. */
+ slot -> ux_device_class_ccid_slot_runner = -1;
+ slot -> ux_device_class_ccid_slot_aborting = UX_FALSE;
+ }
+
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ /* Send response any way. */
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+ continue;
+ }
+
+ /* Aborting. */
+
+ /* Response: Slot Status(aborted). */
+ rsp -> bStatus = UX_DEVICE_CLASS_CCID_SLOT_STATUS(
+ slot -> ux_device_class_ccid_slot_icc_status, 1);
+ rsp -> bError = UX_DEVICE_CLASS_CCID_CMD_ABORTED;
+
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_mutex);
+
+ _ux_device_class_ccid_response(ccid, (UCHAR *)rsp, UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+ }
+}
+#endif
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
new file mode 100644
index 0000000..22a7649
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_time_extension.c
@@ -0,0 +1,128 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_time_extension PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function sends bulk IN time_extension of the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* ccid Pointer to ccid instance */
+/* slot Slot to extend time */
+/* wt BWT (T=1) or WWT (T=0) */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_time_extension(UX_DEVICE_CLASS_CCID *ccid, ULONG slot, ULONG wt)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer;
+UX_DEVICE_CLASS_CCID_SLOT *ccid_slot;
+UX_DEVICE_CLASS_CCID_RUNNER *runner;
+UCHAR *rsp, *runner_rsp;
+UINT status;
+
+ /* Get slot. */
+ ccid_slot = ccid -> ux_device_class_ccid_slots;
+ ccid_slot += slot;
+
+ /* Check slot state. */
+ if ((signed char)ccid_slot -> ux_device_class_ccid_slot_runner < 0)
+ return(UX_INVALID_STATE);
+
+ /* Get runner. */
+ runner = ccid -> ux_device_class_ccid_runners;
+ runner += ccid_slot -> ux_device_class_ccid_slot_runner;
+
+ /* Get bulk IN endpoint. */
+ endpoint = ccid -> ux_device_class_ccid_endpoint_in;
+
+ /* Get transfer request. */
+ transfer = &endpoint -> ux_slave_endpoint_transfer_request;
+
+ /* Lock bulk IN. */
+ _ux_device_mutex_on(&ccid -> ux_device_class_ccid_response_mutex);
+
+ /* Get response buffer. */
+ rsp = transfer -> ux_slave_transfer_request_data_pointer;
+ runner_rsp = runner -> ux_device_class_ccid_runner_response;
+
+ /* Fill response. */
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE] = runner_rsp[UX_DEVICE_CLASS_CCID_OFFSET_MESSAGE_TYPE];
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_LENGTH] = 0;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_LENGTH+1] = 0;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_LENGTH+2] = 0;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_LENGTH+3] = 0;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_SLOT] = runner_rsp[UX_DEVICE_CLASS_CCID_OFFSET_SLOT];
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_SEQ] = runner_rsp[UX_DEVICE_CLASS_CCID_OFFSET_SEQ];
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_STATUS] = runner_rsp[UX_DEVICE_CLASS_CCID_OFFSET_STATUS] |
+ UX_DEVICE_CLASS_CCID_SLOT_STATUS_TIME_EXTENSION;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_ERROR] = (UCHAR)wt;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_CHAIN_PARAMETER] = 0;
+ rsp[UX_DEVICE_CLASS_CCID_OFFSET_CHAIN_PARAMETER+1] = 0;
+
+ /* Transfer data. */
+ status = _ux_device_stack_transfer_request(transfer,
+ UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH,
+ UX_DEVICE_CLASS_CCID_MESSAGE_HEADER_LENGTH);
+
+ /* Unlock bulk IN. */
+ _ux_device_mutex_off(&ccid -> ux_device_class_ccid_response_mutex);
+
+ /* Return transfer status. */
+ return(status);
+}
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
new file mode 100644
index 0000000..776d8d4
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_ccid_uninitialize.c
@@ -0,0 +1,114 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device CCID Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_ccid.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_ccid_uninitialize PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function uninitialize the USB CCID device. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to ccid command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_memory_free Free memory */
+/* _ux_device_mutex_delete Delete mutex */
+/* _ux_utility_event_flags_delete Delete event flags */
+/* _ux_utility_thread_delete Delete thread */
+/* */
+/* CALLED BY */
+/* */
+/* USBX Source Code */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_ccid_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_DEVICE_CLASS_CCID *ccid;
+UX_SLAVE_CLASS *ccid_class;
+#if !defined(UX_DEVICE_STANDALONE)
+UX_DEVICE_CLASS_CCID_RUNNER *runner;
+ULONG i;
+#endif
+
+ /* Get the class container. */
+ ccid_class = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the CCID instance. */
+ ccid = (UX_DEVICE_CLASS_CCID *)ccid_class -> ux_slave_class_instance;
+
+ /* Sanity check. */
+ if (ccid != UX_NULL)
+ {
+
+ /* Free allocated resources. */
+#if !defined(UX_DEVICE_STANDALONE)
+ _ux_device_thread_delete(&ccid -> ux_device_class_ccid_notify_thread);
+ _ux_device_thread_delete(&ccid -> ux_device_class_ccid_thread);
+ for (i = 0;
+ i < ccid -> ux_device_class_ccid_parameter.ux_device_class_ccid_max_n_busy_slots;
+ i ++)
+ {
+ runner = &ccid -> ux_device_class_ccid_runners[i];
+ _ux_device_thread_delete(&runner -> ux_device_class_ccid_runner_thread);
+ }
+ _ux_device_event_flags_delete(&ccid -> ux_device_class_ccid_events);
+ _ux_device_mutex_delete(&ccid -> ux_device_class_ccid_mutex);
+ _ux_device_semaphore_delete(&ccid -> ux_device_class_ccid_notify_semaphore);
+ _ux_device_mutex_delete(&ccid -> ux_device_class_ccid_response_mutex);
+#endif
+
+ /* Free instance memory. */
+ _ux_utility_memory_free(ccid);
+ }
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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 0f27eed..81b591c 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -83,6 +83,10 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* used whole buffer for write,*/
+/* refined macros names, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_cdc_acm_bulkin_thread(ULONG cdc_acm_class)
@@ -162,10 +166,10 @@ ULONG sent_length;
{
/* Check the length remaining to send. */
- if (total_length > endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize)
+ if (total_length > UX_SLAVE_REQUEST_DATA_MAX_LENGTH)
/* We can't fit all the length. */
- transfer_length = endpoint -> ux_slave_endpoint_descriptor.wMaxPacketSize;
+ transfer_length = UX_SLAVE_REQUEST_DATA_MAX_LENGTH;
else
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 a2bd109..7d39b0b 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -59,7 +59,7 @@
/* _ux_utility_memory_allocate Allocate memory */
/* _ux_utility_memory_free Free memory */
/* _ux_utility_mutex_create Create mutex */
-/* _ux_utility_mutex_delete Delete mutex */
+/* _ux_device_mutex_delete Delete mutex */
/* */
/* CALLED BY */
/* */
@@ -81,6 +81,8 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_initialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -138,7 +140,7 @@ UINT status;
{
/* Delete the endpoint IN mutex. */
- _ux_utility_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* Free the resources. */
_ux_utility_memory_free(cdc_acm);
@@ -261,8 +263,8 @@ UINT status;
_ux_utility_event_flags_delete(&cdc_acm -> ux_slave_class_cdc_acm_event_flags_group);
if (cdc_acm -> ux_slave_class_cdc_acm_bulkout_thread_stack)
_ux_utility_memory_free(cdc_acm -> ux_slave_class_cdc_acm_bulkout_thread_stack);
- _ux_utility_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
- _ux_utility_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
_ux_utility_memory_free(cdc_acm);
return(status);
}
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 65050d5..d9bc65f 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -64,7 +64,7 @@
/* */
/* _ux_device_stack_transfer_request Transfer request */
/* _ux_utility_memory_copy Copy memory */
-/* _ux_utility_mutex_off Release mutex */
+/* _ux_device_mutex_off Release mutex */
/* */
/* CALLED BY */
/* */
@@ -84,6 +84,8 @@
/* resulting in version 6.1.9 */
/* 01-31-2022x Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_read(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer,
@@ -142,7 +144,7 @@ ULONG local_requested_length;
}
/* Protect this thread. */
- _ux_utility_mutex_on(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_on(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
/* All CDC reading are on the endpoint OUT, from the host. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
@@ -192,7 +194,7 @@ ULONG local_requested_length;
/* We are done. */
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
/* Return with success. */
return(UX_SUCCESS);
@@ -203,7 +205,7 @@ ULONG local_requested_length;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
/* We got an error. */
return(status);
@@ -212,7 +214,7 @@ ULONG local_requested_length;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
/* Check why we got here, either completion or device was extracted. */
if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
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 5b83da6..3dbe41c 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -53,7 +53,7 @@
/* */
/* CALLS */
/* */
-/* _ux_utility_mutex_delete Delete Mutex */
+/* _ux_device_mutex_delete Delete Mutex */
/* _ux_utility_memory_free Free used local memory */
/* */
/* CALLED BY */
@@ -76,6 +76,8 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -97,10 +99,10 @@ UX_SLAVE_CLASS *class;
#if !defined(UX_DEVICE_STANDALONE)
/* Delete the IN endpoint mutex. */
- _ux_utility_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* Out Mutex. */
- _ux_utility_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
+ _ux_device_mutex_delete(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_out_mutex);
#ifndef UX_DEVICE_CLASS_CDC_ACM_TRANSMISSION_DISABLE
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 996b266..e4f04bb 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -63,8 +63,8 @@
/* */
/* _ux_utility_memory_copy Copy memory */
/* _ux_device_stack_transfer_request Transfer request */
-/* _ux_utility_mutex_on Take Mutex */
-/* _ux_utility_mutex_off Release Mutex */
+/* _ux_device_mutex_on Take Mutex */
+/* _ux_device_mutex_off Release Mutex */
/* */
/* CALLED BY */
/* */
@@ -84,6 +84,8 @@
/* resulting in version 6.1.9 */
/* 01-31-2022x Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_write(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer,
@@ -141,7 +143,7 @@ UINT status = 0;
}
/* Protect this thread. */
- _ux_utility_mutex_on(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_on(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* We are writing to the IN endpoint. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
@@ -157,7 +159,7 @@ UINT status = 0;
status = _ux_device_stack_transfer_request(transfer_request, 0, 0);
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* Return the status. */
return(status);
@@ -208,7 +210,7 @@ UINT status = 0;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* We had an error, abort. */
return(status);
@@ -218,7 +220,7 @@ UINT status = 0;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
+ _ux_device_mutex_off(&cdc_acm -> ux_slave_class_cdc_acm_endpoint_in_mutex);
/* Check why we got here, either completion or device was extracted. */
if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
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 1d00fdb..388c305 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,8 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_acm_write_with_callback(UX_SLAVE_CLASS_CDC_ACM *cdc_acm, UCHAR *buffer,
@@ -155,7 +157,7 @@ UINT status;
cdc_acm -> ux_slave_class_cdc_acm_scheduled_write = UX_TRUE;
/* Invoke the bulkin thread by sending a flag . */
- status = _ux_utility_event_flags_set(&cdc_acm -> ux_slave_class_cdc_acm_event_flags_group, UX_DEVICE_CLASS_CDC_ACM_WRITE_EVENT, UX_OR);
+ status = _ux_device_event_flags_set(&cdc_acm -> ux_slave_class_cdc_acm_event_flags_group, UX_DEVICE_CLASS_CDC_ACM_WRITE_EVENT, UX_OR);
#endif
/* Simply return the last function result. When we leave this function, the deferred writing has been scheduled. */
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 5ed7d81..c34d8d9 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,11 +75,18 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_activate(UX_SLAVE_CLASS_COMMAND *command)
{
-
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+
UX_SLAVE_INTERFACE *interface;
UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
UX_SLAVE_CLASS *class;
@@ -204,7 +211,7 @@ ULONG physical_address_lsw;
cdc_ecm -> ux_slave_class_cdc_ecm_link_state = UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_UP;
/* Wake up the Interrupt thread and send a network notification to the host. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NETWORK_NOTIFICATION_EVENT, UX_OR);
+ _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);
/* Reset the endpoint buffers. */
_ux_utility_memory_set(cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_endpoint -> ux_slave_endpoint_transfer_request.
@@ -252,5 +259,5 @@ ULONG physical_address_lsw;
/* Return completion status. */
return(UX_SUCCESS);
+#endif
}
-
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 9c8d39c..6cec5f3 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
@@ -28,12 +28,14 @@
#include "ux_device_class_cdc_ecm.h"
#include "ux_device_stack.h"
+
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_bulkin_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -57,8 +59,8 @@
/* */
/* _ux_device_stack_transfer_request Request transfer */
/* _ux_utility_event_flags_get Get event flags */
-/* _ux_utility_mutex_on Take mutex */
-/* _ux_utility_mutex_off Free mutex */
+/* _ux_device_mutex_on Take mutex */
+/* _ux_device_mutex_off Free mutex */
/* */
/* CALLED BY */
/* */
@@ -78,6 +80,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_cdc_ecm_bulkin_thread(ULONG cdc_ecm_class)
@@ -128,7 +133,7 @@ ULONG transfer_length;
{
/* Ensure no other threads are modifying the xmit queue. */
- _ux_utility_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* Get the current packet in the list. */
current_packet = cdc_ecm -> ux_slave_class_cdc_ecm_xmit_queue;
@@ -137,7 +142,7 @@ ULONG transfer_length;
cdc_ecm -> ux_slave_class_cdc_ecm_xmit_queue = current_packet -> nx_packet_queue_next;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* 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)
@@ -197,12 +202,12 @@ ULONG transfer_length;
{
/* We need to ensure nobody is adding to the queue, so get the mutex protection. */
- _ux_utility_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* Since we got the mutex, we know no one is trying to modify the queue; we also know
no one can start modifying the queue since the link state is down, so we can just
release the mutex. */
- _ux_utility_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* We get here when the link is down. All packets pending must be freed. */
while (cdc_ecm -> ux_slave_class_cdc_ecm_xmit_queue != UX_NULL)
@@ -236,3 +241,4 @@ ULONG transfer_length;
_ux_device_thread_suspend(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_thread);
}
}
+#endif
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 40ee6e7..c584e41 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
@@ -28,12 +28,14 @@
#include "ux_device_class_cdc_ecm.h"
#include "ux_device_stack.h"
+
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_bulkout_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +80,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_cdc_ecm_bulkout_thread(ULONG cdc_ecm_class)
@@ -183,4 +188,4 @@ ULONG ip_given_length;
_ux_device_thread_suspend(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread);
}
}
-
+#endif
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 e895e74..1bf8717 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -56,7 +56,7 @@
/* _ux_network_driver_link_down Link status down */
/* _ux_utility_memory_set Set memory */
/* _ux_device_thread_resume Resume thread */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_event_flags_set Set event flags */
/* _ux_device_stack_transfer_all_request_abort */
/* Abort transfer */
/* */
@@ -78,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_change(UX_SLAVE_CLASS_COMMAND *command)
@@ -157,7 +160,7 @@ UX_SLAVE_ENDPOINT *endpoint;
_ux_device_thread_resume(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_thread);
/* Wake up the Interrupt thread and send a network notification to the host. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NETWORK_NOTIFICATION_EVENT, UX_OR);
+ _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 there is an activate function call it. */
if (cdc_ecm -> ux_slave_class_cdc_ecm_parameter.ux_slave_class_cdc_ecm_instance_activate != UX_NULL)
@@ -182,10 +185,10 @@ UX_SLAVE_ENDPOINT *endpoint;
/* Notify the thread waiting for network notification events. In this case,
the event is that the link state has been switched to down. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NETWORK_NOTIFICATION_EVENT, UX_OR);
+ _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);
/* Wake up the bulk in thread so that it can clean up the xmit queue. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
+ _ux_device_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
/* If there is a deactivate function call it. */
if (cdc_ecm -> ux_slave_class_cdc_ecm_parameter.ux_slave_class_cdc_ecm_instance_deactivate != UX_NULL)
diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_deactivate.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_deactivate.c
index 7f2a5f7..d09fec1 100644
--- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_deactivate.c
+++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_deactivate.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_deactivate PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,7 +55,7 @@
/* */
/* _ux_device_stack_transfer_all_request_abort */
/* Abort all transfers */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_event_flags_set Set event flags */
/* _ux_network_driver_deactivate Deactivate NetX USB interface */
/* */
/* CALLED BY */
@@ -72,6 +72,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_deactivate(UX_SLAVE_CLASS_COMMAND *command)
@@ -120,7 +123,7 @@ UX_SLAVE_CLASS *class;
_ux_device_stack_transfer_all_request_abort(cdc_ecm -> ux_slave_class_cdc_ecm_interrupt_endpoint, UX_TRANSFER_BUS_RESET);
/* Wake up the bulk in thread so it will release the NetX resources used and suspend. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
+ _ux_device_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
/* If there is a deactivate function call it. */
if (cdc_ecm -> ux_slave_class_cdc_ecm_parameter.ux_slave_class_cdc_ecm_instance_deactivate != UX_NULL)
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 94408cd..4f93708 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
@@ -34,7 +34,7 @@ UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_initialize PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -56,7 +56,7 @@ UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT
/* _ux_utility_memory_allocate Allocate memory */
/* _ux_utility_memory_free Free memory */
/* _ux_utility_mutex_create Create Mutex */
-/* _ux_utility_mutex_delete Delete Mutex */
+/* _ux_device_mutex_delete Delete Mutex */
/* _ux_utility_event_flags_create Create Flag group */
/* _ux_utility_event_flags_delete Delete Flag group */
/* _ux_device_thread_create Create Thread */
@@ -82,10 +82,17 @@ UX_DEVICE_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_initialize(UX_SLAVE_CLASS_COMMAND *command)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
UX_SLAVE_CLASS_CDC_ECM_PARAMETER *cdc_ecm_parameter;
@@ -266,10 +273,10 @@ UINT status;
_ux_utility_memory_free(cdc_ecm -> ux_slave_class_cdc_ecm_interrupt_thread_stack);
if (cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread_stack)
_ux_utility_memory_free(cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread_stack);
- _ux_utility_mutex_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
_ux_utility_memory_free(cdc_ecm);
/* Return completion status. */
return(status);
+#endif
}
-
diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_interrupt_thread.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_interrupt_thread.c
index bc0bc26..dceef3f 100644
--- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_interrupt_thread.c
+++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_interrupt_thread.c
@@ -29,12 +29,13 @@
#include "ux_device_stack.h"
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_interrupt_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -76,6 +77,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_cdc_ecm_interrupt_thread(ULONG cdc_ecm_class)
@@ -157,4 +161,4 @@ UCHAR *notification_buffer;
_ux_device_thread_suspend(&cdc_ecm -> ux_slave_class_cdc_ecm_interrupt_thread);
}
}
-
+#endif
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 857dc63..0ed95e7 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,7 +55,7 @@
/* */
/* CALLS */
/* */
-/* _ux_utility_mutex_delete Delete mutex */
+/* _ux_device_mutex_delete Delete mutex */
/* _ux_device_thread_delete Delete thread */
/* _ux_utility_memory_free Free memory */
/* _ux_utility_event_flags_delete Delete event flags */
@@ -75,6 +75,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -98,8 +101,10 @@ UX_SLAVE_CLASS *class;
because if they weren't, the class register (called by the application)
would have failed. */
+#if !defined(UX_DEVICE_STANDALONE)
+
/* Delete the xmit queue mutex. */
- _ux_utility_mutex_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* Delete bulk out thread . */
_ux_device_thread_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_bulkout_thread);
@@ -120,11 +125,13 @@ UX_SLAVE_CLASS *class;
_ux_utility_memory_free(cdc_ecm -> ux_slave_class_cdc_ecm_bulkin_thread_stack);
/* Delete the interrupt thread sync event flags group. */
- _ux_utility_event_flags_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group);
+ _ux_device_event_flags_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group);
/* Delete the reception packet pool. */
nx_packet_pool_delete(&cdc_ecm -> ux_slave_class_cdc_ecm_packet_pool);
+#endif
+
/* Free the packet pool memory. */
_ux_utility_memory_free(cdc_ecm -> ux_slave_class_cdc_ecm_pool_memory);
diff --git a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_write.c b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_write.c
index c9bca45..a04a9d7 100644
--- a/common/usbx_device_classes/src/ux_device_class_cdc_ecm_write.c
+++ b/common/usbx_device_classes/src/ux_device_class_cdc_ecm_write.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_cdc_ecm_write PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -56,8 +56,8 @@
/* CALLS */
/* */
/* _ux_device_stack_transfer_request Transfer request */
-/* _ux_utility_mutex_off Release mutex */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_mutex_off Release mutex */
+/* _ux_device_event_flags_set Set event flags */
/* */
/* CALLED BY */
/* */
@@ -73,10 +73,18 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_cdc_ecm_write(VOID *cdc_ecm_class, NX_PACKET *packet)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(cdc_ecm_class);
+ UX_PARAMETER_NOT_USED(packet);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UINT status;
UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
@@ -85,7 +93,7 @@ UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
cdc_ecm = (UX_SLAVE_CLASS_CDC_ECM *) cdc_ecm_class;
/* Protect this thread. */
- _ux_utility_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_on(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* We only want to send the packet if the link is up. */
if (cdc_ecm->ux_slave_class_cdc_ecm_link_state == UX_DEVICE_CLASS_CDC_ECM_LINK_STATE_UP)
@@ -109,10 +117,10 @@ UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
packet -> nx_packet_queue_next = NX_NULL;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* Set an event to wake up the bulkin thread. */
- _ux_utility_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_BULKIN_EVENT, UX_OR);
+ _ux_device_event_flags_set(&cdc_ecm -> ux_slave_class_cdc_ecm_event_flags_group, UX_DEVICE_CLASS_CDC_ECM_NEW_BULKIN_EVENT, UX_OR);
/* Packet successfully added. Return success. */
status = UX_SUCCESS;
@@ -121,7 +129,7 @@ UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
+ _ux_device_mutex_off(&cdc_ecm -> ux_slave_class_cdc_ecm_mutex);
/* Report error to application. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CLASS_CDC_ECM_LINK_STATE_DOWN_ERROR);
@@ -132,4 +140,5 @@ UX_SLAVE_CLASS_CDC_ECM *cdc_ecm;
/* We are done here. */
return(status);
+#endif
}
diff --git a/common/usbx_device_classes/src/ux_device_class_dfu_control_request.c b/common/usbx_device_classes/src/ux_device_class_dfu_control_request.c
index 2b1cab2..2bc5ce3 100644
--- a/common/usbx_device_classes/src/ux_device_class_dfu_control_request.c
+++ b/common/usbx_device_classes/src/ux_device_class_dfu_control_request.c
@@ -40,7 +40,7 @@ static inline VOID _ux_device_class_dfu_status_get(UX_SLAVE_CLASS_DFU *,
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_dfu_control_request PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -89,6 +89,9 @@ static inline VOID _ux_device_class_dfu_status_get(UX_SLAVE_CLASS_DFU *,
/* added UPLOAD length check, */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* checked r/w callback status,*/
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_dfu_control_request(UX_SLAVE_CLASS_COMMAND *command)
@@ -103,6 +106,7 @@ ULONG request;
ULONG request_value;
ULONG request_length;
ULONG actual_length;
+UINT status;
#if defined(UX_DEVICE_CLASS_DFU_CUSTOM_REQUEST_ENABLE) || (UX_DEVICE_CLASS_DFU_STATUS_MODE != 1)
ULONG media_status;
#endif
@@ -305,11 +309,19 @@ ULONG media_status;
dfu -> ux_slave_class_dfu_notify(dfu, UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_DOWNLOAD);
/* Write the first block to the firmware. */
- dfu -> ux_slave_class_dfu_write(dfu, request_value,
+ status = dfu -> ux_slave_class_dfu_write(dfu, request_value,
transfer_request -> ux_slave_transfer_request_data_pointer,
request_length,
&actual_length);
+ /* Application can actively reject and set error state. */
+ if (status != UX_SUCCESS)
+ {
+ _ux_device_stack_endpoint_stall(&device -> ux_slave_device_control_endpoint);
+ _ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_ERROR;
+ break;
+ }
+
/* In the system, state the DFU state machine to dfu DOWNLOAD SYNC. */
_ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_DNLOAD_SYNC;
@@ -396,11 +408,19 @@ ULONG media_status;
dfu -> ux_slave_class_dfu_notify(dfu, UX_SLAVE_CLASS_DFU_NOTIFICATION_BEGIN_UPLOAD);
/* Read the first block to the firmware. */
- dfu -> ux_slave_class_dfu_read(dfu, request_value,
+ status = dfu -> ux_slave_class_dfu_read(dfu, request_value,
transfer_request -> ux_slave_transfer_request_data_pointer,
request_length,
&actual_length);
+ /* Application can actively reject and set error state. */
+ if (status != UX_SUCCESS)
+ {
+ _ux_device_stack_endpoint_stall(&device -> ux_slave_device_control_endpoint);
+ _ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_ERROR;
+ break;
+ }
+
/* In the system, state the DFU state machine to dfu UPLOAD IDLE. */
_ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_UPLOAD_IDLE;
@@ -537,11 +557,19 @@ ULONG media_status;
{
/* Write the next block to the firmware. */
- dfu -> ux_slave_class_dfu_write(dfu, request_value,
+ status = dfu -> ux_slave_class_dfu_write(dfu, request_value,
transfer_request -> ux_slave_transfer_request_data_pointer,
request_length,
&actual_length);
+ /* Application can actively reject and set error state. */
+ if (status != UX_SUCCESS)
+ {
+ _ux_device_stack_endpoint_stall(&device -> ux_slave_device_control_endpoint);
+ _ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_ERROR;
+ break;
+ }
+
/* In the system, state the DFU state machine to dfu DOWNLOAD SYNC. */
_ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_DNLOAD_SYNC;
}
@@ -782,11 +810,19 @@ ULONG media_status;
/* We received a UPLOAD command with length > 0. */
/* Read the next block from the firmware. */
- dfu -> ux_slave_class_dfu_read(dfu, request_value,
+ status = dfu -> ux_slave_class_dfu_read(dfu, request_value,
transfer_request -> ux_slave_transfer_request_data_pointer,
request_length,
&actual_length);
+ /* Application can actively reject and set error state. */
+ if (status != UX_SUCCESS)
+ {
+ _ux_device_stack_endpoint_stall(&device -> ux_slave_device_control_endpoint);
+ _ux_system_slave -> ux_system_slave_device_dfu_state_machine = UX_SYSTEM_DFU_STATE_DFU_ERROR;
+ break;
+ }
+
/* If it's short frame, switch to dfu IDLE. */
if (actual_length < request_length)
{
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 52b3376..7a6cb2a 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
@@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_dfu_initialize PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -80,6 +80,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -88,7 +91,7 @@ UINT _ux_device_class_dfu_initialize(UX_SLAVE_CLASS_COMMAND *command)
UX_SLAVE_CLASS_DFU *dfu;
UX_SLAVE_CLASS_DFU_PARAMETER *dfu_parameter;
UX_SLAVE_CLASS *class;
-UINT status;
+UINT status = UX_DESCRIPTOR_CORRUPTED;
UX_DFU_FUNCTIONAL_DESCRIPTOR dfu_functional_descriptor;
UCHAR *dfu_framework;
ULONG dfu_framework_length;
@@ -132,7 +135,6 @@ ULONG descriptor_length;
dfu_framework_length = _ux_system_slave -> ux_system_slave_dfu_framework_length;
/* Parse the device framework and locate interfaces and endpoint descriptor(s). */
- status = UX_DESCRIPTOR_CORRUPTED;
while (dfu_framework_length != 0)
{
diff --git a/common/usbx_device_classes/src/ux_device_class_hid_control_request.c b/common/usbx_device_classes/src/ux_device_class_hid_control_request.c
index 108556d..b37d531 100755
--- a/common/usbx_device_classes/src/ux_device_class_hid_control_request.c
+++ b/common/usbx_device_classes/src/ux_device_class_hid_control_request.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_hid_control_request PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -84,6 +84,8 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_control_request(UX_SLAVE_CLASS_COMMAND *command)
@@ -190,7 +192,7 @@ UX_SLAVE_CLASS_HID *hid;
#else
/* Set an event to wake up the interrupt thread. */
- _ux_utility_event_flags_set(&hid -> ux_device_class_hid_event_flags_group, UX_DEVICE_CLASS_HID_NEW_IDLE_RATE, UX_OR);
+ _ux_device_event_flags_set(&hid -> ux_device_class_hid_event_flags_group, UX_DEVICE_CLASS_HID_NEW_IDLE_RATE, UX_OR);
#endif
}
}
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 24abfa9..690d68e 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -56,7 +56,7 @@
/* CALLS */
/* */
/* _ux_utility_memory_copy Copy memory */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_event_flags_set Set event flags */
/* */
/* CALLED BY */
/* */
@@ -77,6 +77,8 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_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 fbb41a0..341228e 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,8 @@
/* added standalone support, */
/* added interrupt OUT support,*/
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -206,7 +208,7 @@ UINT status = UX_SUCCESS;
#if !defined(UX_DEVICE_STANDALONE)
/* There is error, delete mutex. */
- _ux_utility_mutex_delete(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_delete(&hid -> ux_device_class_hid_read_mutex);
}
else
status = UX_MUTEX_ERROR;
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 95026c9..9fe986a 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -63,7 +63,7 @@
/* */
/* _ux_device_stack_transfer_request Transfer request */
/* _ux_utility_memory_copy Copy memory */
-/* _ux_utility_mutex_off Release mutex */
+/* _ux_device_mutex_off Release mutex */
/* */
/* CALLED BY */
/* */
@@ -74,6 +74,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_read(UX_SLAVE_CLASS_HID *hid, UCHAR *buffer,
@@ -115,7 +118,7 @@ ULONG local_requested_length;
}
/* Protect this thread. */
- _ux_utility_mutex_on(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_on(&hid -> ux_device_class_hid_read_mutex);
/* Locate the endpoint. */
endpoint = hid -> ux_device_class_hid_read_endpoint;
@@ -167,7 +170,7 @@ ULONG local_requested_length;
/* We are done. */
/* Free Mutex resource. */
- _ux_utility_mutex_off(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_off(&hid -> ux_device_class_hid_read_mutex);
/* Return with success. */
return(UX_SUCCESS);
@@ -177,7 +180,7 @@ ULONG local_requested_length;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_off(&hid -> ux_device_class_hid_read_mutex);
/* We got an error. */
return(status);
@@ -185,7 +188,7 @@ ULONG local_requested_length;
}
/* Free Mutex resource. */
- _ux_utility_mutex_off(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_off(&hid -> ux_device_class_hid_read_mutex);
/* Check why we got here, either completion or device was extracted. */
if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
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 3965d7e..c2f21c9 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -65,6 +65,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid)
@@ -99,7 +102,7 @@ UCHAR *next_pos;
pos -> ux_device_class_hid_received_event_length = 0;
/* Inform receiver thread to (re)start. */
- _ux_utility_event_flags_set(&hid -> ux_device_class_hid_event_flags_group,
+ _ux_device_event_flags_set(&hid -> ux_device_class_hid_event_flags_group,
UX_DEVICE_CLASS_HID_RECEIVER_RESTART, UX_OR);
/* Return event status to the user. */
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 ef7bd6e..5c4f76d 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +71,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added receiver callback, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid,
@@ -164,6 +167,10 @@ UINT status = UX_SUCCESS;
/* Initialize uninitialize function. */
(*receiver) -> ux_device_class_hid_receiver_uninitialize = _ux_device_class_hid_receiver_uninitialize;
+ /* Initialize callback function. */
+ (*receiver) -> ux_device_class_hid_receiver_event_callback =
+ parameter -> ux_device_class_hid_parameter_receiver_event_callback;
+
/* Done success. */
return(UX_SUCCESS);
}
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 0854e88..41eeed4 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +70,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added receiver callback, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_hid_receiver_thread(ULONG hid_instance)
@@ -130,7 +133,7 @@ ULONG temp;
transfer = &hid -> ux_device_class_hid_read_endpoint -> ux_slave_endpoint_transfer_request;
/* Protect read. */
- _ux_utility_mutex_on(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_on(&hid -> ux_device_class_hid_read_mutex);
/* Issue the transfer request. */
status = _ux_device_stack_transfer_request(transfer,
@@ -138,10 +141,10 @@ ULONG temp;
receiver -> ux_device_class_hid_receiver_event_buffer_size);
/* Check status and ignore ZLPs. */
- if (status != UX_SUCCESS ||
- transfer -> ux_slave_transfer_request_actual_length == 0)
+ if ((status != UX_SUCCESS) ||
+ (transfer -> ux_slave_transfer_request_actual_length == 0))
{
- _ux_utility_mutex_off(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_off(&hid -> ux_device_class_hid_read_mutex);
continue;
}
@@ -153,7 +156,7 @@ ULONG temp;
temp); /* Use case of memcpy is verified. */
/* Unprotect read. */
- _ux_utility_mutex_off(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_off(&hid -> ux_device_class_hid_read_mutex);
/* Advance the save position. */
next_pos = (UCHAR *)pos + receiver -> ux_device_class_hid_receiver_event_buffer_size + sizeof(ULONG);
@@ -163,6 +166,10 @@ ULONG temp;
/* Save received data length (it's valid now). */
pos -> ux_device_class_hid_received_event_length = temp;
+
+ /* Notify application that a event is received. */
+ if (receiver -> ux_device_class_hid_receiver_event_callback)
+ receiver -> ux_device_class_hid_receiver_event_callback(hid);
}
}
#endif
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 7fb839e..46adf95 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,8 @@
/* added standalone support, */
/* added interrupt OUT support,*/
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -107,7 +109,7 @@ UX_SLAVE_CLASS *class;
#if !defined(UX_DEVICE_STANDALONE)
/* Free read mutex. */
- _ux_utility_mutex_delete(&hid -> ux_device_class_hid_read_mutex);
+ _ux_device_mutex_delete(&hid -> ux_device_class_hid_read_mutex);
#endif
/* Uninitialize receiver. */
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 16a2803..faae507 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,12 +69,14 @@
/* refined macros names, */
/* added variables initialize, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_activate(UX_SLAVE_CLASS_COMMAND *command)
{
- UINT status;
UX_SLAVE_INTERFACE *interface;
UX_SLAVE_CLASS_PIMA *pima;
UX_SLAVE_CLASS *class;
@@ -136,7 +138,7 @@ UX_SLAVE_ENDPOINT *endpoint_interrupt;
pima -> ux_device_class_pima_device_status = UX_DEVICE_CLASS_PIMA_RC_OK;
/* Resume thread. */
- status = _ux_device_thread_resume(&class -> ux_slave_class_thread);
+ _ux_device_thread_resume(&class -> ux_slave_class_thread);
/* If there is a activate function call it. */
if (pima -> ux_device_class_pima_instance_activate != UX_NULL)
@@ -152,6 +154,6 @@ UX_SLAVE_ENDPOINT *endpoint_interrupt;
UX_TRACE_OBJECT_REGISTER(UX_TRACE_DEVICE_OBJECT_TYPE_INTERFACE, pima, 0, 0, 0)
/* Return completion status. */
- return(status);
+ return(UX_SUCCESS);
}
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 67a06eb..6389da5 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
@@ -39,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_pima_device_info_send PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added sanity checks, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_device_info_send(UX_SLAVE_CLASS_PIMA *pima)
@@ -113,9 +116,6 @@ USHORT *array_pointer;
_ux_utility_long_put(device_info + UX_DEVICE_CLASS_PIMA_DATA_HEADER_TRANSACTION_ID,
pima -> ux_device_class_pima_transaction_id);
- /* Allocate the device info pointer to the beginning of the dynamic device info field. */
- device_info_pointer = device_info + UX_DEVICE_CLASS_PIMA_DEVICE_INFO_VENDOR_EXTENSION_DESC;
-
/* Fill in the standard version field. */
_ux_utility_short_put(device_info + UX_DEVICE_CLASS_PIMA_DEVICE_INFO_STANDARD_VERSION,
UX_DEVICE_CLASS_PIMA_STANDARD_VERSION);
@@ -130,7 +130,7 @@ USHORT *array_pointer;
/* Validate buffer space available. */
UX_ASSERT(UX_DEVICE_CLASS_PIMA_TRANSFER_BUFFER_LENGTH >
- ((ULONG)(device_info_pointer - device_info) +
+ (UX_DEVICE_CLASS_PIMA_DEVICE_INFO_VENDOR_EXTENSION_DESC +
_ux_utility_string_length_get(_ux_device_class_pima_vendor_extension_descriptor) * 2 + 1));
/* Fill in the vendor extension description. */
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 b324dfc..8916010 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,11 +74,17 @@
/* refined macros names, */
/* added cancel callback, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_initialize(UX_SLAVE_CLASS_COMMAND *command)
{
-
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UINT status;
UX_SLAVE_CLASS_PIMA *pima;
UX_SLAVE_CLASS_PIMA_PARAMETER *pima_parameter;
@@ -223,5 +229,6 @@ UX_SLAVE_CLASS *class;
/* Return completion status. */
return(status);
+#endif
}
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 79b392e..cac838e 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
@@ -29,12 +29,13 @@
#include "ux_device_stack.h"
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_pima_interrupt_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +78,9 @@
/* refined macros names, */
/* added transaction ID, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_pima_interrupt_thread(ULONG pima_class)
@@ -178,4 +182,4 @@ UCHAR *buffer;
_ux_device_thread_suspend(&pima -> ux_device_class_pima_interrupt_thread);
}
}
-
+#endif
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 11331d4..18be07a 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +77,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* updated status handling, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_pima_object_info_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle)
@@ -185,9 +188,6 @@ ULONG keywords_length;
/* Copy that string into the keywords field. */
_ux_utility_memory_copy(object_info_pointer, object -> ux_device_class_pima_object_keywords, keywords_length); /* Use case of memcpy is verified. */
-
- /* Point to the end of the variable length. */
- object_info_pointer += keywords_length;
/* Fill in the size of the response header. */
_ux_utility_long_put(object_info + UX_DEVICE_CLASS_PIMA_DATA_HEADER_LENGTH,
diff --git a/common/usbx_device_classes/src/ux_device_class_pima_thread.c b/common/usbx_device_classes/src/ux_device_class_pima_thread.c
index a54b168..249ccb3 100644
--- a/common/usbx_device_classes/src/ux_device_class_pima_thread.c
+++ b/common/usbx_device_classes/src/ux_device_class_pima_thread.c
@@ -29,12 +29,13 @@
#include "ux_device_stack.h"
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_pima_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -120,6 +121,9 @@
/* updated phase states, */
/* refined internal function, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_pima_thread(ULONG pima_class)
@@ -490,4 +494,4 @@ UINT status;
_ux_device_thread_suspend(&class -> ux_slave_class_thread);
}
}
-
+#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 db3579f..1007d29 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,7 +55,7 @@
/* _ux_utility_memory_allocate Allocate memory */
/* _ux_utility_memory_free Free memory */
/* _ux_utility_mutex_create Create mutex */
-/* _ux_utility_mutex_delete Delete mutex */
+/* _ux_device_mutex_delete Delete mutex */
/* */
/* CALLED BY */
/* */
@@ -66,10 +66,17 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_printer_initialize(UX_SLAVE_CLASS_COMMAND *command)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UX_DEVICE_CLASS_PRINTER *printer;
UX_DEVICE_CLASS_PRINTER_PARAMETER *printer_parameter;
@@ -120,7 +127,7 @@ UINT status;
{
/* Delete the endpoint IN mutex. */
- _ux_utility_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* Free the resources. */
_ux_utility_memory_free(printer);
@@ -134,4 +141,5 @@ UINT status;
/* Return completion status. */
return(UX_SUCCESS);
+#endif
}
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 cf8cf0f..a1e506b 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
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_printer_read PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -61,7 +61,7 @@
/* */
/* _ux_device_stack_transfer_request Transfer request */
/* _ux_utility_memory_copy Copy memory */
-/* _ux_utility_mutex_off Release mutex */
+/* _ux_device_mutex_off Release mutex */
/* */
/* CALLED BY */
/* */
@@ -72,6 +72,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_printer_read(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer,
@@ -108,7 +111,7 @@ ULONG local_requested_length;
endpoint = printer -> ux_device_class_printer_endpoint_out;
/* Protect this thread. */
- _ux_utility_mutex_on(&printer -> ux_device_class_printer_endpoint_out_mutex);
+ _ux_device_mutex_on(&printer -> ux_device_class_printer_endpoint_out_mutex);
/* All Printer reading are on the endpoint OUT, from the host. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
@@ -160,7 +163,7 @@ ULONG local_requested_length;
/* We are done. */
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
/* Return with success. */
return(UX_SUCCESS);
@@ -170,7 +173,7 @@ ULONG local_requested_length;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
/* We got an error. */
return(status);
@@ -178,7 +181,7 @@ ULONG local_requested_length;
}
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_out_mutex);
/* Check why we got here, either completion or device was extracted. */
if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
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 9c9483a..9905f2a 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -53,7 +53,7 @@
/* */
/* CALLS */
/* */
-/* _ux_utility_mutex_delete Delete Mutex */
+/* _ux_device_mutex_delete Delete Mutex */
/* _ux_utility_memory_free Free used local memory */
/* */
/* CALLED BY */
@@ -65,6 +65,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_printer_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
@@ -84,10 +87,10 @@ UX_SLAVE_CLASS *class;
{
/* Delete the IN endpoint mutex. */
- _ux_utility_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* Out Mutex. */
- _ux_utility_mutex_delete(&printer -> ux_device_class_printer_endpoint_out_mutex);
+ _ux_device_mutex_delete(&printer -> ux_device_class_printer_endpoint_out_mutex);
/* Free the resources. */
_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 b553bd0..5b1a595 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -60,8 +60,8 @@
/* */
/* _ux_utility_memory_copy Copy memory */
/* _ux_device_stack_transfer_request Transfer request */
-/* _ux_utility_mutex_on Take Mutex */
-/* _ux_utility_mutex_off Release Mutex */
+/* _ux_device_mutex_on Take Mutex */
+/* _ux_device_mutex_off Release Mutex */
/* */
/* CALLED BY */
/* */
@@ -72,6 +72,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_printer_write(UX_DEVICE_CLASS_PRINTER *printer, UCHAR *buffer,
@@ -112,7 +115,7 @@ UINT status = 0;
return(UX_FUNCTION_NOT_SUPPORTED);
/* Protect this thread. */
- _ux_utility_mutex_on(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_on(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* We are writing to the IN endpoint. */
transfer_request = &endpoint -> ux_slave_endpoint_transfer_request;
@@ -128,7 +131,7 @@ UINT status = 0;
status = _ux_device_stack_transfer_request(transfer_request, 0, 0);
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* Return the status. */
return(status);
@@ -176,7 +179,7 @@ UINT status = 0;
{
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* We had an error, abort. */
return(status);
@@ -184,7 +187,7 @@ UINT status = 0;
}
/* Free Mutex resource. */
- _ux_utility_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
+ _ux_device_mutex_off(&printer -> ux_device_class_printer_endpoint_in_mutex);
/* Check why we got here, either completion or device was extracted. */
if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
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 7cf3200..3e0c266 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,11 +72,18 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_activate(UX_SLAVE_CLASS_COMMAND *command)
{
-
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+
UX_SLAVE_INTERFACE *interface;
UX_SLAVE_CLASS_RNDIS *rndis;
UX_SLAVE_CLASS *class;
@@ -211,5 +218,5 @@ ULONG physical_address_lsw;
/* Return completion status. */
return(UX_SUCCESS);
}
+#endif
}
-
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 096c99f..1dbb700 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
@@ -29,12 +29,13 @@
#include "ux_device_stack.h"
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_bulkin_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -58,8 +59,8 @@
/* */
/* _ux_device_stack_transfer_request Request transfer */
/* _ux_utility_event_flags_get Get event flags */
-/* _ux_utility_mutex_on Take mutex */
-/* _ux_utility_mutex_off Release mutex */
+/* _ux_device_mutex_on Take mutex */
+/* _ux_device_mutex_off Release mutex */
/* _ux_utility_long_put Put 32-bit value */
/* nx_packet_transmit_release Release NetX packet */
/* */
@@ -81,6 +82,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_rndis_bulkin_thread(ULONG rndis_class)
@@ -131,7 +135,7 @@ ULONG transfer_length;
{
/* Protect this thread. */
- _ux_utility_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
/* Get the current packet in the list. */
current_packet = rndis -> ux_slave_class_rndis_xmit_queue;
@@ -140,7 +144,7 @@ ULONG transfer_length;
rndis -> ux_slave_class_rndis_xmit_queue = current_packet -> nx_packet_queue_next;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
/* 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)
@@ -204,7 +208,7 @@ ULONG transfer_length;
{
/* Protect the chain of packets. */
- _ux_utility_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
/* Get the current packet in the list. */
current_packet = rndis -> ux_slave_class_rndis_xmit_queue;
@@ -213,7 +217,7 @@ ULONG transfer_length;
rndis -> ux_slave_class_rndis_xmit_queue = current_packet -> nx_packet_queue_next;
/* Free Mutex resource. */
- _ux_utility_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
/* Free the packet */
current_packet -> nx_packet_prepend_ptr = current_packet -> nx_packet_prepend_ptr + UX_DEVICE_CLASS_RNDIS_ETHERNET_SIZE;
@@ -229,4 +233,4 @@ ULONG transfer_length;
_ux_device_thread_suspend(&rndis -> ux_slave_class_rndis_bulkin_thread);
}
}
-
+#endif
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 8148c80..4647933 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
@@ -28,12 +28,14 @@
#include "ux_device_class_rndis.h"
#include "ux_device_stack.h"
+
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_bulkout_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +81,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_rndis_bulkout_thread(ULONG rndis_class)
@@ -215,4 +220,4 @@ ULONG packet_payload;
_ux_device_thread_suspend(&rndis -> ux_slave_class_rndis_bulkout_thread);
}
}
-
+#endif
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 edf09eb..2e4de2d 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
@@ -39,7 +39,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_control_request PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -64,7 +64,7 @@
/* _ux_utility_memory_set Set memory */
/* _ux_utility_memory_copy Copy memory */
/* _ux_utility_long_get Get 32-bit value */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_event_flags_set Set event flags */
/* _ux_device_class_rndis_msg_initialize Command initialize */
/* _ux_device_class_rndis_msg_query Command query */
/* _ux_device_class_rndis_msg_set Command set */
@@ -86,6 +86,9 @@
/* refer to TX symbols instead */
/* of using them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_control_request(UX_SLAVE_CLASS_COMMAND *command)
@@ -181,7 +184,7 @@ UX_SLAVE_CLASS_RNDIS *rndis;
transfer_request_in -> ux_slave_transfer_request_data_pointer[0] = UX_DEVICE_CLASS_RNDIS_INTERRUPT_RESPONSE_AVAILABLE_FLAG;
/* Set an event to wake up the interrupt thread. */
- _ux_utility_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_INTERRUPT_EVENT, UX_OR);
+ _ux_device_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_INTERRUPT_EVENT, UX_OR);
break;
diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_deactivate.c b/common/usbx_device_classes/src/ux_device_class_rndis_deactivate.c
index eabb8fa..466e52a 100644
--- a/common/usbx_device_classes/src/ux_device_class_rndis_deactivate.c
+++ b/common/usbx_device_classes/src/ux_device_class_rndis_deactivate.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_deactivate PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,7 +55,7 @@
/* */
/* _ux_device_stack_transfer_all_request_abort */
/* Abort all transfers */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_event_flags_set Set event flags */
/* _ux_network_driver_deactivate Deactivate NetX USB interface */
/* */
/* CALLED BY */
@@ -75,6 +75,9 @@
/* 08-02-2021 Wen Wang Modified comment(s), */
/* fixed spelling error, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_deactivate(UX_SLAVE_CLASS_COMMAND *command)
@@ -112,7 +115,7 @@ UX_SLAVE_CLASS *class;
/* We have 2 threads waiting for an event, interrupt and bulk in. We wake them up with
a DEVICE_STATE_CHANGE event. In turn they will release the NetX resources used and suspend. */
- _ux_utility_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
+ _ux_device_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_DEVICE_STATE_CHANGE_EVENT, UX_OR);
/* If there is a deactivate function call it. */
if (rndis -> ux_slave_class_rndis_parameter.ux_slave_class_rndis_instance_deactivate != UX_NULL)
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 42bbed8..f795b09 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -103,7 +103,7 @@ ULONG ux_device_class_rndis_oid_supported_list[UX_DEVICE_CLASS_RNDIS_OID_SUPPORT
/* _ux_utility_event_flags_create Create Flag group */
/* _ux_utility_event_flags_delete Delete Flag group */
/* _ux_utility_mutex_create Create mutex */
-/* _ux_utility_mutex_delete Delete mutex */
+/* _ux_device_mutex_delete Delete mutex */
/* _ux_device_semaphore_create Create semaphore */
/* _ux_device_semaphore_delete Delete semaphore */
/* _ux_device_thread_create Create thread */
@@ -129,10 +129,17 @@ ULONG ux_device_class_rndis_oid_supported_list[UX_DEVICE_CLASS_RNDIS_OID_SUPPORT
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_initialize(UX_SLAVE_CLASS_COMMAND *command)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UX_SLAVE_CLASS_RNDIS *rndis;
UX_SLAVE_CLASS_RNDIS_PARAMETER *rndis_parameter;
@@ -365,12 +372,12 @@ UINT status;
/* Delete rndis -> ux_slave_class_rndis_mutex. */
if (rndis -> ux_slave_class_rndis_mutex.tx_mutex_id != 0)
- _ux_utility_mutex_delete(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_delete(&rndis -> ux_slave_class_rndis_mutex);
/* Free memory for rndis instance. */
_ux_utility_memory_free(rndis);
/* Return completion status. */
return(status);
+#endif
}
-
diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_interrupt_thread.c b/common/usbx_device_classes/src/ux_device_class_rndis_interrupt_thread.c
index 11dc1a9..9352afa 100644
--- a/common/usbx_device_classes/src/ux_device_class_rndis_interrupt_thread.c
+++ b/common/usbx_device_classes/src/ux_device_class_rndis_interrupt_thread.c
@@ -29,12 +29,13 @@
#include "ux_device_stack.h"
+#if !defined(UX_DEVICE_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_interrupt_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +76,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_rndis_interrupt_thread(ULONG rndis_class)
@@ -137,4 +141,4 @@ ULONG actual_flags;
}
}
-
+#endif
diff --git a/common/usbx_device_classes/src/ux_device_class_rndis_write.c b/common/usbx_device_classes/src/ux_device_class_rndis_write.c
index 4c695db..49f4720 100644
--- a/common/usbx_device_classes/src/ux_device_class_rndis_write.c
+++ b/common/usbx_device_classes/src/ux_device_class_rndis_write.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_rndis_write PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,9 +55,9 @@
/* */
/* CALLS */
/* */
-/* _ux_utility_mutex_on Take mutex */
-/* _ux_utility_mutex_off Free mutex */
-/* _ux_utility_event_flags_set Set event flags */
+/* _ux_device_mutex_on Take mutex */
+/* _ux_device_mutex_off Free mutex */
+/* _ux_device_event_flags_set Set event flags */
/* */
/* CALLED BY */
/* */
@@ -73,10 +73,18 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_rndis_write(VOID *rndis_class, NX_PACKET *packet)
{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(rndis_class);
+ UX_PARAMETER_NOT_USED(packet);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
NX_PACKET *current_packet;
NX_PACKET *next_packet;
@@ -86,7 +94,7 @@ UX_SLAVE_CLASS_RNDIS *rndis;
rndis = (UX_SLAVE_CLASS_RNDIS *) rndis_class;
/* Protect this thread. */
- _ux_utility_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_on(&rndis -> ux_slave_class_rndis_mutex);
/* Check the queue. See if there is something that is being sent. */
if (rndis -> ux_slave_class_rndis_xmit_queue == UX_NULL)
@@ -120,15 +128,15 @@ UX_SLAVE_CLASS_RNDIS *rndis;
}
/* Free Mutex resource. */
- _ux_utility_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
+ _ux_device_mutex_off(&rndis -> ux_slave_class_rndis_mutex);
/* The packet to be sent is the last in the chain. */
packet -> nx_packet_queue_next = NX_NULL;
/* Set an event to wake up the bulkin thread. */
- _ux_utility_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_BULKIN_EVENT, UX_OR);
+ _ux_device_event_flags_set(&rndis -> ux_slave_class_rndis_event_flags_group, UX_DEVICE_CLASS_RNDIS_NEW_BULKIN_EVENT, UX_OR);
/* We are done here. */
return(UX_SUCCESS);
+#endif
}
-
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 138ebc3..6f31b43 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
@@ -65,7 +65,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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -112,6 +112,9 @@ UCHAR usbx_device_class_storage_mode_sense_page_cdrom[USBX_DEVICE_CLASS_STORAGE_
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_device_class_storage_mode_sense(UX_SLAVE_CLASS_STORAGE *storage,
@@ -242,7 +245,6 @@ ULONG page_length;
*(page_pointer + 1) = UX_SLAVE_CLASS_STORAGE_IEC_MODE_PAGE_PAGE_LENGTH;
mode_data_length += page_length;
- page_pointer += page_length;
}
/* Put the payload length in the header. */
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 c7d3026..9bf65ff 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.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -120,6 +120,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_device_class_storage_thread(ULONG storage_class)
@@ -157,9 +160,6 @@ UCHAR *cbw_cb;
while (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED)
{
- /* We assume the worst situation. */
- status = UX_ERROR;
-
/* We are activated. We need the interface to the class. */
interface = storage -> ux_slave_class_storage_interface;
diff --git a/common/usbx_device_classes/src/ux_device_class_video_activate.c b/common/usbx_device_classes/src/ux_device_class_video_activate.c
new file mode 100644
index 0000000..07681fb
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_activate.c
@@ -0,0 +1,165 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_activate PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function initializes the USB Video device. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to video command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_system_error_handler System error trap */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_activate(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_SLAVE_DEVICE *device;
+UX_SLAVE_INTERFACE *interface;
+UX_SLAVE_INTERFACE *control_interface;
+UX_SLAVE_INTERFACE *stream_interface;
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_CLASS *class_inst;
+ULONG stream_index;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ video = (UX_DEVICE_CLASS_VIDEO *) class_inst -> ux_slave_class_instance;
+
+ /* Get the interface that owns this instance. */
+ interface = (UX_SLAVE_INTERFACE *) command -> ux_slave_class_command_interface;
+
+ /* Get the device instance. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+ video -> ux_device_class_video_device = device;
+
+ /* We only support video interface here. */
+ if (interface -> ux_slave_interface_descriptor.bInterfaceClass != UX_DEVICE_CLASS_VIDEO_CLASS)
+ return(UX_NO_CLASS_MATCH);
+
+ /* It's control interface? */
+ if (interface -> ux_slave_interface_descriptor.bInterfaceSubClass == UX_DEVICE_CLASS_VIDEO_SUBCLASS_CONTROL)
+ {
+
+ /* Store the interface in the class instance. */
+ video -> ux_device_class_video_interface = interface;
+
+ /* Store the class instance into the interface. */
+ interface -> ux_slave_interface_class_instance = (VOID *)video;
+ }
+ else
+ {
+
+ /* It's streaming interface. */
+ stream_interface = interface;
+
+ /* Separate driver for each interface (IAD not used)? */
+ if (video -> ux_device_class_video_interface == UX_NULL)
+ {
+
+ /* Always use just 1 stream for 1 interface. */
+ stream_index = 0;
+ }
+
+ /* Re-use the same driver (IAD used)? */
+ else
+ {
+
+ /* Re-use saved control interface. */
+ control_interface = video -> ux_device_class_video_interface;
+
+ /* Calculate stream index. */
+ stream_index = stream_interface -> ux_slave_interface_descriptor.bInterfaceNumber;
+ stream_index -= control_interface -> ux_slave_interface_descriptor.bInterfaceNumber;
+ stream_index --;
+
+ }
+
+ /* Sanity check. */
+ if (stream_index >= video -> ux_device_class_video_streams_nb)
+ {
+
+ /* Error trap! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_MEMORY_INSUFFICIENT);
+ return(UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Locate stream based on interface number. */
+ stream = &video -> ux_device_class_video_streams[stream_index];
+
+ /* Store the interface for the stream. */
+ stream -> ux_device_class_video_stream_interface = stream_interface;
+
+ /* Store the class instance into the interface. */
+ stream_interface -> ux_slave_interface_class_instance = (VOID *)video;
+ }
+
+ /* If there is a activate function call it. */
+ if (video -> ux_device_class_video_callbacks.ux_slave_class_video_instance_activate != UX_NULL)
+ {
+
+ /* Invoke the application. */
+ video -> ux_device_class_video_callbacks.ux_slave_class_video_instance_activate(video);
+ }
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..723773e
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_change.c
@@ -0,0 +1,191 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_change PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function changes the interface of the Video device */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to video command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_system_error_handler System error trap */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_change(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_CLASS *class_inst;
+UX_SLAVE_INTERFACE *interface;
+UX_SLAVE_ENDPOINT *endpoint;
+UCHAR *payload_buffer;
+ULONG stream_index;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ video = (UX_DEVICE_CLASS_VIDEO *) class_inst -> ux_slave_class_instance;
+
+ /* Get the interface that owns this instance. */
+ interface = (UX_SLAVE_INTERFACE *) command -> ux_slave_class_command_interface;
+
+ /* Get the interface number (base 0). */
+ if (video -> ux_device_class_video_interface)
+ {
+
+ /* If IAD used, calculate stream index based on interface number. */
+ stream_index = interface -> ux_slave_interface_descriptor.bInterfaceNumber;
+ stream_index -= video -> ux_device_class_video_interface -> ux_slave_interface_descriptor.bInterfaceNumber;
+ stream_index --;
+ }
+ else
+
+ /* One stream for one driver! */
+ stream_index = 0;
+
+ /* Get the stream instance. */
+ stream = &video -> ux_device_class_video_streams[stream_index];
+
+ /* Update the interface. */
+ stream -> ux_device_class_video_stream_interface = interface;
+
+ /* If the interface to mount has a non zero alternate setting, the class is really active with
+ the endpoints active. If the interface reverts to alternate setting 0, it needs to have
+ the pending transactions terminated. */
+ if (interface -> ux_slave_interface_descriptor.bAlternateSetting != 0)
+ {
+
+ /* Locate the endpoints. ISO IN/OUT for Streaming Interface. */
+ endpoint = interface -> ux_slave_interface_first_endpoint;
+
+ /* Parse all endpoints. */
+ stream -> ux_device_class_video_stream_endpoint = UX_NULL;
+ while (endpoint != UX_NULL)
+ {
+
+ /* Check the endpoint. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bmAttributes & UX_MASK_ENDPOINT_TYPE) == UX_ISOCHRONOUS_ENDPOINT)
+ {
+
+ /* We found the endpoint, check its size. */
+ if (endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_transfer_length >
+ (stream -> ux_device_class_video_stream_payload_buffer_size - 4))
+ {
+
+ /* Error trap! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_MEMORY_INSUFFICIENT);
+
+ /* payload buffer too small for endpoints. */
+ return(UX_MEMORY_INSUFFICIENT);
+ }
+
+ /* Save it. */
+ stream -> ux_device_class_video_stream_endpoint = endpoint;
+ break;
+ }
+
+ /* Next endpoint. */
+ endpoint = endpoint -> ux_slave_endpoint_next_endpoint;
+ }
+
+ /* Now check if all endpoints have been found. */
+ if (stream -> ux_device_class_video_stream_endpoint == UX_NULL)
+ {
+
+ /* Error trap! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_DESCRIPTOR_CORRUPTED);
+
+ /* Not all endpoints have been found. Major error, do not proceed. */
+ return(UX_DESCRIPTOR_CORRUPTED);
+ }
+
+ /* Now reset payload buffers. */
+ payload_buffer = stream -> ux_device_class_video_stream_buffer;
+ while(payload_buffer < stream -> ux_device_class_video_stream_buffer + stream -> ux_device_class_video_stream_buffer_size)
+ {
+
+ /* Reset header information. */
+ *((ULONG *) payload_buffer ) = 0;
+
+ /* Next. */
+ payload_buffer += stream -> ux_device_class_video_stream_payload_buffer_size;
+ }
+ stream -> ux_device_class_video_stream_transfer_pos = stream -> ux_device_class_video_stream_access_pos;
+ }
+ else
+ {
+
+ /* There is no data endpoint. */
+ stream -> ux_device_class_video_stream_endpoint = UX_NULL;
+
+ /* In this case, we are reverting to the Alternate Setting 0. We need to terminate the pending transactions. */
+ /* Endpoints actually aborted and destroyed before change command. */
+ /*
+ _ux_device_stack_transfer_all_request_abort(stream -> ux_device_class_video_stream_endpoint, UX_TRANSFER_APPLICATION_RESET);
+ */
+ }
+
+ /* Invoke stream change callback. */
+ if (stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_change)
+ stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_change(stream, interface -> ux_slave_interface_descriptor.bAlternateSetting);
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_video_control_request.c b/common/usbx_device_classes/src/ux_device_class_video_control_request.c
new file mode 100644
index 0000000..3bfe4aa
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_control_request.c
@@ -0,0 +1,240 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_control_request PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function manages the based sent by the host on the control */
+/* endpoints with a CLASS or VENDOR SPECIFIC type. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_endpoint_stall Endpoint stall */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_control_request(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_SLAVE_TRANSFER *transfer_request;
+UX_SLAVE_DEVICE *device;
+UX_SLAVE_CLASS *class_inst;
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+ULONG stream_index;
+UCHAR request_type;
+UCHAR request;
+UCHAR index_low;
+ULONG value_cs;
+UCHAR *buffer;
+UINT status;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the video instance from this class container. */
+ video = (UX_DEVICE_CLASS_VIDEO *) class_inst -> ux_slave_class_instance;
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* Get the pointer to the transfer request associated with the control endpoint. */
+ transfer_request = &device -> ux_slave_device_control_endpoint.ux_slave_endpoint_transfer_request;
+
+ /* Get bmRequestType, wValue and wIndex low byte. */
+ request_type = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_REQUEST_TYPE];
+ request = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_REQUEST];
+ value_cs = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_VALUE + 1];
+ index_low = transfer_request -> ux_slave_transfer_request_setup[UX_SETUP_INDEX];
+ buffer = transfer_request -> ux_slave_transfer_request_data_pointer;
+
+ /* Check request target (only target interface is supported now). */
+ if ((request_type & UX_REQUEST_TARGET) != UX_REQUEST_TARGET_INTERFACE)
+ return(UX_ERROR);
+
+ /* Check request interface (wIndex low) of control. */
+ if (index_low == video -> ux_device_class_video_interface -> ux_slave_interface_descriptor.bInterfaceNumber)
+ {
+
+ /* Check control selector. */
+ switch(value_cs)
+ {
+ case UX_DEVICE_CLASS_VIDEO_VC_REQUEST_ERROR_CODE_CONTROL:
+
+ /* Must have at least 1 byte buffer. */
+ if (transfer_request->ux_slave_transfer_request_requested_length < 1)
+ return(UX_ERROR);
+
+ /* GET_CUR. */
+ if (request == UX_DEVICE_CLASS_VIDEO_GET_CUR)
+ {
+
+ /* Fill bRequestErrorCode. */
+ *buffer = (UCHAR)video -> ux_device_class_video_error;
+
+ /* Send data. */
+ status = _ux_device_stack_transfer_request(transfer_request, 1, 1);
+ return(status);
+ }
+
+ /* GET_INFO. */
+ if (request == UX_DEVICE_CLASS_VIDEO_GET_INFO)
+ {
+
+ /* Support GET_CUR | GET_INFO. */
+ *buffer = UX_DEVICE_CLASS_VIDEO_INFO_GET_REQUEST_SUPPORT;
+
+ /* Send data. */
+ status = _ux_device_stack_transfer_request(transfer_request, 1, 1);
+ return(status);
+ }
+
+ /* Request not expected. */
+ return(UX_ERROR);
+
+ default:
+ break;
+ }
+
+ /* By default it's not handled. */
+ status = UX_ERROR;
+
+ /* Invoke callback. */
+ if (video -> ux_device_class_video_callbacks.ux_device_class_video_request != UX_NULL)
+ {
+
+ /* Handled by callback. */
+ status = video -> ux_device_class_video_callbacks.ux_device_class_video_request(video, transfer_request);
+ }
+ return(status);
+ }
+
+ /* Check request index of stream. */
+ stream = video -> ux_device_class_video_streams;
+ for (stream_index = 0; stream_index < video -> ux_device_class_video_streams_nb; stream_index ++)
+ {
+
+ /* No stream. */
+ if (stream -> ux_device_class_video_stream_interface == UX_NULL)
+ break;
+
+ /* Check interface number. */
+ if (index_low == stream -> ux_device_class_video_stream_interface ->
+ ux_slave_interface_descriptor.bInterfaceNumber)
+ {
+
+ /* Check control selector. */
+ switch(value_cs)
+ {
+ case UX_DEVICE_CLASS_VIDEO_VS_STREAM_ERROR_CODE_CONTROL:
+
+ /* Must have at least 1 byte buffer. */
+ if (transfer_request->ux_slave_transfer_request_requested_length < 1)
+ return(UX_ERROR);
+
+ /* GET_CUR. */
+ if (request == UX_DEVICE_CLASS_VIDEO_GET_CUR)
+ {
+
+ /* Fill bRequestErrorCode. */
+ *buffer = (UCHAR)stream -> ux_device_class_video_stream_error;
+
+ /* Send data. */
+ status = _ux_device_stack_transfer_request(transfer_request, 1, 1);
+ return(status);
+ }
+
+ /* GET_INFO. */
+ if (request == UX_DEVICE_CLASS_VIDEO_GET_INFO)
+ {
+
+ /* Support GET_CUR | GET_INFO. */
+ *buffer = UX_DEVICE_CLASS_VIDEO_INFO_GET_REQUEST_SUPPORT;
+
+ /* Send data. */
+ status = _ux_device_stack_transfer_request(transfer_request, 1, 1);
+ return(status);
+ }
+
+ /* Request not expected. */
+ return(UX_ERROR);
+
+ default:
+ break;
+ }
+
+ /* By default it's not handled. */
+ status = UX_ERROR;
+
+ /* Invoke callback. */
+ if (stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_request != UX_NULL)
+ {
+
+ /* Handled by callback. */
+ status = stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_request(stream, transfer_request);
+ }
+ return(status);
+ }
+
+ /* Next stream. */
+ stream ++;
+ }
+
+ /* Not handled. */
+ return(UX_ERROR);
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_video_deactivate.c b/common/usbx_device_classes/src/ux_device_class_video_deactivate.c
new file mode 100644
index 0000000..5556968
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_deactivate.c
@@ -0,0 +1,116 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_deactivate PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function deactivate an instance of the video class. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to a class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_stack_transfer_all_request_abort */
+/* Abort all transfers */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_deactivate(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_CLASS *class_inst;
+UINT i;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ video = (UX_DEVICE_CLASS_VIDEO *) class_inst -> ux_slave_class_instance;
+
+ /* Stop pending streams. */
+ stream = video -> ux_device_class_video_streams;
+ for (i = 0; i < video -> ux_device_class_video_streams_nb; i ++)
+ {
+
+ /* Locate the endpoint. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+
+ /* Terminate the transactions pending on the endpoint. */
+ if (endpoint)
+ _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET);
+
+ /* Free the stream. */
+ stream -> ux_device_class_video_stream_endpoint = UX_NULL;
+ stream -> ux_device_class_video_stream_interface = UX_NULL;
+
+ stream ++;
+ }
+
+ /* Free the control. */
+ video -> ux_device_class_video_interface = UX_NULL;
+
+ /* If there is a deactivate function call it. */
+ if (video -> ux_device_class_video_callbacks.ux_slave_class_video_instance_deactivate != UX_NULL)
+
+ /* Invoke the application. */
+ video -> ux_device_class_video_callbacks.ux_slave_class_video_instance_deactivate(video);
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..c1debee
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_entry.c
@@ -0,0 +1,157 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is the entry point of the video class. It */
+/* will be called by the device stack enumeration module when the */
+/* host has sent a SET_CONFIGURATION command and the video interface */
+/* needs to be mounted. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_device_class_video_initialize Initialize video class */
+/* _ux_device_class_video_uninitialize Uninitialize video class */
+/* _ux_device_class_video_activate Activate video class */
+/* _ux_device_class_video_change Change video interface */
+/* _ux_device_class_video_deactivate Deactivate video class */
+/* _ux_device_class_video_control_request Request control */
+/* */
+/* CALLED BY */
+/* */
+/* Device Stack */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_entry(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UINT status;
+
+
+ /* The command request will tell us we need to do here, either a enumeration
+ query, an activation or a deactivation. */
+ switch (command -> ux_slave_class_command_request)
+ {
+
+ case UX_SLAVE_CLASS_COMMAND_INITIALIZE:
+
+ /* Call the init function of the Video class. */
+ status = _ux_device_class_video_initialize(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_UNINITIALIZE:
+
+ /* Call the init function of the Video class. */
+ status = _ux_device_class_video_uninitialize(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_QUERY:
+
+ /* Check the CLASS definition in the interface descriptor. */
+ if (command -> ux_slave_class_command_class == UX_DEVICE_CLASS_VIDEO_CLASS)
+ {
+ if (command -> ux_slave_class_command_subclass == UX_DEVICE_CLASS_VIDEO_SUBCLASS_CONTROL)
+ return(UX_SUCCESS);
+ if (command -> ux_slave_class_command_subclass == UX_DEVICE_CLASS_VIDEO_SUBCLASS_STREAMING)
+ return(UX_SUCCESS);
+ }
+ return(UX_NO_CLASS_MATCH);
+
+ case UX_SLAVE_CLASS_COMMAND_ACTIVATE:
+
+ /* The activate command is used when the host has sent a SET_CONFIGURATION command
+ and this interface has to be mounted. Both Bulk endpoints have to be mounted
+ and the video thread needs to be activated. */
+ status = _ux_device_class_video_activate(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_CHANGE:
+
+ /* The change command is used when the host has sent a SET_INTERFACE command
+ to go from Alternate Setting 0 to 1 or revert to the default mode. */
+ status = _ux_device_class_video_change(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_DEACTIVATE:
+
+ /* The deactivate command is used when the device has been extracted.
+ The device endpoints have to be dismounted and the video thread canceled. */
+ status = _ux_device_class_video_deactivate(command);
+
+ /* Return the completion status. */
+ return(status);
+
+ case UX_SLAVE_CLASS_COMMAND_REQUEST:
+
+ /* The request command is used when the host sends a command on the control endpoint. */
+ _ux_device_class_video_control_request(command);
+
+ /* Return the completion status. */
+ return(UX_SUCCESS);
+
+ default:
+
+ /* Return an error. */
+ return(UX_FUNCTION_NOT_SUPPORTED);
+ }
+}
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
new file mode 100644
index 0000000..8ffb9fe
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_initialize.c
@@ -0,0 +1,243 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_initialize PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function initializes the USB Video device. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to video command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_memory_allocate Allocate memory */
+/* _ux_utility_memory_copy Copy memory */
+/* _ux_utility_memory_free Free memory */
+/* _ux_utility_thread_create Create thread to use */
+/* _ux_utility_thread_delete Delete thread */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_initialize(UX_SLAVE_CLASS_COMMAND *command)
+{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+
+UINT status = UX_SUCCESS;
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_PARAMETER *video_parameter;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_DEVICE_CLASS_VIDEO_STREAM_PARAMETER *stream_parameter;
+UX_SLAVE_CLASS *class_inst;
+ULONG memory_size;
+ULONG streams_size;
+ULONG i;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the pointer to the application parameters for the video class. */
+ video_parameter = (UX_DEVICE_CLASS_VIDEO_PARAMETER *)command -> ux_slave_class_command_parameter;
+
+ /* Create an instance of the device video class, with additional streams and controls instances. */
+ memory_size = sizeof(UX_DEVICE_CLASS_VIDEO);
+
+ /* Put 0 to default result. */
+ streams_size = 0;
+
+ /* Confirm there is no overflow on multiply. */
+ UX_UTILITY_MULC_SAFE(video_parameter -> ux_device_class_video_parameter_streams_nb, (ULONG)sizeof(UX_DEVICE_CLASS_VIDEO_STREAM), streams_size, status);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Confirm there is no overflow on add. */
+ UX_UTILITY_ADD_SAFE(memory_size, streams_size, memory_size, status);
+ if (status != UX_SUCCESS)
+ return(status);
+
+ /* Create buffer for video and controls. */
+ video = (UX_DEVICE_CLASS_VIDEO *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size);
+
+ /* Check for successful allocation. */
+ if (video == UX_NULL)
+ return(UX_MEMORY_INSUFFICIENT);
+
+ /* Save streams. */
+ if (streams_size)
+ {
+ video -> ux_device_class_video_streams = (UX_DEVICE_CLASS_VIDEO_STREAM *)((UCHAR *)video + sizeof(UX_DEVICE_CLASS_VIDEO));
+ video -> ux_device_class_video_streams_nb = video_parameter -> ux_device_class_video_parameter_streams_nb;
+ }
+
+ /* Allocate resources for streams. */
+ stream = video -> ux_device_class_video_streams;
+ stream_parameter = video_parameter -> ux_device_class_video_parameter_streams;
+ for (i = 0; i < video -> ux_device_class_video_streams_nb; i ++)
+ {
+
+ /* Create memory block based on max payload buffer size and max number of payloads buffered.
+ Each payload require some additional header memory (8 bytes). */
+ stream -> ux_device_class_video_stream_payload_buffer_size = stream_parameter -> ux_device_class_video_stream_parameter_max_payload_buffer_size;
+
+ if (UX_OVERFLOW_CHECK_ADD_USHORT(stream -> ux_device_class_video_stream_payload_buffer_size, 4))
+ {
+ status = UX_ERROR;
+ break;
+ }
+ stream -> ux_device_class_video_stream_payload_buffer_size += 4;
+
+ if (UX_OVERFLOW_CHECK_MULV_ULONG(stream -> ux_device_class_video_stream_payload_buffer_size,
+ stream_parameter -> ux_device_class_video_stream_parameter_max_payload_buffer_nb))
+ {
+ status = UX_ERROR;
+ break;
+ }
+ memory_size = stream -> ux_device_class_video_stream_payload_buffer_size *
+ stream_parameter -> ux_device_class_video_stream_parameter_max_payload_buffer_nb;
+
+ /* Create block of buffer buffer is cache safe for USB transfer. */
+ stream -> ux_device_class_video_stream_buffer = (UCHAR *)_ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size);
+
+ /* Check for successful allocation. */
+ if (stream -> ux_device_class_video_stream_buffer == UX_NULL)
+ {
+ status = UX_MEMORY_INSUFFICIENT;
+ break;
+ }
+
+ stream -> ux_device_class_video_stream_buffer_size = memory_size;
+ 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;
+
+ /* Create memory block for streaming thread stack in addition. */
+ if (stream_parameter -> ux_device_class_video_stream_parameter_thread_stack_size == 0)
+ memory_size = UX_DEVICE_CLASS_VIDEO_THREAD_STACK_SIZE;
+ else
+ memory_size = stream_parameter -> ux_device_class_video_stream_parameter_thread_stack_size;
+ stream -> ux_device_class_video_stream_thread_stack = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, memory_size);
+
+ /* Check for successful allocation. */
+ if (stream -> ux_device_class_video_stream_thread_stack == UX_NULL)
+ {
+ status = UX_MEMORY_INSUFFICIENT;
+ break;
+ }
+
+ /* Create streaming thread. */
+ status = _ux_utility_thread_create(&stream -> ux_device_class_video_stream_thread , "ux_device_class_video_stream_thread",
+ stream_parameter -> ux_device_class_video_stream_parameter_thread_entry,
+ (ULONG)(ALIGN_TYPE)stream, (VOID *) stream -> ux_device_class_video_stream_thread_stack,
+ memory_size, UX_THREAD_PRIORITY_CLASS,
+ UX_THREAD_PRIORITY_CLASS, UX_NO_TIME_SLICE, UX_DONT_START);
+
+ /* Check for successful allocation. */
+ if (status != UX_SUCCESS)
+ break;
+
+ UX_THREAD_EXTENSION_PTR_SET(&(stream -> ux_device_class_video_stream_thread), stream)
+
+ /* Save callbacks. */
+ _ux_utility_memory_copy(&stream -> ux_device_class_video_stream_callbacks,
+ &stream_parameter -> ux_device_class_video_stream_parameter_callbacks,
+ sizeof(UX_DEVICE_CLASS_VIDEO_STREAM_CALLBACKS)); /* Use case of memcpy is verified. */
+
+ /* Save video instance. */
+ stream -> ux_device_class_video_stream_video = video;
+
+ stream ++;
+ stream_parameter ++;
+ }
+
+ /* Check for successful creation. */
+ if (status == UX_SUCCESS)
+ {
+
+ /* Save the address of the Video instance inside the Video container. */
+ class_inst -> ux_slave_class_instance = (VOID *) video;
+
+ /* Link to class instance. */
+ video -> ux_device_class_video_class = class_inst;
+
+ /* Save callbacks. */
+ _ux_utility_memory_copy(&video -> ux_device_class_video_callbacks,
+ &video_parameter -> ux_device_class_video_parameter_callbacks,
+ sizeof(UX_DEVICE_CLASS_VIDEO_CALLBACKS)); /* Use case of memcpy is verified. */
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+ }
+
+ /* Error trap! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, status);
+
+ /* Free allocated resources. */
+ stream = video -> ux_device_class_video_streams;
+ for (i = 0; i < video -> ux_device_class_video_streams_nb; i ++)
+ {
+ if (stream -> ux_device_class_video_stream_thread.tx_thread_id)
+ _ux_utility_thread_delete(&stream -> ux_device_class_video_stream_thread);
+ if (stream -> ux_device_class_video_stream_thread_stack)
+ _ux_utility_memory_free(stream -> ux_device_class_video_stream_thread_stack);
+ if (stream -> ux_device_class_video_stream_buffer)
+ _ux_utility_memory_free(stream -> ux_device_class_video_stream_buffer);
+ stream ++;
+ }
+ _ux_utility_memory_free(video);
+
+ return(status);
+#endif
+}
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
new file mode 100644
index 0000000..55aa725
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_ioctl.c
@@ -0,0 +1,105 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_ioctl PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function performs certain functions on the video instance */
+/* */
+/* INPUT */
+/* */
+/* video Address of video class */
+/* instance */
+/* ioctl_function IOCTL function code */
+/* parameter Parameter for function */
+/* */
+/* OUTPUT */
+/* */
+/* Status */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_ioctl(UX_DEVICE_CLASS_VIDEO *video, ULONG ioctl_function,
+ VOID *parameter)
+{
+
+UINT status;
+VOID **pptr_parameter;
+
+
+ /* Let's be optimist ! */
+ status = UX_SUCCESS;
+
+ /* The command request will tell us what we need to do here. */
+ switch (ioctl_function)
+ {
+
+ case UX_DEVICE_CLASS_VIDEO_IOCTL_GET_ARG:
+
+ /* Properly cast the parameter pointer. */
+ pptr_parameter = (VOID **) parameter;
+
+ /* Save argument. */
+ *pptr_parameter = video -> ux_device_class_video_callbacks.ux_device_class_video_arg;
+
+ break;
+
+ default:
+
+ /* Function not supported. Return an error. */
+ status = UX_FUNCTION_NOT_SUPPORTED;
+ }
+
+ /* Return status to caller. */
+ return(status);
+
+}
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
new file mode 100644
index 0000000..d7315e2
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_max_payload_get.c
@@ -0,0 +1,92 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_max_payload_length PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function return max payload length in the Video stream. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* None */
+/* */
+/* CALLED BY */
+/* */
+/* Application */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+ULONG _ux_device_class_video_max_payload_length(UX_DEVICE_CLASS_VIDEO_STREAM *stream)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ return(0);
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(0);
+
+ /* Return enumerated payload size. */
+ return(endpoint -> ux_slave_endpoint_transfer_request.
+ ux_slave_transfer_request_transfer_length);
+}
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
new file mode 100644
index 0000000..cdcb750
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_read_payload_free.c
@@ -0,0 +1,123 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_read_payload_free PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function free access buffer for transfer in the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_read_payload_free(UX_DEVICE_CLASS_VIDEO_STREAM *stream)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+UCHAR *next_payload;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) != UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Underflow!! */
+ if (stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length == 0)
+ {
+ return(UX_BUFFER_OVERFLOW);
+ }
+
+ /* Calculate next payload. */
+ if (stream -> ux_device_class_video_stream_access_pos != stream -> ux_device_class_video_stream_transfer_pos)
+ {
+ next_payload = (UCHAR *)stream -> ux_device_class_video_stream_access_pos;
+ next_payload += stream -> ux_device_class_video_stream_payload_buffer_size;
+ if (next_payload >= stream -> ux_device_class_video_stream_buffer + stream -> ux_device_class_video_stream_buffer_size)
+ next_payload = stream -> ux_device_class_video_stream_buffer;
+
+ /* Re-free current payload. */
+ stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length = 0;
+
+ /* Move to next payload. */
+ stream -> ux_device_class_video_stream_access_pos = (UX_DEVICE_CLASS_VIDEO_PAYLOAD *)next_payload;
+ }
+ else
+
+ /* Just re-free current payload. */
+ stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length = 0;
+
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..b2d22b5
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_read_payload_get.c
@@ -0,0 +1,112 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_read_payload_get PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function obtain payload access pointer from the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* payload_data Pointer to buffer to save */
+/* pointer to payload data */
+/* payload_length Pointer to buffer to save */
+/* Pointer to payload length */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_read_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream,
+ UCHAR **payload_data, ULONG *payload_length)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) != UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Underflow!! */
+ if (stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length == 0)
+ {
+ return(UX_BUFFER_OVERFLOW);
+ }
+
+ /* Obtain payload structure pointer. */
+ *payload_data = stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_data;
+ *payload_length = stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length;
+
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..e9cd669
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_read_thread_entry.c
@@ -0,0 +1,164 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+#if !defined(UX_DEVICE_STANDALONE)
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_read_thread_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is thread of ISO OUT from the Video class. */
+/* */
+/* INPUT */
+/* */
+/* video_stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_system_error_handler System error trap */
+/* _ux_utility_thread_suspend Suspend thread used */
+/* _ux_device_stack_transfer_request Issue transfer request */
+/* _ux_utility_memory_copy Copy data */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+VOID _ux_device_class_video_read_thread_entry(ULONG video_stream)
+{
+
+UINT status;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_DEVICE *device;
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer;
+UCHAR *next_pos;
+UX_DEVICE_CLASS_VIDEO_PAYLOAD *next_payload;
+ULONG max_packet_size;
+ULONG actual_length;
+
+
+ /* Get Video class instance. */
+ UX_THREAD_EXTENSION_PTR_GET(stream, UX_DEVICE_CLASS_VIDEO_STREAM, video_stream)
+
+ /* Get stack device instance. */
+ device = stream -> ux_device_class_video_stream_video -> ux_device_class_video_device;
+
+ /* This thread runs forever but can be suspended or resumed. */
+ while(1)
+ {
+ max_packet_size = 0;
+ while (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED)
+ {
+
+ /* Get endpoint instance. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+
+ /* Endpoint not available, maybe it's alternate setting 0. */
+ if (endpoint == UX_NULL)
+ break;
+
+ /* Calculate transfer size based on packet size and number transactions once endpoint is available. */
+ if (max_packet_size == 0)
+ max_packet_size = endpoint -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_transfer_length;
+
+ /* Get transfer instance. */
+ transfer = &endpoint -> ux_slave_endpoint_transfer_request;
+
+ /* Start payload transfer anyway. */
+ status = _ux_device_stack_transfer_request(transfer, max_packet_size, max_packet_size);
+
+ /* Check error. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Error notification! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_ERROR);
+ break;
+ }
+
+ /* Get actual transfer length. */
+ actual_length = transfer -> ux_slave_transfer_request_actual_length;
+
+ /* Frame received, log it. */
+ stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length = actual_length;
+ _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. */
+
+ /* For simple, do not advance the transfer position if there is overflow. */
+ next_pos = (UCHAR *)stream -> ux_device_class_video_stream_transfer_pos;
+ next_pos += stream -> ux_device_class_video_stream_payload_buffer_size;
+ if (next_pos >= stream -> ux_device_class_video_stream_buffer + stream -> ux_device_class_video_stream_buffer_size)
+ next_pos = stream -> ux_device_class_video_stream_buffer;
+ next_payload = (UX_DEVICE_CLASS_VIDEO_PAYLOAD *)next_pos;
+
+ /* Check overflow! */
+ if (next_payload -> ux_device_class_video_payload_length > 0)
+ {
+
+ /* Error notification! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_BUFFER_OVERFLOW);
+ }
+ else
+
+ /* Update transfer position. */
+ stream -> ux_device_class_video_stream_transfer_pos = next_payload;
+
+ /* Invoke notification callback. */
+ if (stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_payload_done != UX_NULL)
+ stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_payload_done(stream, actual_length);
+ }
+
+ /* We need to suspend ourselves. We will be resumed by the device enumeration module or when a change of alternate setting happens. */
+ _ux_utility_thread_suspend(&stream -> ux_device_class_video_stream_thread);
+ }
+}
+#endif
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
new file mode 100644
index 0000000..84be153
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_reception_start.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_reception_start PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function start receiving payloads in the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_thread_resume Resume thread used */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_reception_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream)
+{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(stream);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) != UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Check if overflow. */
+ if (stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length > 0)
+ return(UX_BUFFER_OVERFLOW);
+
+ /* Start read thread. */
+ _ux_utility_thread_resume(&stream -> ux_device_class_video_stream_thread);
+ return(UX_SUCCESS);
+#endif
+}
diff --git a/common/usbx_device_classes/src/ux_device_class_video_stream_get.c b/common/usbx_device_classes/src/ux_device_class_video_stream_get.c
new file mode 100644
index 0000000..4a29a5b
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_stream_get.c
@@ -0,0 +1,93 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_stream_get PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function get the stream instance of Video class. */
+/* */
+/* INPUT */
+/* */
+/* video Address of video class */
+/* instance */
+/* stream_index Stream instance index 0 based */
+/* stream Pointer to buffer to fill */
+/* pointer to stream instance */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_thread_delete Delete thread used */
+/* _ux_utility_memory_free Free used local memory */
+/* */
+/* CALLED BY */
+/* */
+/* Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_stream_get(UX_DEVICE_CLASS_VIDEO *video,
+ ULONG stream_index, UX_DEVICE_CLASS_VIDEO_STREAM **stream)
+{
+
+
+ /* Sanity check. */
+ if (video == UX_NULL)
+ return(UX_ERROR);
+
+ /* Index validation. */
+ if (stream_index >= video -> ux_device_class_video_streams_nb)
+ return(UX_ERROR);
+
+ /* Store the stream instance found. */
+ if (stream)
+ *stream = video -> ux_device_class_video_streams + stream_index;
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..63a6c30
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_transmission_start.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_transmission_start PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function start sending valid payloads in the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_thread_resume Resume thread used */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_transmission_start(UX_DEVICE_CLASS_VIDEO_STREAM *stream)
+{
+#if defined(UX_DEVICE_STANDALONE)
+ UX_PARAMETER_NOT_USED(stream);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Check if there is payload to send (underflow). */
+ if (stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length == 0)
+ return(UX_BUFFER_OVERFLOW);
+
+ /* Start write thread. */
+ _ux_utility_thread_resume(&stream -> ux_device_class_video_stream_thread);
+ return(UX_SUCCESS);
+#endif
+}
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
new file mode 100644
index 0000000..9eebf2e
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_uninitialize.c
@@ -0,0 +1,109 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_uninitialize PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function uninitialize the Video class. */
+/* */
+/* INPUT */
+/* */
+/* command Pointer to a class command */
+/* */
+/* OUTPUT */
+/* */
+/* Completion Status */
+/* */
+/* CALLS */
+/* */
+/* _ux_utility_thread_delete Delete thread used */
+/* _ux_utility_memory_free Free used local memory */
+/* */
+/* CALLED BY */
+/* */
+/* Device Video Class */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_uninitialize(UX_SLAVE_CLASS_COMMAND *command)
+{
+
+UX_DEVICE_CLASS_VIDEO *video;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_CLASS *class_inst;
+ULONG i;
+
+
+ /* Get the class container. */
+ class_inst = command -> ux_slave_class_command_class_ptr;
+
+ /* Get the class instance in the container. */
+ video = (UX_DEVICE_CLASS_VIDEO *) class_inst -> ux_slave_class_instance;
+
+ /* Sanity check. */
+ if (video != UX_NULL)
+ {
+
+ /* Free the stream resources. */
+ stream = (UX_DEVICE_CLASS_VIDEO_STREAM *)((UCHAR *)video + sizeof(UX_DEVICE_CLASS_VIDEO));
+ for (i = 0; i < video -> ux_device_class_video_streams_nb; i ++)
+ {
+#if !defined(UX_DEVICE_STANDALONE)
+ _ux_utility_thread_delete(&stream -> ux_device_class_video_stream_thread);
+ _ux_utility_memory_free(stream -> ux_device_class_video_stream_thread_stack);
+#endif
+ _ux_utility_memory_free(stream -> ux_device_class_video_stream_buffer);
+
+ /* Next stream instance. */
+ stream ++;
+ }
+
+ /* Free the video instance with controls and streams. */
+ _ux_utility_memory_free(video);
+ }
+
+ /* Return completion status. */
+ return(UX_SUCCESS);
+}
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
new file mode 100644
index 0000000..dade35a
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_write_payload_commit.c
@@ -0,0 +1,126 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_write_payload_commit PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function set payload buffer valid to send in the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* buffer Pointer to buffer to save */
+/* payload data */
+/* length Frame length in bytes */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_write_payload_commit(UX_DEVICE_CLASS_VIDEO_STREAM *stream, ULONG length)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+UCHAR *next_pos;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CONFIGURATION_HANDLE_UNKNOWN);
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Check overflow!! */
+ if (stream -> ux_device_class_video_stream_access_pos == stream -> ux_device_class_video_stream_transfer_pos &&
+ stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length != 0)
+ return(UX_BUFFER_OVERFLOW);
+
+ /* Check payload length. */
+ if ((stream -> ux_device_class_video_stream_payload_buffer_size - 4) < length)
+ return(UX_ERROR);
+
+ /* Calculate next payload buffer. */
+ next_pos = (UCHAR *)stream -> ux_device_class_video_stream_access_pos;
+ next_pos += stream -> ux_device_class_video_stream_payload_buffer_size;
+ if (next_pos >= stream -> ux_device_class_video_stream_buffer + stream -> ux_device_class_video_stream_buffer_size)
+ next_pos = stream -> ux_device_class_video_stream_buffer;
+
+ /* Commit payload length. */
+ stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length = length;
+
+ /* Move payload position. */
+ stream -> ux_device_class_video_stream_access_pos = (UX_DEVICE_CLASS_VIDEO_PAYLOAD *)next_pos;
+
+ return(UX_SUCCESS);
+}
+
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
new file mode 100644
index 0000000..d5b79ea
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_write_payload_get.c
@@ -0,0 +1,113 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_write_payload_get PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function get a writable payload buffer in the Video class. */
+/* */
+/* INPUT */
+/* */
+/* stream Address of video stream */
+/* instance */
+/* payload Pointer to buffer to save */
+/* payload buffer pointer */
+/* length Pointer to save payload */
+/* buffer length in bytes */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+UINT _ux_device_class_video_write_payload_get(UX_DEVICE_CLASS_VIDEO_STREAM *stream, UCHAR **payload, ULONG *length)
+{
+
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_DEVICE *device;
+
+
+ /* Get the pointer to the device. */
+ device = &_ux_system_slave -> ux_system_slave_device;
+
+ /* As long as the device is in the CONFIGURED state. */
+ if (device -> ux_slave_device_state != UX_DEVICE_CONFIGURED)
+ {
+
+ /* Cannot proceed with command, the interface is down. */
+ return(UX_CONFIGURATION_HANDLE_UNKNOWN);
+ }
+
+ /* Check if endpoint is available. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+ if (endpoint == UX_NULL)
+ return(UX_ERROR);
+
+ /* Check if endpoint direction is OK. */
+ if ((endpoint -> ux_slave_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT)
+ return(UX_ERROR);
+
+ /* Check overflow!! */
+ if (stream -> ux_device_class_video_stream_access_pos == stream -> ux_device_class_video_stream_transfer_pos &&
+ stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_length != 0)
+ return(UX_BUFFER_OVERFLOW);
+
+ /* Store payload buffer pointer. */
+ *payload = stream -> ux_device_class_video_stream_access_pos -> ux_device_class_video_payload_data;
+
+ /* Exclude header size in payload buffer size. */
+ *length = (stream -> ux_device_class_video_stream_payload_buffer_size - 4);
+
+ return(UX_SUCCESS);
+}
+
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
new file mode 100644
index 0000000..43006d6
--- /dev/null
+++ b/common/usbx_device_classes/src/ux_device_class_video_write_thread_entry.c
@@ -0,0 +1,173 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) Microsoft Corporation. All rights reserved. */
+/* */
+/* This software is licensed under the Microsoft Software License */
+/* Terms for Microsoft Azure RTOS. Full text of the license can be */
+/* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
+/* and in the root directory of this software. */
+/* */
+/**************************************************************************/
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** USBX Component */
+/** */
+/** Device Video Class */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#define UX_SOURCE_CODE
+
+
+/* Include necessary system files. */
+
+#include "ux_api.h"
+#include "ux_device_class_video.h"
+#include "ux_device_stack.h"
+
+
+#if !defined(UX_DEVICE_STANDALONE)
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_device_class_video_write_thread_entry PORTABLE C */
+/* 6.1.11 */
+/* AUTHOR */
+/* */
+/* Chaoqiong Xiao, Microsoft Corporation */
+/* */
+/* DESCRIPTION */
+/* */
+/* This function is thread of ISO IN for the Video class. */
+/* */
+/* INPUT */
+/* */
+/* video_stream Address of video stream */
+/* instance */
+/* */
+/* OUTPUT */
+/* */
+/* None */
+/* */
+/* CALLS */
+/* */
+/* _ux_system_error_handler System error trap */
+/* _ux_utility_thread_suspend Suspend thread used */
+/* _ux_device_stack_transfer_request Issue transfer request */
+/* _ux_utility_memory_copy Copy data */
+/* */
+/* CALLED BY */
+/* */
+/* ThreadX */
+/* */
+/* RELEASE HISTORY */
+/* */
+/* DATE NAME DESCRIPTION */
+/* */
+/* 04-25-2022 Chaoqiong Xiao Initial Version 6.1.11 */
+/* */
+/**************************************************************************/
+VOID _ux_device_class_video_write_thread_entry(ULONG video_stream)
+{
+
+UINT status;
+UX_DEVICE_CLASS_VIDEO_STREAM *stream;
+UX_SLAVE_DEVICE *device;
+UX_SLAVE_ENDPOINT *endpoint;
+UX_SLAVE_TRANSFER *transfer;
+UCHAR *next_pos;
+UX_DEVICE_CLASS_VIDEO_PAYLOAD *next_payload;
+ULONG transfer_length;
+ULONG actual_length;
+
+
+ /* Get Video class stream instance. */
+ UX_THREAD_EXTENSION_PTR_GET(stream, UX_DEVICE_CLASS_VIDEO_STREAM, video_stream)
+
+ /* Get stack device instance. */
+ device = stream -> ux_device_class_video_stream_video -> ux_device_class_video_device;
+
+ /* This thread runs forever but can be suspended or resumed. */
+ while(1)
+ {
+ while (device -> ux_slave_device_state == UX_DEVICE_CONFIGURED)
+ {
+
+ /* Get endpoint instance. */
+ endpoint = stream -> ux_device_class_video_stream_endpoint;
+
+ /* Endpoint not available, maybe it's alternate setting 0. */
+ if (endpoint == UX_NULL)
+ break;
+
+ /* Get transfer instance. */
+ transfer = &endpoint -> ux_slave_endpoint_transfer_request;
+
+ /* Start payload transfer anyway (even ZLP). */
+ transfer_length = stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length;
+ 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. */
+
+ /* Issue transfer request, thread blocked until transfer done. */
+ status = _ux_device_stack_transfer_request(transfer, transfer_length, transfer_length);
+
+ /* Check error. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Error notification! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_TRANSFER_ERROR);
+ break;
+ }
+
+ /* Frame sent, free it. */
+ stream -> ux_device_class_video_stream_transfer_pos -> ux_device_class_video_payload_length = 0;
+
+ /* Get actual transfer length. */
+ actual_length = transfer -> ux_slave_transfer_request_actual_length;
+
+ /* Calculate next position. */
+ next_pos = (UCHAR *)stream -> ux_device_class_video_stream_transfer_pos;
+ next_pos += stream -> ux_device_class_video_stream_payload_buffer_size;
+ if (next_pos >= stream -> ux_device_class_video_stream_buffer + stream -> ux_device_class_video_stream_buffer_size)
+ next_pos = stream -> ux_device_class_video_stream_buffer;
+ next_payload = (UX_DEVICE_CLASS_VIDEO_PAYLOAD *)next_pos;
+
+ /* Underflow check! */
+ if (transfer_length)
+ {
+
+ /* Advance position. */
+ stream -> ux_device_class_video_stream_transfer_pos = next_payload;
+
+ /* Error trap! */
+ if (next_payload -> ux_device_class_video_payload_length == 0)
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_BUFFER_OVERFLOW);
+ }
+ else
+ {
+
+ /* Advance position if next payload available. */
+ if (next_payload -> ux_device_class_video_payload_length)
+ stream -> ux_device_class_video_stream_transfer_pos = next_payload;
+ else
+
+ /* Error trap! */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_BUFFER_OVERFLOW);
+ }
+
+ /* Invoke notification callback. */
+ if (stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_payload_done != UX_NULL)
+ stream -> ux_device_class_video_stream_callbacks.ux_device_class_video_stream_payload_done(stream, actual_length);
+ }
+
+ /* We need to suspend ourselves. We will be resumed by the device enumeration module or when a change of alternate setting happens. */
+ _ux_utility_thread_suspend(&stream -> ux_device_class_video_stream_thread);
+ }
+}
+#endif
diff --git a/common/usbx_host_classes/inc/ux_host_class_asix.h b/common/usbx_host_classes/inc/ux_host_class_asix.h
index 717842c..dac0f48 100644
--- a/common/usbx_host_classes/inc/ux_host_class_asix.h
+++ b/common/usbx_host_classes/inc/ux_host_class_asix.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_asix.h PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -50,6 +50,9 @@
/* added extern "C" keyword */
/* for compatibility with C++, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -67,8 +70,15 @@ extern "C" {
#endif
+#if !defined(UX_HOST_STANDALONE)
#include "nx_api.h"
#include "ux_network_driver.h"
+#else
+
+/* Assume NX things for compiling. */
+#define NX_PACKET VOID*
+#define NX_PACKET_POOL VOID*
+#endif
/* Define to check if NetX preserved header size is compatible with ASIX. */
/* #define UX_HOST_CLASS_ASIX_HEADER_CHECK_ENABLE */
@@ -363,9 +373,11 @@ typedef struct UX_HOST_CLASS_ASIX_STRUCT
UX_INTERFACE *ux_host_class_asix_interface;
UINT ux_host_class_asix_instance_status;
UINT ux_host_class_asix_state;
+
UX_SEMAPHORE ux_host_class_asix_semaphore;
UX_SEMAPHORE ux_host_class_asix_interrupt_notification_semaphore;
UX_THREAD ux_host_class_asix_thread;
+
UCHAR *ux_host_class_asix_thread_stack;
ULONG ux_host_class_asix_notification_count;
ULONG ux_host_class_asix_primary_phy_id;
@@ -377,9 +389,11 @@ typedef struct UX_HOST_CLASS_ASIX_STRUCT
ULONG ux_host_class_asix_speed_selected;
ULONG ux_host_class_asix_device_state;
ULONG ux_host_class_asix_link_state;
+
NX_PACKET *ux_host_class_asix_xmit_queue;
NX_PACKET *ux_host_class_asix_receive_queue;
NX_PACKET_POOL ux_host_class_asix_packet_pool;
+
UCHAR *ux_host_class_asix_pool_memory;
UCHAR ux_host_class_asix_node_id[UX_HOST_CLASS_ASIX_NODE_ID_LENGTH];
VOID (*ux_host_class_asix_device_status_change_callback)(struct UX_HOST_CLASS_ASIX_STRUCT *asix,
diff --git a/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h b/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h
index 9c6ff12..524656f 100644
--- a/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h
+++ b/common/usbx_host_classes/inc/ux_host_class_cdc_ecm.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_cdc_ecm.h PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -54,6 +54,9 @@
/* added extern "C" keyword */
/* for compatibility with C++, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -70,9 +73,16 @@ extern "C" {
#endif
-/* Include the NetX API. */
+#if !defined(UX_HOST_STANDALONE)
#include "nx_api.h"
#include "ux_network_driver.h"
+#else
+
+/* Assume NX things for compiling. */
+#define NX_PACKET VOID*
+#define NX_PACKET_POOL VOID*
+#endif
+
/* Define CDC_ECM Class constants. Insert here the PID/VID of vendors and products using the CDC ECM chipset.
It is a better mechanism to put this value in the ux_user.h file. */
diff --git a/common/usbx_host_classes/inc/ux_host_class_hid_keyboard.h b/common/usbx_host_classes/inc/ux_host_class_hid_keyboard.h
index ba87ee8..e884392 100644
--- a/common/usbx_host_classes/inc/ux_host_class_hid_keyboard.h
+++ b/common/usbx_host_classes/inc/ux_host_class_hid_keyboard.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_hid_keyboard.h PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -53,6 +53,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -227,6 +230,12 @@ typedef struct UX_HOST_CLASS_HID_KEYBOARD_STRUCT
ULONG ux_host_class_hid_keyboard_keys_decode_disable;
} UX_HOST_CLASS_HID_KEYBOARD;
+typedef struct UX_HOST_CLASS_HID_CLIENT_KEYBOARD_STRUCT
+{
+ UX_HOST_CLASS_HID_KEYBOARD ux_host_class_hid_client_keyboard_keyboard;
+ UX_HOST_CLASS_HID_CLIENT ux_host_class_hid_client_keyboard_client;
+} UX_HOST_CLASS_HID_CLIENT_KEYBOARD;
+
/* Define HID Keyboard Class function prototypes. */
VOID _ux_host_class_hid_keyboard_callback(UX_HOST_CLASS_HID_REPORT_CALLBACK *callback);
diff --git a/common/usbx_host_classes/inc/ux_host_class_hid_mouse.h b/common/usbx_host_classes/inc/ux_host_class_hid_mouse.h
index 9e01f26..d2340ae 100644
--- a/common/usbx_host_classes/inc/ux_host_class_hid_mouse.h
+++ b/common/usbx_host_classes/inc/ux_host_class_hid_mouse.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_hid_mouse.h PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -50,6 +50,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -105,6 +108,12 @@ typedef struct UX_HOST_CLASS_HID_MOUSE_STRUCT
} UX_HOST_CLASS_HID_MOUSE;
+typedef struct UX_HOST_CLASS_HID_CLIENT_MOUSE_STRUCT
+{
+ UX_HOST_CLASS_HID_MOUSE ux_host_class_hid_client_mouse_mouse;
+ UX_HOST_CLASS_HID_CLIENT ux_host_class_hid_client_mouse_client;
+} UX_HOST_CLASS_HID_CLIENT_MOUSE;
+
/* Define HID Mouse Class function prototypes. */
UINT _ux_host_class_hid_mouse_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command);
diff --git a/common/usbx_host_classes/inc/ux_host_class_hid_remote_control.h b/common/usbx_host_classes/inc/ux_host_class_hid_remote_control.h
index 03bb69d..05a49c6 100644
--- a/common/usbx_host_classes/inc/ux_host_class_hid_remote_control.h
+++ b/common/usbx_host_classes/inc/ux_host_class_hid_remote_control.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_hid_remote_control.h PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -47,6 +47,9 @@
/* added extern "C" keyword */
/* for compatibility with C++, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
@@ -86,6 +89,14 @@ typedef struct UX_HOST_CLASS_HID_REMOTE_CONTROL_STRUCT
ULONG *ux_host_class_hid_remote_control_usage_array_tail;
} UX_HOST_CLASS_HID_REMOTE_CONTROL;
+typedef struct UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL_STRUCT
+{
+ UX_HOST_CLASS_HID_REMOTE_CONTROL
+ ux_host_class_hid_client_remote_control_remote_control;
+ UX_HOST_CLASS_HID_CLIENT
+ ux_host_class_hid_client_remote_control_client;
+} UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL;
+
/* Define HID Remote Control Class function prototypes. */
VOID _ux_host_class_hid_remote_control_callback(UX_HOST_CLASS_HID_REPORT_CALLBACK *callback);
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_deactivate.c b/common/usbx_host_classes/src/ux_host_class_asix_deactivate.c
index 324848a..32853e5 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_deactivate.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_deactivate.c
@@ -30,12 +30,13 @@
#include "ux_host_stack.h"
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_deactivate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -80,6 +81,10 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_asix_deactivate(UX_HOST_CLASS_COMMAND *command)
@@ -142,7 +147,7 @@ UINT status;
asix -> ux_host_class_asix_link_state = UX_HOST_CLASS_ASIX_LINK_STATE_DOWN;
/* Deregister this interface to the NetX USB interface broker. */
- status = _ux_network_driver_deactivate((VOID *) asix, asix -> ux_host_class_asix_network_handle);
+ _ux_network_driver_deactivate((VOID *) asix, asix -> ux_host_class_asix_network_handle);
/* If the interrupt endpoint is defined, clean any pending transfer. */
if (asix -> ux_host_class_asix_interrupt_endpoint != UX_NULL)
@@ -218,4 +223,4 @@ UINT status;
/* Return successful status. */
return(UX_SUCCESS);
}
-
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_entry.c b/common/usbx_host_classes/src/ux_host_class_asix_entry.c
index 49d288c..8d4716e 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_entry.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_entry.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_entry PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,10 +71,17 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_asix_entry(UX_HOST_CLASS_COMMAND *command)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UINT status;
@@ -130,5 +137,6 @@ UINT status;
return(UX_FUNCTION_NOT_SUPPORTED);
}
+#endif
}
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_reception_callback.c b/common/usbx_host_classes/src/ux_host_class_asix_reception_callback.c
index 7ae6664..75ad2e9 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_reception_callback.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_reception_callback.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_reception_callback PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -73,11 +73,17 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_asix_reception_callback (UX_TRANSFER *transfer_request)
{
-
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(transfer_request);
+#else
+
UX_HOST_CLASS_ASIX *asix;
NX_PACKET *packet;
ULONG ip_given_length;
@@ -156,5 +162,5 @@ UINT status;
}
/* There is no status to be reported back to the stack. */
return;
+#endif
}
-
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_thread.c b/common/usbx_host_classes/src/ux_host_class_asix_thread.c
index 053a0f5..96f4803 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_thread.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_thread.c
@@ -29,12 +29,14 @@
#include "ux_host_class_asix.h"
#include "ux_host_stack.h"
+
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -81,6 +83,10 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_asix_thread(ULONG parameter)
@@ -322,7 +328,16 @@ ULONG physical_address_lsw;
&asix -> ux_host_class_asix_network_handle,
physical_address_msw,
physical_address_lsw);
-
+ if (status != UX_SUCCESS)
+ {
+
+ /* Unprotect thread reentry to this instance. */
+ _ux_host_semaphore_put(&asix -> ux_host_class_asix_semaphore);
+
+ /* Return completion status. */
+ return;
+ }
+
/* Now the link is up. */
asix -> ux_host_class_asix_link_state = UX_HOST_CLASS_ASIX_LINK_STATE_UP;
@@ -424,4 +439,4 @@ ULONG physical_address_lsw;
}
}
}
-
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c b/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c
index a7e3da0..204af59 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_transmission_callback.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_transmission_callback PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,10 +74,16 @@
/* 08-02-2021 Wen Wang Modified comment(s), */
/* fixed spelling error, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_asix_transmission_callback (UX_TRANSFER *transfer_request)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(transfer_request);
+#else
UX_HOST_CLASS_ASIX *asix;
NX_PACKET *current_packet;
@@ -147,5 +153,5 @@ UCHAR *packet_header;
/* There is no status to be reported back to the stack. */
return;
+#endif
}
-
diff --git a/common/usbx_host_classes/src/ux_host_class_asix_write.c b/common/usbx_host_classes/src/ux_host_class_asix_write.c
index b5b4938..d30bf62 100644
--- a/common/usbx_host_classes/src/ux_host_class_asix_write.c
+++ b/common/usbx_host_classes/src/ux_host_class_asix_write.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_asix_write PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,10 +74,18 @@
/* 08-02-2021 Wen Wang Modified comment(s), */
/* fixed spelling error, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_asix_write(VOID *asix_class, NX_PACKET *packet)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(asix_class);
+ UX_PARAMETER_NOT_USED(packet);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UX_TRANSFER *transfer_request;
UINT status;
@@ -195,6 +203,5 @@ UX_HOST_CLASS_ASIX *asix;
/* We are done here. */
return(UX_SUCCESS);
-
+#endif
}
-
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_configure.c b/common/usbx_host_classes/src/ux_host_class_audio_configure.c
index 2531061..0b75dd3 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_configure.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_configure.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_configure PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -73,6 +73,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_configure(UX_HOST_CLASS_AUDIO *audio)
@@ -135,6 +138,17 @@ UX_DEVICE *parent_device;
/* We have the valid configuration. Ask the USBX stack to set this configuration */
status = _ux_host_stack_device_configuration_select(configuration);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Error trap. */
+ _ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, status);
+
+ /* If trace is enabled, insert this event into the trace buffer. */
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, status, audio -> ux_host_class_audio_device, 0, 0, UX_TRACE_ERRORS, 0, 0)
+
+ return(status);
+ }
/* Start with interface number 0. */
interface_number = 0;
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_get.c b/common/usbx_host_classes/src/ux_host_class_audio_control_get.c
index 71332f9..6da3505 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_control_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_control_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_control_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_control_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control)
@@ -118,7 +121,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -209,7 +212,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c b/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c
index 1096e53..ecc4d9e 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_control_value_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_control_value_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_control_value_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control)
@@ -117,7 +120,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -146,7 +149,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c b/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c
index 250b3bc..164f046 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_control_value_set.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_control_value_set PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_control_value_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_CONTROL *audio_control)
@@ -117,7 +120,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -151,7 +154,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_read.c b/common/usbx_host_classes/src/ux_host_class_audio_read.c
index 868c9cb..a44c9d7 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_read.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_read.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_read PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_read(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_TRANSFER_REQUEST *audio_transfer_request)
@@ -116,7 +119,7 @@ UINT status;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_AUDIO_WRONG_INTERFACE);
@@ -143,7 +146,7 @@ UINT status;
status = _ux_host_class_audio_transfer_request(audio, audio_transfer_request);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c
index 5777c47..5c8ca14 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_streaming_sampling_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -76,6 +76,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_streaming_sampling_get(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_SAMPLING_CHARACTERISTICS *audio_sampling)
@@ -146,7 +149,7 @@ UINT previous_match_found;
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0)
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
return(UX_DESCRIPTOR_CORRUPTED);
}
@@ -228,7 +231,7 @@ UINT previous_match_found;
audio_sampling -> ux_host_class_audio_sampling_characteristics_frequency_high = audio_sampling -> ux_host_class_audio_sampling_characteristics_frequency_low;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* We have found the first streaming characteristics. */
return(UX_SUCCESS);
@@ -296,7 +299,7 @@ UINT previous_match_found;
audio_sampling -> ux_host_class_audio_sampling_characteristics_frequency_high = lower_frequency;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
@@ -334,7 +337,7 @@ UINT previous_match_found;
audio_sampling -> ux_host_class_audio_sampling_characteristics_frequency_high = higher_frequency;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
@@ -350,7 +353,7 @@ UINT previous_match_found;
audio_sampling -> ux_host_class_audio_sampling_characteristics_frequency_high = lower_frequency;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
@@ -372,7 +375,7 @@ UINT previous_match_found;
UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_DESCRIPTOR_CORRUPTED, descriptor, 0, 0, UX_TRACE_ERRORS, 0, 0)
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
return(UX_DESCRIPTOR_CORRUPTED);
}
@@ -385,7 +388,7 @@ UINT previous_match_found;
}
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_NO_ALTERNATE_SETTING);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c
index 763a8a6..75819fd 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_streaming_sampling_set.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_streaming_sampling_set PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -80,6 +80,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_streaming_sampling_set(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_SAMPLING *audio_sampling)
@@ -113,7 +116,7 @@ UINT streaming_interface;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
return(status);
}
@@ -163,7 +166,7 @@ UINT streaming_interface;
audio -> ux_host_class_audio_isochronous_endpoint = endpoint;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
@@ -178,7 +181,7 @@ UINT streaming_interface;
}
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_NO_ALTERNATE_SETTING);
diff --git a/common/usbx_host_classes/src/ux_host_class_audio_write.c b/common/usbx_host_classes/src/ux_host_class_audio_write.c
index 400d0bd..3ae59bc 100644
--- a/common/usbx_host_classes/src/ux_host_class_audio_write.c
+++ b/common/usbx_host_classes/src/ux_host_class_audio_write.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_audio_write PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_audio_write(UX_HOST_CLASS_AUDIO *audio, UX_HOST_CLASS_AUDIO_TRANSFER_REQUEST *audio_transfer_request)
@@ -112,7 +115,7 @@ UINT status;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_AUDIO_WRONG_INTERFACE);
@@ -134,7 +137,7 @@ UINT status;
status = _ux_host_class_audio_transfer_request(audio, audio_transfer_request);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
+ _ux_host_semaphore_put(&audio -> ux_host_class_audio_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c
index ea2bb62..8a99c7a 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_acm_endpoints_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_acm_endpoints_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -76,6 +76,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* initialized timeout value, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_cdc_acm_endpoints_get(UX_HOST_CLASS_CDC_ACM *cdc_acm)
@@ -97,7 +100,7 @@ UX_TRANSFER *transfer_request;
{
/* Get interface endpoint. */
- status = _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint);
+ _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint);
/* Check if endpoint is bulk and OUT. */
if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_OUT) &&
@@ -160,7 +163,7 @@ UX_TRANSFER *transfer_request;
{
/* Get the endpoint handle. */
- status = _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint);
+ _ux_host_stack_interface_endpoint_get(cdc_acm -> ux_host_class_cdc_acm_interface, endpoint_index, &endpoint);
/* Check if endpoint is Interrupt and IN. */
if (((endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION) == UX_ENDPOINT_IN) &&
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c
index faa99e0..8c49534 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_activate.c
@@ -31,12 +31,13 @@
UX_HOST_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_activate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -92,6 +93,9 @@ UX_HOST_CLASS_CDC_ECM_NX_ETHERNET_POOL_ALLOCSIZE_ASSERT
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_cdc_ecm_activate(UX_HOST_CLASS_COMMAND *command)
@@ -382,4 +386,4 @@ UX_INTERFACE *cur_interface;
/* Return completion status. */
return(status);
}
-
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_deactivate.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_deactivate.c
index 6adf7d2..ec561e9 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_deactivate.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_deactivate.c
@@ -30,12 +30,13 @@
#include "ux_host_stack.h"
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_deactivate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -84,6 +85,10 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_cdc_ecm_deactivate(UX_HOST_CLASS_COMMAND *command)
@@ -145,7 +150,7 @@ UX_TRANSFER *transfer_request;
UX_RESTORE
/* Wait for the transfer to be armed, or possibly an error. The CDC-ECM thread will wake us up. */
- _ux_host_semaphore_get(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
/* We're no longer waiting. */
cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish = UX_FALSE;
@@ -158,7 +163,7 @@ UX_TRANSFER *transfer_request;
}
/* Now we can abort the transfer. */
- _ux_host_stack_transfer_request_abort(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_endpoint -> ux_endpoint_transfer_request);
+ _ux_host_stack_transfer_request_abort(transfer_request);
/* De-register this interface to the NetX USB interface broker. */
_ux_network_driver_deactivate((VOID *) cdc_ecm, cdc_ecm -> ux_host_class_cdc_ecm_network_handle);
@@ -212,4 +217,4 @@ UX_TRANSFER *transfer_request;
/* Return successful status. */
return(UX_SUCCESS);
}
-
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_entry.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_entry.c
index 88f7095..4c2891b 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_entry.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_entry.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_entry PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,10 +71,17 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_cdc_ecm_entry(UX_HOST_CLASS_COMMAND *command)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(command);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UINT status;
@@ -152,5 +159,6 @@ UINT status;
return(UX_FUNCTION_NOT_SUPPORTED);
}
+#endif
}
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_interrupt_notification.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_interrupt_notification.c
index 3575a8b..5562e44 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_interrupt_notification.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_interrupt_notification.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_interrupt_notification PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +71,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_cdc_ecm_interrupt_notification(UX_TRANSFER *transfer_request)
@@ -152,7 +155,7 @@ ULONG notification_value;
cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish = UX_TRUE;
/* Wait for the transfer to be armed, or possibly an error. The CDC-ECM thread will wake us up. */
- _ux_host_semaphore_get(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
/* We're no longer waiting. */
cdc_ecm -> ux_host_class_cdc_ecm_bulk_in_transfer_waiting_for_check_and_arm_to_finish = UX_FALSE;
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c
index 42d8ed7..24a36e8 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_thread.c
@@ -29,12 +29,14 @@
#include "ux_host_class_cdc_ecm.h"
#include "ux_host_stack.h"
+
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_thread PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -89,6 +91,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_cdc_ecm_thread(ULONG parameter)
@@ -111,7 +116,7 @@ USB_NETWORK_DEVICE_TYPE *usb_network_device_ptr;
{
/* Wait for the semaphore to be put by the cdc_ecm interrupt event. */
- _ux_host_semaphore_get(&cdc_ecm -> ux_host_class_cdc_ecm_interrupt_notification_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&cdc_ecm -> ux_host_class_cdc_ecm_interrupt_notification_semaphore, UX_WAIT_FOREVER);
/* Check the link state. It is either pending up or down. */
if (cdc_ecm -> ux_host_class_cdc_ecm_link_state == UX_HOST_CLASS_CDC_ECM_LINK_STATE_PENDING_UP)
@@ -204,7 +209,7 @@ USB_NETWORK_DEVICE_TYPE *usb_network_device_ptr;
{
/* Wait for the completion of the transfer request. */
- _ux_host_semaphore_get(&transfer_request -> ux_transfer_request_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&transfer_request -> ux_transfer_request_semaphore, UX_WAIT_FOREVER);
/* Check the transfer status. If there is a transport error, we ignore the packet
and restart it. */
@@ -288,3 +293,4 @@ USB_NETWORK_DEVICE_TYPE *usb_network_device_ptr;
}
}
}
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmission_callback.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmission_callback.c
index 6b66580..506097e 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmission_callback.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmission_callback.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_transmission_callback PORTABLE C */
-/* 6.1.9 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,10 +77,16 @@
/* use pre-calculated value */
/* instead of wMaxPacketSize, */
/* resulting in version 6.1.9 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_cdc_ecm_transmission_callback(UX_TRANSFER *transfer_request)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(transfer_request);
+#else
UX_HOST_CLASS_CDC_ECM *cdc_ecm;
NX_PACKET *current_packet;
@@ -183,4 +189,5 @@ UCHAR *packet_header;
/* There is no status to be reported back to the stack. */
return;
+#endif
}
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmit_queue_clean.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmit_queue_clean.c
index 1ccb3d7..5eba46b 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmit_queue_clean.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_transmit_queue_clean.c
@@ -29,12 +29,14 @@
#include "ux_host_class_cdc_ecm.h"
#include "ux_host_stack.h"
+
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_transmit_queue_clean PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,6 +76,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_cdc_ecm_transmit_queue_clean(UX_HOST_CLASS_CDC_ECM *cdc_ecm)
@@ -102,7 +107,7 @@ NX_PACKET *next_packet;
UX_RESTORE
/* Wait for write function to resume us. */
- _ux_host_semaphore_get(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_out_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&cdc_ecm -> ux_host_class_cdc_ecm_bulk_out_transfer_waiting_for_check_and_arm_to_finish_semaphore, UX_WAIT_FOREVER);
/* We're done waiting. */
cdc_ecm -> ux_host_class_cdc_ecm_bulk_out_transfer_waiting_for_check_and_arm_to_finish = UX_FALSE;
@@ -146,3 +151,4 @@ NX_PACKET *next_packet;
/* Clear the queue. */
cdc_ecm -> ux_host_class_cdc_ecm_xmit_queue_head = UX_NULL;
}
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_write.c b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_write.c
index fd41ba2..f88878e 100644
--- a/common/usbx_host_classes/src/ux_host_class_cdc_ecm_write.c
+++ b/common/usbx_host_classes/src/ux_host_class_cdc_ecm_write.c
@@ -30,12 +30,13 @@
#include "ux_host_stack.h"
+#if !defined(UX_HOST_STANDALONE)
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_cdc_ecm_write PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_cdc_ecm_write(VOID *cdc_ecm_class, NX_PACKET *packet)
@@ -222,3 +226,4 @@ UX_HOST_CLASS_CDC_ECM *cdc_ecm;
/* We are done here. */
return(status);
}
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_gser_activate.c b/common/usbx_host_classes/src/ux_host_class_gser_activate.c
index 6886bb9..1615a8f 100644
--- a/common/usbx_host_classes/src/ux_host_class_gser_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_gser_activate.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_gser_activate PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_gser_activate(UX_HOST_CLASS_COMMAND *command)
@@ -101,7 +104,7 @@ UINT status;
device -> ux_device_class_instance = (VOID *) gser;
/* Create this class instance. */
- status = _ux_host_stack_class_instance_create(gser -> ux_host_class_gser_class, (VOID *) gser);
+ _ux_host_stack_class_instance_create(gser -> ux_host_class_gser_class, (VOID *) gser);
/* Configure the gser class. */
status = _ux_host_class_gser_configure(gser);
diff --git a/common/usbx_host_classes/src/ux_host_class_gser_read.c b/common/usbx_host_classes/src/ux_host_class_gser_read.c
index a5bb43d..3b2b700 100644
--- a/common/usbx_host_classes/src/ux_host_class_gser_read.c
+++ b/common/usbx_host_classes/src/ux_host_class_gser_read.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_gser_read PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_gser_read(UX_HOST_CLASS_GSER *gser,
@@ -159,7 +162,7 @@ ULONG transfer_request_length;
*actual_length += transfer_request -> ux_transfer_request_actual_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* Set the completion code. */
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
@@ -178,7 +181,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* There was a non transfer error, no partial transfer to be checked. */
return(status);
@@ -194,7 +197,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* Return success to caller. */
return(UX_SUCCESS);
@@ -208,7 +211,7 @@ ULONG transfer_request_length;
}
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* We get here when all the transfers went through without errors. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_classes/src/ux_host_class_gser_write.c b/common/usbx_host_classes/src/ux_host_class_gser_write.c
index 10afc09..4a6c3e6 100644
--- a/common/usbx_host_classes/src/ux_host_class_gser_write.c
+++ b/common/usbx_host_classes/src/ux_host_class_gser_write.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_gser_write PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_gser_write(UX_HOST_CLASS_GSER *gser,
@@ -154,7 +157,7 @@ ULONG transfer_request_length;
*actual_length += transfer_request -> ux_transfer_request_actual_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* Set the completion code. */
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
@@ -170,7 +173,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* There was a non transfer error, no partial transfer to be checked */
return(status);
@@ -186,7 +189,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* Return success. */
return(UX_SUCCESS);
@@ -202,7 +205,7 @@ ULONG transfer_request_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
+ _ux_host_semaphore_put(&gser -> ux_host_class_gser_interface_array[interface_index].ux_host_class_gser_semaphore);
/* We get here when all the transfers went through without errors. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_configure.c b/common/usbx_host_classes/src/ux_host_class_hid_configure.c
index 5f7b11a..0a42616 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_configure.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_configure.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_configure PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,6 +74,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_configure(UX_HOST_CLASS_HID *hid)
@@ -134,7 +137,7 @@ UX_DEVICE *parent_device;
#endif
/* We have the valid configuration. Ask the USBX stack to set this configuration. */
- status = _ux_host_stack_device_configuration_select(configuration);
+ _ux_host_stack_device_configuration_select(configuration);
/* If the operation went well, the hid default alternate setting for the HID interface is active
and the interrupt endpoint is now enabled. We have to memorize the first interface since the
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
index f751d40..c4922c1 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
@@ -203,7 +203,7 @@ UINT status;
#if defined(UX_HOST_STANDALONE)
_ux_host_class_hid_unlock(hid);
#else
- status = _ux_host_semaphore_put(&hid -> ux_host_class_hid_semaphore);
+ _ux_host_semaphore_put(&hid -> ux_host_class_hid_semaphore);
#endif
/* Return the completion status. */
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_activate.c b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_activate.c
index eedfe1d..c5efc85 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_activate.c
@@ -98,7 +98,7 @@ UX_HOST_CLASS_HID_KEYBOARD_LAYOUT ux_host_class_hid_keyboard_layout =
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_keyboard_activate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -148,6 +148,9 @@ UX_HOST_CLASS_HID_KEYBOARD_LAYOUT ux_host_class_hid_keyboard_layout =
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_keyboard_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command)
@@ -160,6 +163,7 @@ UX_HOST_CLASS_HID_CLIENT_REPORT client_report;
UX_HOST_CLASS_HID_REPORT_GET_ID report_id;
UX_HOST_CLASS_HID *hid;
UX_HOST_CLASS_HID_CLIENT *hid_client;
+UX_HOST_CLASS_HID_CLIENT_KEYBOARD *client_keyboard;
UX_HOST_CLASS_HID_KEYBOARD *keyboard_instance;
ULONG event_process_memory_size;
UINT status = UX_SUCCESS;
@@ -171,16 +175,22 @@ UX_HOST_CLASS_HID_FIELD *field;
/* Get the instance to the HID class. */
hid = command -> ux_host_class_hid_client_command_instance;
- /* And of the HID client. */
- hid_client = hid -> ux_host_class_hid_client;
-
- /* Get some memory for both the HID class instance of this client
+ /* Get some memory for both the HID class instance and copy of this client
and for the callback. */
- keyboard_instance = (UX_HOST_CLASS_HID_KEYBOARD *) _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
- sizeof(UX_HOST_CLASS_HID_KEYBOARD));
- if (keyboard_instance == UX_NULL)
+ client_keyboard = (UX_HOST_CLASS_HID_CLIENT_KEYBOARD *)
+ _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
+ sizeof(UX_HOST_CLASS_HID_CLIENT_KEYBOARD));
+ if (client_keyboard == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
+ /* Use allocated memory.
+ * - create a client copy.
+ * - get keyboard instance.
+ */
+ keyboard_instance = &client_keyboard -> ux_host_class_hid_client_keyboard_keyboard;
+ hid_client = &client_keyboard -> ux_host_class_hid_client_keyboard_client;
+ _ux_utility_memory_copy(hid_client, hid -> ux_host_class_hid_client, sizeof(UX_HOST_CLASS_HID_CLIENT)); /* Use case of memcpy is verified. */
+
/* Attach the remote control instance to the client instance. */
hid_client -> ux_host_class_hid_client_local_instance = (VOID *) keyboard_instance;
@@ -255,8 +265,7 @@ UX_HOST_CLASS_HID_FIELD *field;
UX_UTILITY_MULC_SAFE(keyboard_instance -> ux_host_class_hid_keyboard_key_count, 6, event_process_memory_size, status);
/* Calculation overflow check. */
- if (status != UX_SUCCESS)
- return(status);
+ if (status == UX_SUCCESS)
#else
/* We reserve 3 bytes for lock keys, 3 for processing. */
@@ -266,12 +275,15 @@ UX_HOST_CLASS_HID_FIELD *field;
event_process_memory_size = keyboard_instance -> ux_host_class_hid_keyboard_key_count * 2;
#endif
+ {
+
/* Allocate memory for usages states. */
keyboard_instance -> ux_host_class_hid_keyboard_key_state = (UCHAR *)
_ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY, event_process_memory_size);
if (keyboard_instance -> ux_host_class_hid_keyboard_key_state == UX_NULL)
status = UX_MEMORY_INSUFFICIENT;
}
+ }
/* If we are OK, go on. */
if (status == UX_SUCCESS)
@@ -351,6 +363,9 @@ UX_HOST_CLASS_HID_FIELD *field;
- SET_IDLE(KEYs, 0)
- _periodic_report_start() */
keyboard_instance -> ux_host_class_hid_keyboard_enum_state = UX_STATE_WAIT;
+
+ /* It's fine, replace client with our copy. */
+ hid -> ux_host_class_hid_client = hid_client;
return(status);
#else
@@ -404,6 +419,9 @@ UX_HOST_CLASS_HID_FIELD *field;
if (status == UX_SUCCESS)
{
+ /* It's fine, replace client copy. */
+ hid -> ux_host_class_hid_client = hid_client;
+
/* If all is fine and the device is mounted, we may need to inform the application
if a function has been programmed in the system structure. */
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
@@ -427,9 +445,6 @@ UX_HOST_CLASS_HID_FIELD *field;
/* We are here if there is error. */
- /* Detach instance. */
- hid_client -> ux_host_class_hid_client_local_instance = UX_NULL;
-
/* Free usage state. */
if (keyboard_instance -> ux_host_class_hid_keyboard_key_state)
_ux_utility_memory_free(keyboard_instance -> ux_host_class_hid_keyboard_key_state);
@@ -456,4 +471,3 @@ UX_HOST_CLASS_HID_FIELD *field;
/* Return completion status. */
return(status);
}
-
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c
index 63ef15b..afd243d 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_keyboard_deactivate.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_keyboard_deactivate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_keyboard_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command)
@@ -83,14 +86,14 @@ UINT _ux_host_class_hid_keyboard_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *c
UX_HOST_CLASS_HID *hid;
UX_HOST_CLASS_HID_CLIENT *hid_client;
UX_HOST_CLASS_HID_KEYBOARD *keyboard_instance;
-UINT status;
+UINT status = UX_SUCCESS;
/* Get the instance to the HID class. */
hid = command -> ux_host_class_hid_client_command_instance;
/* Stop the periodic report. */
- status = _ux_host_class_hid_periodic_report_stop(hid);
+ _ux_host_class_hid_periodic_report_stop(hid);
/* Get the HID client pointer. */
hid_client = hid -> ux_host_class_hid_client;
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_mouse_activate.c b/common/usbx_host_classes/src/ux_host_class_hid_mouse_activate.c
index d68bd4e..813a9e4 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_mouse_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_mouse_activate.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_mouse_activate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_mouse_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command)
@@ -89,6 +92,7 @@ UX_HOST_CLASS_HID_REPORT_CALLBACK call_back;
UX_HOST_CLASS_HID_REPORT_GET_ID report_id;
UX_HOST_CLASS_HID *hid;
UX_HOST_CLASS_HID_CLIENT *hid_client;
+UX_HOST_CLASS_HID_CLIENT_MOUSE *client_mouse;
UX_HOST_CLASS_HID_MOUSE *mouse_instance;
UINT status;
@@ -96,16 +100,19 @@ UINT status;
/* Get the instance to the HID class. */
hid = command -> ux_host_class_hid_client_command_instance;
- /* And of the HID client. */
- hid_client = hid -> ux_host_class_hid_client;
-
- /* Get some memory for both the HID class instance of this client
+ /* Get some memory for both the HID class instance and copy of this client
and for the callback. */
- mouse_instance = (UX_HOST_CLASS_HID_MOUSE *) _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
- sizeof(UX_HOST_CLASS_HID_MOUSE));
- if(mouse_instance == UX_NULL)
+ client_mouse = (UX_HOST_CLASS_HID_CLIENT_MOUSE *)
+ _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
+ sizeof(UX_HOST_CLASS_HID_CLIENT_MOUSE));
+ if(client_mouse == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
+ /* Get client and mouse instance. */
+ mouse_instance = &client_mouse -> ux_host_class_hid_client_mouse_mouse;
+ hid_client = &client_mouse -> ux_host_class_hid_client_mouse_client;
+ _ux_utility_memory_copy(hid_client, hid -> ux_host_class_hid_client, sizeof(UX_HOST_CLASS_HID_CLIENT)); /* Use case of memcpy is verified. */
+
/* Attach the mouse instance to the client instance. */
hid_client -> ux_host_class_hid_client_local_instance = (VOID *) mouse_instance;
@@ -134,6 +141,9 @@ UINT status;
mouse_instance -> ux_host_class_hid_mouse_enum_state = UX_STATE_WAIT;
}
+
+ /* Use our copy of client. */
+ hid -> ux_host_class_hid_client = hid_client;
return(status);
#else
@@ -186,6 +196,9 @@ UINT status;
if (status == UX_SUCCESS)
{
+ /* Use our copy of client. */
+ hid -> ux_host_class_hid_client = hid_client;
+
/* If all is fine and the device is mounted, we may need to inform the application
if a function has been programmed in the system structure. */
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
@@ -205,9 +218,6 @@ UINT status;
/* We are here if there is error. */
- /* Detach the client instance. */
- hid_client -> ux_host_class_hid_client_local_instance = UX_NULL;
-
/* Free mouse client instance. */
_ux_utility_memory_free(mouse_instance);
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_activate.c b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_activate.c
index b5bc0be..f9c3686 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_remote_control_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_remote_control_activate.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_remote_control_activate PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +71,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed clients management, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_remote_control_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command)
@@ -79,6 +82,7 @@ UINT _ux_host_class_hid_remote_control_activate(UX_HOST_CLASS_HID_CLIENT_COMMAN
UX_HOST_CLASS_HID_REPORT_CALLBACK call_back;
UX_HOST_CLASS_HID *hid;
UX_HOST_CLASS_HID_CLIENT *hid_client;
+UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL *client_remote_control;
UX_HOST_CLASS_HID_REMOTE_CONTROL *remote_control_instance;
UINT status = UX_SUCCESS;
@@ -86,16 +90,19 @@ UINT status = UX_SUCCESS;
/* Get the instance to the HID class. */
hid = command -> ux_host_class_hid_client_command_instance;
- /* And of the HID client. */
- hid_client = hid -> ux_host_class_hid_client;
-
- /* Get some memory for both the HID class instance of this client
+ /* Get some memory for both the HID class instance and copy of this client
and for the callback. */
- remote_control_instance = (UX_HOST_CLASS_HID_REMOTE_CONTROL *) _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
- sizeof(UX_HOST_CLASS_HID_REMOTE_CONTROL));
- if (remote_control_instance == UX_NULL)
+ client_remote_control = (UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL *)
+ _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,
+ sizeof(UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL));
+ if (client_remote_control == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
+ /* Get client instance and client copy. */
+ remote_control_instance = &client_remote_control -> ux_host_class_hid_client_remote_control_remote_control;
+ hid_client = &client_remote_control -> ux_host_class_hid_client_remote_control_client;
+ _ux_utility_memory_copy(hid_client, hid -> ux_host_class_hid_client, sizeof(UX_HOST_CLASS_HID_CLIENT)); /* Use case of memcpy is verified. */
+
/* Attach the remote control instance to the client instance. */
hid_client -> ux_host_class_hid_client_local_instance = (VOID *) remote_control_instance;
@@ -147,6 +154,9 @@ UINT status = UX_SUCCESS;
if (status == UX_SUCCESS)
{
+ /* Use out copy of client. */
+ hid -> ux_host_class_hid_client = hid_client;
+
/* If trace is enabled, insert this event into the trace buffer. */
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_REMOTE_CONTROL_ACTIVATE, hid, remote_control_instance, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
@@ -166,9 +176,6 @@ UINT status = UX_SUCCESS;
/* We are here when there is error. */
- /* Detach instance. */
- hid_client -> ux_host_class_hid_client_local_instance = UX_NULL;
-
/* Free usage array. */
if (remote_control_instance -> ux_host_class_hid_remote_control_usage_array)
_ux_utility_memory_free(remote_control_instance -> ux_host_class_hid_remote_control_usage_array);
diff --git a/common/usbx_host_classes/src/ux_host_class_hub_configure.c b/common/usbx_host_classes/src/ux_host_class_hub_configure.c
index 111bbd2..dddf381 100644
--- a/common/usbx_host_classes/src/ux_host_class_hub_configure.c
+++ b/common/usbx_host_classes/src/ux_host_class_hub_configure.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hub_configure PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_hub_configure(UX_HOST_CLASS_HUB *hub)
@@ -178,7 +181,7 @@ UX_DEVICE *parent_device;
#endif
/* We have the valid configuration. Ask the USBX stack to set this configuration. */
- status = _ux_host_stack_device_configuration_select(configuration);
+ _ux_host_stack_device_configuration_select(configuration);
/* If the operation went well, the HUB default alternate setting for the HUB interface is
active and the interrupt endpoint is now enabled. We have to memorize the first interface
diff --git a/common/usbx_host_classes/src/ux_host_class_pima_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_pima_endpoints_get.c
index a4861f8..adebdc8 100644
--- a/common/usbx_host_classes/src/ux_host_class_pima_endpoints_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_pima_endpoints_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_pima_endpoints_get PORTABLE C */
-/* 6.1.9 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* use pre-calculated value */
/* instead of wMaxPacketSize, */
/* resulting in version 6.1.9 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_pima_endpoints_get(UX_HOST_CLASS_PIMA *pima)
@@ -210,7 +213,7 @@ UX_TRANSFER *transfer_request;
{
/* The transfer on the interrupt endpoint can be started. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
}
diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_endpoints_get.c b/common/usbx_host_classes/src/ux_host_class_prolific_endpoints_get.c
index 373e07b..c581bfe 100644
--- a/common/usbx_host_classes/src/ux_host_class_prolific_endpoints_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_prolific_endpoints_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_prolific_endpoints_get PORTABLE C */
-/* 6.1.9 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,9 @@
/* use pre-calculated value */
/* instead of wMaxPacketSize, */
/* resulting in version 6.1.9 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_prolific_endpoints_get(UX_HOST_CLASS_PROLIFIC *prolific)
@@ -212,7 +215,7 @@ UX_TRANSFER *transfer_request;
{
/* The transfer on the interrupt endpoint can be started. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
}
diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c b/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c
index e1fbaff..890ba9d 100644
--- a/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c
+++ b/common/usbx_host_classes/src/ux_host_class_prolific_ioctl.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_prolific_ioctl PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +77,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_prolific_ioctl(UX_HOST_CLASS_PROLIFIC *prolific, ULONG ioctl_function,
@@ -250,7 +253,7 @@ VOID (*callback_function) (struct UX_HOST_CLASS_P
transfer_request -> ux_transfer_request_index = 0;
/* Send request to HCD layer. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
/* Reset upstream data pipes part 1. */
transfer_request -> ux_transfer_request_data_pointer = UX_NULL;
diff --git a/common/usbx_host_classes/src/ux_host_class_prolific_setup.c b/common/usbx_host_classes/src/ux_host_class_prolific_setup.c
index 8d4a91e..5c3082a 100644
--- a/common/usbx_host_classes/src/ux_host_class_prolific_setup.c
+++ b/common/usbx_host_classes/src/ux_host_class_prolific_setup.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_prolific_setup PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +71,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_prolific_setup(UX_HOST_CLASS_PROLIFIC *prolific)
@@ -360,7 +363,7 @@ UINT status;
transfer_request -> ux_transfer_request_value = UX_HOST_CLASS_PROLIFIC_COMMAND_REG_CONFIGURE;
/* Send request to HCD layer. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
/* Reset upstream data pipes part 1. */
diff --git a/common/usbx_host_classes/src/ux_host_class_storage_device_reset.c b/common/usbx_host_classes/src/ux_host_class_storage_device_reset.c
index fd3c406..0ebd352 100644
--- a/common/usbx_host_classes/src/ux_host_class_storage_device_reset.c
+++ b/common/usbx_host_classes/src/ux_host_class_storage_device_reset.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_device_reset PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* added standalone support, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_storage_device_reset(UX_HOST_CLASS_STORAGE *storage)
@@ -93,7 +96,7 @@ UINT status;
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
/* We need to prevent other threads from simultaneously using the endpoint. */
- status = _ux_host_semaphore_get(&control_endpoint -> ux_endpoint_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get_norc(&control_endpoint -> ux_endpoint_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
/* Create a transfer_request for the RESET request. */
transfer_request -> ux_transfer_request_data_pointer = UX_NULL;
diff --git a/common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c b/common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c
index 8c2dd17..4d7fc2a 100644
--- a/common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c
+++ b/common/usbx_host_classes/src/ux_host_class_storage_driver_entry.c
@@ -30,26 +30,88 @@
#include "ux_host_stack.h"
-#if !defined(UX_HOST_CLASS_STORAGE_NO_FILEX) && !defined(UX_HOST_STANDALONE)
-/**************************************************************************/
-/* */
-/* FUNCTION RELEASE */
-/* */
-/* _ux_host_class_storage_driver_entry PORTABLE C */
-/* 6.1.10 */
+/* Defined if FileX is not integrated in USBX
+ and it's used as external module for file system. */
+
+/* #define UX_HOST_CLASS_STORAGE_EXT_FILEX */
+
+#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
+
+#ifdef FX_API_H /* For test, confirm FX is not included before. */
+#error fx_api.h should not be included in this mode
+#endif
+
+/* FX not integrated in UX, but used as external module. */
+#if defined(UX_HOST_CLASS_STORAGE_EXT_FILEX)
+
+/* FX related things needs define here. */
+#include "fx_api.h"
+#define UX_MEDIA FX_MEDIA
+VOID _ux_host_class_storage_driver_entry(UX_MEDIA *media);
+
+/* Partition is not managed. */
+#define _ux_host_class_storage_media_partition_start(m) (0)
+
+/* FX driver is available to support FX as external module. */
+#ifndef UX_HOST_CLASS_STORAGE_DRIVER_ENTRY_ENABLE
+#define UX_HOST_CLASS_STORAGE_DRIVER_ENTRY_ENABLE
+#endif
+#endif
+#else
+
+/* Partition is mounted in UX. */
+#define _ux_host_class_storage_media_partition_start(m) (m)->ux_host_class_storage_media_partition_start
+
+/* FX driver is used for RTOS mode by default. */
+#ifndef UX_HOST_CLASS_STORAGE_DRIVER_ENTRY_ENABLE
+#define UX_HOST_CLASS_STORAGE_DRIVER_ENTRY_ENABLE
+#endif
+#endif
+
+
+#if defined(UX_HOST_CLASS_STORAGE_DRIVER_ENTRY_ENABLE)
+/**************************************************************************/
+/* */
+/* FUNCTION RELEASE */
+/* */
+/* _ux_host_class_storage_driver_entry PORTABLE C */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
-/* This function is the entry point for the FileX file system. All */
-/* FileX driver I/O calls are are multiplexed here and rerouted to */
+/* This function is the entry point for the FileX file system. All */
+/* FileX driver I/O calls are are multiplexed here and rerouted to */
/* the proper USB storage class functions. */
/* */
-/* This entry is for FX support, it's not available if FX media is not */
-/* integrated or standalone mode is used. */
-/* */
+/* When the entry is for storage with FX support (not in standalone */
+/* mode, and with FileX), the FX media is openned in storage mount */
+/* flow, and can be directly used in application after mounted. */
+/* */
+/* When the entry is for no FX mode (FX in external module, and USBX */
+/* is compiled without FileX integration), it is an example without */
+/* disk partition support. In this case the FX media does not operate */
+/* inside the storage flow. Actions are taken when application mounts */
+/* media to FX_MEDIA and then have access to media APIs. */
+/* */
+/* In no FX mode demo, it assumes whole media is managed (start from */
+/* sector 0) without partitions. */
+/* */
+/* The following links are not initialized in no FX mode, they must be */
+/* initialized before using the entry in no FX mode: */
+/* - FX_MEDIA::fx_media_driver_info Pointer to storage instance */
+/* - FX_MEDIA::fx_media_reserved_for_user */
+/* Pointer to the mounted media */
+/* instance */
+/* */
+/* To support partitions in no FX mode, new struct should be created */
+/* to include storage media and partition information, the sample code */
+/* must be modified to use such a struct to access partitions, and */
+/* partitions must be scanned outside in application to fill related */
+/* fields in such a struct. */
+/* */
/* INPUT */
/* */
/* media FileX media pointer */
@@ -82,6 +144,10 @@
/* resulting in version 6.1 */
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* added implement to support */
+/* external FX mode, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_storage_driver_entry(FX_MEDIA *media)
@@ -108,16 +174,43 @@ UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
return;
}
+#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
+
+ /* Ensure the media is valid. */
+ if ((storage_media -> ux_host_class_storage_media_storage != storage) ||
+ (storage_media -> ux_host_class_storage_media_status != UX_USED))
+ {
+
+ /* Media instance is invalid. */
+ media -> fx_media_driver_status = FX_PTR_ERROR;
+ return;
+ }
+#endif
+
/* Protect Thread reentry to this instance. */
- status = _ux_host_semaphore_get(&storage -> ux_host_class_storage_semaphore, UX_WAIT_FOREVER);
+ status = _ux_host_class_storage_lock(storage, UX_WAIT_FOREVER);
+ if (status != UX_SUCCESS)
+ {
+
+ /* Unable to lock, return an error. */
+ media -> fx_media_driver_status = FX_INVALID_STATE;
+ return;
+ }
/* Restore the LUN number from the media instance. */
storage -> ux_host_class_storage_lun = storage_media -> ux_host_class_storage_media_lun;
/* And the sector size. */
- storage -> ux_host_class_storage_sector_size = storage_media -> ux_host_class_storage_media_sector_size;
+ storage -> ux_host_class_storage_sector_size =
+ storage_media -> ux_host_class_storage_media_sector_size;
+#if defined(UX_HOST_CLASS_STORAGE_NO_FILEX)
+ /* Restore current used last sector number. */
+ storage -> ux_host_class_storage_last_sector_number =
+ storage_media -> ux_host_class_storage_media_number_sectors - 1;
+#endif
+
/* Look at the request specified by the FileX caller. */
switch (media -> fx_media_driver_request)
{
@@ -125,30 +218,54 @@ UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
case FX_DRIVER_READ:
/* Read one or more sectors. */
- status = _ux_host_class_storage_media_read(storage, media -> fx_media_driver_logical_sector +
- storage_media -> ux_host_class_storage_media_partition_start,
- media -> fx_media_driver_sectors, media -> fx_media_driver_buffer);
+ status = _ux_host_class_storage_media_read(storage,
+ media -> fx_media_driver_logical_sector +
+ _ux_host_class_storage_media_partition_start(storage_media),
+ media -> fx_media_driver_sectors,
+ media -> fx_media_driver_buffer);
/* Check completion status. */
if (status == UX_SUCCESS)
media -> fx_media_driver_status = FX_SUCCESS;
else
- media -> fx_media_driver_status = _ux_host_class_storage_sense_code_translate(storage, status);
+ {
+
+#if defined(UX_HOST_STANDALONE)
+
+ /* Poll status. */
+ _ux_host_class_storage_media_check(storage);
+#endif
+
+ media -> fx_media_driver_status =
+ _ux_host_class_storage_sense_code_translate(storage, status);
+ }
break;
case FX_DRIVER_WRITE:
/* Write one or more sectors. */
- status = _ux_host_class_storage_media_write(storage, media -> fx_media_driver_logical_sector +
- storage_media -> ux_host_class_storage_media_partition_start,
- media -> fx_media_driver_sectors, media -> fx_media_driver_buffer);
+ status = _ux_host_class_storage_media_write(storage,
+ media -> fx_media_driver_logical_sector +
+ _ux_host_class_storage_media_partition_start(storage_media),
+ media -> fx_media_driver_sectors,
+ media -> fx_media_driver_buffer);
/* Check completion status. */
if (status == UX_SUCCESS)
media -> fx_media_driver_status = FX_SUCCESS;
else
- media -> fx_media_driver_status = _ux_host_class_storage_sense_code_translate(storage,status);
+ {
+
+#if defined(UX_HOST_STANDALONE)
+
+ /* Poll status. */
+ _ux_host_class_storage_media_check(storage);
+#endif
+
+ media -> fx_media_driver_status =
+ _ux_host_class_storage_sense_code_translate(storage,status);
+ }
break;
@@ -158,14 +275,22 @@ UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
media -> fx_media_driver_status = FX_SUCCESS;
break;
+
case FX_DRIVER_ABORT:
/* Nothing to do. Just return a good status! */
media -> fx_media_driver_status = FX_SUCCESS;
break;
+
case FX_DRIVER_INIT:
+#if defined(UX_HOST_STANDALONE)
+
+ /* Poll status. */
+ _ux_host_class_storage_media_check(storage);
+#endif
+
/* Check for media protection. We must do this operation here because FileX clears all the
media fields before init. */
if (storage -> ux_host_class_storage_write_protected_media == UX_TRUE)
@@ -188,30 +313,53 @@ UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
case FX_DRIVER_BOOT_READ:
/* Read the media boot sector. */
- status = _ux_host_class_storage_media_read(storage, storage_media -> ux_host_class_storage_media_partition_start, 1,
+ status = _ux_host_class_storage_media_read(storage,
+ _ux_host_class_storage_media_partition_start(storage_media), 1,
media -> fx_media_driver_buffer);
/* Check completion status. */
if (status == UX_SUCCESS)
media -> fx_media_driver_status = FX_SUCCESS;
else
- media -> fx_media_driver_status = _ux_host_class_storage_sense_code_translate(storage,status);
+ {
+
+#if defined(UX_HOST_STANDALONE)
+
+ /* Poll status. */
+ _ux_host_class_storage_media_check(storage);
+#endif
+
+ media -> fx_media_driver_status =
+ _ux_host_class_storage_sense_code_translate(storage,status);
+ }
break;
case FX_DRIVER_BOOT_WRITE:
/* Write the boot sector. */
- status = _ux_host_class_storage_media_write(storage, storage_media -> ux_host_class_storage_media_partition_start, 1,
+ status = _ux_host_class_storage_media_write(storage,
+ _ux_host_class_storage_media_partition_start(storage_media), 1,
media -> fx_media_driver_buffer);
/* Check completion status. */
if (status == UX_SUCCESS)
media -> fx_media_driver_status = FX_SUCCESS;
else
- media -> fx_media_driver_status = _ux_host_class_storage_sense_code_translate(storage, status);
+ {
+
+#if defined(UX_HOST_STANDALONE)
+
+ /* Poll status. */
+ _ux_host_class_storage_media_check(storage);
+#endif
+
+ media -> fx_media_driver_status =
+ _ux_host_class_storage_sense_code_translate(storage,status);
+ }
break;
+
default:
/* Invalid request from FileX */
@@ -220,6 +368,6 @@ UX_HOST_CLASS_STORAGE_MEDIA *storage_media;
}
/* Unprotect thread reentry to this instance. */
- _ux_host_semaphore_put(&storage -> ux_host_class_storage_semaphore);
+ _ux_host_class_storage_unlock(storage);
}
-#endif /* !defined(UX_HOST_CLASS_STORAGE_NO_FILEX) */
+#endif
diff --git a/common/usbx_host_classes/src/ux_host_class_storage_thread_entry.c b/common/usbx_host_classes/src/ux_host_class_storage_thread_entry.c
index 50939c6..6530b1a 100644
--- a/common/usbx_host_classes/src/ux_host_class_storage_thread_entry.c
+++ b/common/usbx_host_classes/src/ux_host_class_storage_thread_entry.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_thread_entry PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -96,6 +96,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_host_class_storage_thread_entry(ULONG class_address)
@@ -392,7 +395,7 @@ UCHAR *memory;
#endif
/* Now, we protect the storage instance. */
- status = _ux_host_semaphore_get(&storage -> ux_host_class_storage_semaphore, UX_WAIT_FOREVER);
+ _ux_host_semaphore_get(&storage -> ux_host_class_storage_semaphore, UX_WAIT_FOREVER);
}
break;
diff --git a/common/usbx_host_classes/src/ux_host_class_storage_transport_cb.c b/common/usbx_host_classes/src/ux_host_class_storage_transport_cb.c
index e6ec2fb..7475fa3 100644
--- a/common/usbx_host_classes/src/ux_host_class_storage_transport_cb.c
+++ b/common/usbx_host_classes/src/ux_host_class_storage_transport_cb.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_transport_cb PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* fixed CB request index, */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_storage_transport_cb(UX_HOST_CLASS_STORAGE *storage, UCHAR *data_pointer)
@@ -116,7 +119,7 @@ UX_ENDPOINT *control_endpoint;
transfer_request -> ux_transfer_request_requested_length = (ULONG) * (cbw + UX_HOST_CLASS_STORAGE_CBW_CB_LENGTH);
/* Send the ufi block on the control endpoint. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
/* Check the transfer status. If there is a transport error, the host must perform
a reset recovery. */
diff --git a/common/usbx_host_classes/src/ux_host_class_storage_transport_cbi.c b/common/usbx_host_classes/src/ux_host_class_storage_transport_cbi.c
index 18a22cb..b104fb7 100644
--- a/common/usbx_host_classes/src/ux_host_class_storage_transport_cbi.c
+++ b/common/usbx_host_classes/src/ux_host_class_storage_transport_cbi.c
@@ -36,7 +36,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_transport_cbi PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -81,6 +81,9 @@
/* fixed CBI request index, */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_storage_transport_cbi(UX_HOST_CLASS_STORAGE *storage, UCHAR *data_pointer)
@@ -118,7 +121,7 @@ UX_ENDPOINT *control_endpoint;
transfer_request -> ux_transfer_request_requested_length = (ULONG)*(cbw+UX_HOST_CLASS_STORAGE_CBW_CB_LENGTH);
/* Send the ufi block on the control endpoint. */
- status = _ux_host_stack_transfer_request(transfer_request);
+ _ux_host_stack_transfer_request(transfer_request);
/* Check the transfer status. If there is a transport error, the host must perform
a reset recovery. */
diff --git a/common/usbx_host_classes/src/ux_host_class_swar_read.c b/common/usbx_host_classes/src/ux_host_class_swar_read.c
index 170a9d6..dbd6a93 100644
--- a/common/usbx_host_classes/src/ux_host_class_swar_read.c
+++ b/common/usbx_host_classes/src/ux_host_class_swar_read.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_swar_read PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -80,6 +80,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_swar_read(UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
@@ -154,7 +157,7 @@ ULONG transfer_request_length;
*actual_length += transfer_request -> ux_transfer_request_actual_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* Set the completion code. */
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
@@ -173,7 +176,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* There was a non transfer error, no partial transfer to be checked. */
return(status);
@@ -189,7 +192,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* Return success to caller. */
return(UX_SUCCESS);
@@ -203,7 +206,7 @@ ULONG transfer_request_length;
}
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* We get here when all the transfers went through without errors. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_classes/src/ux_host_class_swar_write.c b/common/usbx_host_classes/src/ux_host_class_swar_write.c
index 24b5f60..e8a96ad 100644
--- a/common/usbx_host_classes/src/ux_host_class_swar_write.c
+++ b/common/usbx_host_classes/src/ux_host_class_swar_write.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_swar_write PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_swar_write(UX_HOST_CLASS_SWAR *swar, UCHAR * data_pointer,
@@ -153,7 +156,7 @@ ULONG transfer_request_length;
*actual_length += transfer_request -> ux_transfer_request_actual_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* Set the completion code. */
transfer_request -> ux_transfer_request_completion_code = UX_TRANSFER_TIMEOUT;
@@ -172,7 +175,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* There was a non transfer error, no partial transfer to be checked */
return(status);
@@ -188,7 +191,7 @@ ULONG transfer_request_length;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* Return success. */
return(UX_SUCCESS);
@@ -204,7 +207,7 @@ ULONG transfer_request_length;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
+ _ux_host_semaphore_put(&swar -> ux_host_class_swar_semaphore);
/* We get here when all the transfers went through without errors. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_activate.c b/common/usbx_host_classes/src/ux_host_class_video_activate.c
index f75a986..7a70367 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_activate.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_activate.c
@@ -159,7 +159,7 @@ UCHAR *baInterfaceNr;
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_activate PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -209,6 +209,10 @@ UCHAR *baInterfaceNr;
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_activate(UX_HOST_CLASS_COMMAND *command)
@@ -248,7 +252,7 @@ UX_HOST_CLASS_VIDEO_DESCRIPTORS_PARSER parser;
interface -> ux_interface_class_instance = (VOID *) video;
/* Create this class instance. */
- status = _ux_host_stack_class_instance_create(video -> ux_host_class_video_class, (VOID *) video);
+ _ux_host_stack_class_instance_create(video -> ux_host_class_video_class, (VOID *) video);
/* Configure the video. */
status = _ux_host_class_video_configure(video);
@@ -321,7 +325,7 @@ UX_HOST_CLASS_VIDEO_DESCRIPTORS_PARSER parser;
no need to free. */
/* Destroy the semaphore. */
- if (video -> ux_host_class_video_semaphore.tx_semaphore_id != 0)
+ if (_ux_host_semaphore_created(&video -> ux_host_class_video_semaphore))
_ux_host_semaphore_delete(&video -> ux_host_class_video_semaphore);
/* Destroy the class instance. */
diff --git a/common/usbx_host_classes/src/ux_host_class_video_channel_start.c b/common/usbx_host_classes/src/ux_host_class_video_channel_start.c
index 02baddb..45ee47b 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_channel_start.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_channel_start.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_channel_start PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -85,6 +85,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_channel_start(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_CHANNEL *video_parameter)
@@ -119,7 +122,7 @@ UINT max_payload_size;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -255,7 +258,7 @@ UINT max_payload_size;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_configure.c b/common/usbx_host_classes/src/ux_host_class_video_configure.c
index 2eea285..646fcc4 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_configure.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_configure.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_configure PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -77,6 +77,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_configure(UX_HOST_CLASS_VIDEO *video)
@@ -106,7 +109,7 @@ UX_DEVICE *parent_device;
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_CONFIGURATION_HANDLE_UNKNOWN);
/* If trace is enabled, insert this event into the trace buffer. */
- //UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_CONFIGURATION_HANDLE_UNKNOWN, video -> ux_host_class_video_device, 0, 0, UX_TRACE_ERRORS, 0, 0)
+ UX_TRACE_IN_LINE_INSERT(UX_TRACE_ERROR, UX_CONFIGURATION_HANDLE_UNKNOWN, video -> ux_host_class_video_device, 0, 0, UX_TRACE_ERRORS, 0, 0)
return(UX_CONFIGURATION_HANDLE_UNKNOWN);
@@ -139,6 +142,8 @@ UX_DEVICE *parent_device;
/* We have the valid configuration. Ask the USBX stack to set this configuration */
status = _ux_host_stack_device_configuration_select(configuration);
+ if (status != UX_SUCCESS)
+ return(status);
/* Start with interface number 0. */
interface_number = 0;
diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_get.c b/common/usbx_host_classes/src/ux_host_class_video_control_get.c
index 91bf813..34dc7b5 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_control_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_control_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_control_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_control_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
@@ -118,7 +121,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -209,7 +212,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c b/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c
index 97699a3..f624ba1 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_control_value_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_control_value_get PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_control_value_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
@@ -118,7 +121,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -169,7 +172,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c b/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c
index a9b7382..82353a7 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_control_value_set.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_control_value_set PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_control_value_set(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_CONTROL *video_control)
@@ -117,7 +120,7 @@ UCHAR * control_buffer;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -165,7 +168,7 @@ UCHAR * control_buffer;
_ux_utility_memory_free(control_buffer);
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c b/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c
index 364b3f6..e20a3a4 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_frame_parameters_set.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_frame_parameters_set PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -85,6 +85,10 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* internal clean up, */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_frame_parameters_set(UX_HOST_CLASS_VIDEO *video, ULONG frame_format, ULONG width, ULONG height, ULONG frame_interval)
@@ -187,7 +191,8 @@ ULONG max_payload_size;
/* Check if the frame interval is valid. */
if (frame_interval >= min_frame_interval && frame_interval <= max_frame_interval &&
- ((frame_interval - min_frame_interval) % frame_interval_step == 0))
+ ((frame_interval_step == 0) ||
+ (frame_interval - min_frame_interval) % frame_interval_step == 0))
{
/* Save the frame interval. */
@@ -218,6 +223,8 @@ ULONG max_payload_size;
/* Protect thread reentry to this instance. */
status = _ux_host_semaphore_get(&video -> ux_host_class_video_semaphore, UX_WAIT_FOREVER);
+ if (status != UX_SUCCESS)
+ return(status);
/* We need to get the default control endpoint transfer request pointer. */
control_endpoint = &video -> ux_host_class_video_device -> ux_device_control_endpoint;
@@ -232,7 +239,7 @@ ULONG max_payload_size;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return error. */
return(UX_MEMORY_INSUFFICIENT);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_read.c b/common/usbx_host_classes/src/ux_host_class_video_read.c
index fa35e77..08633fe 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_read.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_read.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_read PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -87,6 +87,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_read(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *video_transfer_request)
@@ -120,7 +123,7 @@ UX_HOST_CLASS_VIDEO_TRANSFER_REQUEST *transfer_list;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_VIDEO_WRONG_INTERFACE);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_stop.c b/common/usbx_host_classes/src/ux_host_class_video_stop.c
index 15cd33c..ba4328c 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_stop.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_stop.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_stop PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_stop(UX_HOST_CLASS_VIDEO *video)
@@ -129,7 +132,7 @@ UINT streaming_interface;
video -> ux_host_class_video_isochronous_endpoint = UX_NULL;
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return successful completion. */
return(UX_SUCCESS);
@@ -141,7 +144,7 @@ UINT streaming_interface;
}
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return completion status. */
return(status);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c
index 8bf0caf..a30d72b 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffer_add.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_transfer_buffer_add PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -82,6 +82,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_transfer_buffer_add(UX_HOST_CLASS_VIDEO *video, UCHAR* buffer)
@@ -116,7 +119,7 @@ ULONG packet_size;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_VIDEO_WRONG_INTERFACE);
@@ -133,7 +136,7 @@ ULONG packet_size;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return error status. */
return(UX_MEMORY_ARRAY_FULL);
diff --git a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c
index d28f8e4..bfa1ffd 100644
--- a/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c
+++ b/common/usbx_host_classes/src/ux_host_class_video_transfer_buffers_add.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_transfer_buffers_add PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -91,6 +91,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_transfer_buffers_add(UX_HOST_CLASS_VIDEO *video, UCHAR** buffers, ULONG num_buffers)
@@ -125,7 +128,7 @@ UINT i;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_CLASS, UX_HOST_CLASS_VIDEO_WRONG_INTERFACE);
@@ -155,7 +158,7 @@ UINT i;
{
/* Unprotect thread reentry to this instance. */
- status = _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
+ _ux_host_semaphore_put(&video -> ux_host_class_video_semaphore);
/* Return error status. */
return(status);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_done_queue_process.c b/common/usbx_host_controllers/src/ux_hcd_ehci_done_queue_process.c
index d04571e..7c2dfec 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_done_queue_process.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_done_queue_process.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_done_queue_process PORTABLE C */
-/* 6.1.2 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -79,6 +79,9 @@
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warning, */
/* resulting in version 6.1.2 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_hcd_ehci_done_queue_process(UX_HCD_EHCI *hcd_ehci)
@@ -93,7 +96,7 @@ UX_EHCI_ED *start_ed;
UX_EHCI_PERIODIC_LINK_POINTER lp;
/* We scan the active isochronous list first. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
lp.itd_ptr = hcd_ehci -> ux_hcd_ehci_hsiso_scan_list;
while(lp.itd_ptr != UX_NULL)
{
@@ -101,12 +104,12 @@ UX_EHCI_PERIODIC_LINK_POINTER lp;
/* Process the iTD, return next active TD. */
lp.itd_ptr = _ux_hcd_ehci_hsisochronous_tds_process(hcd_ehci, lp.itd_ptr);
}
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
/* We scan the split isochronous list then. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
lp.sitd_ptr = hcd_ehci -> ux_hcd_ehci_fsiso_scan_list;
while(lp.sitd_ptr != UX_NULL)
{
@@ -114,13 +117,13 @@ UX_EHCI_PERIODIC_LINK_POINTER lp;
/* Process the iTD, return next active TD. */
lp.sitd_ptr = _ux_hcd_ehci_fsisochronous_tds_process(hcd_ehci, lp.sitd_ptr);
}
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
#endif
#endif
/* We scan the linked interrupt list then. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
ed.ed_ptr = hcd_ehci -> ux_hcd_ehci_interrupt_ed_list;
while(ed.ed_ptr != UX_NULL)
{
@@ -135,7 +138,7 @@ UX_EHCI_PERIODIC_LINK_POINTER lp;
/* Next ED. */
ed.ed_ptr = ed.ed_ptr -> ux_ehci_ed_next_ed;
}
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Now we can parse the asynchronous list. The head ED is always empty and
used as an anchor only. */
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_initialize.c b/common/usbx_host_controllers/src/ux_hcd_ehci_initialize.c
index ec2cbc4..24b849d 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_initialize.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_initialize.c
@@ -60,7 +60,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_initialize PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -90,8 +90,8 @@
/* _ux_utility_physical_address Get physical address */
/* _ux_host_semaphore_create Create semaphore */
/* _ux_host_semaphore_delete Delete semaphore */
-/* _ux_utility_mutex_create Create mutex */
-/* _ux_utility_mutex_delete Delete mutex */
+/* _ux_host_mutex_create Create mutex */
+/* _ux_host_mutex_delete Delete mutex */
/* _ux_utility_set_interrupt_handler Set interrupt handler */
/* _ux_utility_delay_ms Delay ms */
/* */
@@ -114,10 +114,17 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_initialize(UX_HCD *hcd)
{
+#if defined(UX_HOST_STANDALONE)
+ UX_PARAMETER_NOT_USED(hcd);
+ return(UX_FUNCTION_NOT_SUPPORTED);
+#else
UX_HCD_EHCI *hcd_ehci;
UX_EHCI_ED *ed;
@@ -329,7 +336,7 @@ UINT status = UX_SUCCESS;
_ux_hcd_ehci_register_write(hcd_ehci, EHCI_HCOR_CONFIG_FLAG, UX_EHCI_ROUTE_TO_LOCAL_HC);
/* Create mutex for periodic list modification. */
- status = _ux_utility_mutex_create(&hcd_ehci -> ux_hcd_ehci_periodic_mutex, "ehci_periodic_mutex");
+ status = _ux_host_mutex_create(&hcd_ehci -> ux_hcd_ehci_periodic_mutex, "ehci_periodic_mutex");
if (status != UX_SUCCESS)
status = (UX_MUTEX_ERROR);
}
@@ -420,7 +427,7 @@ UINT status = UX_SUCCESS;
_ux_utility_memory_free(hcd_ehci -> ux_hcd_ehci_hsiso_td_list);
#endif
if (hcd_ehci -> ux_hcd_ehci_periodic_mutex.tx_mutex_id != 0)
- _ux_utility_mutex_delete(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_delete(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
if (hcd_ehci -> ux_hcd_ehci_protect_semaphore.tx_semaphore_id != 0)
_ux_host_semaphore_delete(&hcd_ehci -> ux_hcd_ehci_protect_semaphore);
if (hcd_ehci -> ux_hcd_ehci_doorbell_semaphore.tx_semaphore_id != 0)
@@ -429,5 +436,5 @@ UINT status = UX_SUCCESS;
/* Return error status code. */
return(status);
+#endif
}
-
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c b/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c
index 488c54f..21de45b 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_create.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_interrupt_endpoint_create PORTABLE C */
-/* 6.1.6 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -76,8 +76,8 @@
/* _ux_hcd_ehci_least_traffic_list_get Get least traffic list */
/* _ux_hcd_ehci_poll_rate_entry_get Get anchor for poll rate */
/* _ux_utility_physical_address Get physical address */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_hcd_ehci_periodic_descriptor_link Link/unlink descriptor */
/* */
/* CALLED BY */
@@ -101,6 +101,9 @@
/* some macro options, */
/* filled max transfer length, */
/* resulting in version 6.1.6 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_interrupt_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@@ -245,7 +248,7 @@ UINT i;
interval = (1u << interval); /* 1 (1/8ms), 2, 4, 8 (1ms) */
/* We are now updating the periodic list. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Get the list index with the least traffic. */
ed_list = _ux_hcd_ehci_least_traffic_list_get(hcd_ehci, microframe_load, microframe_ssplit_count);
@@ -292,7 +295,7 @@ UINT i;
not be error but we check it any way. */
if (i >= interval)
{
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
ed -> ux_ehci_ed_status = UX_UNUSED;
return(UX_NO_BANDWIDTH_AVAILABLE);
}
@@ -411,7 +414,7 @@ UINT i;
hcd_ehci -> ux_hcd_ehci_interrupt_ed_list = ed;
/* Release the periodic list. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Return successful completion. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_destroy.c b/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_destroy.c
index 822c7bc..3e7284e 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_destroy.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_interrupt_endpoint_destroy.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_interrupt_endpoint_destroy PORTABLE C */
-/* 6.1.6 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -57,8 +57,8 @@
/* */
/* _ux_hcd_ehci_door_bell_wait Setup doorbell wait */
/* _ux_utility_physical_address Get physical address */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_hcd_ehci_periodic_descriptor_link Link/unlink descriptor */
/* */
/* CALLED BY */
@@ -79,6 +79,9 @@
/* fixed compile issues with */
/* some macro options, */
/* resulting in version 6.1.6 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_interrupt_endpoint_destroy(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@@ -94,7 +97,7 @@ ULONG max_packet_size;
ed = (UX_EHCI_ED *) endpoint -> ux_endpoint_ed;
/* Access to periodic list. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Unlink the periodic item. */
_ux_hcd_ehci_periodic_descriptor_link(ed -> ux_ehci_ed_previous_ed,
@@ -190,7 +193,7 @@ ULONG max_packet_size;
}
/* Release periodic list. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Arm the doorbell and wait for its completion. */
_ux_hcd_ehci_door_bell_wait(hcd_ehci);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c
index 29dd251..ef068a0 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_create.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_isochronous_endpoint_create PORTABLE C */
-/* 6.1.6 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -61,8 +61,8 @@
/* _ux_hcd_ehci_least_traffic_list_get Get least traffic list */
/* _ux_hcd_ehci_poll_rate_entry_get Get anchor for poll rate */
/* _ux_utility_physical_address Get physical address */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_hcd_ehci_periodic_descriptor_link Link/unlink descriptor */
/* */
/* CALLED BY */
@@ -84,6 +84,9 @@
/* some macro options, */
/* filled max transfer length, */
/* resulting in version 6.1.6 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_isochronous_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@@ -326,7 +329,7 @@ UINT status;
}
/* Lock the periodic list to update. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Get the list index with the least traffic. */
ed_list = _ux_hcd_ehci_least_traffic_list_get(hcd_ehci, microframe_load, microframe_ssplit_count);
@@ -370,7 +373,7 @@ UINT status;
not be error but we check it any way. */
if (microframe_i >= interval)
{
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
for (i = 0; i < ed -> ux_ehci_hsiso_ed_nb_tds; i ++)
ed -> ux_ehci_hsiso_ed_fr_td[i] -> ux_ehci_hsiso_td_status = UX_UNUSED;
_ux_utility_memory_free(ed);
@@ -555,7 +558,7 @@ UINT status;
}
/* Release the periodic table. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Return successful completion. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_destroy.c b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_destroy.c
index 92c3bf0..8fa5720 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_destroy.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_isochronous_endpoint_destroy.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_isochronous_endpoint_destroy PORTABLE C */
-/* 6.1.6 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -56,8 +56,8 @@
/* CALLS */
/* */
/* None */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_hcd_ehci_periodic_descriptor_link Link/unlink descriptor */
/* _ux_utility_memory_free Free memory */
/* */
@@ -79,6 +79,9 @@
/* fixed compile issues with */
/* some macro options, */
/* resulting in version 6.1.6 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_isochronous_endpoint_destroy(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@@ -114,7 +117,7 @@ ULONG last_size;
ed_td.void_ptr = endpoint -> ux_endpoint_ed;
/* Access to periodic list. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Check active iTD/siTD and unlink it. */
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
@@ -269,7 +272,7 @@ ULONG last_size;
}
/* Release periodic list. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Now we can safely make the iTD/siTDs free. */
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_regular_td_obtain.c b/common/usbx_host_controllers/src/ux_hcd_ehci_regular_td_obtain.c
index 7a5a08b..d4af36d 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_regular_td_obtain.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_regular_td_obtain.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_regular_td_obtain PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,8 +55,8 @@
/* CALLS */
/* */
/* _ux_utility_memory_set Set memory block */
-/* _ux_utility_mutex_on Get protection mutex */
-/* _ux_utility_mutex_off Release protection mutex */
+/* _ux_host_mutex_on Get protection mutex */
+/* _ux_host_mutex_off Release protection mutex */
/* */
/* CALLED BY */
/* */
@@ -71,6 +71,9 @@
/* verified memset and memcpy */
/* cases, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UX_EHCI_TD *_ux_hcd_ehci_regular_td_obtain(UX_HCD_EHCI *hcd_ehci)
@@ -82,7 +85,7 @@ ULONG td_element;
/* Get the mutex as this is a critical section. */
- _ux_utility_mutex_on(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_on(&_ux_system -> ux_system_mutex);
/* Start the search from the beginning of the list. */
td = hcd_ehci -> ux_hcd_ehci_td_list;
@@ -105,7 +108,7 @@ ULONG td_element;
td -> ux_ehci_td_alternate_link_pointer = (UX_EHCI_TD *) td_element;
/* Release the protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Success, return TD pointer. */
return(td);
@@ -118,7 +121,7 @@ ULONG td_element;
/* There is no available TD in the TD list. */
/* Release protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Error, return a null. */
return(UX_NULL);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_request_isochronous_transfer.c b/common/usbx_host_controllers/src/ux_hcd_ehci_request_isochronous_transfer.c
index 22a68c1..d3df179 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_request_isochronous_transfer.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_request_isochronous_transfer.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_request_isochronous_transfer PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -65,8 +65,8 @@
/* */
/* CALLS */
/* */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_host_semaphore_put Put semaphore */
/* */
/* CALLED BY */
@@ -83,6 +83,9 @@
/* 01-31-2022 Chaoqiong Xiao Modified comment(s), */
/* refined macros names, */
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_request_isochronous_transfer(UX_HCD_EHCI *hcd_ehci, UX_TRANSFER *transfer_request)
@@ -116,7 +119,7 @@ UCHAR start = UX_FALSE;
lp.ed_ptr = endpoint -> ux_endpoint_ed;
/* Lock the periodic list to update. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Append the request to iTD/siTD request list tail. */
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
@@ -167,7 +170,7 @@ UCHAR start = UX_FALSE;
(*tail) = ((*tail) -> ux_transfer_request_next_transfer_request);
/* Release the periodic table. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
/* Simulate iTD/siTD done to start - HCD signal. */
if (start)
diff --git a/common/usbx_host_controllers/src/ux_hcd_ehci_transfer_abort.c b/common/usbx_host_controllers/src/ux_hcd_ehci_transfer_abort.c
index 74c280c..f2df19a 100755
--- a/common/usbx_host_controllers/src/ux_hcd_ehci_transfer_abort.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ehci_transfer_abort.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_transfer_abort PORTABLE C */
-/* 6.1.8 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -57,8 +57,8 @@
/* CALLS */
/* */
/* _ux_utility_virtual_address Get virtual address */
-/* _ux_utility_mutex_on Get mutex */
-/* _ux_utility_mutex_off Put mutex */
+/* _ux_host_mutex_on Get mutex */
+/* _ux_host_mutex_off Put mutex */
/* _ux_utility_delay_ms Delay milliseconds */
/* _ux_hcd_ehci_ed_clean Clean TDs on ED */
/* */
@@ -79,6 +79,9 @@
/* 08-02-2021 Wen Wang Modified comment(s), */
/* fixed spelling error, */
/* resulting in version 6.1.8 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_transfer_abort(UX_HCD_EHCI *hcd_ehci,UX_TRANSFER *transfer_request)
@@ -116,7 +119,7 @@ ULONG remain_count;
{
/* Lock the periodic table. */
- _ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
if (endpoint -> ux_endpoint_device -> ux_device_speed != UX_HIGH_SPEED_DEVICE)
@@ -177,7 +180,7 @@ ULONG remain_count;
_ux_utility_delay_ms(1);
/* Release the periodic table. */
- _ux_utility_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
+ _ux_host_mutex_off(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);
}
else
diff --git a/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_create.c b/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_create.c
index 6012699..497707c 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_create.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_create.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_asynchronous_endpoint_create PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -72,6 +72,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed an addressing issue, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_asynchronous_endpoint_create(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
@@ -161,7 +164,10 @@ ULONG ohci_register;
/* Build the back chaining pointer. The previous head ED needs to know about the
inserted ED. */
if (head_ed != UX_NULL)
+ {
+ head_ed = _ux_utility_physical_address(head_ed);
head_ed -> ux_ohci_ed_previous_ed = ed;
+ }
/* Return successful completion. */
return(UX_SUCCESS);
diff --git a/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_destroy.c b/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_destroy.c
index d197298..439da05 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_destroy.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ohci_asynchronous_endpoint_destroy.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_asynchronous_endpoint_destroy PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -74,6 +74,9 @@
/* fixed physical and virtual */
/* address conversion, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed an addressing issue, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_asynchronous_endpoint_destroy(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
@@ -164,7 +167,10 @@ ULONG ohci_register;
/* Update the previous ED pointer in the next ED if exists. */
if (next_ed != UX_NULL)
+ {
+ next_ed = _ux_utility_virtual_address(next_ed);
next_ed -> ux_ohci_ed_previous_ed = previous_ed;
+ }
/* Ensure that the potential Halt bit is removed in the head ED. */
value_td = (ULONG) _ux_utility_virtual_address(ed -> ux_ohci_ed_head_td) & UX_OHCI_ED_MASK_TD;
diff --git a/common/usbx_host_controllers/src/ux_hcd_ohci_initialize.c b/common/usbx_host_controllers/src/ux_hcd_ohci_initialize.c
index 2ad6205..b8400c2 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ohci_initialize.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ohci_initialize.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_initialize PORTABLE C */
-/* 6.1.10 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -61,8 +61,8 @@
/* _ux_hcd_ohci_register_read Read OHCI register */
/* _ux_hcd_ohci_register_write Write OHCI register */
/* _ux_utility_memory_allocate Allocate memory block */
-/* _ux_utility_mutex_on Get mutex protection */
-/* _ux_utility_mutex_off Release mutex protection */
+/* _ux_host_mutex_on Get mutex protection */
+/* _ux_host_mutex_off Release mutex protection */
/* _ux_utility_physical_address Get physical address */
/* _ux_utility_set_interrupt_handler Setup interrupt handler */
/* */
@@ -82,6 +82,9 @@
/* 01-31-2022 Xiuwen Cai Modified comment(s), */
/* fixed HcPeriodicStart value,*/
/* resulting in version 6.1.10 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_initialize(UX_HCD *hcd)
@@ -161,7 +164,7 @@ UINT status;
/* The following is time critical. If we get interrupted here, the controller will go in
suspend mode. Get the protection mutex. */
- _ux_utility_mutex_on(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_on(&_ux_system -> ux_system_mutex);
/* Send the reset command to the controller. The controller should ack
this command within 10us. We try this several time and check for timeout. */
@@ -180,7 +183,7 @@ UINT status;
{
/* Release the thread protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_HCD, UX_CONTROLLER_INIT_FAILED);
@@ -206,7 +209,7 @@ UINT status;
hcd -> ux_hcd_status = UX_HCD_STATUS_OPERATIONAL;
/* We can safely release the mutex protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Set the controller interval. */
ohci_register = _ux_hcd_ohci_register_read(hcd_ohci, OHCI_HC_FM_INTERVAL) & OHCI_HC_FM_INTERVAL_CLEAR;
diff --git a/common/usbx_host_controllers/src/ux_hcd_ohci_regular_td_obtain.c b/common/usbx_host_controllers/src/ux_hcd_ohci_regular_td_obtain.c
index 71bf441..064dcc8 100644
--- a/common/usbx_host_controllers/src/ux_hcd_ohci_regular_td_obtain.c
+++ b/common/usbx_host_controllers/src/ux_hcd_ohci_regular_td_obtain.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_regular_td_obtain PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -55,8 +55,8 @@
/* CALLS */
/* */
/* _ux_utility_memory_set Set memory block */
-/* _ux_utility_mutex_on Get protection mutex */
-/* _ux_utility_mutex_off Release protection mutex */
+/* _ux_host_mutex_on Get protection mutex */
+/* _ux_host_mutex_off Release protection mutex */
/* */
/* CALLED BY */
/* */
@@ -71,6 +71,9 @@
/* verified memset and memcpy */
/* cases, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UX_OHCI_TD *_ux_hcd_ohci_regular_td_obtain(UX_HCD_OHCI *hcd_ohci)
@@ -81,7 +84,7 @@ ULONG td_index;
/* Set the Mutex as this is a critical section. */
- _ux_utility_mutex_on(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_on(&_ux_system -> ux_system_mutex);
/* Start the search from the beginning of the regular TD list. */
td = hcd_ohci -> ux_hcd_ohci_td_list;
@@ -100,7 +103,7 @@ ULONG td_index;
td -> ux_ohci_td_status = UX_USED;
/* Release the protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Return TD pointer - success! */
return(td);
@@ -113,7 +116,7 @@ ULONG td_index;
/* There is no available TD in the TD list. */
/* Release protection. */
- _ux_utility_mutex_off(&_ux_system -> ux_system_mutex);
+ _ux_host_mutex_off(&_ux_system -> ux_system_mutex);
/* Return NULL to caller. */
return(UX_NULL);
diff --git a/common/usbx_network/src/ux_network_driver.c b/common/usbx_network/src/ux_network_driver.c
index c94fd8d..d5c9bd5 100644
--- a/common/usbx_network/src/ux_network_driver.c
+++ b/common/usbx_network/src/ux_network_driver.c
@@ -20,10 +20,20 @@
/**************************************************************************/
/**************************************************************************/
+#include "ux_api.h"
+
+#if !defined(UX_STANDALONE)
+#ifndef UX_NETWORK_DRIVER_ENABLE
+#define UX_NETWORK_DRIVER_ENABLE
+#endif
+#else
+/* Standalone mode not supported. */
+#endif
+
+#if defined(UX_NETWORK_DRIVER_ENABLE)
#include "tx_api.h"
#include "tx_thread.h"
#include "nx_api.h"
-#include "ux_api.h"
#include "ux_network_driver.h"
@@ -36,7 +46,7 @@ static USB_NETWORK_DEVICE_TYPE usb_network_devices[USB_NETWORK_DEVICE_MAX_INSTAN
/* FUNCTION RELEASE */
/* */
/* _ux_network_init PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +79,9 @@ static USB_NETWORK_DEVICE_TYPE usb_network_devices[USB_NETWORK_DEVICE_MAX_INSTAN
/* verified memset and memcpy */
/* cases, */
/* resulting in version 6.1 */
+/* 04-25-2022 Chaoqiong Xiao Modified comment(s), */
+/* fixed standalone compile, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_network_driver_init(VOID)
@@ -966,3 +979,4 @@ USB_NETWORK_DEVICE_TYPE *usb_network_device_ptr = (USB_NETWORK_DEVICE_TYPE*)ux_n
usb_network_device_ptr -> ux_network_device_link_status = NX_FALSE;
}
+#endif
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c b/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c
index 6944122..4095c0d 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_array_element_to_array_hexa.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_array_element_to_array_hexa PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -66,6 +66,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_array_element_to_array_hexa(UCHAR *element, ULONG *hexa_array)
@@ -131,7 +134,7 @@ UINT status;
{
/* Shift the previous content by 1 nibble. */
- local_hexa_value = local_hexa_value << 4;
+ local_hexa_value = (local_hexa_value << 4) & 0xFFFFFFFFu;
/* Get the element content. */
element_content = *element;
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c
index 3c46144..bfb9408 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpsclient_object_data_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_dpsclient_object_data_get PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +70,9 @@
/* refer to TX symbols instead */
/* of using them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_dpsclient_object_data_get(UX_SLAVE_CLASS_PIMA *pima, ULONG object_handle, UCHAR *object_buffer, ULONG object_offset,
@@ -128,8 +131,6 @@ UINT status;
}
else
{
- /* Get the object info from the job info structure. */
- object_info = (UX_SLAVE_CLASS_PIMA_OBJECT *) pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object;
/* Obtain the data from the application jobinfo callback. */
status = pictbridge -> ux_pictbridge_jobinfo.ux_pictbridge_jobinfo_object_data_read(pictbridge, object_handle, object_buffer, object_offset,
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
index 1a69f4e..f76fa21 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_input_object_notify_job_status.c
@@ -36,7 +36,7 @@
/* */
/* _ux_pictbridge_dpshost_input_object_notify_job_status */
/* PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* */
/* AUTHOR */
/* */
@@ -74,6 +74,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_dpshost_input_object_notify_job_status(UX_PICTBRIDGE *pictbridge,
@@ -111,7 +114,10 @@ UINT status = UX_SUCCESS;
/* Check length to go. */
object_length += 7;
if (object_length > UX_PICTBRIDGE_MAX_PIMA_OBJECT_BUFFER)
+ {
status = UX_MEMORY_INSUFFICIENT;
+ return (status);
+ }
/* Insert xxx decimal. */
status = _ux_pictbridge_hexa_to_decimal_string(printinfo -> ux_pictbridge_printinfo_current_page, pima_object_buffer, UX_PICTBRIDGE_LEADING_ZERO_ON, 3);
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
index 864d5f4..38c427f 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_output_object_configure_print_service.c
@@ -36,7 +36,7 @@
/* */
/* _ux_pictbridge_dpshost_output_object_configure_print_service */
/* PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -73,6 +73,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_dpshost_output_object_configure_print_service(UX_PICTBRIDGE *pictbridge,
@@ -111,6 +114,8 @@ UINT status;
status = _ux_pictbridge_object_tag_line_add(pima_object_buffer, object_length, _ux_pictbridge_xml_tag_line_vendorname,
UX_PICTBRIDGE_TAG_FLAG_BEGIN | UX_PICTBRIDGE_TAG_FLAG_END | UX_PICTBRIDGE_TAG_FLAG_VARIABLE_STRING,
UX_NULL, 0, (VOID *)(ALIGN_TYPE) pictbridge -> ux_pictbridge_dpslocal.ux_pictbridge_devinfo_product_name, &pima_object_buffer, &object_length);
+ if (status != UX_SUCCESS)
+ return(status);
/* Add the line <vendorSpecificVersion> major_minor </vendorSpecificVersion> */
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c
index efabe8e..ac9933d 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_start.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_dpshost_start PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -69,6 +69,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_dpshost_start(UX_PICTBRIDGE *pictbridge, UX_HOST_CLASS_PIMA *pima)
@@ -254,7 +257,7 @@ UINT length, length1;
if (status != UX_SUCCESS)
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
}
@@ -266,7 +269,7 @@ UINT length, length1;
if (status != UX_SUCCESS)
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pictbridge -> ux_pictbridge_pima, pima_session);
+ _ux_host_class_pima_session_close(pictbridge -> ux_pictbridge_pima, pima_session);
return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
}
@@ -277,7 +280,7 @@ UINT length, length1;
if (status != UX_SUCCESS)
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
}
@@ -290,7 +293,7 @@ UINT length, length1;
if (status != UX_SUCCESS)
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_STORE_NOT_AVAILABLE);
}
@@ -306,7 +309,7 @@ UINT length, length1;
if (status != UX_SUCCESS)
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE );
}
@@ -352,7 +355,7 @@ UINT length, length1;
{
/* Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_INVALID_OBJECT_HANDLE);
}
@@ -373,7 +376,7 @@ UINT length, length1;
}
/* We come here when we have not found any script or the script does not have the DDISCVRY.DPS file. Close the pima session. */
- status = _ux_host_class_pima_session_close(pima, pima_session);
+ _ux_host_class_pima_session_close(pima, pima_session);
return(UX_PICTBRIDGE_ERROR_NO_DISCOVERY_SCRIPT);
}
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c
index 6933bcb..83a6b21 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_startjob.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_dpshost_startjob PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -67,6 +67,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_dpshost_startjob(UX_PICTBRIDGE *pictbridge)
@@ -180,7 +183,7 @@ UCHAR *object_buffer;
/* Close the object. */
- status = _ux_host_class_pima_object_close(pima, pima_session,
+ _ux_host_class_pima_object_close(pima, pima_session,
printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
/* Return an error. */
return(UX_MEMORY_INSUFFICIENT);
@@ -269,7 +272,7 @@ UCHAR *object_buffer;
}
/* Close the object. */
- status = _ux_host_class_pima_object_close(pima, pima_session,
+ status = _ux_host_class_pima_object_close(pima, pima_session,
printinfo -> ux_pictbridge_printinfo_fileid, &pima_object);
/* Check error code. */
if (status != UX_SUCCESS)
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c
index c6eae64..88c3ac9 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_dpshost_thread.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_dpshost_thread PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +70,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
VOID _ux_pictbridge_dpshost_thread(ULONG parameter)
@@ -178,7 +181,8 @@ UINT status;
/* We have received an order to print one or more picture. */
_ux_pictbridge_dpshost_startjob(pictbridge);
-
+ break;
+
default :
break;
}
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c b/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c
index 23d50d6..6d47e5a 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_element_to_hexa.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_element_to_hexa PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -66,6 +66,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_element_to_hexa(UCHAR *element, ULONG *hexa_value)
@@ -101,7 +104,7 @@ UINT status;
{
/* Shift the previous content by 1 nibble. */
- local_hexa_value = local_hexa_value << 4;
+ local_hexa_value = (local_hexa_value << 4) & 0xFFFFFFFFu;
/* Get the element content. */
element_content = *element;
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c
index fa096df..e74dc79 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_decimal_string.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_hexa_to_decimal_string PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -78,6 +78,10 @@
/* verified memset and memcpy */
/* cases, */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* fixed maximum decimal */
+/* calculation issue, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_hexa_to_decimal_string(ULONG hexa_value, UCHAR *decimal_string,
@@ -121,7 +125,7 @@ ULONG decimal_max[8] = {9, 99, 999, 9999, 99999, 999999, 99999
}
/* If value exceeds, do not proceed. */
- if (hexa_value > decimal_max[decimal_string_shift - 1])
+ if (hexa_value > decimal_max[max_digit_string_size - 1])
return(UX_ERROR);
/* Set the leading zero flag. */
diff --git a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c
index 081cc88..8cdc34d 100644
--- a/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c
+++ b/common/usbx_pictbridge/src/ux_pictbridge_hexa_to_element.c
@@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_pictbridge_hexa_to_element PORTABLE C */
-/* 6.1 */
+/* 6.1.11 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -71,6 +71,9 @@
/* verified memset and memcpy */
/* cases, */
/* resulting in version 6.1 */
+/* 04-25-2022 Yajun Xia Modified comment(s), */
+/* internal clean up, */
+/* resulting in version 6.1.11 */
/* */
/**************************************************************************/
UINT _ux_pictbridge_hexa_to_element(ULONG hexa_value, UCHAR *element)
@@ -118,7 +121,14 @@ ULONG element_shift;
element_length++;
/* Continue shifting by one nibble. */
- element_shift = element_shift - 4;
+ if (element_shift >= 4)
+ {
+ element_shift = element_shift - 4;
+ }
+ else
+ {
+ break;
+ }
}
/* Operation was successful. */
diff --git a/ports/arm9/gnu/inc/ux_port.h b/ports/arm9/gnu/inc/ux_port.h
index 00882db..5d4e701 100644
--- a/ports/arm9/gnu/inc/ux_port.h
+++ b/ports/arm9/gnu/inc/ux_port.h
@@ -239,7 +239,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/arm9/iar/inc/ux_port.h b/ports/arm9/iar/inc/ux_port.h
index a2bc234..d1dba2a 100644
--- a/ports/arm9/iar/inc/ux_port.h
+++ b/ports/arm9/iar/inc/ux_port.h
@@ -246,7 +246,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a15/gnu/inc/ux_port.h b/ports/cortex_a15/gnu/inc/ux_port.h
index 79caa7f..ecd5f98 100644
--- a/ports/cortex_a15/gnu/inc/ux_port.h
+++ b/ports/cortex_a15/gnu/inc/ux_port.h
@@ -235,7 +235,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A15/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A15/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a5/gnu/inc/ux_port.h b/ports/cortex_a5/gnu/inc/ux_port.h
index b956ab2..4e2f3e6 100644
--- a/ports/cortex_a5/gnu/inc/ux_port.h
+++ b/ports/cortex_a5/gnu/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a5/iar/inc/ux_port.h b/ports/cortex_a5/iar/inc/ux_port.h
index 17266c5..40f22e6 100644
--- a/ports/cortex_a5/iar/inc/ux_port.h
+++ b/ports/cortex_a5/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a5x/ac6/inc/ux_port.h b/ports/cortex_a5x/ac6/inc/ux_port.h
index 7029bbc..a482d2a 100644
--- a/ports/cortex_a5x/ac6/inc/ux_port.h
+++ b/ports/cortex_a5x/ac6/inc/ux_port.h
@@ -259,7 +259,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5x/AC6 Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A5x/AC6 Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a7/gnu/inc/ux_port.h b/ports/cortex_a7/gnu/inc/ux_port.h
index ef0d5b4..c2f16da 100644
--- a/ports/cortex_a7/gnu/inc/ux_port.h
+++ b/ports/cortex_a7/gnu/inc/ux_port.h
@@ -246,7 +246,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A7/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A7/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a7/iar/inc/ux_port.h b/ports/cortex_a7/iar/inc/ux_port.h
index 12e711e..14a9a98 100644
--- a/ports/cortex_a7/iar/inc/ux_port.h
+++ b/ports/cortex_a7/iar/inc/ux_port.h
@@ -246,7 +246,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A7/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A7/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a8/gnu/inc/ux_port.h b/ports/cortex_a8/gnu/inc/ux_port.h
index 9107a7f..c18e330 100644
--- a/ports/cortex_a8/gnu/inc/ux_port.h
+++ b/ports/cortex_a8/gnu/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A8/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A8/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a8/iar/inc/ux_port.h b/ports/cortex_a8/iar/inc/ux_port.h
index b7b67dc..10ef85a 100644
--- a/ports/cortex_a8/iar/inc/ux_port.h
+++ b/ports/cortex_a8/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A8/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-A8/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a9/gnu/inc/ux_port.h b/ports/cortex_a9/gnu/inc/ux_port.h
index 6e4e382..5eec14e 100644
--- a/ports/cortex_a9/gnu/inc/ux_port.h
+++ b/ports/cortex_a9/gnu/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_a9/iar/inc/ux_port.h b/ports/cortex_a9/iar/inc/ux_port.h
index 3041444..d05f01e 100644
--- a/ports/cortex_a9/iar/inc/ux_port.h
+++ b/ports/cortex_a9/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX ARM9/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m0/gnu/inc/ux_port.h b/ports/cortex_m0/gnu/inc/ux_port.h
index 74351ef..97f6d96 100644
--- a/ports/cortex_m0/gnu/inc/ux_port.h
+++ b/ports/cortex_m0/gnu/inc/ux_port.h
@@ -240,7 +240,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M0/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M0/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m0/iar/inc/ux_port.h b/ports/cortex_m0/iar/inc/ux_port.h
index fc7eef0..05f25f8 100644
--- a/ports/cortex_m0/iar/inc/ux_port.h
+++ b/ports/cortex_m0/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M0/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M0/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m3/gnu/inc/ux_port.h b/ports/cortex_m3/gnu/inc/ux_port.h
index 5423f20..6ea912d 100644
--- a/ports/cortex_m3/gnu/inc/ux_port.h
+++ b/ports/cortex_m3/gnu/inc/ux_port.h
@@ -240,7 +240,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M3/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M3/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m3/iar/inc/ux_port.h b/ports/cortex_m3/iar/inc/ux_port.h
index 8b4ce6c..3e921dc 100644
--- a/ports/cortex_m3/iar/inc/ux_port.h
+++ b/ports/cortex_m3/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M3/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M3/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m4/gnu/inc/ux_port.h b/ports/cortex_m4/gnu/inc/ux_port.h
index fabaed1..7432a84 100644
--- a/ports/cortex_m4/gnu/inc/ux_port.h
+++ b/ports/cortex_m4/gnu/inc/ux_port.h
@@ -240,7 +240,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M4/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M4/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m4/iar/inc/ux_port.h b/ports/cortex_m4/iar/inc/ux_port.h
index 165ad8b..22994f9 100644
--- a/ports/cortex_m4/iar/inc/ux_port.h
+++ b/ports/cortex_m4/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M4/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M4/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m7/gnu/inc/ux_port.h b/ports/cortex_m7/gnu/inc/ux_port.h
index ef2354b..8474d80 100644
--- a/ports/cortex_m7/gnu/inc/ux_port.h
+++ b/ports/cortex_m7/gnu/inc/ux_port.h
@@ -240,7 +240,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M7/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M7/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_m7/iar/inc/ux_port.h b/ports/cortex_m7/iar/inc/ux_port.h
index cee0cb8..4fb4b5d 100644
--- a/ports/cortex_m7/iar/inc/ux_port.h
+++ b/ports/cortex_m7/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M7/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-M7/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_r4/gnu/inc/ux_port.h b/ports/cortex_r4/gnu/inc/ux_port.h
index 42fc51a..40ee7c0 100644
--- a/ports/cortex_r4/gnu/inc/ux_port.h
+++ b/ports/cortex_r4/gnu/inc/ux_port.h
@@ -238,7 +238,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R4/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R4/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_r4/iar/inc/ux_port.h b/ports/cortex_r4/iar/inc/ux_port.h
index 66ff365..c12fff6 100644
--- a/ports/cortex_r4/iar/inc/ux_port.h
+++ b/ports/cortex_r4/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R4/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R4/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_r5/gnu/inc/ux_port.h b/ports/cortex_r5/gnu/inc/ux_port.h
index b1f66ca..a657698 100644
--- a/ports/cortex_r5/gnu/inc/ux_port.h
+++ b/ports/cortex_r5/gnu/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R5/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R5/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/cortex_r5/iar/inc/ux_port.h b/ports/cortex_r5/iar/inc/ux_port.h
index 3a19749..f900373 100644
--- a/ports/cortex_r5/iar/inc/ux_port.h
+++ b/ports/cortex_r5/iar/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R5/IAR Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Cortex-R5/IAR Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/generic/inc/ux_port.h b/ports/generic/inc/ux_port.h
index 1334a3e..9b940b9 100644
--- a/ports/generic/inc/ux_port.h
+++ b/ports/generic/inc/ux_port.h
@@ -242,7 +242,7 @@ VOID outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Generic Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Generic Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif
diff --git a/ports/linux/gnu/inc/ux_port.h b/ports/linux/gnu/inc/ux_port.h
index fbcd964..692fed0 100644
--- a/ports/linux/gnu/inc/ux_port.h
+++ b/ports/linux/gnu/inc/ux_port.h
@@ -244,7 +244,7 @@ ULONG outpl(ULONG,ULONG);
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
- "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Linux/GNU Version 6.1.10 *";
+ "Copyright (c) Microsoft Corporation. All rights reserved. * USBX Linux/GNU Version 6.1.11 *";
#else
extern CHAR _ux_version_id[];
#endif