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