patch release 6.1.2

This commit is contained in:
Scott Larson 2020-11-10 13:37:32 -08:00
parent 5734ab7037
commit 0eb1872334
43 changed files with 962 additions and 476 deletions

View File

@ -77,6 +77,7 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_hcd_sim_host_timer_function.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_hcd_sim_host_transaction_schedule.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_hcd_sim_host_transfer_abort.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_hcd_sim_host_uninitialize.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_host_class_dpump_activate.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_host_class_dpump_configure.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_host_class_dpump_deactivate.c
@ -201,6 +202,7 @@ target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_thread_sleep.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_thread_suspend.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_timer_create.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_timer_delete.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_unicode_to_string.c
${CMAKE_CURRENT_LIST_DIR}/src/ux_utility_virtual_address.c

View File

@ -26,7 +26,7 @@
/* APPLICATION INTERFACE DEFINITION RELEASE */
/* */
/* ux_api.h PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -62,6 +62,12 @@
/* symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* used unsigned defines, */
/* added HCD uninit command, */
/* modified HCD status code, */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@ -196,7 +202,7 @@ typedef signed char SCHAR;
#define AZURE_RTOS_USBX
#define USBX_MAJOR_VERSION 6
#define USBX_MINOR_VERSION 1
#define USBX_PATCH_VERSION 0
#define USBX_PATCH_VERSION 2
/* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */
@ -808,48 +814,48 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
/* Define basic USBX constants. */
#define UX_NULL ((void*)0)
#define UX_TRUE 1
#define UX_FALSE 0
#define UX_TT_MASK 0x1FF
#define UX_TT_BANDWIDTH 6000
#define UX_SLAVE_ENDPOINT_DEFAULT_BUFFER_SIZE 256
#define UX_TRUE 1u
#define UX_FALSE 0u
#define UX_TT_MASK 0x1FFu
#define UX_TT_BANDWIDTH 6000u
#define UX_SLAVE_ENDPOINT_DEFAULT_BUFFER_SIZE 256u
#define UX_MAX_BYTES_PER_FRAME_FS 1157
#define UX_MAX_BYTES_PER_MICROFRAME_HS 5785
#define UX_MAX_BYTES_PER_FRAME_FS 1157u
#define UX_MAX_BYTES_PER_MICROFRAME_HS 5785u
/* Define USBX command request constants. */
#define UX_SETUP_REQUEST_TYPE 0
#define UX_SETUP_REQUEST 1
#define UX_SETUP_VALUE 2
#define UX_SETUP_INDEX 4
#define UX_SETUP_LENGTH 6
#define UX_SETUP_SIZE 8
#define UX_SETUP_REQUEST_TYPE 0u
#define UX_SETUP_REQUEST 1u
#define UX_SETUP_VALUE 2u
#define UX_SETUP_INDEX 4u
#define UX_SETUP_LENGTH 6u
#define UX_SETUP_SIZE 8u
/* Define USBX standard commands. */
#define UX_GET_STATUS 0
#define UX_CLEAR_FEATURE 1
#define UX_SET_FEATURE 3
#define UX_SET_ADDRESS 5
#define UX_GET_DESCRIPTOR 6
#define UX_SET_DESCRIPTOR 7
#define UX_GET_CONFIGURATION 8
#define UX_SET_CONFIGURATION 9
#define UX_GET_INTERFACE 10
#define UX_SET_INTERFACE 11
#define UX_SYNCH_FRAME 12
#define UX_GET_STATUS 0u
#define UX_CLEAR_FEATURE 1u
#define UX_SET_FEATURE 3u
#define UX_SET_ADDRESS 5u
#define UX_GET_DESCRIPTOR 6u
#define UX_SET_DESCRIPTOR 7u
#define UX_GET_CONFIGURATION 8u
#define UX_SET_CONFIGURATION 9u
#define UX_GET_INTERFACE 10u
#define UX_SET_INTERFACE 11u
#define UX_SYNCH_FRAME 12u
/* Define USBX command sub constants. */
#define UX_ENDPOINT_HALT 0
#define UX_ENDPOINT_HALT 0u
/* Define USBX feature selector constants. */
#define UX_REQUEST_FEATURE_ENDPOINT_HALT 0
#define UX_REQUEST_FEATURE_DEVICE_REMOTE_WAKEUP 1
#define UX_REQUEST_FEATURE_TEST_MODE 2
#define UX_REQUEST_FEATURE_ENDPOINT_HALT 0u
#define UX_REQUEST_FEATURE_DEVICE_REMOTE_WAKEUP 1u
#define UX_REQUEST_FEATURE_TEST_MODE 2u
/* Define Generic USBX constants. */
@ -861,57 +867,57 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_REGULAR_MEMORY 0
#define UX_CACHE_SAFE_MEMORY 1
#define UX_NO_ALIGN 0
#define UX_ALIGN_16 0x0f
#define UX_ALIGN_MIN 0x0f
#define UX_ALIGN_32 0x1f
#define UX_ALIGN_64 0x3f
#define UX_ALIGN_128 0x7f
#define UX_ALIGN_256 0xff
#define UX_ALIGN_512 0x1ff
#define UX_ALIGN_1024 0x3ff
#define UX_ALIGN_2048 0x7ff
#define UX_ALIGN_4096 0xfff
#define UX_SAFE_ALIGN 0xffffffff
#define UX_NO_ALIGN 0u
#define UX_ALIGN_16 0x0fu
#define UX_ALIGN_MIN 0x0fu
#define UX_ALIGN_32 0x1fu
#define UX_ALIGN_64 0x3fu
#define UX_ALIGN_128 0x7fu
#define UX_ALIGN_256 0xffu
#define UX_ALIGN_512 0x1ffu
#define UX_ALIGN_1024 0x3ffu
#define UX_ALIGN_2048 0x7ffu
#define UX_ALIGN_4096 0xfffu
#define UX_SAFE_ALIGN 0xffffffffu
#define UX_MAX_SCATTER_GATHER_ALIGNMENT 4096
#define UX_MAX_USB_DEVICES 127
#define UX_ENDPOINT_DIRECTION 0x80
#define UX_ENDPOINT_IN 0x80
#define UX_ENDPOINT_OUT 0x00
#define UX_ENDPOINT_DIRECTION 0x80u
#define UX_ENDPOINT_IN 0x80u
#define UX_ENDPOINT_OUT 0x00u
#define UX_MASK_ENDPOINT_TYPE 3
#define UX_CONTROL_ENDPOINT 0
#define UX_ISOCHRONOUS_ENDPOINT 1
#define UX_BULK_ENDPOINT 2
#define UX_INTERRUPT_ENDPOINT 3
#define UX_MASK_ENDPOINT_TYPE 3u
#define UX_CONTROL_ENDPOINT 0u
#define UX_ISOCHRONOUS_ENDPOINT 1u
#define UX_BULK_ENDPOINT 2u
#define UX_INTERRUPT_ENDPOINT 3u
#define UX_ISOCHRONOUS_ENDPOINT_IN 0x81
#define UX_ISOCHRONOUS_ENDPOINT_OUT 0x01
#define UX_BULK_ENDPOINT_IN 0x82
#define UX_BULK_ENDPOINT_OUT 0x02
#define UX_INTERRUPT_ENDPOINT_IN 0x83
#define UX_INTERRUPT_ENDPOINT_OUT 0x03
#define UX_ISOCHRONOUS_ENDPOINT_IN 0x81u
#define UX_ISOCHRONOUS_ENDPOINT_OUT 0x01u
#define UX_BULK_ENDPOINT_IN 0x82u
#define UX_BULK_ENDPOINT_OUT 0x02u
#define UX_INTERRUPT_ENDPOINT_IN 0x83u
#define UX_INTERRUPT_ENDPOINT_OUT 0x03u
#define UX_MAX_PACKET_SIZE_MASK 0x7ff
#define UX_MAX_NUMBER_OF_TRANSACTIONS_MASK 0x1800
#define UX_MAX_PACKET_SIZE_MASK 0x7ffu
#define UX_MAX_NUMBER_OF_TRANSACTIONS_MASK 0x1800u
#define UX_MAX_NUMBER_OF_TRANSACTIONS_SHIFT 11
#define UX_REQUEST_DIRECTION 0x80
#define UX_REQUEST_IN 0x80
#define UX_REQUEST_OUT 0x00
#define UX_REQUEST_DIRECTION 0x80u
#define UX_REQUEST_IN 0x80u
#define UX_REQUEST_OUT 0x00u
#define UX_REQUEST_TYPE 0x60
#define UX_REQUEST_TYPE_STANDARD 0x00
#define UX_REQUEST_TYPE_CLASS 0x20
#define UX_REQUEST_TYPE_VENDOR 0x40
#define UX_REQUEST_TYPE 0x60u
#define UX_REQUEST_TYPE_STANDARD 0x00u
#define UX_REQUEST_TYPE_CLASS 0x20u
#define UX_REQUEST_TYPE_VENDOR 0x40u
#define UX_REQUEST_TARGET 0x03
#define UX_REQUEST_TARGET_DEVICE 0x00
#define UX_REQUEST_TARGET_INTERFACE 0x01
#define UX_REQUEST_TARGET_ENDPOINT 0x02
#define UX_REQUEST_TARGET_OTHER 0x03
#define UX_REQUEST_TARGET 0x03u
#define UX_REQUEST_TARGET_DEVICE 0x00u
#define UX_REQUEST_TARGET_INTERFACE 0x01u
#define UX_REQUEST_TARGET_ENDPOINT 0x02u
#define UX_REQUEST_TARGET_OTHER 0x03u
#define UX_DEVICE_RESET 0
#define UX_DEVICE_ATTACHED 1
@ -930,17 +936,17 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_ENDPOINT_RUNNING 1
#define UX_ENDPOINT_HALTED 2
#define UX_DEVICE_DESCRIPTOR_ITEM 1
#define UX_CONFIGURATION_DESCRIPTOR_ITEM 2
#define UX_STRING_DESCRIPTOR_ITEM 3
#define UX_INTERFACE_DESCRIPTOR_ITEM 4
#define UX_ENDPOINT_DESCRIPTOR_ITEM 5
#define UX_DEVICE_QUALIFIER_DESCRIPTOR_ITEM 6
#define UX_OTHER_SPEED_DESCRIPTOR_ITEM 7
#define UX_OTG_DESCRIPTOR_ITEM 9
#define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ITEM 11
#define UX_DFU_FUNCTIONAL_DESCRIPTOR_ITEM 0x21
#define UX_HUB_DESCRIPTOR_ITEM 0x29
#define UX_DEVICE_DESCRIPTOR_ITEM 1u
#define UX_CONFIGURATION_DESCRIPTOR_ITEM 2u
#define UX_STRING_DESCRIPTOR_ITEM 3u
#define UX_INTERFACE_DESCRIPTOR_ITEM 4u
#define UX_ENDPOINT_DESCRIPTOR_ITEM 5u
#define UX_DEVICE_QUALIFIER_DESCRIPTOR_ITEM 6u
#define UX_OTHER_SPEED_DESCRIPTOR_ITEM 7u
#define UX_OTG_DESCRIPTOR_ITEM 9u
#define UX_INTERFACE_ASSOCIATION_DESCRIPTOR_ITEM 11u
#define UX_DFU_FUNCTIONAL_DESCRIPTOR_ITEM 0x21u
#define UX_HUB_DESCRIPTOR_ITEM 0x29u
#define UX_CONTROL_TRANSFER_TIMEOUT 1000
@ -999,48 +1005,48 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
/* Define USBX device power constants. */
#define UX_DEVICE_BUS_POWERED 1
#define UX_DEVICE_SELF_POWERED 2
#define UX_MAX_SELF_POWER (500/2)
#define UX_MAX_BUS_POWER (100/2)
#define UX_CONFIGURATION_DEVICE_BUS_POWERED 0x80
#define UX_CONFIGURATION_DEVICE_SELF_POWERED 0x40
#define UX_STATUS_DEVICE_SELF_POWERED 1
#define UX_DEVICE_BUS_POWERED 1u
#define UX_DEVICE_SELF_POWERED 2u
#define UX_MAX_SELF_POWER (500u/2)
#define UX_MAX_BUS_POWER (100u/2)
#define UX_CONFIGURATION_DEVICE_BUS_POWERED 0x80u
#define UX_CONFIGURATION_DEVICE_SELF_POWERED 0x40u
#define UX_STATUS_DEVICE_SELF_POWERED 1u
/* Define USBX OTG constants. */
#define UX_OTG_BM_ATTRIBUTES 2
#define UX_OTG_SRP_SUPPORT 1
#define UX_OTG_HNP_SUPPORT 2
#define UX_HCD_OTG_CAPABLE 1
#define UX_DCD_OTG_CAPABLE 1
#define UX_OTG_BM_ATTRIBUTES 2u
#define UX_OTG_SRP_SUPPORT 1u
#define UX_OTG_HNP_SUPPORT 2u
#define UX_HCD_OTG_CAPABLE 1u
#define UX_DCD_OTG_CAPABLE 1u
#define UX_OTG_FEATURE_B_HNP_ENABLE 3
#define UX_OTG_FEATURE_A_HNP_SUPPORT 4
#define UX_OTG_FEATURE_A_ALT_HNP_SUPPORT 5
#define UX_OTG_STATUS_SELECTOR 0xF000
#define UX_OTG_HOST_REQUEST_FLAG 0x01
#define UX_OTG_FEATURE_B_HNP_ENABLE 3u
#define UX_OTG_FEATURE_A_HNP_SUPPORT 4u
#define UX_OTG_FEATURE_A_ALT_HNP_SUPPORT 5u
#define UX_OTG_STATUS_SELECTOR 0xF000u
#define UX_OTG_HOST_REQUEST_FLAG 0x01u
#define UX_OTG_IDLE 0
#define UX_OTG_IDLE_TO_HOST 1
#define UX_OTG_IDLE_TO_SLAVE 2
#define UX_OTG_HOST_TO_IDLE 3
#define UX_OTG_HOST_TO_SLAVE 4
#define UX_OTG_SLAVE_TO_IDLE 5
#define UX_OTG_SLAVE_TO_HOST 6
#define UX_OTG_SLAVE_SRP 7
#define UX_OTG_IDLE 0u
#define UX_OTG_IDLE_TO_HOST 1u
#define UX_OTG_IDLE_TO_SLAVE 2u
#define UX_OTG_HOST_TO_IDLE 3u
#define UX_OTG_HOST_TO_SLAVE 4u
#define UX_OTG_SLAVE_TO_IDLE 5u
#define UX_OTG_SLAVE_TO_HOST 6u
#define UX_OTG_SLAVE_SRP 7u
#define UX_OTG_MODE_IDLE 0
#define UX_OTG_MODE_SLAVE 1
#define UX_OTG_MODE_HOST 2
#define UX_OTG_MODE_IDLE 0u
#define UX_OTG_MODE_SLAVE 1u
#define UX_OTG_MODE_HOST 2u
#define UX_OTG_DEVICE_IDLE 0
#define UX_OTG_DEVICE_A 1
#define UX_OTG_DEVICE_B 2
#define UX_OTG_DEVICE_IDLE 0u
#define UX_OTG_DEVICE_A 1u
#define UX_OTG_DEVICE_B 2u
#define UX_OTG_VBUS_IDLE 0
#define UX_OTG_VBUS_ON 1
#define UX_OTG_VBUS_OFF 2
#define UX_OTG_VBUS_IDLE 0u
#define UX_OTG_VBUS_ON 1u
#define UX_OTG_VBUS_OFF 2u
#define UX_OTG_HNP_THREAD_SLEEP_TIME (2 * UX_PERIODIC_RATE)
@ -1057,18 +1063,18 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
/* Define USBX generic port status constants. */
#define UX_PS_CCS 0x01
#define UX_PS_CPE 0x01
#define UX_PS_PES 0x02
#define UX_PS_PSS 0x04
#define UX_PS_POCI 0x08
#define UX_PS_PRS 0x10
#define UX_PS_PPS 0x20
#define UX_PS_DS_LS 0x00
#define UX_PS_DS_FS 0x40
#define UX_PS_DS_HS 0x80
#define UX_PS_CCS 0x01u
#define UX_PS_CPE 0x01u
#define UX_PS_PES 0x02u
#define UX_PS_PSS 0x04u
#define UX_PS_POCI 0x08u
#define UX_PS_PRS 0x10u
#define UX_PS_PPS 0x20u
#define UX_PS_DS_LS 0x00u
#define UX_PS_DS_FS 0x40u
#define UX_PS_DS_HS 0x80u
#define UX_PS_DS 6
#define UX_PS_DS 6u
/* Define USBX Error Code constants. The following format describes
@ -1178,6 +1184,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_HCD_DESTROY_ENDPOINT 15
#define UX_HCD_RESET_ENDPOINT 16
#define UX_HCD_PROCESS_DONE_QUEUE 17
#define UX_HCD_UNINITIALIZE 18
/* Define USBX DCD API function constants. */
@ -1206,9 +1213,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
/* Define USBX generic host controller constants. */
#define UX_HCD_STATUS_HALTED 0
#define UX_HCD_STATUS_OPERATIONAL 1
#define UX_HCD_STATUS_DEAD 2
#define UX_HCD_STATUS_UNUSED 0
#define UX_HCD_STATUS_HALTED 1
#define UX_HCD_STATUS_OPERATIONAL 2
#define UX_HCD_STATUS_DEAD 3
/* Define USBX generic SLAVE controller constants. */
@ -1258,19 +1266,19 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL
#define UX_PCI_NB_DEVICE 32
#define UX_PCI_NB_BUS 0xff
#define UX_PCI_CMD_IO_ENABLE 0x0001
#define UX_PCI_CMD_MEM_ENABLE 0x0002
#define UX_PCI_CMD_MASTER_ENABLE 0x0004
#define UX_PCI_CMD_MONITOR_ENABLE 0x0008
#define UX_PCI_CMD_MEM_WRITE_INV_ENABLE 0x0010
#define UX_PCI_CMD_SNOOP_PALETTE_ENABLE 0x0020
#define UX_PCI_CMD_PARITY_ERROR_ENABLE 0x0040
#define UX_PCI_CMD_WAIT_CYCLE_CTRL_ENABLE 0x0080
#define UX_PCI_CMD_SERR_ENABLE 0x0100
#define UX_PCI_CMD_FBB_ENABLE 0x0200
#define UX_PCI_CMD_IO_ENABLE 0x0001u
#define UX_PCI_CMD_MEM_ENABLE 0x0002u
#define UX_PCI_CMD_MASTER_ENABLE 0x0004u
#define UX_PCI_CMD_MONITOR_ENABLE 0x0008u
#define UX_PCI_CMD_MEM_WRITE_INV_ENABLE 0x0010u
#define UX_PCI_CMD_SNOOP_PALETTE_ENABLE 0x0020u
#define UX_PCI_CMD_PARITY_ERROR_ENABLE 0x0040u
#define UX_PCI_CMD_WAIT_CYCLE_CTRL_ENABLE 0x0080u
#define UX_PCI_CMD_SERR_ENABLE 0x0100u
#define UX_PCI_CMD_FBB_ENABLE 0x0200u
#define UX_PCI_CFG_CTRL_ADDRESS 0x0cf8
#define UX_PCI_CFG_DATA_ADDRESS 0x0cfc
#define UX_PCI_CFG_CTRL_ADDRESS 0x0cf8u
#define UX_PCI_CFG_DATA_ADDRESS 0x0cfcu
#define UX_PCI_CFG_VENDOR_ID 0x00
#define UX_PCI_CFG_DEVICE_ID 0x02
@ -2218,6 +2226,7 @@ UINT ux_host_stack_class_instance_create(UX_HOST_CLASS *host_class, VOID *cla
UINT ux_host_stack_class_instance_destroy(UX_HOST_CLASS *host_class, VOID *class_instance);
UINT ux_host_stack_class_instance_get(UX_HOST_CLASS *host_class, UINT class_index, VOID **class_instance);
UINT ux_host_stack_class_register(UCHAR *class_name, UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *));
UINT ux_host_stack_class_unregister(UINT (*class_entry_function)(struct UX_HOST_CLASS_COMMAND_STRUCT *));
UINT ux_host_stack_configuration_interface_get(UX_CONFIGURATION *configuration, UINT interface_index,
UINT alternate_setting_index, UX_INTERFACE **interface);
UINT ux_host_stack_device_configuration_get(UX_DEVICE *device, UINT configuration_index, UX_CONFIGURATION **configuration);
@ -2225,7 +2234,9 @@ UINT ux_host_stack_device_configuration_select(UX_CONFIGURATION *configuratio
UINT ux_host_stack_device_get(ULONG device_index, UX_DEVICE **device);
UINT ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint);
UINT ux_host_stack_hcd_register(UCHAR *hcd_name, UINT (*hcd_initialize_function)(struct UX_HCD_STRUCT *), ULONG hcd_param1, ULONG hcd_param2);
UINT ux_host_stack_hcd_unregister(UCHAR *hcd_name, ULONG hcd_param1, ULONG hcd_param2);
UINT ux_host_stack_initialize(UINT (*ux_system_host_change_function)(ULONG, UX_HOST_CLASS *, VOID *));
UINT ux_host_stack_uninitialize(VOID);
UINT ux_host_stack_interface_endpoint_get(UX_INTERFACE *interface, UINT endpoint_index, UX_ENDPOINT **endpoint);
UINT ux_host_stack_interface_setting_select(UX_INTERFACE *interface);
UINT ux_host_stack_transfer_request(UX_TRANSFER *transfer_request);

