diff options
| author | Scott Larson <[email protected]> | 2020-10-09 12:39:54 -0700 |
|---|---|---|
| committer | Scott Larson <[email protected]> | 2020-10-09 12:39:54 -0700 |
| commit | 3f1e20df866441bd7e3e8a45fffe1d5ab0413002 (patch) | |
| tree | a4fd231c2da5829f8913d0c92d633e4173f2fa33 /common/core/inc | |
| parent | ed83d6f07d3ef30993be946b5889aaba816b1f17 (diff) | |
6.1 Releasev6.1_rel
Diffstat (limited to 'common/core/inc')
| -rw-r--r-- | common/core/inc/ux_api.h | 424 | ||||
| -rw-r--r-- | common/core/inc/ux_dcd_sim_slave.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_device_class_dpump.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_device_stack.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_hcd_sim_host.h | 15 | ||||
| -rw-r--r-- | common/core/inc/ux_host_class_dpump.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_host_stack.h | 23 | ||||
| -rw-r--r-- | common/core/inc/ux_system.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_user_sample.h | 4 | ||||
| -rw-r--r-- | common/core/inc/ux_utility.h | 63 |
10 files changed, 452 insertions, 97 deletions
diff --git a/common/core/inc/ux_api.h b/common/core/inc/ux_api.h index 4dacbcf..a26e257 100644 --- 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.0.2 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -44,14 +44,24 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ -/* 06-30-2020 Chaoqiong Xiao Modified comment(s), and */ -/* updated product constants, */ -/* avoided div 0 in overflow */ -/* checking macro, */ -/* resulting in version 6.0.1 */ -/* 08-14-2020 Chaoqiong Xiao Modified comment(s), and */ -/* updated product constants, */ -/* resulting in version 6.0.2 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* added query usage of device */ +/* ClassSubclassProtocol, */ +/* added option to disable FX */ +/* media integration, prefixed */ +/* UX to MS_TO_TICK, added */ +/* APIs and macros related to */ +/* uninitialize, optimized */ +/* based on compile */ +/* definitions, updated */ +/* product constants, used */ +/* host class extension */ +/* pointer for class specific */ +/* structured data, used UX */ +/* prefix to refer to TX */ +/* symbols instead of using */ +/* them directly, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ @@ -113,13 +123,59 @@ typedef signed char SCHAR; #endif /* UX_ENABLE_ASSERT */ +/* Convert from millisecond to ThreadX Tick value. */ +#define UX_MS_TO_TICK(ms) ((ms) * (UX_PERIODIC_RATE) / 1000) + +/* Deprecated, left to be compatible with apps already using MS_TO_TICK. */ +#define MS_TO_TICK(ms) UX_MS_TO_TICK(ms) + + +/* If UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined, + it define USBX device max number of endpoints (1~n). + else max number of endpoints are from scan result. + It must be equal to or larger than max number of endpoints + can be activated at the same time. */ +#ifndef UX_MAX_DEVICE_ENDPOINTS +#define UX_MAX_DEVICE_ENDPOINTS 6 +#endif + +/* If UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined, + it define USBX device max number of interfacess (1~n). + else max number of interfacess are from scan result. + It must be equal to or larger than max number of interfaces + in a activated configuration. */ +#ifndef UX_MAX_DEVICE_INTERFACES +#define UX_MAX_DEVICE_INTERFACES 6 +#endif + + +/* Define USBX device max bInterfaceNumber of interfaces (0 ~ n), + it must be larger than max bInterfaceNumber in USB + framework descriptors. */ #ifndef UX_MAX_SLAVE_INTERFACES #define UX_MAX_SLAVE_INTERFACES 16 #endif -/* Convert from millisecond to ThreadX Tick value. */ -#define MS_TO_TICK(ms) ((ms) * (UX_PERIODIC_RATE) / 1000) +/* Define USBX max number of devices (1 ~ n). */ +#ifndef UX_MAX_DEVICES +#define UX_MAX_DEVICES 4 +#endif + +/* Define USBX max number of HCDs (1 ~ n). */ +#ifndef UX_MAX_HCD +#define UX_MAX_HCD 2 +#endif + +/* Define USBX max root hub port (1 ~ n). */ +#ifndef UX_MAX_ROOTHUB_PORT +#define UX_MAX_ROOTHUB_PORT 4 +#endif + +/* Define USBX max TT. */ +#ifndef UX_MAX_TT +#define UX_MAX_TT 8 +#endif /* Define USBX Host Enum Thread Stack Size. */ #ifndef UX_HOST_ENUM_THREAD_STACK_SIZE @@ -139,8 +195,8 @@ typedef signed char SCHAR; /* Define basic constants for the USBX Stack. */ #define AZURE_RTOS_USBX #define USBX_MAJOR_VERSION 6 -#define USBX_MINOR_VERSION 0 -#define USBX_PATCH_VERSION 2 +#define USBX_MINOR_VERSION 1 +#define USBX_PATCH_VERSION 0 /* Macros for concatenating tokens, where UX_CONCATn concatenates n tokens. */ @@ -311,7 +367,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_HOST_STACK_ENDPOINT_INSTANCE_DELETE (UX_TRACE_HOST_STACK_EVENTS_BASE + 16) /* I1 = device , I2 = endpoint */ #define UX_TRACE_HOST_STACK_ENDPOINT_RESET (UX_TRACE_HOST_STACK_EVENTS_BASE + 17) /* I1 = device , I2 = endpoint */ #define UX_TRACE_HOST_STACK_ENDPOINT_TRANSFER_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 18) /* I1 = endpoint */ -#define UX_TRACE_HOST_STACK_HCD_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 19) /* I1 = hcd name */ +#define UX_TRACE_HOST_STACK_HCD_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 19) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ #define UX_TRACE_HOST_STACK_INITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 20) /* */ #define UX_TRACE_HOST_STACK_INTERFACE_ENDPOINT_GET (UX_TRACE_HOST_STACK_EVENTS_BASE + 21) /* I1 = interface , I2 = endpoint index */ #define UX_TRACE_HOST_STACK_INTERFACE_INSTANCE_CREATE (UX_TRACE_HOST_STACK_EVENTS_BASE + 22) /* I1 = interface */ @@ -326,6 +382,10 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_TRACE_HOST_STACK_RH_DEVICE_INSERTION (UX_TRACE_HOST_STACK_EVENTS_BASE + 31) /* I1 = hcd , I2 = port index */ #define UX_TRACE_HOST_STACK_TRANSFER_REQUEST (UX_TRACE_HOST_STACK_EVENTS_BASE + 32) /* I1 = device , I2 = endpoint , I3 = transfer request */ #define UX_TRACE_HOST_STACK_TRANSFER_REQUEST_ABORT (UX_TRACE_HOST_STACK_EVENTS_BASE + 33) /* I1 = device , I2 = endpoint , I3 = transfer request */ +#define UX_TRACE_HOST_STACK_UNINITIALIZE (UX_TRACE_HOST_STACK_EVENTS_BASE + 34) /* */ +#define UX_TRACE_HOST_STACK_HCD_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 35) /* I1 = hcd name , I2 = parameter 1 , I3 = parameter 2 */ +#define UX_TRACE_HOST_STACK_CLASS_REGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 36) /* I1 = class name , I2 = entry function */ +#define UX_TRACE_HOST_STACK_CLASS_UNREGISTER (UX_TRACE_HOST_STACK_EVENTS_BASE + 37) /* I1 = class entry */ /* Define the USBX host class events. */ @@ -640,17 +700,119 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #endif #endif + +/* Define interrupts lockout constructs to protect the memory allocation/release which could happen + under ISR in the device stack. */ + +#ifndef UX_INTERRUPT_SAVE_AREA +#define UX_INTERRUPT_SAVE_AREA TX_INTERRUPT_SAVE_AREA +#endif + +#ifndef UX_DISABLE +#define UX_DISABLE TX_DISABLE +#endif + +#ifndef UX_RESTORE +#define UX_RESTORE TX_RESTORE +#endif + + +/* Define thread/timer related things. */ + +#ifndef UX_EMPTY +#define UX_EMPTY TX_EMPTY +#endif + +#ifndef UX_TIMER +#define UX_TIMER TX_TIMER +#endif + +#ifndef UX_THREAD +#define UX_THREAD TX_THREAD +#endif + +#ifndef UX_AUTO_START +#define UX_AUTO_START TX_AUTO_START +#endif + +#ifndef UX_DONT_START +#define UX_DONT_START TX_DONT_START +#endif + +#ifndef UX_AUTO_ACTIVATE +#define UX_AUTO_ACTIVATE TX_AUTO_ACTIVATE +#endif + +#ifndef UX_NO_ACTIVATE +#define UX_NO_ACTIVATE TX_NO_ACTIVATE +#endif + +#ifndef UX_THREAD_GET_SYSTEM_STATE +#define UX_THREAD_GET_SYSTEM_STATE TX_THREAD_GET_SYSTEM_STATE +#endif + +#ifndef UX_WAIT_FOREVER +#define UX_WAIT_FOREVER TX_WAIT_FOREVER +#endif + +#ifndef UX_NO_WAIT +#define UX_NO_WAIT TX_NO_WAIT +#endif + +#ifndef UX_NO_TIME_SLICE +#define UX_NO_TIME_SLICE TX_NO_TIME_SLICE +#endif + + +/* Define semaphore related things. */ + +#ifndef UX_SEMAPHORE +#define UX_SEMAPHORE TX_SEMAPHORE +#endif + + +/* Define mutex related things. */ + +#ifndef UX_MUTEX +#define UX_MUTEX TX_MUTEX +#endif + + +/* Define event flags group related things. */ + +#ifndef UX_EVENT_FLAGS_GROUP +#define UX_EVENT_FLAGS_GROUP TX_EVENT_FLAGS_GROUP +#endif + +#ifndef UX_OR_CLEAR +#define UX_OR_CLEAR TX_OR_CLEAR +#endif + +#ifndef UX_OR +#define UX_OR TX_OR +#endif + +#ifndef UX_AND_CLEAR +#define UX_AND_CLEAR TX_AND_CLEAR +#endif + +#ifndef UX_AND +#define UX_AND TX_AND +#endif + +#ifndef UX_NO_EVENTS +#define UX_NO_EVENTS TX_NO_EVENTS +#endif + + /* Define basic USBX constants. */ #define UX_NULL ((void*)0) #define UX_TRUE 1 #define UX_FALSE 0 -#define UX_MAX_TT 8 #define UX_TT_MASK 0x1FF #define UX_TT_BANDWIDTH 6000 #define UX_SLAVE_ENDPOINT_DEFAULT_BUFFER_SIZE 256 -#define UX_REGULAR_MEMORY 0 -#define UX_CACHE_SAFE_MEMORY 1 #define UX_MAX_BYTES_PER_FRAME_FS 1157 #define UX_MAX_BYTES_PER_MICROFRAME_HS 5785 @@ -691,11 +853,14 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL /* Define Generic USBX constants. */ -#define UX_WAIT_FOREVER 0xffffffff #define UX_UNUSED 0 #define UX_USED 1 -#define UX_MEMORY_UNUSED 0x12345678 -#define UX_MEMORY_USED 0x87654321 + +#define UX_MEMORY_UNUSED 0x00000000u +#define UX_MEMORY_USED 0x80000000u +#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 @@ -821,6 +986,8 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_DEVICE_REMOVAL 2 #define UX_HID_CLIENT_INSERTION 3 #define UX_HID_CLIENT_REMOVAL 4 +#define UX_STORAGE_MEDIA_INSERTION 5 +#define UX_STORAGE_MEDIA_REMOVAL 6 /* Define USBX transfer request status constants. */ @@ -1059,6 +1226,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_HOST_CLASS_COMMAND_QUERY 1 #define UX_HOST_CLASS_COMMAND_ACTIVATE 2 #define UX_HOST_CLASS_COMMAND_DEACTIVATE 3 +#define UX_HOST_CLASS_COMMAND_DESTROY 4 #define UX_SLAVE_CLASS_COMMAND_QUERY 1 #define UX_SLAVE_CLASS_COMMAND_ACTIVATE 2 @@ -1070,6 +1238,7 @@ VOID _ux_trace_event_update(TX_TRACE_BUFFER_ENTRY *event, ULONG timestamp, UL #define UX_HOST_CLASS_COMMAND_USAGE_PIDVID 1 #define UX_HOST_CLASS_COMMAND_USAGE_CSP 2 +#define UX_HOST_CLASS_COMMAND_USAGE_DCSP 3 #define UX_HOST_CLASS_INSTANCE_FREE 0 #define UX_HOST_CLASS_INSTANCE_LIVE 1 @@ -1191,15 +1360,18 @@ typedef struct UX_HOST_CLASS_COMMAND_STRUCT typedef struct UX_HOST_CLASS_STRUCT { +#if defined(UX_NAME_REFERENCED_BY_POINTER) + const UCHAR *ux_host_class_name; +#else UCHAR ux_host_class_name[UX_MAX_CLASS_NAME_LENGTH + 1]; /* "+1" for string null-terminator */ +#endif + UINT ux_host_class_status; - UINT (*ux_host_class_entry_function) (struct UX_HOST_CLASS_COMMAND_STRUCT *) ; - UINT ux_host_class_nb_devices_owned; + UINT (*ux_host_class_entry_function) (struct UX_HOST_CLASS_COMMAND_STRUCT *); VOID *ux_host_class_first_instance; VOID *ux_host_class_client; - TX_THREAD ux_host_class_thread; - VOID *ux_host_class_thread_stack; VOID *ux_host_class_media; + VOID *ux_host_class_ext; } UX_HOST_CLASS; @@ -1219,7 +1391,7 @@ typedef struct UX_TRANSFER_STRUCT UINT ux_transfer_request_value; UINT ux_transfer_request_index; VOID (*ux_transfer_request_completion_function) (struct UX_TRANSFER_STRUCT *); - TX_SEMAPHORE ux_transfer_request_semaphore; + UX_SEMAPHORE ux_transfer_request_semaphore; VOID *ux_transfer_request_class_instance; ULONG ux_transfer_request_maximum_length; ULONG ux_transfer_request_timeout_value; @@ -1228,7 +1400,7 @@ typedef struct UX_TRANSFER_STRUCT struct UX_TRANSFER_STRUCT *ux_transfer_request_next_transfer_request; VOID *ux_transfer_request_user_specific; - TX_THREAD *ux_transfer_request_thread_pending; + UX_THREAD *ux_transfer_request_thread_pending; } UX_TRANSFER; @@ -1376,31 +1548,66 @@ typedef struct UX_DEVICE_STRUCT ULONG ux_device_state; ULONG ux_device_address; ULONG ux_device_speed; - ULONG ux_device_port_location; - ULONG ux_device_max_power; ULONG ux_device_power_source; UINT ux_device_current_configuration; - TX_SEMAPHORE ux_device_protection_semaphore; - struct UX_DEVICE_STRUCT - *ux_device_parent; + UX_SEMAPHORE ux_device_protection_semaphore; struct UX_HOST_CLASS_STRUCT *ux_device_class; VOID *ux_device_class_instance; - struct UX_HCD_STRUCT - *ux_device_hcd; struct UX_CONFIGURATION_STRUCT *ux_device_first_configuration; - struct UX_DEVICE_STRUCT - *ux_device_next_device; struct UX_DEVICE_DESCRIPTOR_STRUCT ux_device_descriptor; struct UX_ENDPOINT_STRUCT ux_device_control_endpoint; + ULONG ux_device_port_location; +#if UX_MAX_HCD > 1 + struct UX_HCD_STRUCT + *ux_device_hcd; +#endif +#if UX_MAX_DEVICES > 1 + struct UX_DEVICE_STRUCT + *ux_device_parent; + ULONG ux_device_max_power; struct UX_HUB_TT_STRUCT ux_device_hub_tt[UX_MAX_TT]; +#endif } UX_DEVICE; +#if UX_MAX_HCD > 1 +#define UX_DEVICE_HCD_GET(d) ((d)->ux_device_hcd) +#define UX_DEVICE_HCD_SET(d,h) do { (d)->ux_device_hcd = (h); } while(0) +#define UX_DEVICE_HCD_MATCH(d,h) ((d)->ux_device_hcd == (h)) +#else +#define UX_DEVICE_HCD_GET(d) (_ux_system_host->ux_system_host_hcd_array) +#define UX_DEVICE_HCD_SET(d,h) +#define UX_DEVICE_HCD_MATCH(d,h) (_ux_system_host->ux_system_host_hcd_array == (h)) +#endif + + +#if UX_MAX_DEVICES > 1 +#define UX_DEVICE_PARENT_GET(d) ((d)->ux_device_parent) +#define UX_DEVICE_PARENT_SET(d,p) do { (d)->ux_device_parent = (p); } while(0) +#define UX_DEVICE_PARENT_MATCH(d,p) ((d)->ux_device_parent == (p)) +#define UX_DEVICE_PARENT_IS_HUB(d) ((d)->ux_device_parent != UX_NULL) +#define UX_DEVICE_PARENT_IS_ROOTHUB(d) ((d)->ux_device_parent == UX_NULL) +#define UX_DEVICE_MAX_POWER_GET(d) ((d)->ux_device_max_power) +#define UX_DEVICE_MAX_POWER_SET(d,p) do {(d)->ux_device_max_power = (p); } while(0) +#else +#define UX_DEVICE_PARENT_GET(d) (UX_NULL) +#define UX_DEVICE_PARENT_SET(d,p) UX_PARAMETER_NOT_USED(p) +#define UX_DEVICE_PARENT_MATCH(d,p) ((p) == UX_NULL) +#define UX_DEVICE_PARENT_IS_HUB(d) (UX_FALSE) +#define UX_DEVICE_PARENT_IS_ROOTHUB(d) (UX_TRUE) +#define UX_DEVICE_MAX_POWER_GET(d) (UX_MAX_SELF_POWER) +#define UX_DEVICE_MAX_POWER_SET(d,p) UX_PARAMETER_NOT_USED(p) +#endif +#define UX_DEVICE_PORT_LOCATION_GET(d) ((d)->ux_device_port_location) +#define UX_DEVICE_PORT_LOCATION_SET(d,l) do { (d)->ux_device_port_location = (l); } while(0) +#define UX_DEVICE_PORT_LOCATION_MATCH(d,l) ((d)->ux_device_port_location == (l)) + + /* Define USBX Configuration Descriptor structure. */ typedef struct UX_CONFIGURATION_DESCRIPTOR_STRUCT @@ -1523,24 +1730,34 @@ typedef struct UX_DFU_FUNCTIONAL_DESCRIPTOR_STRUCT typedef struct UX_HCD_STRUCT { +#if defined(UX_NAME_REFERENCED_BY_POINTER) + const UCHAR *ux_hcd_name; +#else UCHAR ux_hcd_name[UX_MAX_HCD_NAME_LENGTH + 1]; /* "+1" for string null-terminator */ - UCHAR ux_hcd_address[16]; +#endif + UINT ux_hcd_status; UINT ux_hcd_controller_type; - UINT ux_hcd_otg_capabilities; UINT ux_hcd_irq; UINT ux_hcd_nb_root_hubs; - UINT ux_hcd_root_hub_signal[16]; + UINT ux_hcd_root_hub_signal[UX_MAX_ROOTHUB_PORT]; UINT ux_hcd_nb_devices; - UINT ux_hcd_power_switch; UINT ux_hcd_thread_signal; ULONG ux_hcd_rh_device_connection; ULONG ux_hcd_io; - ULONG ux_hcd_available_bandwidth; - ULONG ux_hcd_maximum_transfer_request_size; - ULONG ux_hcd_version; UINT (*ux_hcd_entry_function) (struct UX_HCD_STRUCT *, UINT, VOID *); void *ux_hcd_controller_hardware; + +#if defined(UX_OTG_SUPPORT) + UINT ux_hcd_otg_capabilities; +#endif + +#if UX_MAX_DEVICES > 1 + UCHAR ux_hcd_address[16]; + UINT ux_hcd_power_switch; + ULONG ux_hcd_available_bandwidth; + ULONG ux_hcd_version; +#endif } UX_HCD; @@ -1561,7 +1778,7 @@ typedef struct UX_SLAVE_TRANSFER_STRUCT ULONG ux_slave_transfer_request_completion_code; ULONG ux_slave_transfer_request_phase; VOID (*ux_slave_transfer_request_completion_function) (struct UX_SLAVE_TRANSFER_STRUCT *); - TX_SEMAPHORE ux_slave_transfer_request_semaphore; + UX_SEMAPHORE ux_slave_transfer_request_semaphore; ULONG ux_slave_transfer_request_timeout; ULONG ux_slave_transfer_request_force_zlp; UCHAR ux_slave_transfer_request_setup[UX_SETUP_SIZE]; @@ -1639,7 +1856,6 @@ typedef struct UX_SLAVE_DEVICE_STRUCT typedef struct UX_SLAVE_DCD_STRUCT { - UCHAR ux_slave_dcd_name[32]; UINT ux_slave_dcd_status; UINT ux_slave_dcd_controller_type; UINT ux_slave_dcd_otg_capabilities; @@ -1676,12 +1892,17 @@ typedef struct UX_SLAVE_CLASS_COMMAND_STRUCT typedef struct UX_SLAVE_CLASS_STRUCT { +#if defined(UX_NAME_REFERENCED_BY_POINTER) + const UCHAR *ux_slave_class_name; +#else UCHAR ux_slave_class_name[UX_MAX_CLASS_NAME_LENGTH + 1]; /* "+1" for string null-terminator */ +#endif + UINT ux_slave_class_status; - UINT (*ux_slave_class_entry_function) (struct UX_SLAVE_CLASS_COMMAND_STRUCT *) ; + UINT (*ux_slave_class_entry_function) (struct UX_SLAVE_CLASS_COMMAND_STRUCT *); VOID *ux_slave_class_instance; VOID *ux_slave_class_client; - TX_THREAD ux_slave_class_thread; + UX_THREAD ux_slave_class_thread; VOID *ux_slave_class_thread_stack; VOID *ux_slave_class_interface_parameter; ULONG ux_slave_class_interface_number; @@ -1714,18 +1935,41 @@ typedef struct UX_SYSTEM_STRUCT UX_MEMORY_BLOCK *ux_system_cache_safe_memory_pool_start; ULONG ux_system_cache_safe_memory_pool_size; ULONG ux_system_cache_safe_memory_pool_free; +#ifdef UX_ENABLE_MEMORY_STATISTICS + UCHAR *ux_system_regular_memory_pool_base; + ALIGN_TYPE ux_system_regular_memory_pool_max_start_offset; + ALIGN_TYPE ux_system_regular_memory_pool_min_free; + UCHAR *ux_system_cache_safe_memory_pool_base; + ALIGN_TYPE ux_system_cache_safe_memory_pool_max_start_offset; + ALIGN_TYPE ux_system_cache_safe_memory_pool_min_free; + ULONG ux_system_regular_memory_pool_alloc_count; + ULONG ux_system_regular_memory_pool_alloc_total; + ULONG ux_system_regular_memory_pool_alloc_max_count; + ULONG ux_system_regular_memory_pool_alloc_max_total; + ULONG ux_system_cache_safe_memory_pool_alloc_count; + ULONG ux_system_cache_safe_memory_pool_alloc_total; + ULONG ux_system_cache_safe_memory_pool_alloc_max_count; + ULONG ux_system_cache_safe_memory_pool_alloc_max_total; +#endif + UINT ux_system_thread_lowest_priority; - TX_MUTEX ux_system_mutex; - ULONG ux_system_debug_code; - ULONG ux_system_debug_count; + UX_MUTEX ux_system_mutex; + +#ifndef UX_DISABLE_ERROR_HANDLER UINT ux_system_last_error; UINT ux_system_error_count; + VOID (*ux_system_error_callback_function) (UINT system_level, UINT system_context, UINT error_code); +#endif + +#ifdef UX_ENABLE_DEBUG_LOG + ULONG ux_system_debug_code; + ULONG ux_system_debug_count; UCHAR *ux_system_debug_log_buffer; UCHAR *ux_system_debug_log_head; UCHAR *ux_system_debug_log_tail; ULONG ux_system_debug_log_size; - VOID (*ux_system_debug_callback_function) (UCHAR *debug_message, ULONG debug_value) ; - VOID (*ux_system_error_callback_function) (UINT system_level, UINT system_context, UINT error_code) ; + VOID (*ux_system_debug_callback_function) (UCHAR *debug_message, ULONG debug_value); +#endif } UX_SYSTEM; @@ -1734,30 +1978,70 @@ typedef struct UX_SYSTEM_STRUCT typedef struct UX_SYSTEM_HOST_STRUCT { +#if UX_MAX_CLASS_DRIVER > 1 UINT ux_system_host_max_class; - UINT ux_system_host_registered_class; +#endif UX_HOST_CLASS *ux_system_host_class_array; + +#if UX_MAX_HCD > 1 UINT ux_system_host_max_hcd; - UX_HCD *ux_system_host_hcd_array; +#endif UINT ux_system_host_registered_hcd; - UX_DEVICE *ux_system_host_device_array; + UX_HCD *ux_system_host_hcd_array; + +#if UX_MAX_DEVICES > 1 ULONG ux_system_host_max_devices; +#endif + UX_DEVICE *ux_system_host_device_array; + ULONG ux_system_host_max_ed; ULONG ux_system_host_max_td; ULONG ux_system_host_max_iso_td; - UINT ux_system_host_rhsc_hcd; + UCHAR *ux_system_host_enum_thread_stack; - TX_THREAD ux_system_host_enum_thread; - TX_SEMAPHORE ux_system_host_enum_semaphore; + UX_THREAD ux_system_host_enum_thread; + UX_SEMAPHORE ux_system_host_enum_semaphore; + +#if UX_MAX_DEVICES > 1 VOID (*ux_system_host_enum_hub_function) (VOID); +#endif + UCHAR *ux_system_host_hcd_thread_stack; - TX_THREAD ux_system_host_hcd_thread; + UX_THREAD ux_system_host_hcd_thread; + UX_SEMAPHORE ux_system_host_hcd_semaphore; + +#if defined(UX_OTG_SUPPORT) UCHAR *ux_system_host_hnp_polling_thread_stack; - TX_THREAD ux_system_host_hnp_polling_thread; - TX_SEMAPHORE ux_system_host_hcd_semaphore; + UX_THREAD ux_system_host_hnp_polling_thread; +#endif + UINT (*ux_system_host_change_function) (ULONG, UX_HOST_CLASS *, VOID *); } UX_SYSTEM_HOST; +#if UX_MAX_CLASS_DRIVER > 1 +#define UX_SYSTEM_HOST_MAX_CLASS_GET() (_ux_system_host->ux_system_host_max_class) +#define UX_SYSTEM_HOST_MAX_CLASS_SET(n) do { _ux_system_host->ux_system_host_max_class = (n); } while(0) +#else +#define UX_SYSTEM_HOST_MAX_CLASS_GET() (1) +#define UX_SYSTEM_HOST_MAX_CLASS_SET(n) UX_PARAMETER_NOT_USED(n) +#endif + +#if UX_MAX_HCD > 1 +#define UX_SYSTEM_HOST_MAX_HCD_GET() (_ux_system_host->ux_system_host_max_hcd) +#define UX_SYSTEM_HOST_MAX_HCD_SET(n) do { _ux_system_host->ux_system_host_max_hcd = (n); } while(0) +#else +#define UX_SYSTEM_HOST_MAX_HCD_GET() (1) +#define UX_SYSTEM_HOST_MAX_HCD_SET(n) UX_PARAMETER_NOT_USED(n) +#endif + +#if UX_MAX_DEVICES > 1 +#define UX_SYSTEM_HOST_MAX_DEVICES_SET(n) do { _ux_system_host->ux_system_host_max_devices = (n); } while(0) +#define UX_SYSTEM_HOST_MAX_DEVICES_GET() (_ux_system_host->ux_system_host_max_devices) +#else +#define UX_SYSTEM_HOST_MAX_DEVICES_SET(n) UX_PARAMETER_NOT_USED(n) +#define UX_SYSTEM_HOST_MAX_DEVICES_GET() (1) +#endif + typedef struct UX_SYSTEM_SLAVE_STRUCT { @@ -1776,8 +2060,9 @@ typedef struct UX_SYSTEM_SLAVE_STRUCT ULONG ux_system_slave_language_id_framework_length; UCHAR *ux_system_slave_dfu_framework; ULONG ux_system_slave_dfu_framework_length; +#if UX_MAX_SLAVE_CLASS_DRIVER > 1 UINT ux_system_slave_max_class; - UINT ux_system_slave_registered_class; +#endif UX_SLAVE_CLASS *ux_system_slave_class_array; UX_SLAVE_CLASS *ux_system_slave_interface_class_array[UX_MAX_SLAVE_INTERFACES]; ULONG ux_system_slave_speed; @@ -1795,12 +2080,20 @@ typedef struct UX_SYSTEM_SLAVE_STRUCT } UX_SYSTEM_SLAVE; +#if UX_MAX_SLAVE_CLASS_DRIVER > 1 +#define UX_SYSTEM_DEVICE_MAX_CLASS_SET(n) do { _ux_system_slave->ux_system_slave_max_class = (n); } while(0) +#define UX_SYSTEM_DEVICE_MAX_CLASS_GET() (_ux_system_slave->ux_system_slave_max_class) +#else +#define UX_SYSTEM_DEVICE_MAX_CLASS_SET(n) do { UX_PARAMETER_NOT_USED(n); } while(0) +#define UX_SYSTEM_DEVICE_MAX_CLASS_GET() (1) +#endif + typedef struct UX_SYSTEM_OTG_STRUCT { - TX_THREAD ux_system_otg_thread; + UX_THREAD ux_system_otg_thread; UCHAR *ux_system_otg_thread_stack; - TX_SEMAPHORE ux_system_otg_semaphore; + UX_SEMAPHORE ux_system_otg_semaphore; UINT (*ux_system_otg_function) (ULONG); ULONG ux_system_otg_mode; ULONG ux_system_otg_io; @@ -1829,7 +2122,7 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT UX_ENDPOINT *ux_host_class_dpump_bulk_in_endpoint; UX_ENDPOINT *ux_host_class_dpump_interrupt_endpoint; UINT ux_host_class_dpump_state; - TX_SEMAPHORE ux_host_class_dpump_semaphore; + UX_SEMAPHORE ux_host_class_dpump_semaphore; } UX_HOST_CLASS_DPUMP; @@ -1855,13 +2148,16 @@ typedef struct UX_HOST_CLASS_DPUMP_STRUCT #define ux_host_stack_class_instance_destroy _ux_host_stack_class_instance_destroy #define ux_host_stack_class_instance_get _ux_host_stack_class_instance_get #define ux_host_stack_class_register _ux_host_stack_class_register +#define ux_host_stack_class_unregister _ux_host_stack_class_unregister #define ux_host_stack_configuration_interface_get _ux_host_stack_configuration_interface_get #define ux_host_stack_device_configuration_get _ux_host_stack_device_configuration_get #define ux_host_stack_device_configuration_select _ux_host_stack_device_configuration_select #define ux_host_stack_device_get _ux_host_stack_device_get #define ux_host_stack_endpoint_transfer_abort _ux_host_stack_endpoint_transfer_abort #define ux_host_stack_hcd_register _ux_host_stack_hcd_register +#define ux_host_stack_hcd_unregister _ux_host_stack_hcd_unregister #define ux_host_stack_initialize _ux_host_stack_initialize +#define ux_host_stack_uninitialize _ux_host_stack_uninitialize #define ux_host_stack_interface_endpoint_get _ux_host_stack_interface_endpoint_get #define ux_host_stack_interface_setting_select _ux_host_stack_interface_setting_select #define ux_host_stack_transfer_request _ux_host_stack_transfer_request diff --git a/common/core/inc/ux_dcd_sim_slave.h b/common/core/inc/ux_dcd_sim_slave.h index 82bf23c..f9ebcff 100644 --- a/common/core/inc/ux_dcd_sim_slave.h +++ b/common/core/inc/ux_dcd_sim_slave.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_dcd_sim_slave.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -42,6 +42,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_device_class_dpump.h b/common/core/inc/ux_device_class_dpump.h index cfed0b2..2216d37 100644 --- a/common/core/inc/ux_device_class_dpump.h +++ b/common/core/inc/ux_device_class_dpump.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_class_dpump.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -41,6 +41,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_device_stack.h b/common/core/inc/ux_device_stack.h index f9ad783..7cecf2d 100644 --- a/common/core/inc/ux_device_stack.h +++ b/common/core/inc/ux_device_stack.h @@ -25,7 +25,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_device_stack.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -40,6 +40,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_hcd_sim_host.h b/common/core/inc/ux_hcd_sim_host.h index fae2c9d..4012012 100644 --- a/common/core/inc/ux_hcd_sim_host.h +++ b/common/core/inc/ux_hcd_sim_host.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_hcd_sim_host.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -42,6 +42,12 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* added controller disable, */ +/* used UX prefix to refer to */ +/* TX symbols instead of using */ +/* them directly, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ @@ -105,7 +111,7 @@ typedef struct UX_HCD_SIM_HOST_STRUCT UINT ux_hcd_sim_host_periodic_scheduler_active; UINT ux_hcd_sim_host_interruptible; ULONG ux_hcd_sim_host_interrupt_count; - TX_TIMER ux_hcd_sim_host_timer; + UX_TIMER ux_hcd_sim_host_timer; } UX_HCD_SIM_HOST; @@ -141,7 +147,7 @@ typedef struct UX_HCD_SIM_HOST_ED_STRUCT typedef struct UX_HCD_SIM_HOST_TD_STRUCT { - UCHAR * ux_sim_host_td_buffer; + UCHAR * ux_sim_host_td_buffer; ULONG ux_sim_host_td_length; struct UX_HCD_SIM_HOST_TD_STRUCT *ux_sim_host_td_next_td; @@ -174,7 +180,7 @@ typedef struct UX_HCD_SIM_HOST_TD_STRUCT typedef struct UX_HCD_SIM_HOST_ISO_TD_STRUCT { - UCHAR * ux_sim_host_iso_td_buffer; + UCHAR * ux_sim_host_iso_td_buffer; ULONG ux_sim_host_iso_td_length; struct UX_HCD_SIM_HOST_ISO_TD_STRUCT *ux_sim_host_iso_td_next_td; @@ -204,6 +210,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_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); VOID _ux_hcd_sim_host_iso_schedule(UX_HCD_SIM_HOST *hcd_sim_host); diff --git a/common/core/inc/ux_host_class_dpump.h b/common/core/inc/ux_host_class_dpump.h index 4b3907e..c3c9047 100644 --- a/common/core/inc/ux_host_class_dpump.h +++ b/common/core/inc/ux_host_class_dpump.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_class_dpump.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -41,6 +41,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_host_stack.h b/common/core/inc/ux_host_stack.h index ec62880..e17f9f1 100644 --- a/common/core/inc/ux_host_stack.h +++ b/common/core/inc/ux_host_stack.h @@ -26,7 +26,7 @@ /* COMPONENT DEFINITION RELEASE */ /* */ /* ux_host_stack.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -41,6 +41,11 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* added uninitialize APIs, */ +/* optimized based on compile */ +/* definitions, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ @@ -50,9 +55,16 @@ /* Define Host Stack component function prototypes. */ +#if UX_MAX_DEVICES > 1 VOID _ux_host_stack_bandwidth_release(UX_HCD *hcd, UX_ENDPOINT *endpoint); VOID _ux_host_stack_bandwidth_claim(UX_HCD *hcd, UX_ENDPOINT *endpoint); UINT _ux_host_stack_bandwidth_check(UX_HCD *hcd, UX_ENDPOINT *endpoint); +#else +#define _ux_host_stack_bandwidth_release(a,b) +#define _ux_host_stack_bandwidth_claim(a,b) +#define _ux_host_stack_bandwidth_check(a,b) (UX_SUCCESS) +#endif + UX_HOST_CLASS * _ux_host_stack_class_call(UX_HOST_CLASS_COMMAND *class_command); UINT _ux_host_stack_class_device_scan(UX_DEVICE *device); UINT _ux_host_stack_class_get(UCHAR *class_name, UX_HOST_CLASS **class); @@ -63,6 +75,7 @@ UINT _ux_host_stack_class_instance_verify(UCHAR *class_name, VOID *class_inst UINT _ux_host_stack_class_interface_scan(UX_DEVICE *device); 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_descriptor_parse(UX_DEVICE *device, UX_CONFIGURATION *configuration, UINT configuration_index); UINT _ux_host_stack_configuration_enumerate(UX_DEVICE *device); UINT _ux_host_stack_configuration_instance_create(UX_CONFIGURATION *configuration); @@ -88,9 +101,11 @@ UINT _ux_host_stack_endpoint_transfer_abort(UX_ENDPOINT *endpoint); VOID _ux_host_stack_enum_thread_entry(ULONG input); UINT _ux_host_stack_hcd_register(UCHAR *hcd_name, UINT (*hcd_init_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); VOID _ux_host_stack_hcd_thread_entry(ULONG input); UINT _ux_host_stack_hcd_transfer_request(UX_TRANSFER *transfer_request); 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_instance_create(UX_INTERFACE *interface); VOID _ux_host_stack_interface_instance_delete(UX_INTERFACE *interface); @@ -109,8 +124,12 @@ UINT _ux_host_stack_rh_device_extraction(UX_HCD *hcd, UINT port_index); UINT _ux_host_stack_rh_device_insertion(UX_HCD *hcd, UINT port_index); UINT _ux_host_stack_transfer_request(UX_TRANSFER *transfer_request); UINT _ux_host_stack_transfer_request_abort(UX_TRANSFER *transfer_request); -VOID _ux_host_stack_hnp_polling_thread_entry(ULONG id); UINT _ux_host_stack_role_swap(UX_DEVICE *device); +#if defined(UX_OTG_SUPPORT) +VOID _ux_host_stack_hnp_polling_thread_entry(ULONG id); +#endif + + #endif diff --git a/common/core/inc/ux_system.h b/common/core/inc/ux_system.h index 06f898b..ac46308 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.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -41,6 +41,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_user_sample.h b/common/core/inc/ux_user_sample.h index b7bb606..7f046fb 100644 --- a/common/core/inc/ux_user_sample.h +++ b/common/core/inc/ux_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* ux_user.h PORTABLE C */ -/* 6.0 */ +/* 6.1 */ /* */ /* AUTHOR */ /* */ @@ -45,6 +45,8 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ diff --git a/common/core/inc/ux_utility.h b/common/core/inc/ux_utility.h index 3f2b6e4..ae74c90 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.0 */ +/* 6.1 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -41,6 +41,12 @@ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ +/* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ +/* added timer delete, used UX */ +/* prefix to refer to TX */ +/* symbols instead of using */ +/* them directly, */ +/* resulting in version 6.1 */ /* */ /**************************************************************************/ @@ -66,10 +72,10 @@ ULONG _ux_utility_string_length_get(UCHAR *string); UINT _ux_utility_string_length_check(UCHAR *input_string, UINT *string_length_ptr, UINT max_string_length); UX_MEMORY_BLOCK *_ux_utility_memory_free_block_best_get(ULONG memory_cache_flag, ULONG memory_size_requested); VOID _ux_utility_memory_set(VOID *destination, UCHAR value, ULONG length); -UINT _ux_utility_mutex_create(TX_MUTEX *mutex, CHAR *mutex_name); -UINT _ux_utility_mutex_delete(TX_MUTEX *mutex); -VOID _ux_utility_mutex_off(TX_MUTEX *mutex); -VOID _ux_utility_mutex_on(TX_MUTEX *mutex); +UINT _ux_utility_mutex_create(UX_MUTEX *mutex, CHAR *mutex_name); +UINT _ux_utility_mutex_delete(UX_MUTEX *mutex); +VOID _ux_utility_mutex_off(UX_MUTEX *mutex); +VOID _ux_utility_mutex_on(UX_MUTEX *mutex); ULONG _ux_utility_pci_class_scan(ULONG pci_class, ULONG bus_number, ULONG device_number, ULONG function_number, ULONG *current_bus_number, ULONG *current_device_number, ULONG *current_function_number); @@ -78,44 +84,51 @@ ULONG _ux_utility_pci_read(ULONG bus_number, ULONG device_number, ULO VOID _ux_utility_pci_write(ULONG bus_number, ULONG device_number, ULONG function_number, ULONG offset, ULONG value, UINT write_size); VOID *_ux_utility_physical_address(VOID *virtual_address); -UINT _ux_utility_semaphore_create(TX_SEMAPHORE *semaphore, CHAR *semaphore_name, UINT initial_count); -UINT _ux_utility_semaphore_delete(TX_SEMAPHORE *semaphore); -UINT _ux_utility_semaphore_get(TX_SEMAPHORE *semaphore, ULONG semaphore_signal); -UINT _ux_utility_semaphore_put(TX_SEMAPHORE *semaphore); +UINT _ux_utility_semaphore_create(UX_SEMAPHORE *semaphore, CHAR *semaphore_name, UINT initial_count); +UINT _ux_utility_semaphore_delete(UX_SEMAPHORE *semaphore); +UINT _ux_utility_semaphore_get(UX_SEMAPHORE *semaphore, ULONG semaphore_signal); +UINT _ux_utility_semaphore_put(UX_SEMAPHORE *semaphore); VOID _ux_utility_set_interrupt_handler(UINT irq, VOID (*interrupt_handler)(VOID)); ULONG _ux_utility_short_get(UCHAR * address); ULONG _ux_utility_short_get_big_endian(UCHAR * address); VOID _ux_utility_short_put(UCHAR * address, USHORT value); VOID _ux_utility_short_put_big_endian(UCHAR * address, USHORT value); -UINT _ux_utility_thread_create(TX_THREAD *thread_ptr, CHAR *name, +UINT _ux_utility_thread_create(UX_THREAD *thread_ptr, CHAR *name, VOID (*entry_function)(ULONG), ULONG entry_input, VOID *stack_start, ULONG stack_size, UINT priority, UINT preempt_threshold, ULONG time_slice, UINT auto_start); -UINT _ux_utility_thread_delete(TX_THREAD *thread_ptr); +UINT _ux_utility_thread_delete(UX_THREAD *thread_ptr); VOID _ux_utility_thread_relinquish(VOID); UINT _ux_utility_thread_schedule_other(UINT caller_priority); -UINT _ux_utility_thread_resume(TX_THREAD *thread_ptr); +UINT _ux_utility_thread_resume(UX_THREAD *thread_ptr); UINT _ux_utility_thread_sleep(ULONG ticks); -UINT _ux_utility_thread_suspend(TX_THREAD *thread_ptr); -TX_THREAD *_ux_utility_thread_identify(VOID); -UINT _ux_utility_timer_create(TX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG), +UINT _ux_utility_thread_suspend(UX_THREAD *thread_ptr); +UX_THREAD *_ux_utility_thread_identify(VOID); +UINT _ux_utility_timer_create(UX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG), ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, UINT activation_flag); +UINT _ux_utility_timer_delete(UX_TIMER *timer); VOID *_ux_utility_virtual_address(VOID *physical_address); -UINT _ux_utility_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name); -UINT _ux_utility_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); -UINT _ux_utility_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, +UINT _ux_utility_event_flags_create(UX_EVENT_FLAGS_GROUP*group_ptr, CHAR *name); +UINT _ux_utility_event_flags_delete(UX_EVENT_FLAGS_GROUP*group_ptr); +UINT _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags, UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); -UINT _ux_utility_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, +UINT _ux_utility_event_flags_set(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG flags_to_set, UINT set_option); VOID _ux_utility_unicode_to_string(UCHAR *source, UCHAR *destination); VOID _ux_utility_string_to_unicode(UCHAR *source, UCHAR *destination); -VOID _ux_system_error_handler(UINT system_level, UINT system_context, UINT error_code); VOID _ux_utility_debug_callback_register(VOID (*debug_callback)(UCHAR *, ULONG)); -VOID _ux_utility_error_callback_register(VOID (*error_callback)(UINT system_level, UINT system_context, UINT error_code)); VOID _ux_utility_delay_ms(ULONG ms_wait); +#ifdef UX_DISABLE_ERROR_HANDLER +#define _ux_system_error_handler(system_level, system_context, error_code) do {} while(0) +#define _ux_utility_error_callback_register(error_callback) do {} while(0) +#else +VOID _ux_system_error_handler(UINT system_level, UINT system_context, UINT error_code); +VOID _ux_utility_error_callback_register(VOID (*error_callback)(UINT system_level, UINT system_context, UINT error_code)); +#endif + #define UX_UTILITY_ADD_SAFE(add_a, add_b, result, status) do { \ if (UX_OVERFLOW_CHECK_ADD_ULONG(add_a, add_b)) \ status = UX_ERROR; \ @@ -174,6 +187,14 @@ VOID* _ux_utility_memory_allocate_add_safe(ULONG align,ULONG cache,UL #endif /* UX_DISABLE_ARITHMETIC_CHECK */ + +#if defined(UX_NAME_REFERENCED_BY_POINTER) +#define ux_utility_name_match(n0,n1,l) ((n0) == (n1)) +#else +#define ux_utility_name_match(n0,n1,l) (_ux_utility_memory_compare(n0,n1,l) == UX_SUCCESS) +#endif + + /* Define the system API mappings. Note: this section is only applicable to application source code, hence the conditional that turns off this |
