1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** USBX Component */ 17 /** */ 18 /** Utility */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /**************************************************************************/ 25 /* */ 26 /* COMPONENT DEFINITION RELEASE */ 27 /* */ 28 /* ux_utility.h PORTABLE C */ 29 /* 6.1.12 */ 30 /* AUTHOR */ 31 /* */ 32 /* Chaoqiong Xiao, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file contains all the header and extern functions used by the */ 37 /* USBX components that utilize utility functions. */ 38 /* */ 39 /* RELEASE HISTORY */ 40 /* */ 41 /* DATE NAME DESCRIPTION */ 42 /* */ 43 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 44 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 45 /* added timer delete, used UX */ 46 /* prefix to refer to TX */ 47 /* symbols instead of using */ 48 /* them directly, */ 49 /* resulting in version 6.1 */ 50 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ 51 /* added standalone support, */ 52 /* resulting in version 6.1.10 */ 53 /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ 54 /* fixed standalone compile, */ 55 /* resulting in version 6.1.11 */ 56 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ 57 /* added macros for RTOS calls,*/ 58 /* fixed OHCI PRSC issue, */ 59 /* resulting in version 6.1.12 */ 60 /* */ 61 /**************************************************************************/ 62 63 #ifndef UX_UTILITY_H 64 #define UX_UTILITY_H 65 66 67 /* Define Utility component function prototypes. */ 68 69 VOID _ux_utility_descriptor_parse(UCHAR * raw_descriptor, UCHAR * descriptor_structure, 70 UINT descriptor_entries, UCHAR * descriptor); 71 VOID _ux_utility_descriptor_pack(UCHAR * descriptor, UCHAR * descriptor_structure, 72 UINT descriptor_entries, UCHAR * raw_descriptor); 73 ULONG _ux_utility_long_get(UCHAR * address); 74 VOID _ux_utility_long_put(UCHAR * address, ULONG value); 75 VOID _ux_utility_long_put_big_endian(UCHAR * address, ULONG value); 76 ULONG _ux_utility_long_get_big_endian(UCHAR * address); 77 VOID *_ux_utility_memory_allocate(ULONG memory_alignment,ULONG memory_cache_flag, ULONG memory_size_requested); 78 UINT _ux_utility_memory_compare(VOID *memory_source, VOID *memory_destination, ULONG length); 79 VOID _ux_utility_memory_copy(VOID *memory_destination, VOID *memory_source, ULONG length); 80 VOID _ux_utility_memory_free(VOID *memory); 81 ULONG _ux_utility_string_length_get(UCHAR *string); 82 UINT _ux_utility_string_length_check(UCHAR *input_string, UINT *string_length_ptr, UINT max_string_length); 83 UX_MEMORY_BLOCK *_ux_utility_memory_free_block_best_get(ULONG memory_cache_flag, ULONG memory_size_requested); 84 VOID _ux_utility_memory_set(VOID *destination, UCHAR value, ULONG length); 85 ULONG _ux_utility_pci_class_scan(ULONG pci_class, ULONG bus_number, ULONG device_number, 86 ULONG function_number, ULONG *current_bus_number, 87 ULONG *current_device_number, ULONG *current_function_number); 88 ULONG _ux_utility_pci_read(ULONG bus_number, ULONG device_number, ULONG function_number, 89 ULONG offset, UINT read_size); 90 VOID _ux_utility_pci_write(ULONG bus_number, ULONG device_number, ULONG function_number, 91 ULONG offset, ULONG value, UINT write_size); 92 VOID *_ux_utility_physical_address(VOID *virtual_address); 93 VOID _ux_utility_set_interrupt_handler(UINT irq, VOID (*interrupt_handler)(VOID)); 94 ULONG _ux_utility_short_get(UCHAR * address); 95 ULONG _ux_utility_short_get_big_endian(UCHAR * address); 96 VOID _ux_utility_short_put(UCHAR * address, USHORT value); 97 VOID _ux_utility_short_put_big_endian(UCHAR * address, USHORT value); 98 VOID *_ux_utility_virtual_address(VOID *physical_address); 99 VOID _ux_utility_unicode_to_string(UCHAR *source, UCHAR *destination); 100 VOID _ux_utility_string_to_unicode(UCHAR *source, UCHAR *destination); 101 VOID _ux_utility_debug_callback_register(VOID (*debug_callback)(UCHAR *, ULONG)); 102 VOID _ux_utility_delay_ms(ULONG ms_wait); 103 104 #if !defined(UX_STANDALONE) 105 UINT _ux_utility_mutex_create(UX_MUTEX *mutex, CHAR *mutex_name); 106 UINT _ux_utility_mutex_delete(UX_MUTEX *mutex); 107 VOID _ux_utility_mutex_off(UX_MUTEX *mutex); 108 VOID _ux_utility_mutex_on(UX_MUTEX *mutex); 109 UINT _ux_utility_semaphore_create(UX_SEMAPHORE *semaphore, CHAR *semaphore_name, UINT initial_count); 110 UINT _ux_utility_semaphore_delete(UX_SEMAPHORE *semaphore); 111 UINT _ux_utility_semaphore_get(UX_SEMAPHORE *semaphore, ULONG semaphore_signal); 112 UINT _ux_utility_semaphore_put(UX_SEMAPHORE *semaphore); 113 UINT _ux_utility_thread_create(UX_THREAD *thread_ptr, CHAR *name, 114 VOID (*entry_function)(ULONG), ULONG entry_input, 115 VOID *stack_start, ULONG stack_size, 116 UINT priority, UINT preempt_threshold, 117 ULONG time_slice, UINT auto_start); 118 UINT _ux_utility_thread_delete(UX_THREAD *thread_ptr); 119 VOID _ux_utility_thread_relinquish(VOID); 120 UINT _ux_utility_thread_schedule_other(UINT caller_priority); 121 UINT _ux_utility_thread_resume(UX_THREAD *thread_ptr); 122 UINT _ux_utility_thread_sleep(ULONG ticks); 123 UINT _ux_utility_thread_suspend(UX_THREAD *thread_ptr); 124 UX_THREAD *_ux_utility_thread_identify(VOID); 125 UINT _ux_utility_timer_create(UX_TIMER *timer, CHAR *timer_name, VOID (*expiration_function) (ULONG), 126 ULONG expiration_input, ULONG initial_ticks, ULONG reschedule_ticks, 127 UINT activation_flag); 128 UINT _ux_utility_timer_delete(UX_TIMER *timer); 129 UINT _ux_utility_event_flags_create(UX_EVENT_FLAGS_GROUP*group_ptr, CHAR *name); 130 UINT _ux_utility_event_flags_delete(UX_EVENT_FLAGS_GROUP*group_ptr); 131 UINT _ux_utility_event_flags_get(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG requested_flags, 132 UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); 133 UINT _ux_utility_event_flags_set(UX_EVENT_FLAGS_GROUP*group_ptr, ULONG flags_to_set, 134 UINT set_option); 135 #endif 136 137 #ifndef _ux_utility_interrupt_disable 138 #ifdef TX_API_H 139 #define _ux_utility_interrupt_disable() _tx_thread_interrupt_disable() 140 #else 141 extern ALIGN_TYPE _ux_utility_interrupt_disable(VOID); 142 #endif 143 #else 144 extern ALIGN_TYPE _ux_utility_interrupt_disable(VOID); 145 #endif 146 147 #ifndef _ux_utility_interrupt_restore 148 #ifdef TX_API_H 149 #define _ux_utility_interrupt_restore(flags) _tx_thread_interrupt_restore(flags) 150 #else 151 extern VOID _ux_utility_interrupt_restore(ALIGN_TYPE); 152 #endif 153 #else 154 extern VOID _ux_utility_interrupt_restore(ALIGN_TYPE); 155 #endif 156 157 #ifndef _ux_utility_time_get 158 #ifdef TX_API_H 159 #define _ux_utility_time_get() tx_time_get() 160 #else 161 extern ULONG _ux_utility_time_get(VOID); 162 #endif 163 #else 164 extern ULONG _ux_utility_time_get(VOID); 165 #endif 166 167 #ifndef _ux_utility_time_elapsed 168 #define _ux_utility_time_elapsed(a,b) (((b)>=(a)) ? ((b)-(a)) : (0xFFFFFFFFul-(b)+(a)+1)) 169 #else 170 extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE); 171 #endif 172 173 #if !defined(UX_STANDALONE) 174 #define _ux_system_semaphore_create _ux_utility_semaphore_create 175 #define _ux_system_semaphore_create_norc _ux_utility_semaphore_create 176 #define _ux_system_semaphore_created(sem) ((sem)->tx_semaphore_id != UX_EMPTY) 177 #define _ux_system_semaphore_get _ux_utility_semaphore_get 178 #define _ux_system_semaphore_get_norc _ux_utility_semaphore_get 179 #define _ux_system_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0) 180 #define _ux_system_semaphore_delete _ux_utility_semaphore_delete 181 #define _ux_system_semaphore_put _ux_utility_semaphore_put 182 #define _ux_system_thread_create _ux_utility_thread_create 183 #define _ux_system_thread_create_norc _ux_utility_thread_create 184 #define _ux_system_thread_created(t) ((t)->tx_thread_id != UX_EMPTY) 185 #define _ux_system_thread_delete _ux_utility_thread_delete 186 #define _ux_system_mutex_create _ux_utility_mutex_create 187 #define _ux_system_mutex_delete _ux_utility_mutex_delete 188 #define _ux_system_mutex_off _ux_utility_mutex_off 189 #define _ux_system_mutex_on _ux_utility_mutex_on 190 #define _ux_system_event_flags_create _ux_utility_event_flags_create 191 #define _ux_system_event_flags_created(e) ((e)->tx_event_flags_group_id != UX_EMPTY) 192 #define _ux_system_event_flags_delete _ux_utility_event_flags_delete 193 #define _ux_system_event_flags_get _ux_utility_event_flags_get 194 #define _ux_system_event_flags_set _ux_utility_event_flags_set 195 #define _ux_system_event_flags_set_rc _ux_utility_event_flags_set 196 #else 197 #define _ux_system_semaphore_create(sem,name,cnt) (UX_SUCCESS) 198 #define _ux_system_semaphore_create_norc(sem,name,cnt) do{}while(0) 199 #define _ux_system_semaphore_created(sem) (UX_FALSE) 200 #define _ux_system_semaphore_get(sem,opt) (UX_SUCCESS) 201 #define _ux_system_semaphore_get_norc(sem,opt) do{}while(0) 202 #define _ux_system_semaphore_waiting(sem) (UX_FALSE) 203 #define _ux_system_semaphore_delete(sem) do{}while(0) 204 #define _ux_system_semaphore_put(sem) do{}while(0) 205 #define _ux_system_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS) 206 #define _ux_system_thread_create_norc(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) do{}while(0) 207 #define _ux_system_thread_created(t) (UX_FALSE) 208 #define _ux_system_thread_delete(t) do{}while(0) 209 #define _ux_system_mutex_create(mutex,name) do{}while(0) 210 #define _ux_system_mutex_delete(mutex) do{}while(0) 211 #define _ux_system_mutex_off(mutex) do{}while(0) 212 #define _ux_system_mutex_on(mutex) do{}while(0) 213 #define _ux_system_event_flags_create(g,name) (UX_SUCCESS) 214 #define _ux_system_event_flags_created(e) (UX_FALSE) 215 #define _ux_system_event_flags_delete(g) do{}while(0) 216 #define _ux_system_event_flags_get(g,req,gopt,actual,wopt) (*actual = 0) 217 #define _ux_system_event_flags_set(g,flags,option) do{(void)flags;}while(0) 218 #define _ux_system_event_flags_set_rc(g,flags,option) (UX_SUCCESS) 219 #endif 220 221 #if !defined(UX_DEVICE_STANDALONE) 222 #define _ux_device_thread_create _ux_utility_thread_create 223 #define _ux_device_thread_delete _ux_utility_thread_delete 224 #define _ux_device_thread_entry(t) ((t)->tx_thread_entry) 225 #define _ux_device_thread_suspend _ux_utility_thread_suspend 226 #define _ux_device_thread_resume _ux_utility_thread_resume 227 #define _ux_device_thread_relinquish _ux_utility_thread_relinquish 228 #define _ux_device_semaphore_create _ux_utility_semaphore_create 229 #define _ux_device_semaphore_created(sem) ((sem)->tx_semaphore_id != 0) 230 #define _ux_device_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0) 231 #define _ux_device_semaphore_delete _ux_utility_semaphore_delete 232 #define _ux_device_semaphore_get _ux_utility_semaphore_get 233 #define _ux_device_semaphore_put _ux_utility_semaphore_put 234 #define _ux_device_mutex_create _ux_utility_mutex_create 235 #define _ux_device_mutex_delete _ux_utility_mutex_delete 236 #define _ux_device_mutex_off _ux_utility_mutex_off 237 #define _ux_device_mutex_on _ux_utility_mutex_on 238 #define _ux_device_event_flags_create _ux_utility_event_flags_create 239 #define _ux_device_event_flags_delete _ux_utility_event_flags_delete 240 #define _ux_device_event_flags_get _ux_utility_event_flags_get 241 #define _ux_device_event_flags_set _ux_utility_event_flags_set 242 #else 243 #define _ux_device_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS) 244 #define _ux_device_thread_delete(t) do{}while(0) 245 #define _ux_device_thread_entry(t) ((UX_THREAD_ENTRY)t) 246 #define _ux_device_thread_suspend(t) do{}while(0) 247 #define _ux_device_thread_resume(t) do{}while(0) 248 #define _ux_device_thread_relinquish(t) do{}while(0) 249 #define _ux_device_semaphore_create(sem,name,cnt) (UX_SUCCESS) 250 #define _ux_device_semaphore_created(sem) (UX_FALSE) 251 #define _ux_device_semaphore_waiting(sem) (UX_FALSE) 252 #define _ux_device_semaphore_delete(sem) do{}while(0) 253 #define _ux_device_semaphore_get(sem,t) (UX_SUCCESS) 254 #define _ux_device_semaphore_put(sem) do{}while(0) 255 #define _ux_device_mutex_create(mutex,name) do{}while(0) 256 #define _ux_device_mutex_delete(mutex) do{}while(0) 257 #define _ux_device_mutex_off(mutex) do{}while(0) 258 #define _ux_device_mutex_on(mutex) do{}while(0) 259 #define _ux_device_event_flags_create(g,name) do{}while(0) 260 #define _ux_device_event_flags_delete(g) do{}while(0) 261 #define _ux_device_event_flags_get(g,req,gopt,actual,wopt) do{}while(0) 262 #define _ux_device_event_flags_set(g,flags,option) do{}while(0) 263 #endif 264 265 266 #if !defined(UX_HOST_STANDALONE) 267 #define _ux_host_thread_create _ux_utility_thread_create 268 #define _ux_host_thread_created(thr) ((thr)->tx_thread_id != 0) 269 #define _ux_host_thread_delete _ux_utility_thread_delete 270 #define _ux_host_thread_entry(thr) ((thr)->tx_thread_entry) 271 #define _ux_host_thread_resume _ux_utility_thread_resume 272 #define _ux_host_thread_sleep _ux_utility_thread_sleep 273 #define _ux_host_thread_schedule_other _ux_utility_thread_schedule_other 274 #define _ux_host_semaphore_create _ux_utility_semaphore_create 275 #define _ux_host_semaphore_created(sem) ((sem)->tx_semaphore_id != 0) 276 #define _ux_host_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0) 277 #define _ux_host_semaphore_delete _ux_utility_semaphore_delete 278 #define _ux_host_semaphore_get _ux_utility_semaphore_get 279 #define _ux_host_semaphore_get_norc _ux_utility_semaphore_get 280 #define _ux_host_semaphore_put _ux_utility_semaphore_put 281 #define _ux_host_semaphore_put_rc _ux_utility_semaphore_put 282 #define _ux_host_mutex_create _ux_utility_mutex_create 283 #define _ux_host_mutex_delete _ux_utility_mutex_delete 284 #define _ux_host_mutex_off _ux_utility_mutex_off 285 #define _ux_host_mutex_on _ux_utility_mutex_on 286 #define _ux_host_event_flags_create _ux_utility_event_flags_create 287 #define _ux_host_event_flags_delete _ux_utility_event_flags_delete 288 #define _ux_host_event_flags_get _ux_utility_event_flags_get 289 #define _ux_host_event_flags_set _ux_utility_event_flags_set 290 #define _ux_host_timer_create _ux_utility_timer_create 291 #define _ux_host_timer_delete _ux_utility_timer_delete 292 #else 293 #define _ux_host_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS) 294 #define _ux_host_thread_created(t) (UX_FALSE) 295 #define _ux_host_thread_delete(t) do{}while(0) 296 #define _ux_host_thread_entry(thr) (UX_NULL) 297 #define _ux_host_thread_resume(t) do{}while(0) 298 #define _ux_host_thread_sleep(t) do{}while(0) 299 #define _ux_host_thread_schedule_other(t) do{}while(0) 300 #define _ux_host_semaphore_create(sem,name,cnt) (UX_SUCCESS) 301 #define _ux_host_semaphore_created(sem) (UX_FALSE) 302 #define _ux_host_semaphore_waiting(sem) (UX_FALSE) 303 #define _ux_host_semaphore_delete(sem) do{}while(0) 304 #define _ux_host_semaphore_get(sem,t) (UX_SUCCESS) 305 #define _ux_host_semaphore_get_norc(sem,t) do{}while(0) 306 #define _ux_host_semaphore_put(sem) do{}while(0) 307 #define _ux_host_semaphore_put_rc(sem) (UX_SUCCESS) 308 #define _ux_host_mutex_create(mutex,name) (UX_SUCCESS) 309 #define _ux_host_mutex_delete(mutex) do{}while(0) 310 #define _ux_host_mutex_off(mutex) do{}while(0) 311 #define _ux_host_mutex_on(mutex) do{}while(0) 312 #define _ux_host_event_flags_create(g,name) (UX_SUCCESS) 313 #define _ux_host_event_flags_delete(g) (UX_SUCCESS) 314 #define _ux_host_event_flags_get(g,req,gopt,actual,wopt) (UX_SUCCESS) 315 #define _ux_host_event_flags_set(g,flags,option) do{}while(0) 316 #define _ux_host_timer_create(t,name,func,arg,tick0,tick1,flag) (UX_SUCCESS) 317 #define _ux_host_timer_delete(t) do{}while(0) 318 #endif 319 320 321 #ifdef UX_DISABLE_ERROR_HANDLER 322 #define _ux_system_error_handler(system_level, system_context, error_code) do {} while(0) 323 #define _ux_utility_error_callback_register(error_callback) do {} while(0) 324 #else 325 VOID _ux_system_error_handler(UINT system_level, UINT system_context, UINT error_code); 326 VOID _ux_utility_error_callback_register(VOID (*error_callback)(UINT system_level, UINT system_context, UINT error_code)); 327 #endif 328 329 #define UX_UTILITY_ADD_SAFE(add_a, add_b, result, status) do { \ 330 if (UX_OVERFLOW_CHECK_ADD_ULONG(add_a, add_b)) \ 331 status = UX_ERROR; \ 332 else \ 333 result = (add_a) + (add_b); \ 334 } while(0) 335 336 #define UX_UTILITY_MULC_SAFE(mul_v, mul_c, result, status) do { \ 337 if (UX_OVERFLOW_CHECK_MULC_ULONG(mul_v, mul_c)) \ 338 status = UX_ERROR; \ 339 else \ 340 result = (mul_v) * (mul_c); \ 341 } while(0) 342 343 #define UX_UTILITY_MULV_SAFE(mul_v0, mul_v1, result, status) do { \ 344 if (UX_OVERFLOW_CHECK_MULC_ULONG(mul_v0, mul_v1)) \ 345 status = UX_ERROR; \ 346 else \ 347 result = (mul_v0) * (mul_v1); \ 348 } while(0) 349 350 #define UX_UTILITY_MEMORY_ALLOCATE_MULC_SAFE(align,cache,size_mul_v,size_mul_c) \ 351 (UX_OVERFLOW_CHECK_MULC_ULONG(size_mul_v, size_mul_c) ? UX_NULL : _ux_utility_memory_allocate((align), (cache), (size_mul_v)*(size_mul_c))) 352 #define UX_UTILITY_MEMORY_ALLOCATE_MULV_SAFE(align,cache,size_mul_v0,size_mul_v1) \ 353 (UX_OVERFLOW_CHECK_MULV_ULONG(size_mul_v0, size_mul_v1) ? UX_NULL : _ux_utility_memory_allocate((align), (cache), (size_mul_v0)*(size_mul_v1))) 354 #define UX_UTILITY_MEMORY_ALLOCATE_ADD_SAFE(align,cache,size_add_a,size_add_b) \ 355 (UX_OVERFLOW_CHECK_ADD_ULONG(size_add_a, size_add_b) ? UX_NULL : _ux_utility_memory_allocate((align), (cache), (size_add_a)+(size_add_b))) 356 357 #ifdef UX_DISABLE_ARITHMETIC_CHECK 358 359 /* No arithmetic check, calculate directly. */ 360 361 #define _ux_utility_memory_allocate_mulc_safe(align,cache,size_mul_v,size_mul_c) _ux_utility_memory_allocate((align), (cache), (size_mul_v)*(size_mul_c)) 362 #define _ux_utility_memory_allocate_mulv_safe(align,cache,size_mul_v0,size_mul_v1) _ux_utility_memory_allocate((align), (cache), (size_mul_v0)*(size_mul_v1)) 363 #define _ux_utility_memory_allocate_add_safe(align,cache,size_add_a,size_add_b) _ux_utility_memory_allocate((align), (cache), (size_add_a)+(size_add_b)) 364 365 #else /* UX_DISABLE_ARITHMETIC_CHECK */ 366 367 #ifdef UX_ENABLE_MEMORY_ARITHMETIC_OPTIMIZE 368 369 /* Uses macro to enable code optimization on compiling. */ 370 371 #define _ux_utility_memory_allocate_mulc_safe(align,cache,size_mul_v,size_mul_c) UX_UTILITY_MEMORY_ALLOCATE_MULC_SAFE(align,cache,size_mul_v,size_mul_c) 372 #define _ux_utility_memory_allocate_mulv_safe(align,cache,size_mul_v0,size_mul_v1) UX_UTILITY_MEMORY_ALLOCATE_MULV_SAFE(align,cache,size_mul_v0,size_mul_v1) 373 #define _ux_utility_memory_allocate_add_safe(align,cache,size_add_a,size_add_b) UX_UTILITY_MEMORY_ALLOCATE_ADD_SAFE(align,cache,size_add_a,size_add_b) 374 375 #else /* UX_ENABLE_MEMORY_ARITHMETIC_OPTIMIZE */ 376 377 /* Uses functions to be most flexible. */ 378 379 VOID* _ux_utility_memory_allocate_mulc_safe(ULONG align,ULONG cache,ULONG size_mul_v,ULONG size_mul_c); 380 VOID* _ux_utility_memory_allocate_mulv_safe(ULONG align,ULONG cache,ULONG size_mul_v0,ULONG size_mul_v1); 381 VOID* _ux_utility_memory_allocate_add_safe(ULONG align,ULONG cache,ULONG size_add_a,ULONG size_add_b); 382 383 #endif /* UX_ENABLE_MEMORY_ARITHMETIC_OPTIMIZE */ 384 385 #endif /* UX_DISABLE_ARITHMETIC_CHECK */ 386 387 388 #if defined(UX_NAME_REFERENCED_BY_POINTER) 389 #define ux_utility_name_match(n0,n1,l) ((n0) == (n1)) 390 #else 391 #define ux_utility_name_match(n0,n1,l) (_ux_utility_memory_compare(n0,n1,l) == UX_SUCCESS) 392 #endif 393 394 395 /* Define the system API mappings. 396 Note: this section is only applicable to 397 application source code, hence the conditional that turns off this 398 stuff when the include file is processed by the ThreadX source. */ 399 400 #ifndef UX_SOURCE_CODE 401 402 403 #define ux_utility_descriptor_parse _ux_utility_descriptor_parse 404 #define ux_utility_descriptor_pack _ux_utility_descriptor_pack 405 #define ux_utility_long_get _ux_utility_long_get 406 #define ux_utility_long_put _ux_utility_long_put 407 #define ux_utility_long_put_big_endian _ux_utility_long_put_big_endian 408 #define ux_utility_long_get_big_endian _ux_utility_long_get_big_endian 409 #define ux_utility_memory_allocate _ux_utility_memory_allocate 410 #define ux_utility_memory_compare _ux_utility_memory_compare 411 #define ux_utility_memory_copy _ux_utility_memory_copy 412 #define ux_utility_memory_free _ux_utility_memory_free 413 #define ux_utility_string_length_get _ux_utility_string_length_get 414 #define ux_utility_string_length_check _ux_utility_string_length_check 415 #define ux_utility_memory_set _ux_utility_memory_set 416 #define ux_utility_mutex_create _ux_utility_mutex_create 417 #define ux_utility_mutex_delete _ux_utility_mutex_delete 418 #define ux_utility_mutex_off _ux_utility_mutex_off 419 #define ux_utility_mutex_on _ux_utility_mutex_on 420 #define ux_utility_pci_class_scan _ux_utility_pci_class_scan 421 #define ux_utility_pci_read _ux_utility_pci_read 422 #define ux_utility_pci_write _ux_utility_pci_write 423 #define ux_utility_physical_address _ux_utility_physical_address 424 #define ux_utility_semaphore_create _ux_utility_semaphore_create 425 #define ux_utility_semaphore_delete _ux_utility_semaphore_delete 426 #define ux_utility_semaphore_get _ux_utility_semaphore_get 427 #define ux_utility_semaphore_put _ux_utility_semaphore_put 428 #define ux_utility_set_interrupt_handler _ux_utility_set_interrupt_handler 429 #define ux_utility_short_get _ux_utility_short_get 430 #define ux_utility_short_get_big_endian _ux_utility_short_get_big_endian 431 #define ux_utility_short_put _ux_utility_short_put 432 #define ux_utility_short_put_big_endian _ux_utility_short_put_big_endian 433 #define ux_utility_thread_create _ux_utility_thread_create 434 #define ux_utility_thread_delete _ux_utility_thread_delete 435 #define ux_utility_thread_relinquish _ux_utility_thread_relinquish 436 #define ux_utility_thread_resume _ux_utility_thread_resume 437 #define ux_utility_thread_sleep _ux_utility_thread_sleep 438 #define ux_utility_thread_suspend _ux_utility_thread_suspend 439 #define ux_utility_thread_identify _ux_utility_thread_identify 440 #define ux_utility_timer_create _ux_utility_timer_create 441 #define ux_utility_event_flags_create _ux_utility_event_flags_create 442 #define ux_utility_event_flags_delete _ux_utility_event_flags_delete 443 #define ux_utility_event_flags_get _ux_utility_event_flags_get 444 #define ux_utility_event_flags_set _ux_utility_event_flags_set 445 #define ux_utility_unicode_to_string _ux_utility_unicode_to_string 446 #define ux_utility_string_to_unicode _ux_utility_string_to_unicode 447 #define ux_utility_delay_ms _ux_utility_delay_ms 448 #define ux_utility_error_callback_register _ux_utility_error_callback_register 449 #define ux_system_error_handler _ux_system_error_handler 450 451 #define ux_utility_time_get _ux_utility_time_get 452 #define ux_utility_time_elapsed _ux_utility_time_elapsed 453 #endif 454 455 #endif 456