View File

@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_hcd_sim_host.h PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -48,6 +48,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* added HCD uninitialize, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@ -210,6 +213,7 @@ UINT _ux_hcd_sim_host_entry(UX_HCD *hcd, UINT function, VOID *parameter);
UINT _ux_hcd_sim_host_frame_number_get(UX_HCD_SIM_HOST *hcd_sim_host, ULONG *frame_number);
VOID _ux_hcd_sim_host_frame_number_set(UX_HCD_SIM_HOST *hcd_sim_host, ULONG frame_number);
UINT _ux_hcd_sim_host_initialize(UX_HCD *hcd);
UINT _ux_hcd_sim_host_uninitialize(UX_HCD_SIM_HOST *hcd);
UINT _ux_hcd_sim_host_controller_disable(UX_HCD_SIM_HOST *hcd);
UINT _ux_hcd_sim_host_interrupt_endpoint_create(UX_HCD_SIM_HOST *hcd_sim_host, UX_ENDPOINT *endpoint);
VOID _ux_hcd_sim_host_iso_queue_process(UX_HCD_SIM_HOST *hcd_sim_host);

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_sim_host_controller_disable PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -55,8 +55,6 @@
/* */
/* CALLS */
/* */
/* _ux_utility_memory_free Free memory block */
/* _ux_utility_timer_delete Delete timer */
/* */
/* CALLED BY */
/* */
@ -67,6 +65,9 @@
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 Chaoqiong Xiao Initial Version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* did controller halt only, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_sim_host_controller_disable(UX_HCD_SIM_HOST *hcd_sim_host)
@ -75,24 +76,9 @@ UINT _ux_hcd_sim_host_controller_disable(UX_HCD_SIM_HOST *hcd_sim_host)
UX_HCD *hcd = hcd_sim_host -> ux_hcd_sim_host_hcd_owner;
/* Set the state of the controller to HALTED first. */
/* Set the state of the controller to HALTED. */
hcd -> ux_hcd_status = UX_HCD_STATUS_HALTED;
/* Get simulated host controller. */
hcd_sim_host = (UX_HCD_SIM_HOST *)hcd -> ux_hcd_controller_hardware;
/* Delete timer. */
_ux_utility_timer_delete(&hcd_sim_host -> ux_hcd_sim_host_timer);
/* Free TD/ED memories. */
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_iso_td_list);
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_td_list);
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_ed_list);
/* Free simulated host controller memory. */
_ux_utility_memory_free(hcd_sim_host);
hcd -> ux_hcd_controller_hardware = UX_NULL;
/* Return successful completion. */
return(UX_SUCCESS);
}

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_sim_host_entry PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -85,6 +85,9 @@
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* added controller disable, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* added HCD uninitialize, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_sim_host_entry(UX_HCD *hcd, UINT function, VOID *parameter)
@ -114,6 +117,11 @@ UX_HCD_SIM_HOST *hcd_sim_host;
switch(function)
{
case UX_HCD_UNINITIALIZE:
status = _ux_hcd_sim_host_uninitialize(hcd_sim_host);
break;
case UX_HCD_DISABLE_CONTROLLER:
status = _ux_hcd_sim_host_controller_disable(hcd_sim_host);

View File

@ -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 */
/** */
/** Host Simulator Controller Driver */
/** */
/**************************************************************************/
/**************************************************************************/
#define UX_SOURCE_CODE
/* Include necessary system files. */
#include "ux_api.h"
#include "ux_hcd_sim_host.h"
/**************************************************************************/
/* */
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_sim_host_uninitialize PORTABLE C */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This function will uninitialize the simulated host controller. */
/* The controller will release all its resources (memory, IO ...). */
/* After this, the controller will not send SOF any longer. */
/* */
/* INPUT */
/* */
/* hcd_sim_host Pointer to host controller */
/* */
/* OUTPUT */
/* */
/* Completion Status */
/* */
/* CALLS */
/* */
/* _ux_utility_memory_free Free memory block */
/* _ux_utility_timer_delete Delete timer */
/* */
/* CALLED BY */
/* */
/* Host Simulator Controller Driver */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* 11-09-2020 Chaoqiong Xiao Initial Version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_sim_host_uninitialize(UX_HCD_SIM_HOST *hcd_sim_host)
{
UX_HCD *hcd = hcd_sim_host -> ux_hcd_sim_host_hcd_owner;
/* Set the state of the controller to HALTED first. */
hcd -> ux_hcd_status = UX_HCD_STATUS_HALTED;
/* Get simulated host controller. */
hcd_sim_host = (UX_HCD_SIM_HOST *)hcd -> ux_hcd_controller_hardware;
/* Delete timer. */
_ux_utility_timer_delete(&hcd_sim_host -> ux_hcd_sim_host_timer);
/* Free TD/ED memories. */
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_iso_td_list);
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_td_list);
_ux_utility_memory_free(hcd_sim_host -> ux_hcd_sim_host_ed_list);
/* Free simulated host controller memory. */
_ux_utility_memory_free(hcd_sim_host);
hcd -> ux_hcd_controller_hardware = UX_NULL;
/* Set the state of the controller to UNUSED first. */
hcd -> ux_hcd_status = UX_UNUSED;
/* Return successful completion. */
return(UX_SUCCESS);
}

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_hcd_thread_entry PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -72,6 +72,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed registered HCD scan, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
VOID _ux_host_stack_hcd_thread_entry(ULONG input)
@ -95,7 +98,7 @@ UX_INTERRUPT_SAVE_AREA
#if UX_MAX_HCD > 1
/* This thread was awaken by one or more HCD controllers. Check each of the HCDs
to see who posted work to do. */
for(hcd_index = 0; hcd_index < _ux_system_host -> ux_system_host_registered_hcd; hcd_index++)
for(hcd_index = 0; hcd_index < _ux_system_host -> ux_system_host_max_hcd; hcd_index++)
{
#else
hcd_index = 0;

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_hcd_unregister PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -75,6 +75,11 @@
/* DATE NAME DESCRIPTION */
/* */
/* 09-30-2020 Chaoqiong Xiao Initial Version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed HCD devices scan, */
/* used HCD uninit command, */
/* fixed HCD status scan, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_host_stack_hcd_unregister(UCHAR *hcd_name,
@ -112,13 +117,13 @@ UINT hcd_name_length = 0;
#if UX_MAX_CLASS_DRIVER > 1
/* We need to parse the controller driver table to find an empty spot. */
for (scan_index = 0;
scan_index < _ux_system_host -> ux_system_host_max_hcd;
scan_index < UX_SYSTEM_HOST_MAX_HCD_GET();
scan_index++)
{
#endif
/* Is this slot available and saved hcd_parameters match? */
if (hcd -> ux_hcd_status == UX_USED &&
if (hcd -> ux_hcd_status != UX_UNUSED &&
hcd -> ux_hcd_io == hcd_param1 &&
hcd -> ux_hcd_irq == hcd_param2)
{
@ -146,7 +151,7 @@ UINT hcd_name_length = 0;
return(UX_ERROR);
/* Now disable controller. */
hcd -> ux_hcd_entry_function(hcd, UX_HCD_DISABLE_CONTROLLER, UX_NULL);
hcd -> ux_hcd_entry_function(hcd, UX_HCD_UNINITIALIZE, UX_NULL);
/* Get first device. */
device = _ux_system_host -> ux_system_host_device_array;
@ -179,6 +184,9 @@ UINT hcd_name_length = 0;
}
#if UX_MAX_DEVICES > 1
/* Try the next device. */
device ++;
}
#endif

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_stack_rh_change_process PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -70,6 +70,9 @@
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* used new interrupt macros, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed registered HCD scan, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
VOID _ux_host_stack_rh_change_process(VOID)
@ -83,7 +86,7 @@ UX_INTERRUPT_SAVE_AREA
/* This thread was maybe awaken by one or more HCD controllers. Check each
of the HCD to see where there has been a change of topology. */
for(hcd_index = 0; hcd_index < _ux_system_host -> ux_system_host_registered_hcd; hcd_index++)
for(hcd_index = 0; hcd_index < UX_SYSTEM_HOST_MAX_HCD_GET(); hcd_index++)
{
/* Pickup HCD pointer. */

View File

@ -33,7 +33,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_utility_delay_ms PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* 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 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings 64b, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
VOID _ux_utility_delay_ms(ULONG ms_wait)
@ -75,7 +78,7 @@ VOID _ux_utility_delay_ms(ULONG ms_wait)
ULONG ticks;
/* translate ms into ticks. */
ticks = (ms_wait * UX_PERIODIC_RATE) / 1000;
ticks = (ULONG)(ms_wait * UX_PERIODIC_RATE) / 1000;
/* For safety add 1 to ticks. */
ticks++;

View File

@ -34,7 +34,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_device_class_hid_control_request PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -74,6 +74,9 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings 64b, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_device_class_hid_control_request(UX_SLAVE_CLASS_COMMAND *command)
@ -166,7 +169,7 @@ UX_SLAVE_CLASS_HID *hid;
{
/* Calculate the timeout value. Weighted as 4ms. */
hid -> ux_device_class_hid_event_wait_timeout = UX_MS_TO_TICK((ULONG)duration << 2u);
hid -> ux_device_class_hid_event_wait_timeout = (ULONG)UX_MS_TO_TICK((ULONG)duration << 2u);
/* Be sure to have a timeout that is not zero. */
if (hid -> ux_device_class_hid_event_wait_timeout == 0)

View File

@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_storage.h PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -52,6 +52,9 @@
/* refer to TX symbols instead */
/* of using them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* added exFAT type define, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@ -398,6 +401,7 @@
#define UX_HOST_CLASS_STORAGE_PARTITION_FAT_16 4
#define UX_HOST_CLASS_STORAGE_PARTITION_EXTENDED 5
#define UX_HOST_CLASS_STORAGE_PARTITION_FAT_16L 6
#define UX_HOST_CLASS_STORAGE_PARTITION_EXFAT 7
#define UX_HOST_CLASS_STORAGE_PARTITION_FAT_32_1 0x0b
#define UX_HOST_CLASS_STORAGE_PARTITION_FAT_32_2 0x0c
#define UX_HOST_CLASS_STORAGE_PARTITION_FAT_16_LBA_MAPPED 0x0e

View File

@ -36,7 +36,7 @@ UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_MULC_ULONG(sizeof(UX_HOST_CLASS_STORAG
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_entry PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -85,6 +85,9 @@ UX_COMPILE_TIME_ASSERT(!UX_OVERFLOW_CHECK_MULC_ULONG(sizeof(UX_HOST_CLASS_STORAG
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed class ext access, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_storage_entry(UX_HOST_CLASS_COMMAND *command)
@ -157,6 +160,12 @@ UX_HOST_CLASS_STORAGE_EXT *class_ext;
/* Save extension. */
class_inst -> ux_host_class_ext = (VOID *)class_ext;
}
else
{
/* Get storage class extension. */
class_ext = (UX_HOST_CLASS_STORAGE_EXT *)class_inst -> ux_host_class_ext;
}
/* Allocate some memory for the media structures used by UX_MEDIA (default FileX). */
if (class_inst -> ux_host_class_media == UX_NULL)

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_storage_partition_read PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -75,6 +75,9 @@
/* added option to disable FX */
/* media integration, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* added exFAT support, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_storage_partition_read(UX_HOST_CLASS_STORAGE *storage, UCHAR *sector_memory, ULONG sector)
@ -106,6 +109,7 @@ UINT partition_index;
case UX_HOST_CLASS_STORAGE_PARTITION_FAT_16_LBA_MAPPED:
case UX_HOST_CLASS_STORAGE_PARTITION_FAT_32_1:
case UX_HOST_CLASS_STORAGE_PARTITION_FAT_32_2:
case UX_HOST_CLASS_STORAGE_PARTITION_EXFAT:
/* We have found a legal partition entry pointing to a potential boot sector. */
status = _ux_host_class_storage_media_open(storage, sector + _ux_utility_long_get(sector_memory + UX_HOST_CLASS_STORAGE_PARTITION_SECTORS_BEFORE));

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_deactivate PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -79,6 +79,9 @@
/* ready, deleted new semaphore*/
/* for control requests, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* freed descriptor memory, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_deactivate(UX_HOST_CLASS_COMMAND *command)
@ -108,6 +111,10 @@ UINT status;
endpoints to exit properly. */
_ux_utility_thread_schedule_other(UX_THREAD_PRIORITY_ENUM);
/* Free descriptor memory. */
if (video -> ux_host_class_video_configuration_descriptor)
_ux_utility_memory_free(video -> ux_host_class_video_configuration_descriptor);
/* Destroy the instance. */
_ux_host_stack_class_instance_destroy(video -> ux_host_class_video_class, (VOID *) video);

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_video_frame_interval_get PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -70,6 +70,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings 64b, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_video_frame_interval_get(UX_HOST_CLASS_VIDEO *video, UX_HOST_CLASS_VIDEO_PARAMETER_FRAME_INTERVAL *interval_parameter)
@ -147,11 +150,11 @@ ULONG i;
/* Check if we have enough space to copy. */
if (intervals_to_copy * sizeof(ULONG) > interval_parameter -> ux_host_class_video_parameter_frame_interval_buffer_length)
{
intervals_to_copy = interval_parameter -> ux_host_class_video_parameter_frame_interval_buffer_length / sizeof(ULONG);
intervals_to_copy = (ULONG)(interval_parameter -> ux_host_class_video_parameter_frame_interval_buffer_length / sizeof(ULONG));
}
/* Return bytes copied. */
interval_parameter -> ux_host_class_video_parameter_frame_interval_buffer_length_written = intervals_to_copy * sizeof(ULONG);
interval_parameter -> ux_host_class_video_parameter_frame_interval_buffer_length_written = (ULONG)(intervals_to_copy * sizeof(ULONG));
/* Loop to copy interval data. */
for (i = 0; i < intervals_to_copy; i++)

View File

@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_hcd_ehci.h PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -46,6 +46,10 @@
/* TX symbols instead of using */
/* them directly, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* used unsigned defines, */
/* named unions and structs, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@ -95,18 +99,18 @@
/* Define EHCI IO control register values. */
#define EHCI_HC_IO_RS 0x00000001
#define EHCI_HC_IO_HCRESET 0x00000002
#define EHCI_HC_IO_PSE 0x00000010
#define EHCI_HC_IO_ASE 0x00000020
#define EHCI_HC_IO_IAAD 0x00000040
#define EHCI_HC_IO_ITC 0x00010000
#define EHCI_HC_IO_FRAME_SIZE_1024 0x00000000
#define EHCI_HC_IO_FRAME_SIZE_512 0x00000004
#define EHCI_HC_IO_FRAME_SIZE_256 0x00000008
#define EHCI_HC_IO_FRAME_SIZE_128 0x0000000C
#define EHCI_HC_IO_FRAME_SIZE_64 0x00008000
#define EHCI_HC_IO_FRAME_SIZE_32 0x00008004
#define EHCI_HC_IO_RS 0x00000001u
#define EHCI_HC_IO_HCRESET 0x00000002u
#define EHCI_HC_IO_PSE 0x00000010u
#define EHCI_HC_IO_ASE 0x00000020u
#define EHCI_HC_IO_IAAD 0x00000040u
#define EHCI_HC_IO_ITC 0x00010000u
#define EHCI_HC_IO_FRAME_SIZE_1024 0x00000000u
#define EHCI_HC_IO_FRAME_SIZE_512 0x00000004u
#define EHCI_HC_IO_FRAME_SIZE_256 0x00000008u
#define EHCI_HC_IO_FRAME_SIZE_128 0x0000000Cu
#define EHCI_HC_IO_FRAME_SIZE_64 0x00008000u
#define EHCI_HC_IO_FRAME_SIZE_32 0x00008004u
/* The number if entries in the periodic tree can be changed to save space IF and only IF the PFLF flag in the HCCPARAMS register
allows it. Setting values less than 1024 in controllers without the ability to change the Frame List Size leads to a EHCI crash. */
@ -118,46 +122,46 @@
/* Define EHCI HCOR status register. */
#define EHCI_HC_STS_USB_INT 0x00000001
#define EHCI_HC_STS_USB_ERR_INT 0x00000002
#define EHCI_HC_STS_PCD 0x00000004
#define EHCI_HC_STS_FLR 0x00000008
#define EHCI_HC_STS_HSE 0x00000010
#define EHCI_HC_STS_IAA 0x00000020
#define EHCI_HC_STS_HC_HALTED 0x00001000
#define EHCI_HC_STS_RECLAMATION 0x00002000
#define EHCI_HC_STS_PSS 0x00004000
#define EHCI_HC_STS_ASS 0x00008000
#define EHCI_HC_STS_USB_INT 0x00000001u
#define EHCI_HC_STS_USB_ERR_INT 0x00000002u
#define EHCI_HC_STS_PCD 0x00000004u
#define EHCI_HC_STS_FLR 0x00000008u
#define EHCI_HC_STS_HSE 0x00000010u
#define EHCI_HC_STS_IAA 0x00000020u
#define EHCI_HC_STS_HC_HALTED 0x00001000u
#define EHCI_HC_STS_RECLAMATION 0x00002000u
#define EHCI_HC_STS_PSS 0x00004000u
#define EHCI_HC_STS_ASS 0x00008000u
#define EHCI_HC_INTERRUPT_ENABLE_NORMAL (EHCI_HC_STS_USB_INT|EHCI_HC_STS_USB_ERR_INT|EHCI_HC_STS_PCD|EHCI_HC_STS_HSE|EHCI_HC_STS_IAA)
/* Define EHCI HCOR root HUB command/status. */
#define EHCI_HC_RH_PPC 0x00000010
#define EHCI_HC_RH_PSM 0x00000100
#define EHCI_HC_RH_NPS 0x00000200
#define EHCI_HC_RH_DT 0x00000400
#define EHCI_HC_RH_OCPM 0x00000800
#define EHCI_HC_RH_NOCP 0x00001000
#define EHCI_HC_RH_PPC 0x00000010u
#define EHCI_HC_RH_PSM 0x00000100u
#define EHCI_HC_RH_NPS 0x00000200u
#define EHCI_HC_RH_DT 0x00000400u
#define EHCI_HC_RH_OCPM 0x00000800u
#define EHCI_HC_RH_NOCP 0x00001000u
#define EHCI_HC_PS_CCS 0x00000001
#define EHCI_HC_PS_CSC 0x00000002
#define EHCI_HC_PS_PE 0x00000004
#define EHCI_HC_PS_PEC 0x00000008
#define EHCI_HC_PS_OCA 0x00000010
#define EHCI_HC_PS_OCC 0x00000020
#define EHCI_HC_PS_FPR 0x00000040
#define EHCI_HC_PS_SUSPEND 0x00000080
#define EHCI_HC_PS_PR 0x00000100
#define EHCI_HC_PS_PP 0x00001000
#define EHCI_HC_PS_SPEED_MASK 0x00000c00
#define EHCI_HC_PS_SPEED_LOW 0x00000400
#define EHCI_HC_PS_PO 0x00002000
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_MASK 0x0c000000
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_FULL 0x00000000
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_LOW 0x04000000
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_HIGH 0x08000000
#define EHCI_HC_PS_CCS 0x00000001u
#define EHCI_HC_PS_CSC 0x00000002u
#define EHCI_HC_PS_PE 0x00000004u
#define EHCI_HC_PS_PEC 0x00000008u
#define EHCI_HC_PS_OCA 0x00000010u
#define EHCI_HC_PS_OCC 0x00000020u
#define EHCI_HC_PS_FPR 0x00000040u
#define EHCI_HC_PS_SUSPEND 0x00000080u
#define EHCI_HC_PS_PR 0x00000100u
#define EHCI_HC_PS_PP 0x00001000u
#define EHCI_HC_PS_SPEED_MASK 0x00000c00u
#define EHCI_HC_PS_SPEED_LOW 0x00000400u
#define EHCI_HC_PS_PO 0x00002000u
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_MASK 0x0c000000u
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_FULL 0x00000000u
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_LOW 0x04000000u
#define EHCI_HC_PS_EMBEDDED_TT_SPEED_HIGH 0x08000000u
#define EHCI_HC_RH_POWER_STABLE_DELAY 25
#define EHCI_HC_RH_RESET_DELAY 50
@ -166,12 +170,12 @@
/* Define EHCI interrupt status register definitions. */
#define EHCI_HC_INT_IE 0x00000001
#define EHCI_HC_INT_EIE 0x00000002
#define EHCI_HC_INT_PCIE 0x00000004
#define EHCI_HC_INT_FLRE 0x00000008
#define EHCI_HC_INT_HSER 0x00000010
#define EHCI_HC_INT_IAAE 0x00000020
#define EHCI_HC_INT_IE 0x00000001u
#define EHCI_HC_INT_EIE 0x00000002u
#define EHCI_HC_INT_PCIE 0x00000004u
#define EHCI_HC_INT_FLRE 0x00000008u
#define EHCI_HC_INT_HSER 0x00000010u
#define EHCI_HC_INT_IAAE 0x00000020u
/* Define EHCI frame interval definition. */
@ -399,58 +403,58 @@ typedef struct UX_EHCI_ED_STRUCT
*ux_ehci_ed_next_anchor; /* + 1 DWord. */
USHORT ux_ehci_ed_microframe_load[8]; /* + 4 DWords. */
UCHAR ux_ehci_ed_microframe_ssplit_count[8]; /* + 2 DWords. */
};
} ANCHOR;
struct { /* As interrupt ED. */
struct UX_EHCI_ED_STRUCT
*ux_ehci_ed_anchor; /* + 1 DWord. */
struct UX_ENDPOINT_STRUCT
*ux_ehci_ed_endpoint; /* + 1 Dword. */
};
} INTR;
struct { /* Space: 7 DWord. */
ULONG ux_ehci_ed_reserved[7];
};
};
} RESERVED;
} REF_AS;
/* 24 DWord aligned. */
} UX_EHCI_ED;
/* Define EHCI ED bitmap. */
#define UX_EHCI_QH_TYP_ITD 0
#define UX_EHCI_QH_TYP_QH 2
#define UX_EHCI_QH_TYP_SITD 4
#define UX_EHCI_QH_TYP_FSTN 6
#define UX_EHCI_QH_TYP_ITD 0u
#define UX_EHCI_QH_TYP_QH 2u
#define UX_EHCI_QH_TYP_SITD 4u
#define UX_EHCI_QH_TYP_FSTN 6u
#define UX_EHCI_QH_T 1
#define UX_EHCI_QH_T 1u
#define UX_EHCI_QH_STATIC 0x80000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_7 0x40000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_6 0x20000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_5 0x10000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_4 0x08000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_3 0x04000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_2 0x02000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_1 0x01000000
#define UX_EHCI_QH_SSPLIT_SCH_FULL_0 0x00800000
#define UX_EHCI_QH_STATIC 0x80000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_7 0x40000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_6 0x20000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_5 0x10000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_4 0x08000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_3 0x04000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_2 0x02000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_1 0x01000000u
#define UX_EHCI_QH_SSPLIT_SCH_FULL_0 0x00800000u
#define UX_EHCI_QH_MPS_LOC 16
#define UX_EHCI_QH_MPS_MASK 0x07ff0000
#define UX_EHCI_QH_NCR 0xf0000000
#define UX_EHCI_QH_CEF 0x08000000
#define UX_EHCI_QH_ED_AD_LOC 8
#define UX_EHCI_QH_HBPM 0x40000000
#define UX_EHCI_QH_HBPM_LOC 30
#define UX_EHCI_QH_HEAD 0x00008000
#define UX_EHCI_QH_MPS_LOC 16u
#define UX_EHCI_QH_MPS_MASK 0x07ff0000u
#define UX_EHCI_QH_NCR 0xf0000000u
#define UX_EHCI_QH_CEF 0x08000000u
#define UX_EHCI_QH_ED_AD_LOC 8u
#define UX_EHCI_QH_HBPM 0x40000000u
#define UX_EHCI_QH_HBPM_LOC 30u
#define UX_EHCI_QH_HEAD 0x00008000u
#define UX_EHCI_QH_HIGH_SPEED 0x00002000
#define UX_EHCI_QH_LOW_SPEED 0x00001000
#define UX_EHCI_QH_HIGH_SPEED 0x00002000u
#define UX_EHCI_QH_LOW_SPEED 0x00001000u
#define UX_EHCI_QH_HUB_ADDR_LOC 16
#define UX_EHCI_QH_PORT_NUMBER_LOC 23
#define UX_EHCI_QH_MULT_LOC 30
#define UX_EHCI_QH_MULT_MASK 0xc0000000
#define UX_EHCI_QH_C_MASK 0x00001c00
#define UX_EHCI_QH_IS_MASK 0x00000001
#define UX_EHCI_QH_HUB_ADDR_LOC 16u
#define UX_EHCI_QH_PORT_NUMBER_LOC 23u
#define UX_EHCI_QH_MULT_LOC 30u
#define UX_EHCI_QH_MULT_MASK 0xc0000000u
#define UX_EHCI_QH_C_MASK 0x00001c00u
#define UX_EHCI_QH_IS_MASK 0x00000001u
#define UX_EHCI_QH_SMASK_MASK 0x000000FFu
#define UX_EHCI_QH_SMASK_0 0x00000001u
@ -462,11 +466,11 @@ typedef struct UX_EHCI_ED_STRUCT
#define UX_EHCI_QH_SMASK_6 0x00000040u
#define UX_EHCI_QH_SMASK_7 0x00000080u
#define UX_EHCI_QH_DTC 0x00004000
#define UX_EHCI_QH_TOGGLE 0x80000000
#define UX_EHCI_LINK_ADDRESS_MASK 0xfffffff0
#define UX_EHCI_TOGGLE_0 0
#define UX_EHCI_TOGGLE_1 0x80000000
#define UX_EHCI_QH_DTC 0x00004000u
#define UX_EHCI_QH_TOGGLE 0x80000000u
#define UX_EHCI_LINK_ADDRESS_MASK 0xfffffff0u
#define UX_EHCI_TOGGLE_0 0u
#define UX_EHCI_TOGGLE_1 0x80000000u
/* Define EHCI TD structure. */
@ -500,29 +504,29 @@ typedef struct UX_EHCI_TD_STRUCT
/* Define EHCI TD bitmap. */
#define UX_EHCI_TD_T 1
#define UX_EHCI_TD_LG_LOC 16
#define UX_EHCI_TD_LG_MASK 0x7fff
#define UX_EHCI_TD_IOC 0x00008000
#define UX_EHCI_TD_CERR 0x00000c00
#define UX_EHCI_TD_T 1u
#define UX_EHCI_TD_LG_LOC 16u
#define UX_EHCI_TD_LG_MASK 0x7fffu
#define UX_EHCI_TD_IOC 0x00008000u
#define UX_EHCI_TD_CERR 0x00000c00u
#define UX_EHCI_TD_PING 1
#define UX_EHCI_TD_DO_COMPLETE_SPLIT 2
#define UX_EHCI_TD_MISSED_MICRO_FRAMES 4
#define UX_EHCI_TD_TRANSACTION_ERROR 8
#define UX_EHCI_TD_BABBLE_DETECTED 0x10
#define UX_EHCI_TD_DATA_BUFFER_ERROR 0x20
#define UX_EHCI_TD_HALTED 0x40
#define UX_EHCI_TD_ACTIVE 0x80
#define UX_EHCI_TD_PING 1u
#define UX_EHCI_TD_DO_COMPLETE_SPLIT 2u
#define UX_EHCI_TD_MISSED_MICRO_FRAMES 4u
#define UX_EHCI_TD_TRANSACTION_ERROR 8u
#define UX_EHCI_TD_BABBLE_DETECTED 0x10u
#define UX_EHCI_TD_DATA_BUFFER_ERROR 0x20u
#define UX_EHCI_TD_HALTED 0x40u
#define UX_EHCI_TD_ACTIVE 0x80u
#define UX_EHCI_PID_OUT 0x00000000
#define UX_EHCI_PID_IN 0x00000100
#define UX_EHCI_PID_SETUP 0x00000200
#define UX_EHCI_PID_MASK 0x00000300
#define UX_EHCI_PID_OUT 0x00000000u
#define UX_EHCI_PID_IN 0x00000100u
#define UX_EHCI_PID_SETUP 0x00000200u
#define UX_EHCI_PID_MASK 0x00000300u
#define UX_EHCI_TD_SETUP_PHASE 0x00010000
#define UX_EHCI_TD_DATA_PHASE 0x00020000
#define UX_EHCI_TD_STATUS_PHASE 0x00040000
#define UX_EHCI_TD_SETUP_PHASE 0x00010000u
#define UX_EHCI_TD_DATA_PHASE 0x00020000u
#define UX_EHCI_TD_STATUS_PHASE 0x00040000u
/* Define EHCI ISOCHRONOUS TD extension structure. */

