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 /** ThreadX Component */ 17 /** */ 18 /** Application Interface (API) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /**************************************************************************/ 25 /* */ 26 /* APPLICATION INTERFACE DEFINITION RELEASE */ 27 /* */ 28 /* tx_api.h PORTABLE SMP */ 29 /* 6.3.0 */ 30 /* AUTHOR */ 31 /* */ 32 /* William E. Lamie, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file defines the basic Application Interface (API) to the */ 37 /* high-performance ThreadX real-time kernel. All service prototypes */ 38 /* and data structure definitions are defined in this file. */ 39 /* Please note that basic data type definitions and other architecture-*/ 40 /* specific information is contained in the file tx_port.h. */ 41 /* */ 42 /* RELEASE HISTORY */ 43 /* */ 44 /* DATE NAME DESCRIPTION */ 45 /* */ 46 /* 09-30-2020 William E. Lamie Initial Version 6.1 */ 47 /* 10-16-2020 William E. Lamie Modified comment(s), and */ 48 /* increased patch version, */ 49 /* resulting in version 6.1.1 */ 50 /* 12-31-2020 William E. Lamie Modified comment(s), and */ 51 /* increased patch version, */ 52 /* resulting in version 6.1.3 */ 53 /* 03-02-2021 Scott Larson Modified comment(s), and */ 54 /* order defines numerically, */ 55 /* add option to remove FileX */ 56 /* pointer, fix whitespace, */ 57 /* resulting in version 6.1.5 */ 58 /* 04-02-2021 Scott Larson Modified comment(s), and */ 59 /* update patch number, */ 60 /* resulting in version 6.1.6 */ 61 /* 06-02-2021 Scott Larson Added options for multiple */ 62 /* block pool search & delay, */ 63 /* resulting in version 6.1.7 */ 64 /* 08-02-2021 Scott Larson Modified comment(s), and */ 65 /* update patch number, */ 66 /* resulting in version 6.1.8 */ 67 /* 10-15-2021 Yuxin Zhou Modified comment(s), */ 68 /* update patch number, */ 69 /* resulting in version 6.1.9 */ 70 /* 01-31-2022 Scott Larson Modified comment(s), */ 71 /* add unused parameter macro, */ 72 /* update patch number, */ 73 /* resulting in version 6.1.10 */ 74 /* 04-25-2022 Wenhui Xie Modified comment(s), */ 75 /* optimized the definition of */ 76 /* TX_TIMER_TICKS_PER_SECOND, */ 77 /* resulting in version 6.1.11 */ 78 /* 07-29-2022 Scott Larson Modified comment(s), */ 79 /* update patch number, */ 80 /* resulting in version 6.1.12 */ 81 /* 10-31-2022 Scott Larson Modified comment(s), */ 82 /* add extension macros, */ 83 /* update version numbers, */ 84 /* resulting in version 6.2.0 */ 85 /* 03-08-2023 Tiejun Zhou Modified comment(s), */ 86 /* update patch number, */ 87 /* resulting in version 6.2.1 */ 88 /* 10-31-2023 Xiuwen Cai Modified comment(s), */ 89 /* added option for random */ 90 /* number stack filling, */ 91 /* resulting in version 6.3.0 */ 92 /* */ 93 /**************************************************************************/ 94 95 #ifndef TX_API_H 96 #define TX_API_H 97 98 99 /* Determine if a C++ compiler is being used. If so, ensure that standard 100 C is used to process the API information. */ 101 102 #ifdef __cplusplus 103 104 /* Yes, C++ compiler is present. Use standard C. */ 105 extern "C" { 106 107 #endif 108 109 /* Disable warning of parameter not used. */ 110 #ifndef TX_PARAMETER_NOT_USED 111 #define TX_PARAMETER_NOT_USED(p) ((void)(p)) 112 #endif /* TX_PARAMETER_NOT_USED */ 113 114 /* Include the port-specific data type file. */ 115 116 #include "tx_port.h" 117 118 119 /* If not defined by tx_port.h, default the port-specific memory synchronization macro to whitespace. */ 120 121 #ifndef TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION 122 #define TX_PORT_SPECIFIC_MEMORY_SYNCHRONIZATION 123 #endif 124 125 126 /* Define default block pool search and delay values. */ 127 #ifndef TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH 128 #define TX_BYTE_POOL_MULTIPLE_BLOCK_SEARCH 20 129 #endif 130 #ifndef TX_BTYE_POOL_DELAY_VALUE 131 #define TX_BYTE_POOL_DELAY_VALUE 3 132 #endif 133 134 135 /* Define basic constants for the ThreadX kernel. */ 136 137 138 /* Define the major/minor version information that can be used by the application 139 and the ThreadX source as well. */ 140 141 #define AZURE_RTOS_THREADX 142 #define THREADX_MAJOR_VERSION 6 143 #define THREADX_MINOR_VERSION 3 144 #define THREADX_PATCH_VERSION 0 145 146 /* Define the following symbol for backward compatibility */ 147 #define EL_PRODUCT_THREADX 148 149 150 /* API input parameters and general constants. */ 151 152 #define TX_NO_WAIT ((ULONG) 0) 153 #define TX_WAIT_FOREVER ((ULONG) 0xFFFFFFFFUL) 154 #define TX_AND ((UINT) 2) 155 #define TX_AND_CLEAR ((UINT) 3) 156 #define TX_OR ((UINT) 0) 157 #define TX_OR_CLEAR ((UINT) 1) 158 #define TX_1_ULONG ((UINT) 1) 159 #define TX_2_ULONG ((UINT) 2) 160 #define TX_4_ULONG ((UINT) 4) 161 #define TX_8_ULONG ((UINT) 8) 162 #define TX_16_ULONG ((UINT) 16) 163 #define TX_NO_TIME_SLICE ((ULONG) 0) 164 #define TX_AUTO_START ((UINT) 1) 165 #define TX_DONT_START ((UINT) 0) 166 #define TX_AUTO_ACTIVATE ((UINT) 1) 167 #define TX_NO_ACTIVATE ((UINT) 0) 168 #define TX_TRUE ((UINT) 1) 169 #define TX_FALSE ((UINT) 0) 170 #define TX_NULL ((void *) 0) 171 #define TX_INHERIT ((UINT) 1) 172 #define TX_NO_INHERIT ((UINT) 0) 173 #define TX_THREAD_ENTRY ((UINT) 0) 174 #define TX_THREAD_EXIT ((UINT) 1) 175 #define TX_NO_SUSPENSIONS ((UINT) 0) 176 #define TX_NO_MESSAGES ((UINT) 0) 177 #define TX_EMPTY ((ULONG) 0) 178 #define TX_CLEAR_ID ((ULONG) 0) 179 #if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) 180 #define TX_STACK_FILL (thread_ptr -> tx_thread_stack_fill_value) 181 #else 182 #define TX_STACK_FILL ((ULONG) 0xEFEFEFEFUL) 183 #endif 184 185 186 /* Thread execution state values. */ 187 188 #define TX_READY ((UINT) 0) 189 #define TX_COMPLETED ((UINT) 1) 190 #define TX_TERMINATED ((UINT) 2) 191 #define TX_SUSPENDED ((UINT) 3) 192 #define TX_SLEEP ((UINT) 4) 193 #define TX_QUEUE_SUSP ((UINT) 5) 194 #define TX_SEMAPHORE_SUSP ((UINT) 6) 195 #define TX_EVENT_FLAG ((UINT) 7) 196 #define TX_BLOCK_MEMORY ((UINT) 8) 197 #define TX_BYTE_MEMORY ((UINT) 9) 198 #define TX_IO_DRIVER ((UINT) 10) 199 #define TX_FILE ((UINT) 11) 200 #define TX_TCP_IP ((UINT) 12) 201 #define TX_MUTEX_SUSP ((UINT) 13) 202 #define TX_PRIORITY_CHANGE ((UINT) 14) 203 204 205 /* API return values. */ 206 207 #define TX_SUCCESS ((UINT) 0x00) 208 #define TX_DELETED ((UINT) 0x01) 209 #define TX_POOL_ERROR ((UINT) 0x02) 210 #define TX_PTR_ERROR ((UINT) 0x03) 211 #define TX_WAIT_ERROR ((UINT) 0x04) 212 #define TX_SIZE_ERROR ((UINT) 0x05) 213 #define TX_GROUP_ERROR ((UINT) 0x06) 214 #define TX_NO_EVENTS ((UINT) 0x07) 215 #define TX_OPTION_ERROR ((UINT) 0x08) 216 #define TX_QUEUE_ERROR ((UINT) 0x09) 217 #define TX_QUEUE_EMPTY ((UINT) 0x0A) 218 #define TX_QUEUE_FULL ((UINT) 0x0B) 219 #define TX_SEMAPHORE_ERROR ((UINT) 0x0C) 220 #define TX_NO_INSTANCE ((UINT) 0x0D) 221 #define TX_THREAD_ERROR ((UINT) 0x0E) 222 #define TX_PRIORITY_ERROR ((UINT) 0x0F) 223 #define TX_NO_MEMORY ((UINT) 0x10) 224 #define TX_START_ERROR ((UINT) 0x10) 225 #define TX_DELETE_ERROR ((UINT) 0x11) 226 #define TX_RESUME_ERROR ((UINT) 0x12) 227 #define TX_CALLER_ERROR ((UINT) 0x13) 228 #define TX_SUSPEND_ERROR ((UINT) 0x14) 229 #define TX_TIMER_ERROR ((UINT) 0x15) 230 #define TX_TICK_ERROR ((UINT) 0x16) 231 #define TX_ACTIVATE_ERROR ((UINT) 0x17) 232 #define TX_THRESH_ERROR ((UINT) 0x18) 233 #define TX_SUSPEND_LIFTED ((UINT) 0x19) 234 #define TX_WAIT_ABORTED ((UINT) 0x1A) 235 #define TX_WAIT_ABORT_ERROR ((UINT) 0x1B) 236 #define TX_MUTEX_ERROR ((UINT) 0x1C) 237 #define TX_NOT_AVAILABLE ((UINT) 0x1D) 238 #define TX_NOT_OWNED ((UINT) 0x1E) 239 #define TX_INHERIT_ERROR ((UINT) 0x1F) 240 #define TX_NOT_DONE ((UINT) 0x20) 241 #define TX_CEILING_EXCEEDED ((UINT) 0x21) 242 #define TX_INVALID_CEILING ((UINT) 0x22) 243 #define TX_FEATURE_NOT_ENABLED ((UINT) 0xFF) 244 245 246 #ifdef TX_64_BIT 247 248 #ifndef TX_THREAD_EXTENSION_PTR_SET 249 #define TX_THREAD_EXTENSION_PTR_SET(a, b) { \ 250 TX_THREAD *thread_ptr; \ 251 thread_ptr = (TX_THREAD *) (a); \ 252 (thread_ptr -> tx_thread_extension_ptr) = (VOID *)(b); \ 253 } 254 #endif /* TX_THREAD_EXTENSION_PTR_SET */ 255 256 #ifndef TX_THREAD_EXTENSION_PTR_GET 257 #define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \ 258 TX_PARAMETER_NOT_USED(c); \ 259 TX_THREAD *thread_ptr; \ 260 thread_ptr = tx_thread_identify(); \ 261 while(1)\ 262 { \ 263 if (thread_ptr -> tx_thread_extension_ptr) \ 264 { \ 265 (a) = (b *)(thread_ptr -> tx_thread_extension_ptr); \ 266 break; \ 267 } \ 268 tx_thread_sleep(1); \ 269 } \ 270 } 271 #endif /* TX_THREAD_EXTENSION_PTR_GET */ 272 273 #ifndef TX_TIMER_EXTENSION_PTR_SET 274 #define TX_TIMER_EXTENSION_PTR_SET(a, b) { \ 275 TX_TIMER *timer_ptr; \ 276 timer_ptr = (TX_TIMER *) (a); \ 277 (timer_ptr -> tx_timer_internal.tx_timer_internal_extension_ptr) = (VOID *)(b); \ 278 } 279 #endif /* TX_TIMER_EXTENSION_PTR_SET */ 280 281 #ifndef TX_TIMER_EXTENSION_PTR_GET 282 #define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \ 283 TX_PARAMETER_NOT_USED(c); \ 284 if (!_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr) \ 285 return; \ 286 (a) = (b *)(_tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr); \ 287 } 288 #endif /* TX_TIMER_EXTENSION_PTR_GET */ 289 290 #else /* not 64 bit */ 291 292 #ifndef TX_THREAD_EXTENSION_PTR_SET 293 #define TX_THREAD_EXTENSION_PTR_SET(a, b) 294 #endif /* TX_THREAD_EXTENSION_PTR_SET */ 295 296 #ifndef TX_THREAD_EXTENSION_PTR_GET 297 #define TX_THREAD_EXTENSION_PTR_GET(a, b, c) { \ 298 (a) = (b *)(c); \ 299 } 300 #endif /* TX_THREAD_EXTENSION_PTR_GET */ 301 302 #ifndef TX_TIMER_EXTENSION_PTR_SET 303 #define TX_TIMER_EXTENSION_PTR_SET(a, b) 304 #endif /* TX_TIMER_EXTENSION_PTR_SET */ 305 306 #ifndef TX_TIMER_EXTENSION_PTR_GET 307 #define TX_TIMER_EXTENSION_PTR_GET(a, b, c) { \ 308 (a) = (b *)(c); \ 309 } 310 #endif /* TX_TIMER_EXTENSION_PTR_GET */ 311 312 #endif /* TX_64_BIT */ 313 314 315 316 /* Define the common timer tick reference for use by other middleware components. The default 317 value is 10ms, but may be replaced by a port specific version in tx_port.h or by the user 318 as a compilation option. */ 319 320 #ifndef TX_TIMER_TICKS_PER_SECOND 321 #define TX_TIMER_TICKS_PER_SECOND (100UL) 322 #endif 323 324 325 /* Event numbers 0 through 4095 are reserved by Azure RTOS. Specific event assignments are: 326 327 ThreadX events: 1-199 328 FileX events: 200-299 329 NetX events: 300-599 330 USBX events: 600-999 331 GUIX events: 1000-1500 332 333 User-defined event numbers start at 4096 and continue through 65535, as defined by the constants 334 TX_TRACE_USER_EVENT_START and TX_TRACE_USER_EVENT_END, respectively. User events should be based 335 on these constants in case the user event number assignment is changed in future releases. */ 336 337 #define TX_TRACE_USER_EVENT_START 4096 /* I1, I2, I3, I4 are user defined */ 338 #define TX_TRACE_USER_EVENT_END 65535 /* I1, I2, I3, I4 are user defined */ 339 340 341 /* Define event filters that can be used to selectively disable certain events or groups of events. */ 342 343 #define TX_TRACE_ALL_EVENTS 0x000007FF /* All ThreadX events */ 344 #define TX_TRACE_INTERNAL_EVENTS 0x00000001 /* ThreadX internal events */ 345 #define TX_TRACE_BLOCK_POOL_EVENTS 0x00000002 /* ThreadX Block Pool events */ 346 #define TX_TRACE_BYTE_POOL_EVENTS 0x00000004 /* ThreadX Byte Pool events */ 347 #define TX_TRACE_EVENT_FLAGS_EVENTS 0x00000008 /* ThreadX Event Flags events */ 348 #define TX_TRACE_INTERRUPT_CONTROL_EVENT 0x00000010 /* ThreadX Interrupt Control events */ 349 #define TX_TRACE_MUTEX_EVENTS 0x00000020 /* ThreadX Mutex events */ 350 #define TX_TRACE_QUEUE_EVENTS 0x00000040 /* ThreadX Queue events */ 351 #define TX_TRACE_SEMAPHORE_EVENTS 0x00000080 /* ThreadX Semaphore events */ 352 #define TX_TRACE_THREAD_EVENTS 0x00000100 /* ThreadX Thread events */ 353 #define TX_TRACE_TIME_EVENTS 0x00000200 /* ThreadX Time events */ 354 #define TX_TRACE_TIMER_EVENTS 0x00000400 /* ThreadX Timer events */ 355 #define TX_TRACE_USER_EVENTS 0x80000000UL /* ThreadX User Events */ 356 357 358 /* Define basic alignment type used in block and byte pool operations. This data type must 359 be at least 32-bits in size and also be large enough to hold a pointer type. */ 360 361 #ifndef ALIGN_TYPE_DEFINED 362 #define ALIGN_TYPE ULONG 363 #endif 364 365 366 /* Define the control block definitions for all system objects. */ 367 368 369 /* Define the basic timer management structures. These are the structures 370 used to manage thread sleep, timeout, and user timer requests. */ 371 372 /* Determine if the internal timer control block has an extension defined. If not, 373 define the extension to whitespace. */ 374 375 #ifndef TX_TIMER_INTERNAL_EXTENSION 376 #define TX_TIMER_INTERNAL_EXTENSION 377 #endif 378 379 380 /* Define the common internal timer control block. */ 381 382 typedef struct TX_TIMER_INTERNAL_STRUCT 383 { 384 385 /* Define the remaining ticks and re-initialization tick values. */ 386 ULONG tx_timer_internal_remaining_ticks; 387 ULONG tx_timer_internal_re_initialize_ticks; 388 389 /* Define the timeout function and timeout function parameter. */ 390 VOID (*tx_timer_internal_timeout_function)(ULONG id); 391 ULONG tx_timer_internal_timeout_param; 392 393 394 /* Define the next and previous internal link pointers for active 395 internal timers. */ 396 struct TX_TIMER_INTERNAL_STRUCT 397 *tx_timer_internal_active_next, 398 *tx_timer_internal_active_previous; 399 400 /* Keep track of the pointer to the head of this list as well. */ 401 struct TX_TIMER_INTERNAL_STRUCT 402 **tx_timer_internal_list_head; 403 404 /************* Define ThreadX SMP timer control block extensions. *************/ 405 406 /* Define the timer SMP core exclusion for timer callback. */ 407 ULONG tx_timer_internal_smp_cores_excluded; 408 409 /************* End of ThreadX SMP timer control block extensions. *************/ 410 411 /* Define optional extension to internal timer control block. */ 412 TX_TIMER_INTERNAL_EXTENSION 413 414 } TX_TIMER_INTERNAL; 415 416 417 /* Determine if the timer control block has an extension defined. If not, 418 define the extension to whitespace. */ 419 420 #ifndef TX_TIMER_EXTENSION 421 #define TX_TIMER_EXTENSION 422 #endif 423 424 425 /* Define the timer structure utilized by the application. */ 426 427 typedef struct TX_TIMER_STRUCT 428 { 429 430 /* Define the timer ID used for error checking. */ 431 ULONG tx_timer_id; 432 433 /* Define the timer's name. */ 434 CHAR *tx_timer_name; 435 436 /* Define the actual contents of the timer. This is the block that 437 is used in the actual timer expiration processing. */ 438 TX_TIMER_INTERNAL tx_timer_internal; 439 440 /* Define the pointers for the created list. */ 441 struct TX_TIMER_STRUCT 442 *tx_timer_created_next, 443 *tx_timer_created_previous; 444 445 /* Define optional extension to timer control block. */ 446 TX_TIMER_EXTENSION 447 448 #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO 449 450 /* Define the number of timer activations. */ 451 ULONG tx_timer_performance_activate_count; 452 453 /* Define the number of timer reactivations. */ 454 ULONG tx_timer_performance_reactivate_count; 455 456 /* Define the number of timer deactivations. */ 457 ULONG tx_timer_performance_deactivate_count; 458 459 /* Define the number of timer expirations. */ 460 ULONG tx_timer_performance_expiration_count; 461 462 /* Define the total number of timer expiration adjustments. */ 463 ULONG tx_timer_performance__expiration_adjust_count; 464 #endif 465 466 } TX_TIMER; 467 468 469 /* Determine if the thread priority change extension is defined. If not, define the 470 extension to whitespace. */ 471 472 #ifndef TX_THREAD_PRIORITY_CHANGE_EXTENSION 473 #define TX_THREAD_PRIORITY_CHANGE_EXTENSION 474 #endif 475 476 477 /* ThreadX thread control block structure follows. Additional fields 478 can be added providing they are added after the information that is 479 referenced in the port-specific assembly code. */ 480 481 typedef struct TX_THREAD_STRUCT 482 { 483 /* The first section of the control block contains critical 484 information that is referenced by the port-specific 485 assembly language code. Any changes in this section could 486 necessitate changes in the assembly language. */ 487 488 ULONG tx_thread_id; /* Control block ID */ 489 ULONG tx_thread_run_count; /* Thread's run counter */ 490 VOID *tx_thread_stack_ptr; /* Thread's stack pointer */ 491 VOID *tx_thread_stack_start; /* Stack starting address */ 492 VOID *tx_thread_stack_end; /* Stack ending address */ 493 ULONG tx_thread_stack_size; /* Stack size */ 494 ULONG tx_thread_time_slice; /* Current time-slice */ 495 ULONG tx_thread_new_time_slice; /* New time-slice */ 496 497 /* Define pointers to the next and previous ready threads. */ 498 struct TX_THREAD_STRUCT 499 *tx_thread_ready_next, 500 *tx_thread_ready_previous; 501 502 /***************************************************************/ 503 504 /* Define the first port extension in the thread control block. This 505 is typically defined to whitespace or a pointer type in tx_port.h. */ 506 TX_THREAD_EXTENSION_0 507 508 CHAR *tx_thread_name; /* Pointer to thread's name */ 509 UINT tx_thread_priority; /* Priority of thread (0-1023) */ 510 UINT tx_thread_state; /* Thread's execution state */ 511 UINT tx_thread_delayed_suspend; /* Delayed suspend flag */ 512 UINT tx_thread_suspending; /* Thread suspending flag */ 513 UINT tx_thread_preempt_threshold; /* Preemption threshold */ 514 515 /* Define the thread schedule hook. The usage of this is port/application specific, 516 but when used, the function pointer designated is called whenever the thread is 517 scheduled and unscheduled. */ 518 VOID (*tx_thread_schedule_hook)(struct TX_THREAD_STRUCT *thread_ptr, ULONG id); 519 520 /* Nothing after this point is referenced by the target-specific 521 assembly language. Hence, information after this point can 522 be added to the control block providing the complete system 523 is recompiled. */ 524 525 /* Define the thread's entry point and input parameter. */ 526 VOID (*tx_thread_entry)(ULONG id); 527 ULONG tx_thread_entry_parameter; 528 529 /* Define the thread's timer block. This is used for thread 530 sleep and timeout requests. */ 531 TX_TIMER_INTERNAL tx_thread_timer; 532 533 /* Define the thread's cleanup function and associated data. This 534 is used to cleanup various data structures when a thread 535 suspension is lifted or terminated either by the user or 536 a timeout. */ 537 VOID (*tx_thread_suspend_cleanup)(struct TX_THREAD_STRUCT *thread_ptr, ULONG suspension_sequence); 538 VOID *tx_thread_suspend_control_block; 539 struct TX_THREAD_STRUCT 540 *tx_thread_suspended_next, 541 *tx_thread_suspended_previous; 542 ULONG tx_thread_suspend_info; 543 VOID *tx_thread_additional_suspend_info; 544 UINT tx_thread_suspend_option; 545 UINT tx_thread_suspend_status; 546 547 /* Define the second port extension in the thread control block. This 548 is typically defined to whitespace or a pointer type in tx_port.h. */ 549 TX_THREAD_EXTENSION_1 550 551 /* Define pointers to the next and previous threads in the 552 created list. */ 553 struct TX_THREAD_STRUCT 554 *tx_thread_created_next, 555 *tx_thread_created_previous; 556 557 /************* Define ThreadX SMP thread control block extensions. *************/ 558 559 UINT tx_thread_smp_core_mapped; 560 ULONG tx_thread_smp_core_control; 561 UINT tx_thread_smp_core_executing; 562 563 /************* End of ThreadX SMP thread control block extensions. *************/ 564 565 /* Define the third port extension in the thread control block. This 566 is typically defined to whitespace in tx_port.h. */ 567 TX_THREAD_EXTENSION_2 568 569 /************* Define ThreadX SMP thread control block extensions. *************/ 570 571 ULONG tx_thread_smp_cores_excluded; 572 ULONG tx_thread_smp_cores_allowed; 573 ULONG tx_thread_smp_lock_ready_bit; 574 575 /************* End of ThreadX SMP thread control block extensions. *************/ 576 577 /* Define a pointer type for FileX extensions. */ 578 #ifndef TX_NO_FILEX_POINTER 579 VOID *tx_thread_filex_ptr; 580 #endif 581 582 /* Define the priority inheritance variables. These will be used 583 to manage priority inheritance changes applied to this thread 584 as a result of mutex get operations. */ 585 UINT tx_thread_user_priority; 586 UINT tx_thread_user_preempt_threshold; 587 UINT tx_thread_inherit_priority; 588 589 /* Define the owned mutex count and list head pointer. */ 590 UINT tx_thread_owned_mutex_count; 591 struct TX_MUTEX_STRUCT 592 *tx_thread_owned_mutex_list; 593 594 #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO 595 596 /* Define the number of times this thread is resumed. */ 597 ULONG tx_thread_performance_resume_count; 598 599 /* Define the number of times this thread suspends. */ 600 ULONG tx_thread_performance_suspend_count; 601 602 /* Define the number of times this thread is preempted by calling 603 a ThreadX API service. */ 604 ULONG tx_thread_performance_solicited_preemption_count; 605 606 /* Define the number of times this thread is preempted by an 607 ISR calling a ThreadX API service. */ 608 ULONG tx_thread_performance_interrupt_preemption_count; 609 610 /* Define the number of priority inversions for this thread. */ 611 ULONG tx_thread_performance_priority_inversion_count; 612 613 /* Define the last thread pointer to preempt this thread. */ 614 struct TX_THREAD_STRUCT 615 *tx_thread_performance_last_preempting_thread; 616 617 /* Define the total number of times this thread was time-sliced. */ 618 ULONG tx_thread_performance_time_slice_count; 619 620 /* Define the total number of times this thread relinquishes. */ 621 ULONG tx_thread_performance_relinquish_count; 622 623 /* Define the total number of times this thread had a timeout. */ 624 ULONG tx_thread_performance_timeout_count; 625 626 /* Define the total number of times this thread had suspension lifted 627 because of the tx_thread_wait_abort service. */ 628 ULONG tx_thread_performance_wait_abort_count; 629 #endif 630 631 /* Define the highest stack pointer variable. */ 632 VOID *tx_thread_stack_highest_ptr; /* Stack highest usage pointer */ 633 634 635 #ifndef TX_DISABLE_NOTIFY_CALLBACKS 636 637 /* Define the application callback routine used to notify the application when 638 the thread is entered or exits. */ 639 VOID (*tx_thread_entry_exit_notify)(struct TX_THREAD_STRUCT *thread_ptr, UINT type); 640 #endif 641 642 /* Define the fourth port extension in the thread control block. This 643 is typically defined to whitespace in tx_port.h. */ 644 TX_THREAD_EXTENSION_3 645 646 /* Define suspension sequence number. This is used to ensure suspension is still valid when 647 cleanup routine executes. */ 648 ULONG tx_thread_suspension_sequence; 649 650 #if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) 651 652 /* Define the random stack fill number. This can be used to detect stack overflow. */ 653 ULONG tx_thread_stack_fill_value; 654 #endif 655 656 /* Define the user extension field. This typically is defined 657 to white space, but some ports of ThreadX may need to have 658 additional fields in the thread control block. This is 659 defined in the file tx_port.h. */ 660 TX_THREAD_USER_EXTENSION 661 662 } TX_THREAD; 663 664 665 /* Define the block memory pool structure utilized by the application. */ 666 667 typedef struct TX_BLOCK_POOL_STRUCT 668 { 669 670 /* Define the block pool ID used for error checking. */ 671 ULONG tx_block_pool_id; 672 673 /* Define the block pool's name. */ 674 CHAR *tx_block_pool_name; 675 676 /* Define the number of available memory blocks in the pool. */ 677 UINT tx_block_pool_available; 678 679 /* Save the initial number of blocks. */ 680 UINT tx_block_pool_total; 681 682 /* Define the head pointer of the available block pool. */ 683 UCHAR *tx_block_pool_available_list; 684 685 /* Save the start address of the block pool's memory area. */ 686 UCHAR *tx_block_pool_start; 687 688 /* Save the block pool's size in bytes. */ 689 ULONG tx_block_pool_size; 690 691 /* Save the individual memory block size - rounded for alignment. */ 692 UINT tx_block_pool_block_size; 693 694 /* Define the block pool suspension list head along with a count of 695 how many threads are suspended. */ 696 struct TX_THREAD_STRUCT 697 *tx_block_pool_suspension_list; 698 UINT tx_block_pool_suspended_count; 699 700 /* Define the created list next and previous pointers. */ 701 struct TX_BLOCK_POOL_STRUCT 702 *tx_block_pool_created_next, 703 *tx_block_pool_created_previous; 704 705 #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO 706 707 /* Define the number of block allocates. */ 708 ULONG tx_block_pool_performance_allocate_count; 709 710 /* Define the number of block releases. */ 711 ULONG tx_block_pool_performance_release_count; 712 713 /* Define the number of block pool suspensions. */ 714 ULONG tx_block_pool_performance_suspension_count; 715 716 /* Define the number of block pool timeouts. */ 717 ULONG tx_block_pool_performance_timeout_count; 718 #endif 719 720 /* Define the port extension in the block pool control block. This 721 is typically defined to whitespace in tx_port.h. */ 722 TX_BLOCK_POOL_EXTENSION 723 724 } TX_BLOCK_POOL; 725 726 727 /* Determine if the byte allocate extension is defined. If not, define the 728 extension to whitespace. */ 729 730 #ifndef TX_BYTE_ALLOCATE_EXTENSION 731 #define TX_BYTE_ALLOCATE_EXTENSION 732 #endif 733 734 735 /* Determine if the byte release extension is defined. If not, define the 736 extension to whitespace. */ 737 738 #ifndef TX_BYTE_RELEASE_EXTENSION 739 #define TX_BYTE_RELEASE_EXTENSION 740 #endif 741 742 743 /* Define the byte memory pool structure utilized by the application. */ 744 745 typedef struct TX_BYTE_POOL_STRUCT 746 { 747 748 /* Define the byte pool ID used for error checking. */ 749 ULONG tx_byte_pool_id; 750 751 /* Define the byte pool's name. */ 752 CHAR *tx_byte_pool_name; 753 754 /* Define the number of available bytes in the pool. */ 755 ULONG tx_byte_pool_available; 756 757 /* Define the number of fragments in the pool. */ 758 UINT tx_byte_pool_fragments; 759 760 /* Define the head pointer of byte pool. */ 761 UCHAR *tx_byte_pool_list; 762 763 /* Define the search pointer used for initial searching for memory 764 in a byte pool. */ 765 UCHAR *tx_byte_pool_search; 766 767 /* Save the start address of the byte pool's memory area. */ 768 UCHAR *tx_byte_pool_start; 769 770 /* Save the byte pool's size in bytes. */ 771 ULONG tx_byte_pool_size; 772 773 /* This is used to mark the owner of the byte memory pool during 774 a search. If this value changes during the search, the local search 775 pointer must be reset. */ 776 struct TX_THREAD_STRUCT 777 *tx_byte_pool_owner; 778 779 /* Define the byte pool suspension list head along with a count of 780 how many threads are suspended. */ 781 struct TX_THREAD_STRUCT 782 *tx_byte_pool_suspension_list; 783 UINT tx_byte_pool_suspended_count; 784 785 /* Define the created list next and previous pointers. */ 786 struct TX_BYTE_POOL_STRUCT 787 *tx_byte_pool_created_next, 788 *tx_byte_pool_created_previous; 789 790 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO 791 792 /* Define the number of allocates. */ 793 ULONG tx_byte_pool_performance_allocate_count; 794 795 /* Define the number of releases. */ 796 ULONG tx_byte_pool_performance_release_count; 797 798 /* Define the number of adjacent memory fragment merges. */ 799 ULONG tx_byte_pool_performance_merge_count; 800 801 /* Define the number of memory fragment splits. */ 802 ULONG tx_byte_pool_performance_split_count; 803 804 /* Define the number of memory fragments searched that either were not free or could not satisfy the 805 request. */ 806 ULONG tx_byte_pool_performance_search_count; 807 808 /* Define the number of byte pool suspensions. */ 809 ULONG tx_byte_pool_performance_suspension_count; 810 811 /* Define the number of byte pool timeouts. */ 812 ULONG tx_byte_pool_performance_timeout_count; 813 #endif 814 815 /* Define the port extension in the byte pool control block. This 816 is typically defined to whitespace in tx_port.h. */ 817 TX_BYTE_POOL_EXTENSION 818 819 } TX_BYTE_POOL; 820 821 822 /* Define the event flags group structure utilized by the application. */ 823 824 typedef struct TX_EVENT_FLAGS_GROUP_STRUCT 825 { 826 827 /* Define the event flags group ID used for error checking. */ 828 ULONG tx_event_flags_group_id; 829 830 /* Define the event flags group's name. */ 831 CHAR *tx_event_flags_group_name; 832 833 /* Define the actual current event flags in this group. A zero in a 834 particular bit indicates the event flag is not set. */ 835 ULONG tx_event_flags_group_current; 836 837 /* Define the reset search flag that is set when an ISR sets flags during 838 the search of the suspended threads list. */ 839 UINT tx_event_flags_group_reset_search; 840 841 /* Define the event flags group suspension list head along with a count of 842 how many threads are suspended. */ 843 struct TX_THREAD_STRUCT 844 *tx_event_flags_group_suspension_list; 845 UINT tx_event_flags_group_suspended_count; 846 847 /* Define the created list next and previous pointers. */ 848 struct TX_EVENT_FLAGS_GROUP_STRUCT 849 *tx_event_flags_group_created_next, 850 *tx_event_flags_group_created_previous; 851 852 /* Define the delayed clearing event flags. */ 853 ULONG tx_event_flags_group_delayed_clear; 854 855 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO 856 857 /* Define the number of event flag sets. */ 858 ULONG tx_event_flags_group_performance_set_count; 859 860 /* Define the number of event flag gets. */ 861 ULONG tx_event_flags_group__performance_get_count; 862 863 /* Define the number of event flag suspensions. */ 864 ULONG tx_event_flags_group___performance_suspension_count; 865 866 /* Define the number of event flag timeouts. */ 867 ULONG tx_event_flags_group____performance_timeout_count; 868 #endif 869 870 #ifndef TX_DISABLE_NOTIFY_CALLBACKS 871 872 /* Define the application callback routine used to notify the application when 873 an event flag is set. */ 874 VOID (*tx_event_flags_group_set_notify)(struct TX_EVENT_FLAGS_GROUP_STRUCT *group_ptr); 875 #endif 876 877 /* Define the port extension in the event flags group control block. This 878 is typically defined to whitespace in tx_port.h. */ 879 TX_EVENT_FLAGS_GROUP_EXTENSION 880 881 } TX_EVENT_FLAGS_GROUP; 882 883 884 /* Determine if the mutex put extension 1 is defined. If not, define the 885 extension to whitespace. */ 886 887 #ifndef TX_MUTEX_PUT_EXTENSION_1 888 #define TX_MUTEX_PUT_EXTENSION_1 889 #endif 890 891 892 /* Determine if the mutex put extension 2 is defined. If not, define the 893 extension to whitespace. */ 894 895 #ifndef TX_MUTEX_PUT_EXTENSION_2 896 #define TX_MUTEX_PUT_EXTENSION_2 897 #endif 898 899 900 /* Determine if the mutex priority change extension is defined. If not, define the 901 extension to whitespace. */ 902 903 #ifndef TX_MUTEX_PRIORITY_CHANGE_EXTENSION 904 #define TX_MUTEX_PRIORITY_CHANGE_EXTENSION 905 #endif 906 907 908 /* Define the mutex structure utilized by the application. */ 909 910 typedef struct TX_MUTEX_STRUCT 911 { 912 913 /* Define the mutex ID used for error checking. */ 914 ULONG tx_mutex_id; 915 916 /* Define the mutex's name. */ 917 CHAR *tx_mutex_name; 918 919 /* Define the mutex ownership count. */ 920 UINT tx_mutex_ownership_count; 921 922 /* Define the mutex ownership pointer. This pointer points to the 923 the thread that owns the mutex. */ 924 TX_THREAD *tx_mutex_owner; 925 926 /* Define the priority inheritance flag. If this flag is set, priority 927 inheritance will be in effect. */ 928 UINT tx_mutex_inherit; 929 930 /* Define the save area for the owning thread's original priority. */ 931 UINT tx_mutex_original_priority; 932 933 /* Define the mutex suspension list head along with a count of 934 how many threads are suspended. */ 935 struct TX_THREAD_STRUCT 936 *tx_mutex_suspension_list; 937 UINT tx_mutex_suspended_count; 938 939 /* Define the created list next and previous pointers. */ 940 struct TX_MUTEX_STRUCT 941 *tx_mutex_created_next, 942 *tx_mutex_created_previous; 943 944 /* Define the priority of the highest priority thread waiting for 945 this mutex. */ 946 UINT tx_mutex_highest_priority_waiting; 947 948 /* Define the owned list next and previous pointers. */ 949 struct TX_MUTEX_STRUCT 950 *tx_mutex_owned_next, 951 *tx_mutex_owned_previous; 952 953 #ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO 954 955 /* Define the number of mutex puts. */ 956 ULONG tx_mutex_performance_put_count; 957 958 /* Define the total number of mutex gets. */ 959 ULONG tx_mutex_performance_get_count; 960 961 /* Define the total number of mutex suspensions. */ 962 ULONG tx_mutex_performance_suspension_count; 963 964 /* Define the total number of mutex timeouts. */ 965 ULONG tx_mutex_performance_timeout_count; 966 967 /* Define the total number of priority inversions. */ 968 ULONG tx_mutex_performance_priority_inversion_count; 969 970 /* Define the total number of priority inheritance conditions. */ 971 ULONG tx_mutex_performance__priority_inheritance_count; 972 #endif 973 974 /* Define the port extension in the mutex control block. This 975 is typically defined to whitespace in tx_port.h. */ 976 TX_MUTEX_EXTENSION 977 978 } TX_MUTEX; 979 980 981 /* Define the queue structure utilized by the application. */ 982 983 typedef struct TX_QUEUE_STRUCT 984 { 985 986 /* Define the queue ID used for error checking. */ 987 ULONG tx_queue_id; 988 989 /* Define the queue's name. */ 990 CHAR *tx_queue_name; 991 992 /* Define the message size that was specified in queue creation. */ 993 UINT tx_queue_message_size; 994 995 /* Define the total number of messages in the queue. */ 996 UINT tx_queue_capacity; 997 998 /* Define the current number of messages enqueued and the available 999 queue storage space. */ 1000 UINT tx_queue_enqueued; 1001 UINT tx_queue_available_storage; 1002 1003 /* Define pointers that represent the start and end for the queue's 1004 message area. */ 1005 ULONG *tx_queue_start; 1006 ULONG *tx_queue_end; 1007 1008 /* Define the queue read and write pointers. Send requests use the write 1009 pointer while receive requests use the read pointer. */ 1010 ULONG *tx_queue_read; 1011 ULONG *tx_queue_write; 1012 1013 /* Define the queue suspension list head along with a count of 1014 how many threads are suspended. */ 1015 struct TX_THREAD_STRUCT 1016 *tx_queue_suspension_list; 1017 UINT tx_queue_suspended_count; 1018 1019 /* Define the created list next and previous pointers. */ 1020 struct TX_QUEUE_STRUCT 1021 *tx_queue_created_next, 1022 *tx_queue_created_previous; 1023 1024 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO 1025 1026 /* Define the number of messages sent to this queue. */ 1027 ULONG tx_queue_performance_messages_sent_count; 1028 1029 /* Define the number of messages received from this queue. */ 1030 ULONG tx_queue_performance_messages_received_count; 1031 1032 /* Define the number of empty suspensions on this queue. */ 1033 ULONG tx_queue_performance_empty_suspension_count; 1034 1035 /* Define the number of full suspensions on this queue. */ 1036 ULONG tx_queue_performance_full_suspension_count; 1037 1038 /* Define the number of full non-suspensions on this queue. These 1039 messages are rejected with an appropriate error code. */ 1040 ULONG tx_queue_performance_full_error_count; 1041 1042 /* Define the number of queue timeouts. */ 1043 ULONG tx_queue_performance_timeout_count; 1044 #endif 1045 1046 #ifndef TX_DISABLE_NOTIFY_CALLBACKS 1047 1048 /* Define the application callback routine used to notify the application when 1049 the a message is sent to the queue. */ 1050 VOID (*tx_queue_send_notify)(struct TX_QUEUE_STRUCT *queue_ptr); 1051 #endif 1052 1053 /* Define the port extension in the queue control block. This 1054 is typically defined to whitespace in tx_port.h. */ 1055 TX_QUEUE_EXTENSION 1056 1057 } TX_QUEUE; 1058 1059 1060 /* Define the semaphore structure utilized by the application. */ 1061 1062 typedef struct TX_SEMAPHORE_STRUCT 1063 { 1064 1065 /* Define the semaphore ID used for error checking. */ 1066 ULONG tx_semaphore_id; 1067 1068 /* Define the semaphore's name. */ 1069 CHAR *tx_semaphore_name; 1070 1071 /* Define the actual semaphore count. A zero means that no semaphore 1072 instance is available. */ 1073 ULONG tx_semaphore_count; 1074 1075 /* Define the semaphore suspension list head along with a count of 1076 how many threads are suspended. */ 1077 struct TX_THREAD_STRUCT 1078 *tx_semaphore_suspension_list; 1079 UINT tx_semaphore_suspended_count; 1080 1081 /* Define the created list next and previous pointers. */ 1082 struct TX_SEMAPHORE_STRUCT 1083 *tx_semaphore_created_next, 1084 *tx_semaphore_created_previous; 1085 1086 #ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO 1087 1088 /* Define the number of semaphore puts. */ 1089 ULONG tx_semaphore_performance_put_count; 1090 1091 /* Define the number of semaphore gets. */ 1092 ULONG tx_semaphore_performance_get_count; 1093 1094 /* Define the number of semaphore suspensions. */ 1095 ULONG tx_semaphore_performance_suspension_count; 1096 1097 /* Define the number of semaphore timeouts. */ 1098 ULONG tx_semaphore_performance_timeout_count; 1099 #endif 1100 1101 #ifndef TX_DISABLE_NOTIFY_CALLBACKS 1102 1103 /* Define the application callback routine used to notify the application when 1104 the a semaphore is put. */ 1105 VOID (*tx_semaphore_put_notify)(struct TX_SEMAPHORE_STRUCT *semaphore_ptr); 1106 #endif 1107 1108 /* Define the port extension in the semaphore control block. This 1109 is typically defined to whitespace in tx_port.h. */ 1110 TX_SEMAPHORE_EXTENSION 1111 1112 } TX_SEMAPHORE; 1113 1114 1115 /************* Define ThreadX SMP function prototypes and remapping. *************/ 1116 1117 /* Re-map user API to internal API for SMP routines. */ 1118 1119 #ifndef TX_SOURCE_CODE 1120 #define tx_thread_smp_core_exclude _tx_thread_smp_core_exclude 1121 #define tx_thread_smp_core_exclude_get _tx_thread_smp_core_exclude_get 1122 #define tx_thread_smp_core_get _tx_thread_smp_core_get 1123 #define tx_timer_smp_core_exclude _tx_timer_smp_core_exclude 1124 #define tx_timer_smp_core_exclude_get _tx_timer_smp_core_exclude_get 1125 #endif 1126 1127 1128 #ifndef TX_MISRA_ENABLE 1129 1130 /* Define external data references for SMP. */ 1131 #ifndef TX_SOURCE_CODE 1132 extern ULONG volatile _tx_timer_system_clock; 1133 #endif 1134 #endif 1135 1136 1137 /* Define all SMP prototypes for calling from C. */ 1138 1139 UINT _tx_thread_smp_core_exclude(TX_THREAD *thread_ptr, ULONG exclusion_map); 1140 UINT _tx_thread_smp_core_exclude_get(TX_THREAD *thread_ptr, ULONG *exclusion_map_ptr); 1141 UINT _tx_thread_smp_core_get(void); 1142 UINT _tx_timer_smp_core_exclude(TX_TIMER *timer_ptr, ULONG exclusion_map); 1143 UINT _tx_timer_smp_core_exclude_get(TX_TIMER *timer_ptr, ULONG *exclusion_map_ptr); 1144 1145 /* Define ThreadX SMP low-level assembly routines. */ 1146 1147 TX_THREAD *_tx_thread_smp_current_thread_get(void); 1148 UINT _tx_thread_smp_protect(void); 1149 void _tx_thread_smp_unprotect(UINT interrupt_save); 1150 ULONG _tx_thread_smp_current_state_get(void); 1151 ULONG _tx_thread_smp_time_get(void); 1152 1153 1154 /* Determine if SMP Debug is selected. If so, the function prototype is setup. Otherwise, the debug call is 1155 simply mapped to whitespace. */ 1156 1157 #ifdef TX_THREAD_SMP_DEBUG_ENABLE 1158 void _tx_thread_smp_debug_entry_insert(ULONG id, ULONG suspend, VOID *thread_ptr); 1159 #endif 1160 1161 1162 /* Define the get thread macro. */ 1163 1164 #define TX_THREAD_GET_CURRENT(a) (a) = (TX_THREAD *) _tx_thread_smp_current_thread_get(); 1165 1166 1167 /* Define the get core ID macro. */ 1168 1169 #define TX_SMP_CORE_ID _tx_thread_smp_core_get() 1170 1171 1172 /************* End of ThreadX SMP function prototypes and remapping. *************/ 1173 1174 1175 /* Define the system API mappings based on the error checking 1176 selected by the user. Note: this section is only applicable to 1177 application source code, hence the conditional that turns off this 1178 stuff when the include file is processed by the ThreadX source. */ 1179 1180 #ifndef TX_SOURCE_CODE 1181 1182 1183 /* Determine if error checking is desired. If so, map API functions 1184 to the appropriate error checking front-ends. Otherwise, map API 1185 functions to the core functions that actually perform the work. 1186 Note: error checking is enabled by default. */ 1187 1188 #ifdef TX_DISABLE_ERROR_CHECKING 1189 1190 1191 /* Services without error checking. */ 1192 1193 #define tx_kernel_enter _tx_initialize_kernel_enter 1194 1195 #define tx_block_allocate _tx_block_allocate 1196 #define tx_block_pool_create _tx_block_pool_create 1197 #define tx_block_pool_delete _tx_block_pool_delete 1198 #define tx_block_pool_info_get _tx_block_pool_info_get 1199 #define tx_block_pool_performance_info_get _tx_block_pool_performance_info_get 1200 #define tx_block_pool_performance_system_info_get _tx_block_pool_performance_system_info_get 1201 #define tx_block_pool_prioritize _tx_block_pool_prioritize 1202 #define tx_block_release _tx_block_release 1203 1204 #define tx_byte_allocate _tx_byte_allocate 1205 #define tx_byte_pool_create _tx_byte_pool_create 1206 #define tx_byte_pool_delete _tx_byte_pool_delete 1207 #define tx_byte_pool_info_get _tx_byte_pool_info_get 1208 #define tx_byte_pool_performance_info_get _tx_byte_pool_performance_info_get 1209 #define tx_byte_pool_performance_system_info_get _tx_byte_pool_performance_system_info_get 1210 #define tx_byte_pool_prioritize _tx_byte_pool_prioritize 1211 #define tx_byte_release _tx_byte_release 1212 1213 #define tx_event_flags_create _tx_event_flags_create 1214 #define tx_event_flags_delete _tx_event_flags_delete 1215 #define tx_event_flags_get _tx_event_flags_get 1216 #define tx_event_flags_info_get _tx_event_flags_info_get 1217 #define tx_event_flags_performance_info_get _tx_event_flags_performance_info_get 1218 #define tx_event_flags_performance_system_info_get _tx_event_flags_performance_system_info_get 1219 #define tx_event_flags_set _tx_event_flags_set 1220 #define tx_event_flags_set_notify _tx_event_flags_set_notify 1221 1222 #ifdef TX_ENABLE_EVENT_LOGGING 1223 UINT _tx_el_interrupt_control(UINT new_posture); 1224 #define tx_interrupt_control _tx_el_interrupt_control 1225 #else 1226 #ifdef TX_ENABLE_EVENT_TRACE 1227 #define tx_interrupt_control _tx_trace_interrupt_control 1228 #else 1229 #define tx_interrupt_control _tx_thread_interrupt_control 1230 #endif 1231 #endif 1232 1233 #define tx_mutex_create _tx_mutex_create 1234 #define tx_mutex_delete _tx_mutex_delete 1235 #define tx_mutex_get _tx_mutex_get 1236 #define tx_mutex_info_get _tx_mutex_info_get 1237 #define tx_mutex_performance_info_get _tx_mutex_performance_info_get 1238 #define tx_mutex_performance_system_info_get _tx_mutex_performance_system_info_get 1239 #define tx_mutex_prioritize _tx_mutex_prioritize 1240 #define tx_mutex_put _tx_mutex_put 1241 1242 #define tx_queue_create _tx_queue_create 1243 #define tx_queue_delete _tx_queue_delete 1244 #define tx_queue_flush _tx_queue_flush 1245 #define tx_queue_info_get _tx_queue_info_get 1246 #define tx_queue_performance_info_get _tx_queue_performance_info_get 1247 #define tx_queue_performance_system_info_get _tx_queue_performance_system_info_get 1248 #define tx_queue_receive _tx_queue_receive 1249 #define tx_queue_send _tx_queue_send 1250 #define tx_queue_send_notify _tx_queue_send_notify 1251 #define tx_queue_front_send _tx_queue_front_send 1252 #define tx_queue_prioritize _tx_queue_prioritize 1253 1254 #define tx_semaphore_ceiling_put _tx_semaphore_ceiling_put 1255 #define tx_semaphore_create _tx_semaphore_create 1256 #define tx_semaphore_delete _tx_semaphore_delete 1257 #define tx_semaphore_get _tx_semaphore_get 1258 #define tx_semaphore_info_get _tx_semaphore_info_get 1259 #define tx_semaphore_performance_info_get _tx_semaphore_performance_info_get 1260 #define tx_semaphore_performance_system_info_get _tx_semaphore_performance_system_info_get 1261 #define tx_semaphore_prioritize _tx_semaphore_prioritize 1262 #define tx_semaphore_put _tx_semaphore_put 1263 #define tx_semaphore_put_notify _tx_semaphore_put_notify 1264 1265 #define tx_thread_create _tx_thread_create 1266 #define tx_thread_delete _tx_thread_delete 1267 #define tx_thread_entry_exit_notify _tx_thread_entry_exit_notify 1268 #define tx_thread_identify _tx_thread_identify 1269 #define tx_thread_info_get _tx_thread_info_get 1270 #define tx_thread_performance_info_get _tx_thread_performance_info_get 1271 #define tx_thread_performance_system_info_get _tx_thread_performance_system_info_get 1272 #define tx_thread_preemption_change _tx_thread_preemption_change 1273 #define tx_thread_priority_change _tx_thread_priority_change 1274 #define tx_thread_relinquish _tx_thread_relinquish 1275 #define tx_thread_reset _tx_thread_reset 1276 #define tx_thread_resume _tx_thread_resume 1277 #define tx_thread_sleep _tx_thread_sleep 1278 #define tx_thread_stack_error_notify _tx_thread_stack_error_notify 1279 #define tx_thread_suspend _tx_thread_suspend 1280 #define tx_thread_terminate _tx_thread_terminate 1281 #define tx_thread_time_slice_change _tx_thread_time_slice_change 1282 #define tx_thread_wait_abort _tx_thread_wait_abort 1283 1284 /************* Define ThreadX SMP remapping of tx_time_get. *************/ 1285 #ifndef TX_MISRA_ENABLE 1286 #define tx_time_get() (_tx_timer_system_clock) 1287 #else 1288 #define tx_time_get _tx_time_get 1289 #endif 1290 /************* End ThreadX SMP remapping of tx_time_get. *************/ 1291 #define tx_time_set _tx_time_set 1292 #define tx_timer_activate _tx_timer_activate 1293 #define tx_timer_change _tx_timer_change 1294 #define tx_timer_create _tx_timer_create 1295 #define tx_timer_deactivate _tx_timer_deactivate 1296 #define tx_timer_delete _tx_timer_delete 1297 #define tx_timer_info_get _tx_timer_info_get 1298 #define tx_timer_performance_info_get _tx_timer_performance_info_get 1299 #define tx_timer_performance_system_info_get _tx_timer_performance_system_info_get 1300 1301 #define tx_trace_enable _tx_trace_enable 1302 #define tx_trace_event_filter _tx_trace_event_filter 1303 #define tx_trace_event_unfilter _tx_trace_event_unfilter 1304 #define tx_trace_disable _tx_trace_disable 1305 #define tx_trace_isr_enter_insert _tx_trace_isr_enter_insert 1306 #define tx_trace_isr_exit_insert _tx_trace_isr_exit_insert 1307 #define tx_trace_buffer_full_notify _tx_trace_buffer_full_notify 1308 #define tx_trace_user_event_insert _tx_trace_user_event_insert 1309 1310 #else 1311 1312 /* Services with error checking. */ 1313 1314 #define tx_kernel_enter _tx_initialize_kernel_enter 1315 1316 /* Define the system API mappings depending on the runtime error 1317 checking behavior selected by the user. */ 1318 1319 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING 1320 1321 /* Services with MULTI runtime error checking ThreadX. */ 1322 1323 #define tx_block_allocate _txr_block_allocate 1324 #define tx_block_pool_create(p,n,b,s,l) _txr_block_pool_create((p),(n),(b),(s),(l),(sizeof(TX_BLOCK_POOL))) 1325 #define tx_block_pool_delete _txr_block_pool_delete 1326 #define tx_block_pool_info_get _txr_block_pool_info_get 1327 #define tx_block_pool_performance_info_get _tx_block_pool_performance_info_get 1328 #define tx_block_pool_performance_system_info_get _tx_block_pool_performance_system_info_get 1329 #define tx_block_pool_prioritize _txr_block_pool_prioritize 1330 #define tx_block_release _txr_block_release 1331 1332 #define tx_byte_allocate _txr_byte_allocate 1333 #define tx_byte_pool_create(p,n,s,l) _txr_byte_pool_create((p),(n),(s),(l),(sizeof(TX_BYTE_POOL))) 1334 #define tx_byte_pool_delete _txr_byte_pool_delete 1335 #define tx_byte_pool_info_get _txr_byte_pool_info_get 1336 #define tx_byte_pool_performance_info_get _tx_byte_pool_performance_info_get 1337 #define tx_byte_pool_performance_system_info_get _tx_byte_pool_performance_system_info_get 1338 #define tx_byte_pool_prioritize _txr_byte_pool_prioritize 1339 #define tx_byte_release _txr_byte_release 1340 1341 #define tx_event_flags_create(g,n) _txr_event_flags_create((g),(n),(sizeof(TX_EVENT_FLAGS_GROUP))) 1342 #define tx_event_flags_delete _txr_event_flags_delete 1343 #define tx_event_flags_get _txr_event_flags_get 1344 #define tx_event_flags_info_get _txr_event_flags_info_get 1345 #define tx_event_flags_performance_info_get _tx_event_flags_performance_info_get 1346 #define tx_event_flags_performance_system_info_get _tx_event_flags_performance_system_info_get 1347 #define tx_event_flags_set _txr_event_flags_set 1348 #define tx_event_flags_set_notify _txr_event_flags_set_notify 1349 1350 #ifdef TX_ENABLE_EVENT_LOGGING 1351 UINT _tx_el_interrupt_control(UINT new_posture); 1352 #define tx_interrupt_control _tx_el_interrupt_control 1353 #else 1354 #ifdef TX_ENABLE_EVENT_TRACE 1355 #define tx_interrupt_control _tx_trace_interrupt_control 1356 #else 1357 #define tx_interrupt_control _tx_thread_interrupt_control 1358 #endif 1359 #endif 1360 1361 #define tx_mutex_create(m,n,i) _txr_mutex_create((m),(n),(i),(sizeof(TX_MUTEX))) 1362 #define tx_mutex_delete _txr_mutex_delete 1363 #define tx_mutex_get _txr_mutex_get 1364 #define tx_mutex_info_get _txr_mutex_info_get 1365 #define tx_mutex_performance_info_get _tx_mutex_performance_info_get 1366 #define tx_mutex_performance_system_info_get _tx_mutex_performance_system_info_get 1367 #define tx_mutex_prioritize _txr_mutex_prioritize 1368 #define tx_mutex_put _txr_mutex_put 1369 1370 #define tx_queue_create(q,n,m,s,l) _txr_queue_create((q),(n),(m),(s),(l),(sizeof(TX_QUEUE))) 1371 #define tx_queue_delete _txr_queue_delete 1372 #define tx_queue_flush _txr_queue_flush 1373 #define tx_queue_info_get _txr_queue_info_get 1374 #define tx_queue_performance_info_get _tx_queue_performance_info_get 1375 #define tx_queue_performance_system_info_get _tx_queue_performance_system_info_get 1376 #define tx_queue_receive _txr_queue_receive 1377 #define tx_queue_send _txr_queue_send 1378 #define tx_queue_send_notify _txr_queue_send_notify 1379 #define tx_queue_front_send _txr_queue_front_send 1380 #define tx_queue_prioritize _txr_queue_prioritize 1381 1382 #define tx_semaphore_ceiling_put _txr_semaphore_ceiling_put 1383 #define tx_semaphore_create(s,n,i) _txr_semaphore_create((s),(n),(i),(sizeof(TX_SEMAPHORE))) 1384 #define tx_semaphore_delete _txr_semaphore_delete 1385 #define tx_semaphore_get _txr_semaphore_get 1386 #define tx_semaphore_info_get _txr_semaphore_info_get 1387 #define tx_semaphore_performance_info_get _tx_semaphore_performance_info_get 1388 #define tx_semaphore_performance_system_info_get _tx_semaphore_performance_system_info_get 1389 #define tx_semaphore_prioritize _txr_semaphore_prioritize 1390 #define tx_semaphore_put _txr_semaphore_put 1391 #define tx_semaphore_put_notify _txr_semaphore_put_notify 1392 1393 #define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txr_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD))) 1394 #define tx_thread_delete _txr_thread_delete 1395 #define tx_thread_entry_exit_notify _txr_thread_entry_exit_notify 1396 #define tx_thread_identify _tx_thread_identify 1397 #define tx_thread_info_get _txr_thread_info_get 1398 #define tx_thread_performance_info_get _tx_thread_performance_info_get 1399 #define tx_thread_performance_system_info_get _tx_thread_performance_system_info_get 1400 #define tx_thread_preemption_change _txr_thread_preemption_change 1401 #define tx_thread_priority_change _txr_thread_priority_change 1402 #define tx_thread_relinquish _txe_thread_relinquish 1403 #define tx_thread_reset _txr_thread_reset 1404 #define tx_thread_resume _txr_thread_resume 1405 #define tx_thread_sleep _tx_thread_sleep 1406 #define tx_thread_stack_error_notify _tx_thread_stack_error_notify 1407 #define tx_thread_suspend _txr_thread_suspend 1408 #define tx_thread_terminate _txr_thread_terminate 1409 #define tx_thread_time_slice_change _txr_thread_time_slice_change 1410 #define tx_thread_wait_abort _txr_thread_wait_abort 1411 1412 /************* Define ThreadX SMP remapping of tx_time_get. *************/ 1413 #ifndef TX_MISRA_ENABLE 1414 #define tx_time_get() (_tx_timer_system_clock) 1415 #else 1416 #define tx_time_get _tx_time_get 1417 #endif 1418 /************* End ThreadX SMP remapping of tx_time_get. *************/ 1419 #define tx_time_set _tx_time_set 1420 #define tx_timer_activate _txr_timer_activate 1421 #define tx_timer_change _txr_timer_change 1422 #define tx_timer_create(t,n,e,i,c,r,a) _txr_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER))) 1423 #define tx_timer_deactivate _txr_timer_deactivate 1424 #define tx_timer_delete _txr_timer_delete 1425 #define tx_timer_info_get _txr_timer_info_get 1426 #define tx_timer_performance_info_get _tx_timer_performance_info_get 1427 #define tx_timer_performance_system_info_get _tx_timer_performance_system_info_get 1428 1429 #define tx_trace_enable _tx_trace_enable 1430 #define tx_trace_event_filter _tx_trace_event_filter 1431 #define tx_trace_event_unfilter _tx_trace_event_unfilter 1432 #define tx_trace_disable _tx_trace_disable 1433 #define tx_trace_isr_enter_insert _tx_trace_isr_enter_insert 1434 #define tx_trace_isr_exit_insert _tx_trace_isr_exit_insert 1435 #define tx_trace_buffer_full_notify _tx_trace_buffer_full_notify 1436 #define tx_trace_user_event_insert _tx_trace_user_event_insert 1437 1438 #else 1439 1440 #define tx_block_allocate _txe_block_allocate 1441 #define tx_block_pool_create(p,n,b,s,l) _txe_block_pool_create((p),(n),(b),(s),(l),(sizeof(TX_BLOCK_POOL))) 1442 #define tx_block_pool_delete _txe_block_pool_delete 1443 #define tx_block_pool_info_get _txe_block_pool_info_get 1444 #define tx_block_pool_performance_info_get _tx_block_pool_performance_info_get 1445 #define tx_block_pool_performance_system_info_get _tx_block_pool_performance_system_info_get 1446 #define tx_block_pool_prioritize _txe_block_pool_prioritize 1447 #define tx_block_release _txe_block_release 1448 1449 #define tx_byte_allocate _txe_byte_allocate 1450 #define tx_byte_pool_create(p,n,s,l) _txe_byte_pool_create((p),(n),(s),(l),(sizeof(TX_BYTE_POOL))) 1451 #define tx_byte_pool_delete _txe_byte_pool_delete 1452 #define tx_byte_pool_info_get _txe_byte_pool_info_get 1453 #define tx_byte_pool_performance_info_get _tx_byte_pool_performance_info_get 1454 #define tx_byte_pool_performance_system_info_get _tx_byte_pool_performance_system_info_get 1455 #define tx_byte_pool_prioritize _txe_byte_pool_prioritize 1456 #define tx_byte_release _txe_byte_release 1457 1458 #define tx_event_flags_create(g,n) _txe_event_flags_create((g),(n),(sizeof(TX_EVENT_FLAGS_GROUP))) 1459 #define tx_event_flags_delete _txe_event_flags_delete 1460 #define tx_event_flags_get _txe_event_flags_get 1461 #define tx_event_flags_info_get _txe_event_flags_info_get 1462 #define tx_event_flags_performance_info_get _tx_event_flags_performance_info_get 1463 #define tx_event_flags_performance_system_info_get _tx_event_flags_performance_system_info_get 1464 #define tx_event_flags_set _txe_event_flags_set 1465 #define tx_event_flags_set_notify _txe_event_flags_set_notify 1466 1467 #ifdef TX_ENABLE_EVENT_LOGGING 1468 UINT _tx_el_interrupt_control(UINT new_posture); 1469 #define tx_interrupt_control _tx_el_interrupt_control 1470 #else 1471 #ifdef TX_ENABLE_EVENT_TRACE 1472 #define tx_interrupt_control _tx_trace_interrupt_control 1473 #else 1474 #define tx_interrupt_control _tx_thread_interrupt_control 1475 #endif 1476 #endif 1477 1478 #define tx_mutex_create(m,n,i) _txe_mutex_create((m),(n),(i),(sizeof(TX_MUTEX))) 1479 #define tx_mutex_delete _txe_mutex_delete 1480 #define tx_mutex_get _txe_mutex_get 1481 #define tx_mutex_info_get _txe_mutex_info_get 1482 #define tx_mutex_performance_info_get _tx_mutex_performance_info_get 1483 #define tx_mutex_performance_system_info_get _tx_mutex_performance_system_info_get 1484 #define tx_mutex_prioritize _txe_mutex_prioritize 1485 #define tx_mutex_put _txe_mutex_put 1486 1487 #define tx_queue_create(q,n,m,s,l) _txe_queue_create((q),(n),(m),(s),(l),(sizeof(TX_QUEUE))) 1488 #define tx_queue_delete _txe_queue_delete 1489 #define tx_queue_flush _txe_queue_flush 1490 #define tx_queue_info_get _txe_queue_info_get 1491 #define tx_queue_performance_info_get _tx_queue_performance_info_get 1492 #define tx_queue_performance_system_info_get _tx_queue_performance_system_info_get 1493 #define tx_queue_receive _txe_queue_receive 1494 #define tx_queue_send _txe_queue_send 1495 #define tx_queue_send_notify _txe_queue_send_notify 1496 #define tx_queue_front_send _txe_queue_front_send 1497 #define tx_queue_prioritize _txe_queue_prioritize 1498 1499 #define tx_semaphore_ceiling_put _txe_semaphore_ceiling_put 1500 #define tx_semaphore_create(s,n,i) _txe_semaphore_create((s),(n),(i),(sizeof(TX_SEMAPHORE))) 1501 #define tx_semaphore_delete _txe_semaphore_delete 1502 #define tx_semaphore_get _txe_semaphore_get 1503 #define tx_semaphore_info_get _txe_semaphore_info_get 1504 #define tx_semaphore_performance_info_get _tx_semaphore_performance_info_get 1505 #define tx_semaphore_performance_system_info_get _tx_semaphore_performance_system_info_get 1506 #define tx_semaphore_prioritize _txe_semaphore_prioritize 1507 #define tx_semaphore_put _txe_semaphore_put 1508 #define tx_semaphore_put_notify _txe_semaphore_put_notify 1509 1510 #define tx_thread_create(t,n,e,i,s,l,p,r,c,a) _txe_thread_create((t),(n),(e),(i),(s),(l),(p),(r),(c),(a),(sizeof(TX_THREAD))) 1511 #define tx_thread_delete _txe_thread_delete 1512 #define tx_thread_entry_exit_notify _txe_thread_entry_exit_notify 1513 #define tx_thread_identify _tx_thread_identify 1514 #define tx_thread_info_get _txe_thread_info_get 1515 #define tx_thread_performance_info_get _tx_thread_performance_info_get 1516 #define tx_thread_performance_system_info_get _tx_thread_performance_system_info_get 1517 #define tx_thread_preemption_change _txe_thread_preemption_change 1518 #define tx_thread_priority_change _txe_thread_priority_change 1519 #define tx_thread_relinquish _txe_thread_relinquish 1520 #define tx_thread_reset _txe_thread_reset 1521 #define tx_thread_resume _txe_thread_resume 1522 #define tx_thread_sleep _tx_thread_sleep 1523 #define tx_thread_stack_error_notify _tx_thread_stack_error_notify 1524 #define tx_thread_suspend _txe_thread_suspend 1525 #define tx_thread_terminate _txe_thread_terminate 1526 #define tx_thread_time_slice_change _txe_thread_time_slice_change 1527 #define tx_thread_wait_abort _txe_thread_wait_abort 1528 1529 /************* Define ThreadX SMP remapping of tx_time_get. *************/ 1530 #ifndef TX_MISRA_ENABLE 1531 #define tx_time_get() (_tx_timer_system_clock) 1532 #else 1533 #define tx_time_get _tx_time_get 1534 #endif 1535 /************* End ThreadX SMP remapping of tx_time_get. *************/ 1536 #define tx_time_set _tx_time_set 1537 #define tx_timer_activate _txe_timer_activate 1538 #define tx_timer_change _txe_timer_change 1539 #define tx_timer_create(t,n,e,i,c,r,a) _txe_timer_create((t),(n),(e),(i),(c),(r),(a),(sizeof(TX_TIMER))) 1540 #define tx_timer_deactivate _txe_timer_deactivate 1541 #define tx_timer_delete _txe_timer_delete 1542 #define tx_timer_info_get _txe_timer_info_get 1543 #define tx_timer_performance_info_get _tx_timer_performance_info_get 1544 #define tx_timer_performance_system_info_get _tx_timer_performance_system_info_get 1545 1546 #define tx_trace_enable _tx_trace_enable 1547 #define tx_trace_event_filter _tx_trace_event_filter 1548 #define tx_trace_event_unfilter _tx_trace_event_unfilter 1549 #define tx_trace_disable _tx_trace_disable 1550 #define tx_trace_isr_enter_insert _tx_trace_isr_enter_insert 1551 #define tx_trace_isr_exit_insert _tx_trace_isr_exit_insert 1552 #define tx_trace_buffer_full_notify _tx_trace_buffer_full_notify 1553 #define tx_trace_user_event_insert _tx_trace_user_event_insert 1554 1555 #endif 1556 #endif 1557 1558 #endif 1559 1560 1561 /* Declare the tx_application_define function as having C linkage. */ 1562 1563 VOID tx_application_define(VOID *first_unused_memory); 1564 1565 1566 /* Define the function prototypes of the ThreadX API. */ 1567 1568 1569 /* Define block memory pool management function prototypes. */ 1570 1571 UINT _tx_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option); 1572 UINT _tx_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, 1573 VOID *pool_start, ULONG pool_size); 1574 UINT _tx_block_pool_delete(TX_BLOCK_POOL *pool_ptr); 1575 UINT _tx_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, 1576 ULONG *total_blocks, TX_THREAD **first_suspended, 1577 ULONG *suspended_count, TX_BLOCK_POOL **next_pool); 1578 UINT _tx_block_pool_performance_info_get(TX_BLOCK_POOL *pool_ptr, ULONG *allocates, ULONG *releases, 1579 ULONG *suspensions, ULONG *timeouts); 1580 UINT _tx_block_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, 1581 ULONG *suspensions, ULONG *timeouts); 1582 UINT _tx_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr); 1583 UINT _tx_block_release(VOID *block_ptr); 1584 1585 1586 /* Define error checking shells for API services. These are only referenced by the 1587 application. */ 1588 1589 UINT _txe_block_allocate(TX_BLOCK_POOL *pool_ptr, VOID **block_ptr, ULONG wait_option); 1590 UINT _txe_block_pool_create(TX_BLOCK_POOL *pool_ptr, CHAR *name_ptr, ULONG block_size, 1591 VOID *pool_start, ULONG pool_size, UINT pool_control_block_size); 1592 UINT _txe_block_pool_delete(TX_BLOCK_POOL *pool_ptr); 1593 UINT _txe_block_pool_info_get(TX_BLOCK_POOL *pool_ptr, CHAR **name, ULONG *available_blocks, 1594 ULONG *total_blocks, TX_THREAD **first_suspended, 1595 ULONG *suspended_count, TX_BLOCK_POOL **next_pool); 1596 UINT _txe_block_pool_prioritize(TX_BLOCK_POOL *pool_ptr); 1597 UINT _txe_block_release(VOID *block_ptr); 1598 1599 1600 /* Define byte memory pool management function prototypes. */ 1601 1602 UINT _tx_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, 1603 ULONG wait_option); 1604 UINT _tx_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, 1605 ULONG pool_size); 1606 UINT _tx_byte_pool_delete(TX_BYTE_POOL *pool_ptr); 1607 UINT _tx_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, 1608 ULONG *fragments, TX_THREAD **first_suspended, 1609 ULONG *suspended_count, TX_BYTE_POOL **next_pool); 1610 UINT _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases, 1611 ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts); 1612 UINT _tx_byte_pool_performance_system_info_get(ULONG *allocates, ULONG *releases, 1613 ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts); 1614 UINT _tx_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr); 1615 UINT _tx_byte_release(VOID *memory_ptr); 1616 1617 1618 /* Define error checking shells for API services. These are only referenced by the 1619 application. */ 1620 1621 UINT _txe_byte_allocate(TX_BYTE_POOL *pool_ptr, VOID **memory_ptr, ULONG memory_size, 1622 ULONG wait_option); 1623 UINT _txe_byte_pool_create(TX_BYTE_POOL *pool_ptr, CHAR *name_ptr, VOID *pool_start, 1624 ULONG pool_size, UINT pool_control_block_size); 1625 UINT _txe_byte_pool_delete(TX_BYTE_POOL *pool_ptr); 1626 UINT _txe_byte_pool_info_get(TX_BYTE_POOL *pool_ptr, CHAR **name, ULONG *available_bytes, 1627 ULONG *fragments, TX_THREAD **first_suspended, 1628 ULONG *suspended_count, TX_BYTE_POOL **next_pool); 1629 UINT _txe_byte_pool_prioritize(TX_BYTE_POOL *pool_ptr); 1630 UINT _txe_byte_release(VOID *memory_ptr); 1631 1632 1633 /* Define event flags management function prototypes. */ 1634 1635 UINT _tx_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr); 1636 UINT _tx_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); 1637 UINT _tx_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, 1638 UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); 1639 UINT _tx_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, 1640 TX_THREAD **first_suspended, ULONG *suspended_count, 1641 TX_EVENT_FLAGS_GROUP **next_group); 1642 UINT _tx_event_flags_performance_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG *sets, ULONG *gets, 1643 ULONG *suspensions, ULONG *timeouts); 1644 UINT _tx_event_flags_performance_system_info_get(ULONG *sets, ULONG *gets, 1645 ULONG *suspensions, ULONG *timeouts); 1646 UINT _tx_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, 1647 UINT set_option); 1648 UINT _tx_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); 1649 1650 1651 /* Define error checking shells for API services. These are only referenced by the 1652 application. */ 1653 1654 UINT _txe_event_flags_create(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR *name_ptr, UINT event_control_block_size); 1655 UINT _txe_event_flags_delete(TX_EVENT_FLAGS_GROUP *group_ptr); 1656 UINT _txe_event_flags_get(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG requested_flags, 1657 UINT get_option, ULONG *actual_flags_ptr, ULONG wait_option); 1658 UINT _txe_event_flags_info_get(TX_EVENT_FLAGS_GROUP *group_ptr, CHAR **name, ULONG *current_flags, 1659 TX_THREAD **first_suspended, ULONG *suspended_count, 1660 TX_EVENT_FLAGS_GROUP **next_group); 1661 UINT _txe_event_flags_set(TX_EVENT_FLAGS_GROUP *group_ptr, ULONG flags_to_set, 1662 UINT set_option); 1663 UINT _txe_event_flags_set_notify(TX_EVENT_FLAGS_GROUP *group_ptr, VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); 1664 1665 1666 /* Define initialization function prototypes. */ 1667 1668 VOID _tx_initialize_kernel_enter(VOID); 1669 1670 1671 /* Define mutex management function prototypes. */ 1672 1673 UINT _tx_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit); 1674 UINT _tx_mutex_delete(TX_MUTEX *mutex_ptr); 1675 UINT _tx_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option); 1676 UINT _tx_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, 1677 TX_THREAD **first_suspended, ULONG *suspended_count, 1678 TX_MUTEX **next_mutex); 1679 UINT _tx_mutex_performance_info_get(TX_MUTEX *mutex_ptr, ULONG *puts, ULONG *gets, 1680 ULONG *suspensions, ULONG *timeouts, ULONG *inversions, ULONG *inheritances); 1681 UINT _tx_mutex_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts, 1682 ULONG *inversions, ULONG *inheritances); 1683 UINT _tx_mutex_prioritize(TX_MUTEX *mutex_ptr); 1684 UINT _tx_mutex_put(TX_MUTEX *mutex_ptr); 1685 1686 1687 /* Define error checking shells for API services. These are only referenced by the 1688 application. */ 1689 1690 UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size); 1691 UINT _txe_mutex_delete(TX_MUTEX *mutex_ptr); 1692 UINT _txe_mutex_get(TX_MUTEX *mutex_ptr, ULONG wait_option); 1693 UINT _txe_mutex_info_get(TX_MUTEX *mutex_ptr, CHAR **name, ULONG *count, TX_THREAD **owner, 1694 TX_THREAD **first_suspended, ULONG *suspended_count, 1695 TX_MUTEX **next_mutex); 1696 UINT _txe_mutex_prioritize(TX_MUTEX *mutex_ptr); 1697 UINT _txe_mutex_put(TX_MUTEX *mutex_ptr); 1698 1699 1700 /* Define queue management function prototypes. */ 1701 1702 UINT _tx_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, 1703 VOID *queue_start, ULONG queue_size); 1704 UINT _tx_queue_delete(TX_QUEUE *queue_ptr); 1705 UINT _tx_queue_flush(TX_QUEUE *queue_ptr); 1706 UINT _tx_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage, 1707 TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue); 1708 UINT _tx_queue_performance_info_get(TX_QUEUE *queue_ptr, ULONG *messages_sent, ULONG *messages_received, 1709 ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts); 1710 UINT _tx_queue_performance_system_info_get(ULONG *messages_sent, ULONG *messages_received, 1711 ULONG *empty_suspensions, ULONG *full_suspensions, ULONG *full_errors, ULONG *timeouts); 1712 UINT _tx_queue_prioritize(TX_QUEUE *queue_ptr); 1713 UINT _tx_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option); 1714 UINT _tx_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); 1715 UINT _tx_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)); 1716 UINT _tx_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); 1717 1718 1719 /* Define error checking shells for API services. These are only referenced by the 1720 application. */ 1721 1722 UINT _txe_queue_create(TX_QUEUE *queue_ptr, CHAR *name_ptr, UINT message_size, 1723 VOID *queue_start, ULONG queue_size, UINT queue_control_block_size); 1724 UINT _txe_queue_delete(TX_QUEUE *queue_ptr); 1725 UINT _txe_queue_flush(TX_QUEUE *queue_ptr); 1726 UINT _txe_queue_info_get(TX_QUEUE *queue_ptr, CHAR **name, ULONG *enqueued, ULONG *available_storage, 1727 TX_THREAD **first_suspended, ULONG *suspended_count, TX_QUEUE **next_queue); 1728 UINT _txe_queue_prioritize(TX_QUEUE *queue_ptr); 1729 UINT _txe_queue_receive(TX_QUEUE *queue_ptr, VOID *destination_ptr, ULONG wait_option); 1730 UINT _txe_queue_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); 1731 UINT _txe_queue_send_notify(TX_QUEUE *queue_ptr, VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)); 1732 UINT _txe_queue_front_send(TX_QUEUE *queue_ptr, VOID *source_ptr, ULONG wait_option); 1733 1734 1735 /* Define semaphore management function prototypes. */ 1736 1737 UINT _tx_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling); 1738 UINT _tx_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count); 1739 UINT _tx_semaphore_delete(TX_SEMAPHORE *semaphore_ptr); 1740 UINT _tx_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option); 1741 UINT _tx_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, 1742 TX_THREAD **first_suspended, ULONG *suspended_count, 1743 TX_SEMAPHORE **next_semaphore); 1744 UINT _tx_semaphore_performance_info_get(TX_SEMAPHORE *semaphore_ptr, ULONG *puts, ULONG *gets, 1745 ULONG *suspensions, ULONG *timeouts); 1746 UINT _tx_semaphore_performance_system_info_get(ULONG *puts, ULONG *gets, ULONG *suspensions, ULONG *timeouts); 1747 UINT _tx_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr); 1748 UINT _tx_semaphore_put(TX_SEMAPHORE *semaphore_ptr); 1749 UINT _tx_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)); 1750 1751 1752 /* Define error checking shells for API services. These are only referenced by the 1753 application. */ 1754 1755 UINT _txe_semaphore_ceiling_put(TX_SEMAPHORE *semaphore_ptr, ULONG ceiling); 1756 UINT _txe_semaphore_create(TX_SEMAPHORE *semaphore_ptr, CHAR *name_ptr, ULONG initial_count, UINT semaphore_control_block_size); 1757 UINT _txe_semaphore_delete(TX_SEMAPHORE *semaphore_ptr); 1758 UINT _txe_semaphore_get(TX_SEMAPHORE *semaphore_ptr, ULONG wait_option); 1759 UINT _txe_semaphore_info_get(TX_SEMAPHORE *semaphore_ptr, CHAR **name, ULONG *current_value, 1760 TX_THREAD **first_suspended, ULONG *suspended_count, 1761 TX_SEMAPHORE **next_semaphore); 1762 UINT _txe_semaphore_prioritize(TX_SEMAPHORE *semaphore_ptr); 1763 UINT _txe_semaphore_put(TX_SEMAPHORE *semaphore_ptr); 1764 UINT _txe_semaphore_put_notify(TX_SEMAPHORE *semaphore_ptr, VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)); 1765 1766 1767 /* Define thread control function prototypes. */ 1768 1769 VOID _tx_thread_context_save(VOID); 1770 VOID _tx_thread_context_restore(VOID); 1771 UINT _tx_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, 1772 VOID (*entry_function)(ULONG entry_input), ULONG entry_input, 1773 VOID *stack_start, ULONG stack_size, 1774 UINT priority, UINT preempt_threshold, 1775 ULONG time_slice, UINT auto_start); 1776 UINT _tx_thread_delete(TX_THREAD *thread_ptr); 1777 UINT _tx_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)); 1778 TX_THREAD *_tx_thread_identify(VOID); 1779 UINT _tx_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, 1780 UINT *priority, UINT *preemption_threshold, ULONG *time_slice, 1781 TX_THREAD **next_thread, TX_THREAD **next_suspended_thread); 1782 UINT _tx_thread_interrupt_control(UINT new_posture); 1783 UINT _tx_thread_performance_info_get(TX_THREAD *thread_ptr, ULONG *resumptions, ULONG *suspensions, 1784 ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, 1785 ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, TX_THREAD **last_preempted_by); 1786 UINT _tx_thread_performance_system_info_get(ULONG *resumptions, ULONG *suspensions, 1787 ULONG *solicited_preemptions, ULONG *interrupt_preemptions, ULONG *priority_inversions, 1788 ULONG *time_slices, ULONG *relinquishes, ULONG *timeouts, ULONG *wait_aborts, 1789 ULONG *non_idle_returns, ULONG *idle_returns); 1790 UINT _tx_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, 1791 UINT *old_threshold); 1792 UINT _tx_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority, 1793 UINT *old_priority); 1794 VOID _tx_thread_relinquish(VOID); 1795 UINT _tx_thread_reset(TX_THREAD *thread_ptr); 1796 UINT _tx_thread_resume(TX_THREAD *thread_ptr); 1797 UINT _tx_thread_sleep(ULONG timer_ticks); 1798 UINT _tx_thread_stack_error_notify(VOID (*stack_error_handler)(TX_THREAD *thread_ptr)); 1799 UINT _tx_thread_suspend(TX_THREAD *thread_ptr); 1800 UINT _tx_thread_terminate(TX_THREAD *thread_ptr); 1801 UINT _tx_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice); 1802 UINT _tx_thread_wait_abort(TX_THREAD *thread_ptr); 1803 1804 1805 /* Define error checking shells for API services. These are only referenced by the 1806 application. */ 1807 1808 UINT _txe_thread_create(TX_THREAD *thread_ptr, CHAR *name_ptr, 1809 VOID (*entry_function)(ULONG entry_input), ULONG entry_input, 1810 VOID *stack_start, ULONG stack_size, 1811 UINT priority, UINT preempt_threshold, 1812 ULONG time_slice, UINT auto_start, UINT thread_control_block_size); 1813 UINT _txe_thread_delete(TX_THREAD *thread_ptr); 1814 UINT _txe_thread_entry_exit_notify(TX_THREAD *thread_ptr, VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT type)); 1815 UINT _txe_thread_info_get(TX_THREAD *thread_ptr, CHAR **name, UINT *state, ULONG *run_count, 1816 UINT *priority, UINT *preemption_threshold, ULONG *time_slice, 1817 TX_THREAD **next_thread, TX_THREAD **next_suspended_thread); 1818 UINT _txe_thread_preemption_change(TX_THREAD *thread_ptr, UINT new_threshold, 1819 UINT *old_threshold); 1820 UINT _txe_thread_priority_change(TX_THREAD *thread_ptr, UINT new_priority, 1821 UINT *old_priority); 1822 VOID _txe_thread_relinquish(VOID); 1823 UINT _txe_thread_reset(TX_THREAD *thread_ptr); 1824 UINT _txe_thread_resume(TX_THREAD *thread_ptr); 1825 UINT _txe_thread_suspend(TX_THREAD *thread_ptr); 1826 UINT _txe_thread_terminate(TX_THREAD *thread_ptr); 1827 UINT _txe_thread_time_slice_change(TX_THREAD *thread_ptr, ULONG new_time_slice, ULONG *old_time_slice); 1828 UINT _txe_thread_wait_abort(TX_THREAD *thread_ptr); 1829 1830 1831 /* Define timer management function prototypes. */ 1832 1833 UINT _tx_timer_activate(TX_TIMER *timer_ptr); 1834 UINT _tx_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks); 1835 UINT _tx_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, 1836 VOID (*expiration_function)(ULONG input), ULONG expiration_input, 1837 ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate); 1838 UINT _tx_timer_deactivate(TX_TIMER *timer_ptr); 1839 UINT _tx_timer_delete(TX_TIMER *timer_ptr); 1840 UINT _tx_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, 1841 ULONG *reschedule_ticks, TX_TIMER **next_timer); 1842 UINT _tx_timer_performance_info_get(TX_TIMER *timer_ptr, ULONG *activates, ULONG *reactivates, 1843 ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts); 1844 UINT _tx_timer_performance_system_info_get(ULONG *activates, ULONG *reactivates, 1845 ULONG *deactivates, ULONG *expirations, ULONG *expiration_adjusts); 1846 1847 ULONG _tx_time_get(VOID); 1848 VOID _tx_time_set(ULONG new_time); 1849 1850 1851 /* Define error checking shells for API services. These are only referenced by the 1852 application. */ 1853 1854 UINT _txe_timer_activate(TX_TIMER *timer_ptr); 1855 UINT _txe_timer_change(TX_TIMER *timer_ptr, ULONG initial_ticks, ULONG reschedule_ticks); 1856 UINT _txe_timer_create(TX_TIMER *timer_ptr, CHAR *name_ptr, 1857 VOID (*expiration_function)(ULONG input), ULONG expiration_input, 1858 ULONG initial_ticks, ULONG reschedule_ticks, UINT auto_activate, UINT timer_control_block_size); 1859 UINT _txe_timer_deactivate(TX_TIMER *timer_ptr); 1860 UINT _txe_timer_delete(TX_TIMER *timer_ptr); 1861 UINT _txe_timer_info_get(TX_TIMER *timer_ptr, CHAR **name, UINT *active, ULONG *remaining_ticks, 1862 ULONG *reschedule_ticks, TX_TIMER **next_timer); 1863 1864 1865 /* Define trace API function prototypes. */ 1866 1867 UINT _tx_trace_enable(VOID *trace_buffer_start, ULONG trace_buffer_size, ULONG registry_entries); 1868 UINT _tx_trace_event_filter(ULONG event_filter_bits); 1869 UINT _tx_trace_event_unfilter(ULONG event_unfilter_bits); 1870 UINT _tx_trace_disable(VOID); 1871 VOID _tx_trace_isr_enter_insert(ULONG isr_id); 1872 VOID _tx_trace_isr_exit_insert(ULONG isr_id); 1873 UINT _tx_trace_buffer_full_notify(VOID (*full_buffer_callback)(VOID *buffer)); 1874 UINT _tx_trace_user_event_insert(ULONG event_id, ULONG info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4); 1875 UINT _tx_trace_interrupt_control(UINT new_posture); 1876 1877 1878 /* Add a default macro that can be re-defined in tx_port.h to add default processing when a thread starts. Common usage 1879 would be for enabling floating point for a thread by default, however, the additional processing could be anything 1880 defined in tx_port.h. */ 1881 1882 #ifndef TX_THREAD_STARTED_EXTENSION 1883 #define TX_THREAD_STARTED_EXTENSION(thread_ptr) 1884 #endif 1885 1886 1887 /* Add a default macro that can be re-defined in tx_port.h to add processing to the thread stack analyze function. 1888 By default, this is simply defined as whitespace. */ 1889 1890 #ifndef TX_THREAD_STACK_ANALYZE_EXTENSION 1891 #define TX_THREAD_STACK_ANALYZE_EXTENSION 1892 #endif 1893 1894 1895 /* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize kernel enter function. 1896 By default, this is simply defined as whitespace. */ 1897 1898 #ifndef TX_INITIALIZE_KERNEL_ENTER_EXTENSION 1899 #define TX_INITIALIZE_KERNEL_ENTER_EXTENSION 1900 #endif 1901 1902 1903 /* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize random number generator. 1904 By default, this is simply defined as whitespace. */ 1905 1906 #ifndef TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION 1907 #define TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION 1908 #endif 1909 1910 1911 /* Define the TX_RAND macro to the standard library function, if not already defined. */ 1912 1913 #ifndef TX_RAND 1914 #define TX_RAND() rand() 1915 #endif 1916 1917 1918 /* Check for MISRA compliance requirements. */ 1919 1920 #ifdef TX_MISRA_ENABLE 1921 1922 /* Define MISRA-specific routines. */ 1923 1924 VOID _tx_misra_memset(VOID *ptr, UINT value, UINT size); 1925 UCHAR *_tx_misra_uchar_pointer_add(UCHAR *ptr, ULONG amount); 1926 UCHAR *_tx_misra_uchar_pointer_sub(UCHAR *ptr, ULONG amount); 1927 ULONG _tx_misra_uchar_pointer_dif(UCHAR *ptr1, UCHAR *ptr2); 1928 ULONG _tx_misra_pointer_to_ulong_convert(VOID *ptr); 1929 ULONG *_tx_misra_ulong_pointer_add(ULONG *ptr, ULONG amount); 1930 ULONG *_tx_misra_ulong_pointer_sub(ULONG *ptr, ULONG amount); 1931 ULONG _tx_misra_ulong_pointer_dif(ULONG *ptr1, ULONG *ptr2); 1932 VOID *_tx_misra_ulong_to_pointer_convert(ULONG input); 1933 VOID _tx_misra_message_copy(ULONG **source, ULONG **destination, UINT size); 1934 ULONG _tx_misra_timer_pointer_dif(TX_TIMER_INTERNAL **ptr1, TX_TIMER_INTERNAL **ptr2); 1935 TX_TIMER_INTERNAL **_tx_misra_timer_pointer_add(TX_TIMER_INTERNAL **ptr1, ULONG size); 1936 VOID _tx_misra_user_timer_pointer_get(TX_TIMER_INTERNAL *internal_timer, TX_TIMER **user_timer); 1937 VOID _tx_misra_thread_stack_check(TX_THREAD *thread_ptr, VOID **highest_stack); 1938 VOID _tx_misra_trace_event_insert(ULONG event_id, VOID *info_field_1, ULONG info_field_2, ULONG info_field_3, ULONG info_field_4, ULONG filter, ULONG time_stamp); 1939 UINT _tx_misra_always_true(void); 1940 UCHAR **_tx_misra_indirect_void_to_uchar_pointer_convert(VOID **pointer); 1941 UCHAR **_tx_misra_uchar_to_indirect_uchar_pointer_convert(UCHAR *pointer); 1942 UCHAR *_tx_misra_block_pool_to_uchar_pointer_convert(TX_BLOCK_POOL *pool); 1943 TX_BLOCK_POOL *_tx_misra_void_to_block_pool_pointer_convert(VOID *pointer); 1944 UCHAR *_tx_misra_void_to_uchar_pointer_convert(VOID *pointer); 1945 TX_BLOCK_POOL *_tx_misra_uchar_to_block_pool_pointer_convert(UCHAR *pointer); 1946 UCHAR **_tx_misra_void_to_indirect_uchar_pointer_convert(VOID *pointer); 1947 TX_BYTE_POOL *_tx_misra_void_to_byte_pool_pointer_convert(VOID *pointer); 1948 UCHAR *_tx_misra_byte_pool_to_uchar_pointer_convert(TX_BYTE_POOL *pool); 1949 ALIGN_TYPE *_tx_misra_uchar_to_align_type_pointer_convert(UCHAR *pointer); 1950 TX_BYTE_POOL **_tx_misra_uchar_to_indirect_byte_pool_pointer_convert(UCHAR *pointer); 1951 TX_EVENT_FLAGS_GROUP *_tx_misra_void_to_event_flags_pointer_convert(VOID *pointer); 1952 ULONG *_tx_misra_void_to_ulong_pointer_convert(VOID *pointer); 1953 TX_MUTEX *_tx_misra_void_to_mutex_pointer_convert(VOID *pointer); 1954 UINT _tx_misra_status_get(UINT status); 1955 TX_QUEUE *_tx_misra_void_to_queue_pointer_convert(VOID *pointer); 1956 TX_SEMAPHORE *_tx_misra_void_to_semaphore_pointer_convert(VOID *pointer); 1957 VOID *_tx_misra_uchar_to_void_pointer_convert(UCHAR *pointer); 1958 TX_THREAD *_tx_misra_ulong_to_thread_pointer_convert(ULONG value); 1959 VOID *_tx_misra_timer_indirect_to_void_pointer_convert(TX_TIMER_INTERNAL **pointer); 1960 CHAR *_tx_misra_const_char_to_char_pointer_convert(const char *pointer); 1961 TX_THREAD *_tx_misra_void_to_thread_pointer_convert(VOID *pointer); 1962 UCHAR *_tx_misra_char_to_uchar_pointer_convert(CHAR *pointer); 1963 VOID _tx_misra_event_flags_group_not_used(TX_EVENT_FLAGS_GROUP *group_ptr); 1964 VOID _tx_misra_event_flags_set_notify_not_used(VOID (*events_set_notify)(TX_EVENT_FLAGS_GROUP *notify_group_ptr)); 1965 VOID _tx_misra_queue_not_used(TX_QUEUE *queue_ptr); 1966 VOID _tx_misra_queue_send_notify_not_used(VOID (*queue_send_notify)(TX_QUEUE *notify_queue_ptr)); 1967 VOID _tx_misra_semaphore_not_used(TX_SEMAPHORE *semaphore_ptr); 1968 VOID _tx_misra_semaphore_put_notify_not_used(VOID (*semaphore_put_notify)(TX_SEMAPHORE *notify_semaphore_ptr)); 1969 VOID _tx_misra_thread_not_used(TX_THREAD *thread_ptr); 1970 VOID _tx_misra_thread_entry_exit_notify_not_used(VOID (*thread_entry_exit_notify)(TX_THREAD *notify_thread_ptr, UINT id)); 1971 1972 #define TX_MEMSET(a,b,c) _tx_misra_memset((a), (UINT) (b), (UINT) (c)) 1973 #define TX_UCHAR_POINTER_ADD(a,b) _tx_misra_uchar_pointer_add((UCHAR *) (a), (ULONG) (b)) 1974 #define TX_UCHAR_POINTER_SUB(a,b) _tx_misra_uchar_pointer_sub((UCHAR *) (a), (ULONG) (b)) 1975 #define TX_UCHAR_POINTER_DIF(a,b) _tx_misra_uchar_pointer_dif((UCHAR *) (a), (UCHAR *) (b)) 1976 #define TX_ULONG_POINTER_ADD(a,b) _tx_misra_ulong_pointer_add((ULONG *) (a), (ULONG) (b)) 1977 #define TX_ULONG_POINTER_SUB(a,b) _tx_misra_ulong_pointer_sub((ULONG *) (a), (ULONG) (b)) 1978 #define TX_ULONG_POINTER_DIF(a,b) _tx_misra_ulong_pointer_dif((ULONG *) (a), (ULONG *) (b)) 1979 #define TX_POINTER_TO_ULONG_CONVERT(a) _tx_misra_pointer_to_ulong_convert((VOID *) (a)) 1980 #define TX_ULONG_TO_POINTER_CONVERT(a) _tx_misra_ulong_to_pointer_convert((ULONG) (a)) 1981 #define TX_QUEUE_MESSAGE_COPY(s,d,z) _tx_misra_message_copy(&(s), &(d), (z)); 1982 #define TX_TIMER_POINTER_DIF(a,b) _tx_misra_timer_pointer_dif((TX_TIMER_INTERNAL **) (a), (TX_TIMER_INTERNAL **) (b)) 1983 #define TX_TIMER_POINTER_ADD(a,b) _tx_misra_timer_pointer_add((TX_TIMER_INTERNAL **) (a), (ULONG) (b)) 1984 #define TX_USER_TIMER_POINTER_GET(a,b) _tx_misra_user_timer_pointer_get((TX_TIMER_INTERNAL *) (a), (TX_TIMER **) &(b)); 1985 #define TX_THREAD_STACK_CHECK(a) _tx_misra_thread_stack_check((a), &((a)->tx_thread_stack_highest_ptr)); 1986 #ifdef TX_ENABLE_EVENT_TRACE 1987 #define TX_TRACE_IN_LINE_INSERT(i,a,b,c,d,e) _tx_misra_trace_event_insert((ULONG) (i), (VOID *) (a), (ULONG) (b), (ULONG) (c), (ULONG) (d), (ULONG) (e), ((ULONG) TX_TRACE_TIME_SOURCE)); 1988 #endif 1989 #define TX_LOOP_FOREVER (_tx_misra_always_true() == TX_TRUE) 1990 #define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_indirect_void_to_uchar_pointer_convert((a)) 1991 #define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) _tx_misra_uchar_to_indirect_uchar_pointer_convert((a)) 1992 #define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_block_pool_to_uchar_pointer_convert((a)) 1993 #define TX_VOID_TO_BLOCK_POOL_POINTER_CONVERT(a) _tx_misra_void_to_block_pool_pointer_convert((a)) 1994 #define TX_VOID_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_void_to_uchar_pointer_convert((a)) 1995 #define TX_UCHAR_TO_BLOCK_POOL_POINTER_CONVERT(a) _tx_misra_uchar_to_block_pool_pointer_convert((a)) 1996 #define TX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) _tx_misra_void_to_indirect_uchar_pointer_convert((a)) 1997 #define TX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a) _tx_misra_void_to_byte_pool_pointer_convert((a)) 1998 #define TX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_byte_pool_to_uchar_pointer_convert((a)) 1999 #define TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a) _tx_misra_uchar_to_align_type_pointer_convert((a)) 2000 #define TX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a) _tx_misra_uchar_to_indirect_byte_pool_pointer_convert((a)) 2001 #define TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(a) _tx_misra_void_to_event_flags_pointer_convert((a)) 2002 #define TX_VOID_TO_ULONG_POINTER_CONVERT(a) _tx_misra_void_to_ulong_pointer_convert((a)) 2003 #define TX_VOID_TO_MUTEX_POINTER_CONVERT(a) _tx_misra_void_to_mutex_pointer_convert((a)) 2004 #define TX_MUTEX_PRIORITIZE_MISRA_EXTENSION(a) _tx_misra_status_get((a)) 2005 #define TX_VOID_TO_QUEUE_POINTER_CONVERT(a) _tx_misra_void_to_queue_pointer_convert((a)) 2006 #define TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(a) _tx_misra_void_to_semaphore_pointer_convert((a)) 2007 #define TX_UCHAR_TO_VOID_POINTER_CONVERT(a) _tx_misra_uchar_to_void_pointer_convert((a)) 2008 #define TX_ULONG_TO_THREAD_POINTER_CONVERT(a) _tx_misra_ulong_to_thread_pointer_convert((a)) 2009 #define TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(a) _tx_misra_timer_indirect_to_void_pointer_convert((a)) 2010 #ifndef TX_TIMER_INITIALIZE_EXTENSION 2011 #define TX_TIMER_INITIALIZE_EXTENSION(a) status = _tx_misra_status_get((a)); 2012 #endif 2013 #define TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT(a) _tx_misra_const_char_to_char_pointer_convert((a)) 2014 #define TX_VOID_TO_THREAD_POINTER_CONVERT(a) _tx_misra_void_to_thread_pointer_convert((a)) 2015 #define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a) _tx_misra_char_to_uchar_pointer_convert((a)) 2016 #define TX_EVENT_FLAGS_GROUP_NOT_USED(a) _tx_misra_event_flags_group_not_used((a)) 2017 #define TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED(a) _tx_misra_event_flags_set_notify_not_used((a)) 2018 #define TX_QUEUE_NOT_USED(a) _tx_misra_queue_not_used((a)) 2019 #define TX_QUEUE_SEND_NOTIFY_NOT_USED(a) _tx_misra_queue_send_notify_not_used((a)) 2020 #define TX_SEMAPHORE_NOT_USED(a) _tx_misra_semaphore_not_used((a)) 2021 #define TX_SEMAPHORE_PUT_NOTIFY_NOT_USED(a) _tx_misra_semaphore_put_notify_not_used((a)) 2022 #define TX_THREAD_NOT_USED(a) _tx_misra_thread_not_used((a)) 2023 #define TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(a) _tx_misra_thread_entry_exit_notify_not_used((a)) 2024 2025 #else 2026 2027 /* Define the TX_MEMSET macro to the standard library function, if not already defined. */ 2028 2029 #ifndef TX_MEMSET 2030 #define TX_MEMSET(a,b,c) memset((a),(b),(c)) 2031 #endif 2032 2033 #define TX_UCHAR_POINTER_ADD(a,b) (((UCHAR *) (a)) + ((UINT) (b))) 2034 #define TX_UCHAR_POINTER_SUB(a,b) (((UCHAR *) (a)) - ((UINT) (b))) 2035 #define TX_UCHAR_POINTER_DIF(a,b) ((ULONG)(((UCHAR *) (a)) - ((UCHAR *) (b)))) 2036 #define TX_ULONG_POINTER_ADD(a,b) (((ULONG *) (a)) + ((UINT) (b))) 2037 #define TX_ULONG_POINTER_SUB(a,b) (((ULONG *) (a)) - ((UINT) (b))) 2038 #define TX_ULONG_POINTER_DIF(a,b) ((ULONG)(((ULONG *) (a)) - ((ULONG *) (b)))) 2039 #define TX_POINTER_TO_ULONG_CONVERT(a) ((ULONG) ((VOID *) (a))) 2040 #define TX_ULONG_TO_POINTER_CONVERT(a) ((VOID *) ((ULONG) (a))) 2041 #define TX_POINTER_TO_ALIGN_TYPE_CONVERT(a) ((ALIGN_TYPE) ((VOID *) (a))) 2042 #define TX_ALIGN_TYPE_TO_POINTER_CONVERT(a) ((VOID *) ((ALIGN_TYPE) (a))) 2043 #define TX_TIMER_POINTER_DIF(a,b) ((ULONG)(((TX_TIMER_INTERNAL **) (a)) - ((TX_TIMER_INTERNAL **) (b)))) 2044 #define TX_TIMER_POINTER_ADD(a,b) (((TX_TIMER_INTERNAL **) (a)) + ((ULONG) (b))) 2045 #define TX_USER_TIMER_POINTER_GET(a,b) { \ 2046 UCHAR *working_ptr; \ 2047 working_ptr = (UCHAR *) (a); \ 2048 (b) = (TX_TIMER *) working_ptr; \ 2049 working_ptr = working_ptr - (((UCHAR *) &(b) -> tx_timer_internal) - ((UCHAR *) &(b) -> tx_timer_id)); \ 2050 (b) = (TX_TIMER *) working_ptr; \ 2051 } 2052 #define TX_LOOP_FOREVER ((UINT) 1) 2053 #define TX_INDIRECT_VOID_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) 2054 #define TX_UCHAR_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) 2055 #define TX_BLOCK_POOL_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) 2056 #define TX_VOID_TO_BLOCK_POOL_POINTER_CONVERT(a) ((TX_BLOCK_POOL *) ((VOID *) (a))) 2057 #define TX_VOID_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) 2058 #define TX_UCHAR_TO_BLOCK_POOL_POINTER_CONVERT(a) ((TX_BLOCK_POOL *) ((VOID *) (a))) 2059 #define TX_VOID_TO_INDIRECT_UCHAR_POINTER_CONVERT(a) ((UCHAR **) ((VOID *) (a))) 2060 #define TX_VOID_TO_BYTE_POOL_POINTER_CONVERT(a) ((TX_BYTE_POOL *) ((VOID *) (a))) 2061 #define TX_BYTE_POOL_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) 2062 #ifndef TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT 2063 #define TX_UCHAR_TO_ALIGN_TYPE_POINTER_CONVERT(a) ((ALIGN_TYPE *) ((VOID *) (a))) 2064 #endif 2065 #define TX_UCHAR_TO_INDIRECT_BYTE_POOL_POINTER(a) ((TX_BYTE_POOL **) ((VOID *) (a))) 2066 #define TX_VOID_TO_EVENT_FLAGS_POINTER_CONVERT(a) ((TX_EVENT_FLAGS_GROUP *) ((VOID *) (a))) 2067 #define TX_VOID_TO_ULONG_POINTER_CONVERT(a) ((ULONG *) ((VOID *) (a))) 2068 #define TX_VOID_TO_MUTEX_POINTER_CONVERT(a) ((TX_MUTEX *) ((VOID *) (a))) 2069 #define TX_VOID_TO_QUEUE_POINTER_CONVERT(a) ((TX_QUEUE *) ((VOID *) (a))) 2070 #define TX_VOID_TO_SEMAPHORE_POINTER_CONVERT(a) ((TX_SEMAPHORE *) ((VOID *) (a))) 2071 #define TX_UCHAR_TO_VOID_POINTER_CONVERT(a) ((VOID *) (a)) 2072 #define TX_ULONG_TO_THREAD_POINTER_CONVERT(a) ((TX_THREAD *) ((VOID *) (a))) 2073 #ifndef TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT 2074 #define TX_TIMER_INDIRECT_TO_VOID_POINTER_CONVERT(a) ((VOID *) (a)) 2075 #endif 2076 #ifndef TX_TIMER_INITIALIZE_EXTENSION 2077 #define TX_TIMER_INITIALIZE_EXTENSION(a) 2078 #endif 2079 #define TX_CONST_CHAR_TO_CHAR_POINTER_CONVERT(a) ((CHAR *) ((VOID *) (a))) 2080 #define TX_VOID_TO_THREAD_POINTER_CONVERT(a) ((TX_THREAD *) ((VOID *) (a))) 2081 #define TX_CHAR_TO_UCHAR_POINTER_CONVERT(a) ((UCHAR *) ((VOID *) (a))) 2082 #ifndef TX_EVENT_FLAGS_GROUP_NOT_USED 2083 #define TX_EVENT_FLAGS_GROUP_NOT_USED(a) ((void)(a)) 2084 #endif 2085 #ifndef TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED 2086 #define TX_EVENT_FLAGS_SET_NOTIFY_NOT_USED(a) ((void)(a)) 2087 #endif 2088 #ifndef TX_QUEUE_NOT_USED 2089 #define TX_QUEUE_NOT_USED(a) ((void)(a)) 2090 #endif 2091 #ifndef TX_QUEUE_SEND_NOTIFY_NOT_USED 2092 #define TX_QUEUE_SEND_NOTIFY_NOT_USED(a) ((void)(a)) 2093 #endif 2094 #ifndef TX_SEMAPHORE_NOT_USED 2095 #define TX_SEMAPHORE_NOT_USED(a) ((void)(a)) 2096 #endif 2097 #ifndef TX_SEMAPHORE_PUT_NOTIFY_NOT_USED 2098 #define TX_SEMAPHORE_PUT_NOTIFY_NOT_USED(a) ((void)(a)) 2099 #endif 2100 #ifndef TX_THREAD_NOT_USED 2101 #define TX_THREAD_NOT_USED(a) ((void)(a)) 2102 #endif 2103 #ifndef TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED 2104 #define TX_THREAD_ENTRY_EXIT_NOTIFY_NOT_USED(a) ((void)(a)) 2105 #endif 2106 2107 #endif 2108 2109 2110 /* Determine if there is an tx_api.h extension file to include. */ 2111 2112 #ifdef TX_THREAD_API_EXTENSION 2113 2114 /* Yes, bring in the tx_api.h extension file. */ 2115 #include "tx_api_extension.h" 2116 2117 #endif 2118 2119 2120 /* Define safety critical configuration and exception handling. */ 2121 2122 #ifdef TX_SAFETY_CRITICAL 2123 2124 /* Ensure the maximum number of priorities is defined in safety critical mode. */ 2125 #ifndef TX_MAX_PRIORITIES 2126 #error "tx_port.h: TX_MAX_PRIORITIES not defined." 2127 #endif 2128 2129 /* Ensure the maximum number of priorities is a multiple of 32. */ 2130 #if (TX_MAX_PRIORITIES %32) != 0 2131 #error "tx_port.h: TX_MAX_PRIORITIES must be a multiple of 32." 2132 #endif 2133 2134 /* Ensure error checking is enabled. */ 2135 #ifdef TX_DISABLE_ERROR_CHECKING 2136 #error "TX_DISABLE_ERROR_CHECKING must not be defined." 2137 #endif 2138 2139 /* Ensure timer ISR processing is not defined. */ 2140 #ifdef TX_TIMER_PROCESS_IN_ISR 2141 #error "TX_TIMER_PROCESS_IN_ISR must not be defined." 2142 #endif 2143 2144 /* Ensure timer reactivation in-line is not defined. */ 2145 #ifdef TX_REACTIVATE_INLINE 2146 #error "TX_REACTIVATE_INLINE must not be defined." 2147 #endif 2148 2149 /* Ensure disable stack filling is not defined. */ 2150 #ifdef TX_DISABLE_STACK_FILLING 2151 #error "TX_DISABLE_STACK_FILLING must not be defined." 2152 #endif 2153 2154 /* Ensure enable stack checking is not defined. */ 2155 #ifdef TX_ENABLE_STACK_CHECKING 2156 #error "TX_ENABLE_STACK_CHECKING must not be defined." 2157 #endif 2158 2159 /* Ensure disable preemption-threshold is not defined. */ 2160 #ifdef TX_DISABLE_PREEMPTION_THRESHOLD 2161 #error "TX_DISABLE_PREEMPTION_THRESHOLD must not be defined." 2162 #endif 2163 2164 /* Ensure disable redundant clearing is not defined. */ 2165 #ifdef TX_DISABLE_REDUNDANT_CLEARING 2166 #error "TX_DISABLE_REDUNDANT_CLEARING must not be defined." 2167 #endif 2168 2169 /* Ensure no timer is not defined. */ 2170 #ifdef TX_NO_TIMER 2171 #error "TX_NO_TIMER must not be defined." 2172 #endif 2173 2174 /* Ensure disable notify callbacks is not defined. */ 2175 #ifdef TX_DISABLE_NOTIFY_CALLBACKS 2176 #error "TX_DISABLE_NOTIFY_CALLBACKS must not be defined." 2177 #endif 2178 2179 /* Ensure in-line thread suspend/resume is not defined. */ 2180 #ifdef TX_INLINE_THREAD_RESUME_SUSPEND 2181 #error "TX_INLINE_THREAD_RESUME_SUSPEND must not be defined." 2182 #endif 2183 2184 /* Ensure not interruptable is not defined. */ 2185 #ifdef TX_NOT_INTERRUPTABLE 2186 #error "TX_NOT_INTERRUPTABLE must not be defined." 2187 #endif 2188 2189 /* Ensure event trace enable is not defined. */ 2190 #ifdef TX_ENABLE_EVENT_TRACE 2191 #error "TX_ENABLE_EVENT_TRACE must not be defined." 2192 #endif 2193 2194 /* Ensure block pool performance info enable is not defined. */ 2195 #ifdef TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO 2196 #error "TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO must not be defined." 2197 #endif 2198 2199 /* Ensure byte pool performance info enable is not defined. */ 2200 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO 2201 #error "TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO must not be defined." 2202 #endif 2203 2204 /* Ensure event flag performance info enable is not defined. */ 2205 #ifdef TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO 2206 #error "TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO must not be defined." 2207 #endif 2208 2209 /* Ensure mutex performance info enable is not defined. */ 2210 #ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO 2211 #error "TX_MUTEX_ENABLE_PERFORMANCE_INFO must not be defined." 2212 #endif 2213 2214 /* Ensure queue performance info enable is not defined. */ 2215 #ifdef TX_QUEUE_ENABLE_PERFORMANCE_INFO 2216 #error "TX_QUEUE_ENABLE_PERFORMANCE_INFO must not be defined." 2217 #endif 2218 2219 /* Ensure semaphore performance info enable is not defined. */ 2220 #ifdef TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO 2221 #error "TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO must not be defined." 2222 #endif 2223 2224 /* Ensure thread performance info enable is not defined. */ 2225 #ifdef TX_THREAD_ENABLE_PERFORMANCE_INFO 2226 #error "TX_THREAD_ENABLE_PERFORMANCE_INFO must not be defined." 2227 #endif 2228 2229 /* Ensure timer performance info enable is not defined. */ 2230 #ifdef TX_TIMER_ENABLE_PERFORMANCE_INFO 2231 #error "TX_TIMER_ENABLE_PERFORMANCE_INFO must not be defined." 2232 #endif 2233 2234 2235 /* Now define the safety critical exception handler. */ 2236 2237 VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status); 2238 2239 2240 #ifndef TX_SAFETY_CRITICAL_EXCEPTION 2241 #define TX_SAFETY_CRITICAL_EXCEPTION(a, b, c) _tx_safety_critical_exception_handler(a, b, c); 2242 #endif 2243 2244 #ifndef TX_SAFETY_CRITICAL_EXCEPTION_HANDLER 2245 #define TX_SAFETY_CRITICAL_EXCEPTION_HANDLER VOID _tx_safety_critical_exception_handler(CHAR *file_name, INT line_number, UINT status) \ 2246 { \ 2247 while(1) \ 2248 { \ 2249 } \ 2250 } 2251 #endif 2252 #endif 2253 2254 2255 #ifdef TX_ENABLE_MULTI_ERROR_CHECKING 2256 2257 /* Define ThreadX API MULTI run-time error checking function. */ 2258 void __ghs_rnerr(char *errMsg, int stackLevels, int stackTraceDisplay, void *hexVal); 2259 2260 #endif 2261 2262 /* Bring in the event logging constants and prototypes. Note that 2263 TX_ENABLE_EVENT_LOGGING must be defined when building the ThreadX 2264 library components in order to enable event logging. */ 2265 2266 #ifdef TX_ENABLE_EVENT_LOGGING 2267 #include "tx_el.h" 2268 #else 2269 #ifndef TX_SOURCE_CODE 2270 #ifndef TX_MISRA_ENABLE 2271 #define _tx_el_user_event_insert(a,b,c,d,e) 2272 #endif 2273 #endif 2274 #define TX_EL_INITIALIZE 2275 #define TX_EL_THREAD_REGISTER(a) 2276 #define TX_EL_THREAD_UNREGISTER(a) 2277 #define TX_EL_THREAD_STATUS_CHANGE_INSERT(a, b) 2278 #define TX_EL_BYTE_ALLOCATE_INSERT 2279 #define TX_EL_BYTE_POOL_CREATE_INSERT 2280 #define TX_EL_BYTE_POOL_DELETE_INSERT 2281 #define TX_EL_BYTE_RELEASE_INSERT 2282 #define TX_EL_BLOCK_ALLOCATE_INSERT 2283 #define TX_EL_BLOCK_POOL_CREATE_INSERT 2284 #define TX_EL_BLOCK_POOL_DELETE_INSERT 2285 #define TX_EL_BLOCK_RELEASE_INSERT 2286 #define TX_EL_EVENT_FLAGS_CREATE_INSERT 2287 #define TX_EL_EVENT_FLAGS_DELETE_INSERT 2288 #define TX_EL_EVENT_FLAGS_GET_INSERT 2289 #define TX_EL_EVENT_FLAGS_SET_INSERT 2290 #define TX_EL_INTERRUPT_CONTROL_INSERT 2291 #define TX_EL_QUEUE_CREATE_INSERT 2292 #define TX_EL_QUEUE_DELETE_INSERT 2293 #define TX_EL_QUEUE_FLUSH_INSERT 2294 #define TX_EL_QUEUE_RECEIVE_INSERT 2295 #define TX_EL_QUEUE_SEND_INSERT 2296 #define TX_EL_SEMAPHORE_CREATE_INSERT 2297 #define TX_EL_SEMAPHORE_DELETE_INSERT 2298 #define TX_EL_SEMAPHORE_GET_INSERT 2299 #define TX_EL_SEMAPHORE_PUT_INSERT 2300 #define TX_EL_THREAD_CREATE_INSERT 2301 #define TX_EL_THREAD_DELETE_INSERT 2302 #define TX_EL_THREAD_IDENTIFY_INSERT 2303 #define TX_EL_THREAD_PREEMPTION_CHANGE_INSERT 2304 #define TX_EL_THREAD_PRIORITY_CHANGE_INSERT 2305 #define TX_EL_THREAD_RELINQUISH_INSERT 2306 #define TX_EL_THREAD_RESUME_INSERT 2307 #define TX_EL_THREAD_SLEEP_INSERT 2308 #define TX_EL_THREAD_SUSPEND_INSERT 2309 #define TX_EL_THREAD_TERMINATE_INSERT 2310 #define TX_EL_THREAD_TIME_SLICE_CHANGE_INSERT 2311 #define TX_EL_TIME_GET_INSERT 2312 #define TX_EL_TIME_SET_INSERT 2313 #define TX_EL_TIMER_ACTIVATE_INSERT 2314 #define TX_EL_TIMER_CHANGE_INSERT 2315 #define TX_EL_TIMER_CREATE_INSERT 2316 #define TX_EL_TIMER_DEACTIVATE_INSERT 2317 #define TX_EL_TIMER_DELETE_INSERT 2318 #define TX_EL_BLOCK_POOL_INFO_GET_INSERT 2319 #define TX_EL_BLOCK_POOL_PRIORITIZE_INSERT 2320 #define TX_EL_BYTE_POOL_INFO_GET_INSERT 2321 #define TX_EL_BYTE_POOL_PRIORITIZE_INSERT 2322 #define TX_EL_EVENT_FLAGS_INFO_GET_INSERT 2323 #define TX_EL_MUTEX_CREATE_INSERT 2324 #define TX_EL_MUTEX_DELETE_INSERT 2325 #define TX_EL_MUTEX_GET_INSERT 2326 #define TX_EL_MUTEX_INFO_GET_INSERT 2327 #define TX_EL_MUTEX_PRIORITIZE_INSERT 2328 #define TX_EL_MUTEX_PUT_INSERT 2329 #define TX_EL_QUEUE_INFO_GET_INSERT 2330 #define TX_EL_QUEUE_FRONT_SEND_INSERT 2331 #define TX_EL_QUEUE_PRIORITIZE_INSERT 2332 #define TX_EL_SEMAPHORE_INFO_GET_INSERT 2333 #define TX_EL_SEMAPHORE_PRIORITIZE_INSERT 2334 #define TX_EL_THREAD_INFO_GET_INSERT 2335 #define TX_EL_THREAD_WAIT_ABORT_INSERT 2336 #define TX_EL_TIMER_INFO_GET_INSERT 2337 #define TX_EL_BLOCK_POOL_PERFORMANCE_INFO_GET_INSERT 2338 #define TX_EL_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2339 #define TX_EL_BYTE_POOL_PERFORMANCE_INFO_GET_INSERT 2340 #define TX_EL_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2341 #define TX_EL_EVENT_FLAGS_PERFORMANCE_INFO_GET_INSERT 2342 #define TX_EL_EVENT_FLAGS__PERFORMANCE_SYSTEM_INFO_GET_INSERT 2343 #define TX_EL_EVENT_FLAGS_SET_NOTIFY_INSERT 2344 #define TX_EL_MUTEX_PERFORMANCE_INFO_GET_INSERT 2345 #define TX_EL_MUTEX_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2346 #define TX_EL_QUEUE_PERFORMANCE_INFO_GET_INSERT 2347 #define TX_EL_QUEUE_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2348 #define TX_EL_QUEUE_SEND_NOTIFY_INSERT 2349 #define TX_EL_SEMAPHORE_CEILING_PUT_INSERT 2350 #define TX_EL_SEMAPHORE_PERFORMANCE_INFO_GET_INSERT 2351 #define TX_EL_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2352 #define TX_EL_SEMAPHORE_PUT_NOTIFY_INSERT 2353 #define TX_EL_THREAD_ENTRY_EXIT_NOTIFY_INSERT 2354 #define TX_EL_THREAD_RESET_INSERT 2355 #define TX_EL_THREAD_PERFORMANCE_INFO_GET_INSERT 2356 #define TX_EL_THREAD_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2357 #define TX_EL_THREAD_STACK_ERROR_NOTIFY_INSERT 2358 #define TX_EL_TIMER_PERFORMANCE_INFO_GET_INSERT 2359 #define TX_EL_TIMER_PERFORMANCE_SYSTEM_INFO_GET_INSERT 2360 2361 #endif 2362 2363 2364 2365 /* Determine if a C++ compiler is being used. If so, complete the standard 2366 C conditional started above. */ 2367 #ifdef __cplusplus 2368 } 2369 #endif 2370 2371 #endif 2372 2373