summaryrefslogtreecommitdiff
path: root/common/core/inc/ux_utility.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/core/inc/ux_utility.h')
-rw-r--r--common/core/inc/ux_utility.h63
1 files changed, 42 insertions, 21 deletions
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