View File

@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_hcd_ohci.h PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -43,6 +43,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* used unsigned defines, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
@ -54,7 +57,7 @@
#define UX_OHCI_CONTROLLER 1
#define UX_OHCI_MAX_PAYLOAD 4096
#define UX_OHCI_FRAME_DELAY 4
#define UX_OHCI_FRAME_DELAY 4u
/* Define OHCI HCOR register mapping. */
@ -85,73 +88,73 @@
/* Define OHCI control register values. */
#define OHCI_HC_CR_CBSR_0 0x00000000
#define OHCI_HC_CR_CBSR_1 0x00000001
#define OHCI_HC_CR_CBSR_2 0x00000002
#define OHCI_HC_CR_CBSR_3 0x00000003
#define OHCI_HC_CR_PLE 0x00000004
#define OHCI_HC_CR_IE 0x00000008
#define OHCI_HC_CR_CLE 0x00000010
#define OHCI_HC_CR_BLE 0x00000020
#define OHCI_HC_CR_RESET 0x00000000
#define OHCI_HC_CR_RESUME 0x00000040
#define OHCI_HC_CR_OPERATIONAL 0x00000080
#define OHCI_HC_CR_SUSPEND 0x000000c0
#define OHCI_HC_CR_IR 0x00000100
#define OHCI_HC_CR_RWC 0x00000200
#define OHCI_HC_CR_RWE 0x00000400
#define OHCI_HC_CR_CBSR_0 0x00000000u
#define OHCI_HC_CR_CBSR_1 0x00000001u
#define OHCI_HC_CR_CBSR_2 0x00000002u
#define OHCI_HC_CR_CBSR_3 0x00000003u
#define OHCI_HC_CR_PLE 0x00000004u
#define OHCI_HC_CR_IE 0x00000008u
#define OHCI_HC_CR_CLE 0x00000010u
#define OHCI_HC_CR_BLE 0x00000020u
#define OHCI_HC_CR_RESET 0x00000000u
#define OHCI_HC_CR_RESUME 0x00000040u
#define OHCI_HC_CR_OPERATIONAL 0x00000080u
#define OHCI_HC_CR_SUSPEND 0x000000c0u
#define OHCI_HC_CR_IR 0x00000100u
#define OHCI_HC_CR_RWC 0x00000200u
#define OHCI_HC_CR_RWE 0x00000400u
#define OHCI_HC_CONTROL_VALUE (OHCI_HC_CR_CBSR_3 | OHCI_HC_CR_OPERATIONAL | OHCI_HC_CR_PLE | OHCI_HC_CR_IE | OHCI_HC_CR_CLE | OHCI_HC_CR_BLE)
/* Define OHCI HCOR command/status bitmaps. */
#define OHCI_HC_CS_HCR 0x00000001
#define OHCI_HC_CS_CLF 0x00000002
#define OHCI_HC_CS_BLF 0x00000004
#define OHCI_HC_CS_HCR 0x00000001u
#define OHCI_HC_CS_CLF 0x00000002u
#define OHCI_HC_CS_BLF 0x00000004u
#define OHCI_HC_RH_PSM 0x00000100
#define OHCI_HC_RH_NPS 0x00000200
#define OHCI_HC_RH_DT 0x00000400
#define OHCI_HC_RH_OCPM 0x00000800
#define OHCI_HC_RH_NOCP 0x00001000
#define OHCI_HC_RH_POTPGT 24
#define OHCI_HC_RH_PSM 0x00000100u
#define OHCI_HC_RH_NPS 0x00000200u
#define OHCI_HC_RH_DT 0x00000400u
#define OHCI_HC_RH_OCPM 0x00000800u
#define OHCI_HC_RH_NOCP 0x00001000u
#define OHCI_HC_RH_POTPGT 24u
#define OHCI_HC_RS_LPS 0x00000001
#define OHCI_HC_RS_OCI 0x00000002
#define OHCI_HC_RS_DRWE 0x00008000
#define OHCI_HC_RS_LPSC 0x00010000
#define OHCI_HC_RS_OCIC 0x00020000
#define OHCI_HC_RS_CRWE 0x80000000
#define OHCI_HC_RS_LPS 0x00000001u
#define OHCI_HC_RS_OCI 0x00000002u
#define OHCI_HC_RS_DRWE 0x00008000u
#define OHCI_HC_RS_LPSC 0x00010000u
#define OHCI_HC_RS_OCIC 0x00020000u
#define OHCI_HC_RS_CRWE 0x80000000u
#define OHCI_HC_PS_CCS 0x00000001
#define OHCI_HC_PS_CPE 0x00000001
#define OHCI_HC_PS_PES 0x00000002
#define OHCI_HC_PS_PSS 0x00000004
#define OHCI_HC_PS_POCI 0x00000008
#define OHCI_HC_PS_PRS 0x00000010
#define OHCI_HC_PS_PPS 0x00000100
#define OHCI_HC_PS_LSDA 0x00000200
#define OHCI_HC_PS_CSC 0x00010000
#define OHCI_HC_PS_PESC 0x00020000
#define OHCI_HC_PS_PSSC 0x00040000
#define OHCI_HC_PS_OCIC 0x00080000
#define OHCI_HC_PS_PRSC 0x00100000
#define OHCI_HC_PS_CCS 0x00000001u
#define OHCI_HC_PS_CPE 0x00000001u
#define OHCI_HC_PS_PES 0x00000002u
#define OHCI_HC_PS_PSS 0x00000004u
#define OHCI_HC_PS_POCI 0x00000008u
#define OHCI_HC_PS_PRS 0x00000010u
#define OHCI_HC_PS_PPS 0x00000100u
#define OHCI_HC_PS_LSDA 0x00000200u
#define OHCI_HC_PS_CSC 0x00010000u
#define OHCI_HC_PS_PESC 0x00020000u
#define OHCI_HC_PS_PSSC 0x00040000u
#define OHCI_HC_PS_OCIC 0x00080000u
#define OHCI_HC_PS_PRSC 0x00100000u
/* Define OHCI interrupt status register definitions. */
#define OHCI_HC_INT_SO 0x00000001
#define OHCI_HC_INT_WDH 0x00000002
#define OHCI_HC_INT_SF 0x00000004
#define OHCI_HC_INT_RD 0x00000008
#define OHCI_HC_INT_UE 0x00000010
#define OHCI_HC_INT_FNO 0x00000020
#define OHCI_HC_INT_RHSC 0x00000040
#define OHCI_HC_INT_OC 0x40000000
#define OHCI_HC_INT_SO 0x00000001u
#define OHCI_HC_INT_WDH 0x00000002u
#define OHCI_HC_INT_SF 0x00000004u
#define OHCI_HC_INT_RD 0x00000008u
#define OHCI_HC_INT_UE 0x00000010u
#define OHCI_HC_INT_FNO 0x00000020u
#define OHCI_HC_INT_RHSC 0x00000040u
#define OHCI_HC_INT_OC 0x40000000u
#define OHCI_HC_INT_MIE 0x80000000
#define OHCI_HC_INT_MIE 0x80000000u
#define OHCI_HC_INTERRUPT_ENABLE_NORMAL (OHCI_HC_INT_WDH | OHCI_HC_INT_RD | OHCI_HC_INT_UE | OHCI_HC_INT_RHSC | OHCI_HC_INT_MIE)
@ -169,13 +172,13 @@
/* Define OHCI frame interval definition. */
#define OHCI_HC_FM_INTERVAL_CLEAR 0x8000ffff
#define OHCI_HC_FM_INTERVAL_SET 0x27780000
#define OHCI_HC_FM_INTERVAL_CLEAR 0x8000ffffu
#define OHCI_HC_FM_INTERVAL_SET 0x27780000u
/* Define OHCI static definition. */
#define UX_OHCI_AVAILABLE_BANDWIDTH 6000
#define UX_OHCI_AVAILABLE_BANDWIDTH 6000u
#define UX_OHCI_INIT_DELAY 1000
#define UX_OHCI_RESET_RETRY 1000
#define UX_OHCI_RESET_DELAY 10
@ -187,7 +190,7 @@
#define UX_OHCI_COMMAND_STATUS_RESET 0
#define UX_OHCI_INIT_RESET_DELAY 10
#define UX_OHCI_HC_PERIODIC_START_DEFAULT 0x00003e67
#define UX_OHCI_HC_PERIODIC_START_DEFAULT 0x00003e67u
/* Define OHCI completion code errors. */
@ -266,17 +269,17 @@ typedef struct UX_OHCI_ED_STRUCT
/* Define OHCI ED bitmap. */
#define UX_OHCI_ED_LOW_SPEED 0x00002000
#define UX_OHCI_ED_SKIP 0x00004000
#define UX_OHCI_ED_ISOCHRONOUS 0x00008000
#define UX_OHCI_ED_MPS 0x0000ffff
#define UX_OHCI_ED_LOW_SPEED 0x00002000u
#define UX_OHCI_ED_SKIP 0x00004000u
#define UX_OHCI_ED_ISOCHRONOUS 0x00008000u
#define UX_OHCI_ED_MPS 0x0000ffffu
#define UX_OHCI_ED_HALTED 0x00000001
#define UX_OHCI_ED_TOGGLE_CARRY 0x00000002
#define UX_OHCI_ED_MASK_TD (~0x00000003)
#define UX_OHCI_ED_HALTED 0x00000001u
#define UX_OHCI_ED_TOGGLE_CARRY 0x00000002u
#define UX_OHCI_ED_MASK_TD (~0x00000003u)
#define UX_OHCI_ED_OUT 0x800
#define UX_OHCI_ED_IN 0x1000
#define UX_OHCI_ED_OUT 0x0800u
#define UX_OHCI_ED_IN 0x1000u
/* Define OHCI TD structure. */
@ -303,17 +306,17 @@ typedef struct UX_OHCI_TD_STRUCT
/* Define OHCI TD bitmap. */
#define UX_OHCI_TD_OUT 0x00080000
#define UX_OHCI_TD_IN 0x00100000
#define UX_OHCI_TD_DEFAULT_DW0 0xf0000000
#define UX_OHCI_TD_DATA0 0x02000000
#define UX_OHCI_TD_DATA1 0x03000000
#define UX_OHCI_TD_R 0x00040000
#define UX_OHCI_TD_OUT 0x00080000u
#define UX_OHCI_TD_IN 0x00100000u
#define UX_OHCI_TD_DEFAULT_DW0 0xf0000000u
#define UX_OHCI_TD_DATA0 0x02000000u
#define UX_OHCI_TD_DATA1 0x03000000u
#define UX_OHCI_TD_R 0x00040000u
#define UX_OHCI_TD_SETUP_PHASE 0x00010000
#define UX_OHCI_TD_DATA_PHASE 0x00020000
#define UX_OHCI_TD_STATUS_PHASE 0x00040000
#define UX_OHCI_TD_CC 28
#define UX_OHCI_TD_SETUP_PHASE 0x00010000u
#define UX_OHCI_TD_DATA_PHASE 0x00020000u
#define UX_OHCI_TD_STATUS_PHASE 0x00040000u
#define UX_OHCI_TD_CC 28u
/* Define OHCI ISOCHRONOUS TD structure. */
@ -341,10 +344,10 @@ typedef struct UX_OHCI_ISO_TD_STRUCT
/* Define OHCI ISOCHRONOUS TD bitmap. */
#define UX_OHCI_ISO_TD_BASE 0xfffff000
#define UX_OHCI_ISO_TD_OFFSET 0x00000fff
#define UX_OHCI_ISO_TD_PSW_CC 0x0000e000
#define UX_OHCI_ISO_TD_FC 24
#define UX_OHCI_ISO_TD_BASE 0xfffff000u
#define UX_OHCI_ISO_TD_OFFSET 0x00000fffu
#define UX_OHCI_ISO_TD_PSW_CC 0x0000e000u
#define UX_OHCI_ISO_TD_FC 24u
/* Define OHCI function prototypes. */

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_asynchronous_endpoint_create PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -72,6 +72,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_asynchronous_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@ -96,7 +99,7 @@ UX_EHCI_LINK_POINTER queue_head;
endpoint -> ux_endpoint_ed = (VOID *) ed;
/* Now do the opposite, attach the ED container to the physical ED. */
ed -> ux_ehci_ed_endpoint = endpoint;
ed -> REF_AS.INTR.ux_ehci_ed_endpoint = endpoint;
/* Set the default MPS Capability info in the ED. */
ed -> ux_ehci_ed_cap0 = endpoint -> ux_endpoint_descriptor.wMaxPacketSize << UX_EHCI_QH_MPS_LOC;

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_done_queue_process PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -76,6 +76,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warning, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
VOID _ux_hcd_ehci_done_queue_process(UX_HCD_EHCI *hcd_ehci)
@ -84,10 +87,10 @@ VOID _ux_hcd_ehci_done_queue_process(UX_HCD_EHCI *hcd_ehci)
UX_EHCI_TD *td;
UX_EHCI_PERIODIC_LINK_POINTER ed;
UX_EHCI_ED *start_ed;
UX_EHCI_PERIODIC_LINK_POINTER lp;
#if UX_MAX_ISO_TD
UX_EHCI_PERIODIC_LINK_POINTER lp;
/* We scan the active isochronous list first. */
_ux_utility_mutex_on(&hcd_ehci -> ux_hcd_ehci_periodic_mutex);

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_hsisochronous_tds_process PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* 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 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UX_EHCI_HSISO_TD* _ux_hcd_ehci_hsisochronous_tds_process(
@ -124,15 +127,15 @@ UINT i;
*/
/* Get number of frames (8,4,2 or 1). */
n_fr = 8 >> ed -> ux_ehci_hsiso_ed_frinterval_shift;
n_fr = 8u >> ed -> ux_ehci_hsiso_ed_frinterval_shift;
/* Process if there is requests loaded. */
if (ed -> ux_ehci_hsiso_ed_frload > 0)
{
/* Process count to target micro frames. */
fr_hc = ed -> ux_ehci_hsiso_ed_fr_hc << ed -> ux_ehci_hsiso_ed_frinterval_shift;
fr_hc += ed -> ux_ehci_hsiso_ed_frstart;
fr_hc = (USHORT)(ed -> ux_ehci_hsiso_ed_fr_hc << ed -> ux_ehci_hsiso_ed_frinterval_shift);
fr_hc = (USHORT)(fr_hc + ed -> ux_ehci_hsiso_ed_frstart);
fr_hc &= 0x7u;
/* Process done iTDs. */
@ -211,8 +214,8 @@ UINT i;
}
/* Clear load map anyway. */
fr_td -> ux_ehci_hsiso_td_frload &= ~(1u << frindex);
ed -> ux_ehci_hsiso_ed_frload &= ~(1u << frindex);
fr_td -> ux_ehci_hsiso_td_frload = (UCHAR)(fr_td -> ux_ehci_hsiso_td_frload & ~(1u << frindex));
ed -> ux_ehci_hsiso_ed_frload = (USHORT)(ed -> ux_ehci_hsiso_ed_frload & ~(1u << frindex));
/* Handle the request. */
transfer = ed -> ux_ehci_hsiso_ed_transfer_head;
@ -308,8 +311,8 @@ UINT i;
} /* if (ed -> ux_ehci_hsiso_ed_fr_sw == 0xFE) */
/* Process count to target micro frames. */
fr_sw = ed -> ux_ehci_hsiso_ed_fr_sw << ed -> ux_ehci_hsiso_ed_frinterval_shift;
fr_sw += ed -> ux_ehci_hsiso_ed_frstart;
fr_sw = (USHORT)(ed -> ux_ehci_hsiso_ed_fr_sw << ed -> ux_ehci_hsiso_ed_frinterval_shift);
fr_sw = (USHORT)(fr_sw + ed -> ux_ehci_hsiso_ed_frstart);
fr_sw &= 0x7u;
/* Build requests. */
@ -379,8 +382,8 @@ UINT i;
transfer -> ux_transfer_request_next_transfer_request;
/* Update load map. */
fr_td -> ux_ehci_hsiso_td_frload |= (1u << frindex);
ed -> ux_ehci_hsiso_ed_frload |= (1u << frindex);
fr_td -> ux_ehci_hsiso_td_frload = (UCHAR)(fr_td -> ux_ehci_hsiso_td_frload | (1u << frindex));
ed -> ux_ehci_hsiso_ed_frload = (UCHAR)(ed -> ux_ehci_hsiso_ed_frload | (1u << frindex));
/* Get transfer size. */
trans_bytes = transfer -> ux_transfer_request_requested_length;

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_interrupt_endpoint_create PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -93,6 +93,9 @@
/* optimized based on compile */
/* definitions, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_interrupt_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@ -138,7 +141,7 @@ UINT i;
endpoint -> ux_endpoint_ed = (VOID *) ed;
/* Now do the opposite, attach the ED container to the physical ED. */
ed -> ux_ehci_ed_endpoint = endpoint;
ed -> REF_AS.INTR.ux_ehci_ed_endpoint = endpoint;
/* Set the default MPS Capability info in the ED. */
max_packet_size = endpoint -> ux_endpoint_descriptor.wMaxPacketSize & UX_MAX_PACKET_SIZE_MASK;
@ -244,7 +247,7 @@ UINT i;
ed_anchor = _ux_hcd_ehci_poll_rate_entry_get(hcd_ehci, ed_list, poll_depth);
/* Save anchor pointer for interrupt ED. */
ed -> ux_ehci_ed_anchor = ed_anchor;
ed -> REF_AS.INTR.ux_ehci_ed_anchor = ed_anchor;
/* Calculate packet size with num transactions. */
max_packet_size *= num_transaction;
@ -335,18 +338,18 @@ UINT i;
{
/* Reserve load for CSplit. */
ed_anchor -> ux_ehci_ed_microframe_load[(i + 2)&7] += max_packet_size;
ed_anchor -> ux_ehci_ed_microframe_load[(i + 3)&7] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 2)&7] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 2)&7] + max_packet_size);
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 3)&7] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 3)&7] + max_packet_size);
/* Need additional CSplit. */
if (csplit_count > 2)
ed_anchor -> ux_ehci_ed_microframe_load[(i + 4)&7] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 4)&7] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[(i + 4)&7] + max_packet_size);
}
else
{
/* Reserve load for SSplit. */
ed_anchor -> ux_ehci_ed_microframe_load[i] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + max_packet_size);
}
/* Update schedule masks. */
@ -356,7 +359,7 @@ UINT i;
#endif
{
/* Update anchor micro-frame load. */
ed_anchor -> ux_ehci_ed_microframe_load[i] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + max_packet_size);
}
}
else
@ -378,7 +381,7 @@ UINT i;
/* Update anchor micro-frame loads. */
for (; i < 8; i += interval)
ed_anchor -> ux_ehci_ed_microframe_load[i] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + max_packet_size);
}
/* We found the node entry of the ED pointer that will be the anchor for this interrupt

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_interrupt_endpoint_destroy PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* 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 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_interrupt_endpoint_destroy(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
@ -154,7 +157,7 @@ ULONG max_packet_size;
{
/* Decrement the start split count. */
ed -> ux_ehci_ed_anchor -> ux_ehci_ed_microframe_ssplit_count[frindex] --;
ed -> REF_AS.INTR.ux_ehci_ed_anchor -> ux_ehci_ed_microframe_ssplit_count[frindex] --;
/* Check next endpoint if it's IN (load in C-Mask). */
if (endpoint -> ux_endpoint_descriptor.bEndpointAddress & UX_ENDPOINT_DIRECTION)
@ -162,7 +165,7 @@ ULONG max_packet_size;
}
#endif
/* Decrement the microframe load. */
ed -> ux_ehci_ed_anchor -> ux_ehci_ed_microframe_load[frindex] -= max_packet_size;
ed -> REF_AS.INTR.ux_ehci_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] = (USHORT)(ed -> REF_AS.INTR.ux_ehci_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] - max_packet_size);
/* S-Mask found, no C-Mask at the same time, skip C-Mask check. */
continue;
@ -177,7 +180,7 @@ ULONG max_packet_size;
{
/* Decrement the microframe load. */
ed -> ux_ehci_ed_anchor -> ux_ehci_ed_microframe_load[frindex] -= max_packet_size;
ed -> REF_AS.INTR.ux_ehci_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] = (USHORT)(ed -> REF_AS.INTR.ux_ehci_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] - max_packet_size);
}
#endif
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_isochronous_endpoint_create PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -76,12 +76,18 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_isochronous_endpoint_create(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
{
#if UX_MAX_ISO_TD == 0
UX_PARAMETER_NOT_USED(hcd_ehci);
UX_PARAMETER_NOT_USED(endpoint);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_HCD, UX_FUNCTION_NOT_SUPPORTED);
@ -126,7 +132,7 @@ UINT status;
device = endpoint -> ux_endpoint_device;
/* Get the interval value from endpoint descriptor. */
interval = endpoint -> ux_endpoint_descriptor.bInterval;
interval = (UCHAR)endpoint -> ux_endpoint_descriptor.bInterval;
/* For ISO, interval 1 ~ 16, means 2^(n-1). */
if (interval == 0)
@ -135,10 +141,10 @@ UINT status;
interval = 16;
/* Interval shift is base 0. */
interval_shift = interval - 1;
interval_shift = (UCHAR)(interval - 1);
/* Keep interval as number of micro-frames. */
interval = (1u << interval_shift);
interval = (UCHAR)(1u << interval_shift);
/* Get max packet size. */
max_packet_size = endpoint -> ux_endpoint_descriptor.wMaxPacketSize & UX_MAX_PACKET_SIZE_MASK;
@ -194,7 +200,7 @@ UINT status;
if (interval > 2)
ed -> ux_ehci_hsiso_ed_nb_tds = 1;
else
ed -> ux_ehci_hsiso_ed_nb_tds = 4 >> interval_shift;
ed -> ux_ehci_hsiso_ed_nb_tds = (UCHAR)(4u >> interval_shift);
/* Obtain iTDs. */
status = UX_SUCCESS;
@ -213,7 +219,7 @@ UINT status;
itd.itd_ptr -> ux_ehci_hsiso_td_ed = ed;
/* Save max transfer size. */
itd.itd_ptr -> ux_ehci_hsiso_td_max_trans_size = max_trans_size;
itd.itd_ptr -> ux_ehci_hsiso_td_max_trans_size = (USHORT)max_trans_size;
/* Save the iTD for the micro-frame(s). */
ed -> ux_ehci_hsiso_ed_fr_td[i] = itd.itd_ptr;
@ -254,7 +260,7 @@ UINT status;
else if (interval > 8)
poll_depth = 0;
else
poll_depth = 8 - interval;
poll_depth = (UINT)(8u - interval);
/* Keep only interval < 1ms for micro-frame calculation. */
interval_shift &= 0x3;
@ -282,7 +288,7 @@ UINT status;
itd.itd_ptr = ed -> ux_ehci_hsiso_ed_fr_td[i];
/* Build next link pointer, if not last one.*/
if (i < ed -> ux_ehci_hsiso_ed_nb_tds - 1)
if (i < ed -> ux_ehci_hsiso_ed_nb_tds - 1u)
{
lp.void_ptr = _ux_utility_physical_address(ed -> ux_ehci_hsiso_ed_fr_td[i + 1]);
itd.itd_ptr -> ux_ehci_hsiso_td_next_lp = lp;
@ -418,10 +424,10 @@ UINT status;
if (split_last_size &&
i == ((microframe_i + split_count - 1) & 7))
{
ed_anchor -> ux_ehci_ed_microframe_load[i] += split_last_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + split_last_size);
}
else
ed_anchor -> ux_ehci_ed_microframe_load[i] += 188;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + 188u);
/* Increment SSplit count. */
ed_anchor -> ux_ehci_ed_microframe_ssplit_count[i] ++;
@ -471,7 +477,7 @@ UINT status;
continue;
/* Add to load. */
ed_anchor -> ux_ehci_ed_microframe_load[i] += 188;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + 188u);
}
/* Increment SSplit count. */
@ -484,7 +490,7 @@ UINT status;
{
/* Save index base of allocated micro-frame. */
ed -> ux_ehci_hsiso_ed_frindex = microframe_i;
ed -> ux_ehci_hsiso_ed_frindex = (UCHAR)microframe_i;
/* Save anchor pointer. */
ed -> ux_ehci_hsiso_ed_anchor = ed_anchor;
@ -494,7 +500,7 @@ UINT status;
{
/* Update anchor micro-frame loads. */
ed_anchor -> ux_ehci_ed_microframe_load[i] += max_packet_size;
ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] = (USHORT)(ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[i] + max_packet_size);
/* Initialize control with PG -> BP (3, 5). */
itd.itd_ptr = ed -> ux_ehci_hsiso_ed_fr_td[i >> 1];

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_isochronous_endpoint_destroy PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -72,12 +72,18 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_isochronous_endpoint_destroy(UX_HCD_EHCI *hcd_ehci, UX_ENDPOINT *endpoint)
{
#if UX_MAX_ISO_TD == 0
UX_PARAMETER_NOT_USED(hcd_ehci);
UX_PARAMETER_NOT_USED(endpoint);
/* Error trap. */
_ux_system_error_handler(UX_SYSTEM_LEVEL_THREAD, UX_SYSTEM_CONTEXT_HCD, UX_FUNCTION_NOT_SUPPORTED);
@ -225,16 +231,19 @@ ULONG last_size;
last_size = max_packet_size % 188;
if (last_size == 0 &&
frindex == last_frindex)
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] -= last_size;
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] = (USHORT)
(ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] - last_size);
else
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] -= 188;
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] = (USHORT)
(ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] - 188u);
}
}
/* Update complete split related (IN only). */
if (ed_td.sitd_ptr -> ux_ehci_fsiso_td_cap1 & (UX_EHCI_CMASK_0 << frindex))
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] -= 188;
ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] = (USHORT)
(ed_td.sitd_ptr -> ux_ehci_fsiso_td_anchor -> ux_ehci_ed_microframe_load[frindex] - 188u);
}
}
else
@ -251,7 +260,7 @@ ULONG last_size;
{
/* Decrement the microframes scheduled. */
ed -> ux_ehci_hsiso_ed_anchor -> ux_ehci_ed_microframe_load[frindex] -= max_packet_size;
ed -> ux_ehci_hsiso_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] = (USHORT)(ed -> ux_ehci_hsiso_ed_anchor -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex] - max_packet_size);
}
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_least_traffic_list_get PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* 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 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UX_EHCI_ED *_ux_hcd_ehci_least_traffic_list_get(UX_HCD_EHCI *hcd_ehci,
@ -83,9 +86,6 @@ UX_EHCI_ED *ed;
UX_EHCI_PERIODIC_LINK_POINTER anchor;
UINT list_index;
UINT frindex;
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
UINT bfindex;
#endif
ULONG min_bandwidth_used;
ULONG bandwidth_used;
@ -126,18 +126,18 @@ ULONG bandwidth_used;
/* Scan static anchors in the list. */
ed = anchor.ed_ptr;
while(ed -> ux_ehci_ed_next_anchor != UX_NULL)
while(ed -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor != UX_NULL)
{
for (frindex = 0; frindex < 8; frindex ++)
{
microframe_load[frindex] += ed -> ux_ehci_ed_microframe_load[frindex];
microframe_load[frindex] += ed -> REF_AS.ANCHOR.ux_ehci_ed_microframe_load[frindex];
#if defined(UX_HCD_EHCI_SPLIT_TRANSFER_ENABLE)
microframe_ssplit_count[frindex] += ed -> ux_ehci_ed_microframe_ssplit_count[frindex];
#endif
}
/* Next static anchor. */
ed = ed -> ux_ehci_ed_next_anchor;
ed = ed -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor;
}
/* Summarize bandwidth from micro-frames. */

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_periodic_tree_create PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -69,6 +69,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_periodic_tree_create(UX_HCD_EHCI *hcd_ehci)
@ -129,11 +132,11 @@ UX_EHCI_PERIODIC_LINK_POINTER lp;
previous_ed = ed_list[current_list_entry * 2];
previous_ed -> ux_ehci_ed_queue_head = lp.ed_ptr;
previous_ed -> ux_ehci_ed_next_ed = ed;
previous_ed -> ux_ehci_ed_next_anchor = ed;
previous_ed -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor = ed;
previous_ed = ed_list[(current_list_entry * 2) + 1];
previous_ed -> ux_ehci_ed_queue_head = lp.ed_ptr;
previous_ed -> ux_ehci_ed_next_ed = ed;
previous_ed -> ux_ehci_ed_next_anchor = ed;
previous_ed -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor = ed;
}
/* Memorize this ED in the local list. We do this operation now, otherwise

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_poll_rate_entry_get PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -78,6 +78,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UX_EHCI_ED *_ux_hcd_ehci_poll_rate_entry_get(UX_HCD_EHCI *hcd_ehci,
@ -95,9 +98,9 @@ UX_EHCI_ED *_ux_hcd_ehci_poll_rate_entry_get(UX_HCD_EHCI *hcd_ehci,
/* Obtain next link pointer including Typ and T. */
while(poll_depth --)
{
if (ed_list -> ux_ehci_ed_next_anchor == UX_NULL)
if (ed_list -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor == UX_NULL)
break;
ed_list = ed_list -> ux_ehci_ed_next_anchor;
ed_list = ed_list -> REF_AS.ANCHOR.ux_ehci_ed_next_anchor;
}
/* Return the list entry. */

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_request_control_transfer PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -82,6 +82,9 @@
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* prefixed UX to MS_TO_TICK, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_request_control_transfer(UX_HCD_EHCI *hcd_ehci, UX_TRANSFER *transfer_request)
@ -108,11 +111,11 @@ UINT pid;
if (setup_request == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
*setup_request = transfer_request -> ux_transfer_request_function;
*(setup_request + UX_SETUP_REQUEST_TYPE) = transfer_request -> ux_transfer_request_type;
*(setup_request + UX_SETUP_REQUEST) = transfer_request -> ux_transfer_request_function;
_ux_utility_short_put(setup_request + UX_SETUP_VALUE, transfer_request -> ux_transfer_request_value);
_ux_utility_short_put(setup_request + UX_SETUP_INDEX, transfer_request -> ux_transfer_request_index);
*setup_request = (UCHAR)transfer_request -> ux_transfer_request_function;
*(setup_request + UX_SETUP_REQUEST_TYPE) = (UCHAR)transfer_request -> ux_transfer_request_type;
*(setup_request + UX_SETUP_REQUEST) = (UCHAR)transfer_request -> ux_transfer_request_function;
_ux_utility_short_put(setup_request + UX_SETUP_VALUE, (USHORT)transfer_request -> ux_transfer_request_value);
_ux_utility_short_put(setup_request + UX_SETUP_INDEX, (USHORT)transfer_request -> ux_transfer_request_index);
_ux_utility_short_put(setup_request + UX_SETUP_LENGTH, (USHORT) transfer_request -> ux_transfer_request_requested_length);
/* Reset the last TD pointer since it is the first time we hook a transaction. */

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ehci_transfer_abort PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* 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 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ehci_transfer_abort(UX_HCD_EHCI *hcd_ehci,UX_TRANSFER *transfer_request)
@ -127,7 +130,7 @@ ULONG remain_count;
list_head = &ied -> ux_ehci_hsiso_ed_transfer_head;
/* Max load count (in 1 ms): 8, 4, 2, 1 ... */
max_load_count = 8 >> ied -> ux_ehci_hsiso_ed_frinterval_shift;
max_load_count = 8u >> ied -> ux_ehci_hsiso_ed_frinterval_shift;
}
/* The whole list is aborted. */

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_endpoint_error_clear PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -69,6 +69,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_endpoint_error_clear(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
@ -77,7 +80,9 @@ UINT _ux_hcd_ohci_endpoint_error_clear(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endp
UX_OHCI_ED *ed;
ULONG td_value;
UX_PARAMETER_NOT_USED(hcd_ohci);
/* From the endpoint container fetch the OHCI ED descriptor. */
ed = (UX_OHCI_ED *) endpoint -> ux_endpoint_ed;

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_endpoint_reset PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -68,6 +68,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_endpoint_reset(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
@ -76,7 +79,9 @@ UINT _ux_hcd_ohci_endpoint_reset(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
UX_OHCI_ED *ed;
ULONG td_value;
UX_PARAMETER_NOT_USED(hcd_ohci);
/* From the endpoint container fetch the OHCI ED descriptor. */
ed = (UX_OHCI_ED *) endpoint -> ux_endpoint_ed;

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_periodic_endpoint_destroy PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -70,6 +70,9 @@
/* fixed physical and virtual */
/* address conversion, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_periodic_endpoint_destroy(UX_HCD_OHCI *hcd_ohci, UX_ENDPOINT *endpoint)
@ -82,7 +85,9 @@ UX_OHCI_TD *tail_td;
UX_OHCI_TD *head_td;
ULONG value_td;
UX_PARAMETER_NOT_USED(hcd_ohci);
/* From the endpoint container fetch the OHCI ED descriptor. */
ed = (UX_OHCI_ED*) endpoint -> ux_endpoint_ed;

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_port_resume PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -69,11 +69,16 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_port_resume(UX_HCD_OHCI *hcd_ohci, UINT port_index)
{
UX_PARAMETER_NOT_USED(hcd_ohci);
UX_PARAMETER_NOT_USED(port_index);
return(UX_FUNCTION_NOT_SUPPORTED);
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_port_suspend PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -69,11 +69,16 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_port_suspend(UX_HCD_OHCI *hcd_ohci, ULONG port_index)
{
UX_PARAMETER_NOT_USED(hcd_ohci);
UX_PARAMETER_NOT_USED(port_index);
return(UX_FUNCTION_NOT_SUPPORTED);
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_power_down_port PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -69,11 +69,16 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_power_down_port(UX_HCD_OHCI *hcd_ohci, ULONG port_index)
{
UX_PARAMETER_NOT_USED(hcd_ohci);
UX_PARAMETER_NOT_USED(port_index);
return(UX_FUNCTION_NOT_SUPPORTED);
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_power_on_port PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -68,11 +68,16 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_power_on_port(UX_HCD_OHCI *hcd_ohci, ULONG port_index)
{
UX_PARAMETER_NOT_USED(hcd_ohci);
UX_PARAMETER_NOT_USED(port_index);
return(UX_FUNCTION_NOT_SUPPORTED);
}

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_power_root_hubs PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -70,6 +70,9 @@
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
VOID _ux_hcd_ohci_power_root_hubs(UX_HCD_OHCI *hcd_ohci)
@ -110,7 +113,7 @@ UINT port_index;
for (port_index = 0; port_index < hcd_ohci -> ux_hcd_ohci_nb_root_hubs; port_index++)
{
if ((ohci_register_b & (0x20000 << port_index)) == 0)
if ((ohci_register_b & (0x20000u << port_index)) == 0)
{
_ux_hcd_ohci_register_write(hcd_ohci, OHCI_HC_RH_STATUS, OHCI_HC_RS_LPSC);
@ -123,7 +126,7 @@ UINT port_index;
for (port_index = 0; port_index < hcd_ohci -> ux_hcd_ohci_nb_root_hubs; port_index++)
{
if ((ohci_register_b & (0x20000 << port_index)) != 0)
if ((ohci_register_b & (0x20000u << port_index)) != 0)
{
ohci_register_port_status = _ux_hcd_ohci_register_read(hcd_ohci, OHCI_HC_RH_PORT_STATUS + port_index);

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_request_control_transfer PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -85,6 +85,9 @@
/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */
/* prefixed UX to MS_TO_TICK, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_request_control_transfer(UX_HCD_OHCI *hcd_ohci, UX_TRANSFER *transfer_request)
@ -115,11 +118,11 @@ UINT status;
if (setup_request == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
*setup_request = transfer_request -> ux_transfer_request_function;
*(setup_request + UX_SETUP_REQUEST_TYPE) = transfer_request -> ux_transfer_request_type;
*(setup_request + UX_SETUP_REQUEST) = transfer_request -> ux_transfer_request_function;
_ux_utility_short_put(setup_request + UX_SETUP_VALUE, transfer_request -> ux_transfer_request_value);
_ux_utility_short_put(setup_request + UX_SETUP_INDEX, transfer_request -> ux_transfer_request_index);
*setup_request = (UCHAR)transfer_request -> ux_transfer_request_function;
*(setup_request + UX_SETUP_REQUEST_TYPE) = (UCHAR)transfer_request -> ux_transfer_request_type;
*(setup_request + UX_SETUP_REQUEST) = (UCHAR)transfer_request -> ux_transfer_request_function;
_ux_utility_short_put(setup_request + UX_SETUP_VALUE, (USHORT)transfer_request -> ux_transfer_request_value);
_ux_utility_short_put(setup_request + UX_SETUP_INDEX, (USHORT)transfer_request -> ux_transfer_request_index);
_ux_utility_short_put(setup_request + UX_SETUP_LENGTH, (USHORT) transfer_request -> ux_transfer_request_requested_length);
/* Set the ED address and MPS values since they may have changed.

View File

@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_hcd_ohci_transfer_abort PORTABLE C */
/* 6.1 */
/* 6.1.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@ -73,6 +73,9 @@
/* fixed physical and virtual */
/* address conversion, */
/* resulting in version 6.1 */
/* 11-09-2020 Chaoqiong Xiao Modified comment(s), */
/* fixed compile warnings, */
/* resulting in version 6.1.2 */
/* */
/**************************************************************************/
UINT _ux_hcd_ohci_transfer_abort(UX_HCD_OHCI *hcd_ohci, UX_TRANSFER *transfer_request)
@ -84,7 +87,9 @@ UX_OHCI_TD *head_td;
UX_OHCI_TD *tail_td;
ULONG value_td;
ULONG value_carry;
UX_PARAMETER_NOT_USED(hcd_ohci);
/* Get the pointer to the endpoint associated with the transfer request. */
endpoint = (UX_ENDPOINT *) transfer_request -> ux_transfer_request_endpoint;

View File

@ -0,0 +1,9 @@
target_sources(${PROJECT_NAME} PRIVATE
# {{BEGIN_TARGET_SOURCES}}
# {{END_TARGET_SOURCES}}
)
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}/inc
)

View File

@ -0,0 +1,221 @@
/**************************************************************************/
/* */
/* 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 */
/** */
/** Port Specific */
/** */
/**************************************************************************/
/**************************************************************************/
/**************************************************************************/
/* */
/* PORT SPECIFIC C INFORMATION RELEASE */
/* */
/* ux_port.h Linux/GNU */
/* 6.x */
/* */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
/* */
/* DESCRIPTION */
/* */
/* This file contains data type definitions that make USBX function */
/* identically on a variety of different processor architectures. */
/* */
/* RELEASE HISTORY */
/* */
/* DATE NAME DESCRIPTION */
/* */
/* xx-xx-xxxx Chaoqiong Xiao Initial Version 6.x */
/* */
/**************************************************************************/
#ifndef UX_PORT_H
#define UX_PORT_H
/* Remap keywords in the Visual environment. */
#define class usbx_class
#define interface uxbx_interface
/* Determine if the optional USBX user define file should be used. */
#ifdef UX_INCLUDE_USER_DEFINE_FILE
/* Yes, include the user defines in ux_user.h. The defines in this file may
alternately be defined on the command line. */
#include "ux_user.h"
#endif
/* Include library header files. */
#include <stdio.h>
#include <string.h>
/* CPU definition for X86 systems without preemptive timer function.
This will make USBX uses the controller for the timer. */
#undef THREADX_X86_NO_PTIMER
/* For X86 systems, the define #define UX_USE_IO_INSTRUCTIONS should be used. */
/* Define additional generic USBX types. */
typedef long SLONG;
/* Generic USBX Project constants follow. */
#ifndef UX_PERIODIC_RATE
#define UX_PERIODIC_RATE 100
#endif
#ifndef UX_MAX_CLASS_DRIVER
#define UX_MAX_CLASS_DRIVER 8
#endif
#ifndef UX_MAX_SLAVE_CLASS_DRIVER
#define UX_MAX_SLAVE_CLASS_DRIVER 3
#endif
#ifndef UX_MAX_HCD
#define UX_MAX_HCD 2
#endif
#ifndef UX_MAX_DEVICES
#define UX_MAX_DEVICES 8
#endif
#ifndef UX_MAX_ED
#define UX_MAX_ED 80
#endif
#ifndef UX_MAX_TD
#define UX_MAX_TD 32
#endif
#ifndef UX_MAX_ISO_TD
#define UX_MAX_ISO_TD 128
#endif
#ifndef UX_HOST_ENUM_THREAD_STACK_SIZE
#define UX_HOST_ENUM_THREAD_STACK_SIZE (2*1024)
#endif
#ifndef UX_THREAD_STACK_SIZE
#define UX_THREAD_STACK_SIZE (1*1024)
#endif
#ifndef UX_THREAD_PRIORITY_ENUM
#define UX_THREAD_PRIORITY_ENUM 20
#endif
#ifndef UX_THREAD_PRIORITY_CLASS
#define UX_THREAD_PRIORITY_CLASS 20
#endif
#ifndef UX_THREAD_PRIORITY_KEYBOARD
#define UX_THREAD_PRIORITY_KEYBOARD 20
#endif
#ifndef UX_THREAD_PRIORITY_HCD
#define UX_THREAD_PRIORITY_HCD 2
#endif
#ifndef UX_THREAD_PRIORITY_DCD
#define UX_THREAD_PRIORITY_DCD 2
#endif
#ifndef UX_NO_TIME_SLICE
#define UX_NO_TIME_SLICE 0
#endif
#ifndef UX_MAX_SLAVE_LUN
#define UX_MAX_SLAVE_LUN 2
#endif
#ifndef UX_MAX_HOST_LUN
#define UX_MAX_HOST_LUN 2
#endif
#ifndef UX_HOST_CLASS_STORAGE_MAX_MEDIA
#define UX_HOST_CLASS_STORAGE_MAX_MEDIA 2
#endif
#ifndef UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH
#define UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH 256
#endif
#ifndef UX_SLAVE_REQUEST_DATA_MAX_LENGTH
#define UX_SLAVE_REQUEST_DATA_MAX_LENGTH 4096
#endif
#ifndef UX_USE_IO_INSTRUCTIONS
/* Don't use IO instructions if this define is not set. Default to memory mapped. */
#define inpb(a) *((UCHAR *) (a))
#define inpw(a) *((USHORT *) (a))
#define inpl(a) *((ULONG *) (a))
#define outpb(a, b) *((UCHAR *) (a)) = ((UCHAR) (b))
#define outpw(a, b) *((USHORT *) (a)) = ((USHORT) (b))
#define outpl(a, b) *((ULONG *) (a)) = ((ULONG) (b))
#else
/* Define simple prototypes for non-memory mapped hardware access. */
UCHAR inpb(ULONG);
USHORT inpw(ULONG);
ULONG inpl(ULONG);
UCHAR outpb(ULONG,UCHAR);
USHORT outpw(ULONG,USHORT);
ULONG outpl(ULONG,ULONG);
#endif
/* Define interrupt lockout constructs to protect the memory allocation/release which could happen
under ISR in the device stack. */
#define UX_INT_SAVE_AREA unsigned int old_interrupt_posture;
#define UX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE);
#define UX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture);
/* Define the version ID of USBX. This may be utilized by the application. */
#ifdef UX_SYSTEM_INIT
CHAR _ux_version_id[] =
"Copyright (c) Microsoft Corporation. All rights reserved. * USBX Linux/GNU Version 6.x *";
#else
extern CHAR _ux_version_id[];
#endif
#endif

View File

@ -10,9 +10,7 @@
/* Define USBX demo constants. */
#define UX_DEMO_STACK_SIZE 4096
#define UX_DEMO_BUFFER_SIZE 2048
#define UX_DEMO_RUN 1
#define UX_DEMO_MEMORY_SIZE (64*1024)
#define UX_DEMO_MEMORY_SIZE (28*1024)
/* Define the counters used in the demo application... */
@ -24,13 +22,15 @@ ULONG error_counter;
/* Define USBX demo global variables. */
ULONG ux_demo_memory_buffer[(UX_DEMO_MEMORY_SIZE + UX_DEMO_STACK_SIZE * 2) / sizeof(ULONG)];
unsigned char host_out_buffer[UX_HOST_CLASS_DPUMP_PACKET_SIZE];
unsigned char host_in_buffer[UX_HOST_CLASS_DPUMP_PACKET_SIZE];
unsigned char slave_buffer[UX_HOST_CLASS_DPUMP_PACKET_SIZE];
unsigned char device_buffer[UX_HOST_CLASS_DPUMP_PACKET_SIZE];
UX_HOST_CLASS *class_driver;
UX_HOST_CLASS_DPUMP *dpump;
UX_SLAVE_CLASS_DPUMP *dpump_slave;
UX_SLAVE_CLASS_DPUMP *dpump_device;
#define DEVICE_FRAMEWORK_LENGTH_FULL_SPEED 50
@ -134,9 +134,9 @@ UINT _ux_host_class_dpump_read (UX_HOST_CLASS_DPUMP *dpump, UCHAR
ULONG requested_length, ULONG *actual_length);
TX_THREAD tx_demo_thread_host_simulation;
TX_THREAD tx_demo_thread_slave_simulation;
TX_THREAD tx_demo_thread_device_simulation;
void tx_demo_thread_host_simulation_entry(ULONG);
void tx_demo_thread_slave_simulation_entry(ULONG);
void tx_demo_thread_device_simulation_entry(ULONG);
VOID error_handler(void);
@ -161,10 +161,12 @@ CHAR *stack_pointer;
CHAR *memory_pointer;
UINT status;
UX_SLAVE_CLASS_DPUMP_PARAMETER parameter;
UX_PARAMETER_NOT_USED(first_unused_memory);
/* Initialize the free memory pointer. */
stack_pointer = (CHAR *) first_unused_memory;
stack_pointer = (CHAR *) ux_demo_memory_buffer;
memory_pointer = stack_pointer + (UX_DEMO_STACK_SIZE * 2);
/* Initialize USBX Memory. */
@ -234,7 +236,7 @@ UX_SLAVE_CLASS_DPUMP_PARAMETER parameter;
error_handler();
/* Create the main demo thread. */
status = tx_thread_create(&tx_demo_thread_slave_simulation, "tx demo slave simulation", tx_demo_thread_slave_simulation_entry, 0,
status = tx_thread_create(&tx_demo_thread_device_simulation, "tx demo slave simulation", tx_demo_thread_device_simulation_entry, 0,
stack_pointer + UX_DEMO_STACK_SIZE, UX_DEMO_STACK_SIZE,
20, 20, 1, TX_AUTO_START);
@ -323,7 +325,7 @@ UX_HOST_CLASS *class;
}
void tx_demo_thread_slave_simulation_entry(ULONG arg)
void tx_demo_thread_device_simulation_entry(ULONG arg)
{
UINT status;
@ -336,21 +338,21 @@ ULONG actual_length;
{
/* Ensure the dpump class on the device is still alive. */
while (dpump_slave != UX_NULL)
while (dpump_device != UX_NULL)
{
/* Increment thread counter. */
thread_1_counter++;
/* Read from the device data pump. */
status = _ux_device_class_dpump_read(dpump_slave, slave_buffer, UX_HOST_CLASS_DPUMP_PACKET_SIZE, &actual_length);
status = _ux_device_class_dpump_read(dpump_device, device_buffer, UX_HOST_CLASS_DPUMP_PACKET_SIZE, &actual_length);
/* Verify that the status and the amount of data is correct. */
if ((status != UX_SUCCESS) || actual_length != UX_HOST_CLASS_DPUMP_PACKET_SIZE)
error_handler();
/* Now write to the device data pump. */
status = _ux_device_class_dpump_write(dpump_slave, slave_buffer, UX_HOST_CLASS_DPUMP_PACKET_SIZE, &actual_length);
status = _ux_device_class_dpump_write(dpump_device, device_buffer, UX_HOST_CLASS_DPUMP_PACKET_SIZE, &actual_length);
/* Verify that the status and the amount of data is correct. */
if ((status != UX_SUCCESS) || actual_length != UX_HOST_CLASS_DPUMP_PACKET_SIZE)
@ -366,7 +368,7 @@ VOID tx_demo_instance_activate(VOID *dpump_instance)
{
/* Save the DPUMP instance. */
dpump_slave = (UX_SLAVE_CLASS_DPUMP *) dpump_instance;
dpump_device = (UX_SLAVE_CLASS_DPUMP *) dpump_instance;
}
VOID tx_demo_instance_deactivate(VOID *dpump_instance)
@ -375,7 +377,7 @@ VOID tx_demo_instance_deactivate(VOID *dpump_instance)
UX_PARAMETER_NOT_USED(dpump_instance);
/* Reset the DPUMP instance. */
dpump_slave = UX_NULL;
dpump_device = UX_NULL;
}