|
26 | 26 | /* APPLICATION INTERFACE DEFINITION RELEASE */ |
27 | 27 | /* */ |
28 | 28 | /* tx_api.h PORTABLE SMP */ |
29 | | -/* 6.2.1 */ |
| 29 | +/* 6.x */ |
30 | 30 | /* AUTHOR */ |
31 | 31 | /* */ |
32 | 32 | /* William E. Lamie, Microsoft Corporation */ |
|
85 | 85 | /* 03-08-2023 Tiejun Zhou Modified comment(s), */ |
86 | 86 | /* update patch number, */ |
87 | 87 | /* resulting in version 6.2.1 */ |
| 88 | +/* xx-xx-xxxx Xiuwen Cai Modified comment(s), */ |
| 89 | +/* added option for random */ |
| 90 | +/* number stack filling, */ |
| 91 | +/* resulting in version 6.x */ |
88 | 92 | /* */ |
89 | 93 | /**************************************************************************/ |
90 | 94 |
|
@@ -172,7 +176,11 @@ extern "C" { |
172 | 176 | #define TX_NO_MESSAGES ((UINT) 0) |
173 | 177 | #define TX_EMPTY ((ULONG) 0) |
174 | 178 | #define TX_CLEAR_ID ((ULONG) 0) |
| 179 | +#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) |
| 180 | +#define TX_STACK_FILL (thread_ptr -> tx_thread_stack_fill_value) |
| 181 | +#else |
175 | 182 | #define TX_STACK_FILL ((ULONG) 0xEFEFEFEFUL) |
| 183 | +#endif |
176 | 184 |
|
177 | 185 |
|
178 | 186 | /* Thread execution state values. */ |
@@ -639,6 +647,12 @@ typedef struct TX_THREAD_STRUCT |
639 | 647 | cleanup routine executes. */ |
640 | 648 | ULONG tx_thread_suspension_sequence; |
641 | 649 |
|
| 650 | +#if defined(TX_ENABLE_RANDOM_NUMBER_STACK_FILLING) && defined(TX_ENABLE_STACK_CHECKING) |
| 651 | + |
| 652 | + /* Define the random stack fill number. This can be used to detect stack overflow. */ |
| 653 | + ULONG tx_thread_stack_fill_value; |
| 654 | +#endif |
| 655 | + |
642 | 656 | /* Define the user extension field. This typically is defined |
643 | 657 | to white space, but some ports of ThreadX may need to have |
644 | 658 | additional fields in the thread control block. This is |
@@ -1886,6 +1900,21 @@ UINT _tx_trace_interrupt_control(UINT new_posture); |
1886 | 1900 | #endif |
1887 | 1901 |
|
1888 | 1902 |
|
| 1903 | +/* Add a default macro that can be re-defined in tx_port.h to add processing to the initialize random number generator. |
| 1904 | + By default, this is simply defined as whitespace. */ |
| 1905 | + |
| 1906 | +#ifndef TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION |
| 1907 | +#define TX_INITIALIZE_RANDOM_GENERATOR_INITIALIZATION |
| 1908 | +#endif |
| 1909 | + |
| 1910 | + |
| 1911 | +/* Define the TX_RAND macro to the standard library function, if not already defined. */ |
| 1912 | + |
| 1913 | +#ifndef TX_RAND |
| 1914 | +#define TX_RAND() rand() |
| 1915 | +#endif |
| 1916 | + |
| 1917 | + |
1889 | 1918 | /* Check for MISRA compliance requirements. */ |
1890 | 1919 |
|
1891 | 1920 | #ifdef TX_MISRA_ENABLE |
|
0 commit comments