1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** ThreadX Component                                                     */
17 /**                                                                       */
18 /**   Port Specific                                                       */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  PORT SPECIFIC C INFORMATION                            RELEASE        */
27 /*                                                                        */
28 /*    tx_port.h                                           Linux/GNU       */
29 /*                                                           6.1.11       */
30 /*                                                                        */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    William E. Lamie, Microsoft Corporation                             */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This file contains data type definitions that make the ThreadX      */
38 /*    real-time kernel function identically on a variety of different     */
39 /*    processor architectures.  For example, the size or number of bits   */
40 /*    in an "int" data type vary between microprocessor architectures and */
41 /*    even C compilers for the same microprocessor.  ThreadX does not     */
42 /*    directly use native C data types.  Instead, ThreadX creates its     */
43 /*    own special types that can be mapped to actual data types by this   */
44 /*    file to guarantee consistency in the interface and functionality.   */
45 /*                                                                        */
46 /*  RELEASE HISTORY                                                       */
47 /*                                                                        */
48 /*    DATE              NAME                      DESCRIPTION             */
49 /*                                                                        */
50 /*  09-30-2020     William E. Lamie         Initial Version 6.1           */
51 /*  10-15-2021     William E. Lamie         Modified comment(s), added    */
52 /*                                            symbol ULONG64_DEFINED,     */
53 /*                                            resulting in version 6.1.9  */
54 /*  04-25-2022     William E. Lamie         Modified comment(s), removed  */
55 /*                                            useless definition,         */
56 /*                                            resulting in version 6.1.11 */
57 /*                                                                        */
58 /**************************************************************************/
59 
60 #ifndef TX_PORT_H
61 #define TX_PORT_H
62 
63 
64 #define TX_MAX_PRIORITIES                       32
65 /* #define TX_MISRA_ENABLE  */
66 
67 
68 /* #define TX_INLINE_INITIALIZATION */
69 
70 /* #define TX_NOT_INTERRUPTABLE  */
71 /* #define TX_TIMER_PROCESS_IN_ISR */
72 /* #define TX_REACTIVATE_INLINE */
73 /* #define TX_DISABLE_STACK_FILLING */
74 /* #define TX_ENABLE_STACK_CHECKING */
75 /* #define TX_DISABLE_PREEMPTION_THRESHOLD */
76 /* #define TX_DISABLE_REDUNDANT_CLEARING */
77 /* #define TX_DISABLE_NOTIFY_CALLBACKS */
78 /* #define TX_INLINE_THREAD_RESUME_SUSPEND */
79 /* #define TX_ENABLE_EVENT_TRACE */
80 
81 
82 /* For MISRA, define enable performance info. Also, for MISRA TX_DISABLE_NOTIFY_CALLBACKS should not be defined.  */
83 
84 
85 /* #define TX_BLOCK_POOL_ENABLE_PERFORMANCE_INFO
86 #define TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
87 #define TX_EVENT_FLAGS_ENABLE_PERFORMANCE_INFO
88 #define TX_MUTEX_ENABLE_PERFORMANCE_INFO
89 #define TX_QUEUE_ENABLE_PERFORMANCE_INFO
90 #define TX_SEMAPHORE_ENABLE_PERFORMANCE_INFO
91 #define TX_THREAD_ENABLE_PERFORMANCE_INFO
92 #define TX_TIMER_ENABLE_PERFORMANCE_INFO */
93 
94 
95 
96 /* Determine if the optional ThreadX user define file should be used.  */
97 
98 #ifdef TX_INCLUDE_USER_DEFINE_FILE
99 
100 
101 /* Yes, include the user defines in tx_user.h. The defines in this file may
102    alternately be defined on the command line.  */
103 
104 #include "tx_user.h"
105 #endif
106 
107 
108 /* Define compiler library include files.  */
109 
110 #include <stdlib.h>
111 #include <string.h>
112 #include <stdint.h>
113 #ifndef __USE_POSIX199309
114 #define __USE_POSIX199309
115 #include <pthread.h>
116 #include <semaphore.h>
117 #include <time.h>
118 #undef __USE_POSIX199309
119 #else /* __USE_POSIX199309 */
120 #include <pthread.h>
121 #include <semaphore.h>
122 #include <time.h>
123 #endif /* __USE_POSIX199309 */
124 
125 
126 /* Define ThreadX basic types for this port.  */
127 
128 typedef void                                    VOID;
129 typedef char                                    CHAR;
130 typedef unsigned char                           UCHAR;
131 typedef int                                     INT;
132 typedef unsigned int                            UINT;
133 #if __x86_64__
134 typedef int                                     LONG;
135 typedef unsigned int                            ULONG;
136 #else /* __x86_64__ */
137 typedef long                                    LONG;
138 typedef unsigned long                           ULONG;
139 #endif /* __x86_64__ */
140 typedef short                                   SHORT;
141 typedef unsigned short                          USHORT;
142 typedef uint64_t                                ULONG64;
143 #define ULONG64_DEFINED
144 
145 /* Override the alignment type to use 64-bit alignment and storage for pointers.  */
146 
147 #if __x86_64__
148 #define ALIGN_TYPE_DEFINED
149 typedef unsigned long long                      ALIGN_TYPE;
150 
151 /* Override the free block marker for byte pools to be a 64-bit constant.   */
152 
153 #define TX_BYTE_BLOCK_FREE                      ((ALIGN_TYPE) 0xFFFFEEEEFFFFEEEE)
154 #endif
155 
156 /* Define automated coverage test extensions...  These are required for the
157    ThreadX regression test.  */
158 
159 typedef unsigned int    TEST_FLAG;
160 extern TEST_FLAG        threadx_byte_allocate_loop_test;
161 extern TEST_FLAG        threadx_byte_release_loop_test;
162 extern TEST_FLAG        threadx_mutex_suspension_put_test;
163 extern TEST_FLAG        threadx_mutex_suspension_priority_test;
164 #ifndef TX_TIMER_PROCESS_IN_ISR
165 extern TEST_FLAG        threadx_delete_timer_thread;
166 #endif
167 
168 extern void             abort_and_resume_byte_allocating_thread(void);
169 extern void             abort_all_threads_suspended_on_mutex(void);
170 extern void             suspend_lowest_priority(void);
171 #ifndef TX_TIMER_PROCESS_IN_ISR
172 extern void             delete_timer_thread(void);
173 #endif
174 extern TEST_FLAG        test_stack_analyze_flag;
175 extern TEST_FLAG        test_initialize_flag;
176 extern TEST_FLAG        test_forced_mutex_timeout;
177 
178 
179 #ifdef TX_REGRESSION_TEST
180 
181 /* Define extension macros for automated coverage tests.  */
182 
183 
184 #define TX_BYTE_ALLOCATE_EXTENSION              if (threadx_byte_allocate_loop_test == ((TEST_FLAG) 1))         \
185                                                 {                                                               \
186                                                     pool_ptr -> tx_byte_pool_owner =  TX_NULL;                  \
187                                                     threadx_byte_allocate_loop_test = ((TEST_FLAG) 0);          \
188                                                 }
189 
190 #define TX_BYTE_RELEASE_EXTENSION               if (threadx_byte_release_loop_test == ((TEST_FLAG) 1))          \
191                                                 {                                                               \
192                                                     threadx_byte_release_loop_test = ((TEST_FLAG) 0);           \
193                                                     abort_and_resume_byte_allocating_thread();                  \
194                                                 }
195 
196 #define TX_MUTEX_PUT_EXTENSION_1                if (threadx_mutex_suspension_put_test == ((TEST_FLAG) 1))       \
197                                                 {                                                               \
198                                                     threadx_mutex_suspension_put_test = ((TEST_FLAG) 0);        \
199                                                     abort_all_threads_suspended_on_mutex();                     \
200                                                 }
201 
202 
203 #define TX_MUTEX_PUT_EXTENSION_2                if (test_forced_mutex_timeout == ((TEST_FLAG) 1))               \
204                                                 {                                                               \
205                                                     test_forced_mutex_timeout = ((TEST_FLAG) 0);                \
206                                                     _tx_thread_wait_abort(mutex_ptr -> tx_mutex_suspension_list); \
207                                                 }
208 
209 
210 #define TX_MUTEX_PRIORITY_CHANGE_EXTENSION      if (threadx_mutex_suspension_priority_test == ((TEST_FLAG) 1))  \
211                                                 {                                                               \
212                                                     threadx_mutex_suspension_priority_test = ((TEST_FLAG) 0);   \
213                                                     suspend_lowest_priority();                                  \
214                                                 }
215 
216 #ifndef TX_TIMER_PROCESS_IN_ISR
217 
218 #define TX_TIMER_INITIALIZE_EXTENSION(a)        if (threadx_delete_timer_thread == ((TEST_FLAG) 1))             \
219                                                 {                                                               \
220                                                     threadx_delete_timer_thread = ((TEST_FLAG) 0);              \
221                                                     delete_timer_thread();                                      \
222                                                     (a) =  ((UINT) 1);                                          \
223                                                 }
224 
225 #endif
226 
227 #define TX_THREAD_STACK_ANALYZE_EXTENSION       if (test_stack_analyze_flag == ((TEST_FLAG) 1))                 \
228                                                 {                                                               \
229                                                     thread_ptr -> tx_thread_id =  ((TEST_FLAG) 0);              \
230                                                     test_stack_analyze_flag =     ((TEST_FLAG) 0);              \
231                                                 }                                                               \
232                                                 else if (test_stack_analyze_flag == ((TEST_FLAG) 2))            \
233                                                 {                                                               \
234                                                     stack_ptr =  thread_ptr -> tx_thread_stack_start;           \
235                                                     test_stack_analyze_flag =     ((TEST_FLAG) 0);              \
236                                                 }                                                               \
237                                                 else if (test_stack_analyze_flag == ((TEST_FLAG) 3))            \
238                                                 {                                                               \
239                                                     *stack_ptr =  TX_STACK_FILL;                                \
240                                                     test_stack_analyze_flag =     ((TEST_FLAG) 0);              \
241                                                 }                                                               \
242                                                 else                                                            \
243                                                 {                                                               \
244                                                     test_stack_analyze_flag =     ((TEST_FLAG) 0);              \
245                                                 }
246 
247 #define TX_INITIALIZE_KERNEL_ENTER_EXTENSION    if (test_initialize_flag == ((TEST_FLAG) 1))                    \
248                                                 {                                                               \
249                                                     test_initialize_flag =  ((TEST_FLAG) 0);                    \
250                                                     return;                                                     \
251                                                 }
252 
253 #endif
254 
255 
256 
257 /* Add Linux debug insert prototype.  */
258 
259 void    _tx_linux_debug_entry_insert(char *action, char *file, unsigned long line);
260 
261 #ifndef TX_LINUX_DEBUG_ENABLE
262 
263 /* If Linux debug is not enabled, turn logging into white-space.  */
264 
265 #define _tx_linux_debug_entry_insert(a, b, c)
266 
267 #endif
268 
269 
270 
271 /* Define the TX_MEMSET macro to remove library reference.  */
272 
273 #ifndef TX_MISRA_ENABLE
274 #define TX_MEMSET(a,b,c)                        {                                       \
275                                                 UCHAR *ptr;                             \
276                                                 UCHAR value;                            \
277                                                 UINT  i, size;                          \
278                                                     ptr =    (UCHAR *) ((VOID *) a);    \
279                                                     value =  (UCHAR) b;                 \
280                                                     size =   (UINT) c;                  \
281                                                     for (i = 0; i < size; i++)          \
282                                                     {                                   \
283                                                         *ptr++ =  value;                \
284                                                     }                                   \
285                                                 }
286 #endif
287 
288 
289 /* Define the priority levels for ThreadX.  Legal values range
290    from 32 to 1024 and MUST be evenly divisible by 32.  */
291 
292 #ifndef TX_MAX_PRIORITIES
293 #define TX_MAX_PRIORITIES                       32
294 #endif
295 
296 
297 /* Define the minimum stack for a ThreadX thread on this processor. If the size supplied during
298    thread creation is less than this value, the thread create call will return an error.  */
299 
300 #ifndef TX_MINIMUM_STACK
301 #define TX_MINIMUM_STACK                        200         /* Minimum stack size for this port */
302 #endif
303 
304 
305 /* Define the system timer thread's default stack size and priority.  These are only applicable
306    if TX_TIMER_PROCESS_IN_ISR is not defined.  */
307 
308 #ifndef TX_TIMER_THREAD_STACK_SIZE
309 #define TX_TIMER_THREAD_STACK_SIZE              400         /* Default timer thread stack size - Not used in Linux port!  */
310 #endif
311 
312 #ifndef TX_TIMER_THREAD_PRIORITY
313 #define TX_TIMER_THREAD_PRIORITY                0           /* Default timer thread priority    */
314 #endif
315 
316 
317 /* Define various constants for the ThreadX  port.  */
318 
319 #define TX_INT_DISABLE                          1           /* Disable interrupts               */
320 #define TX_INT_ENABLE                           0           /* Enable interrupts                */
321 
322 
323 /* Define the clock source for trace event entry time stamp. The following two item are port specific.
324    For example, if the time source is at the address 0x0a800024 and is 16-bits in size, the clock
325    source constants would be:
326 
327 #define TX_TRACE_TIME_SOURCE                    *((ULONG *) 0x0a800024)
328 #define TX_TRACE_TIME_MASK                      0x0000FFFFUL
329 
330 */
331 
332 #ifndef TX_MISRA_ENABLE
333 #ifndef TX_TRACE_TIME_SOURCE
334 #define TX_TRACE_TIME_SOURCE                    ((ULONG) (_tx_linux_time_stamp.tv_nsec));
335 #endif
336 #else
337 ULONG   _tx_misra_time_stamp_get(VOID);
338 #define TX_TRACE_TIME_SOURCE                    _tx_misra_time_stamp_get()
339 #endif
340 
341 #ifndef TX_TRACE_TIME_MASK
342 #define TX_TRACE_TIME_MASK                      0xFFFFFFFFUL
343 #endif
344 
345 
346 /* Define the port-specific trace extension to pickup the Windows timer.  */
347 
348 #define TX_TRACE_PORT_EXTENSION                 clock_gettime(CLOCK_REALTIME, &_tx_linux_time_stamp);
349 
350 
351 /* Define the port specific options for the _tx_build_options variable. This variable indicates
352    how the ThreadX library was built.  */
353 
354 #define TX_PORT_SPECIFIC_BUILD_OPTIONS          0
355 
356 
357 /* Define the in-line initialization constant so that modules with in-line
358    initialization capabilities can prevent their initialization from being
359    a function call.  */
360 
361 #ifdef TX_MISRA_ENABLE
362 #define TX_DISABLE_INLINE
363 #else
364 #define TX_INLINE_INITIALIZATION
365 #endif
366 
367 
368 /* Define the Linux-specific initialization code that is expanded in the generic source.  */
369 
370 void    _tx_initialize_start_interrupts(void);
371 
372 #define TX_PORT_SPECIFIC_PRE_SCHEDULER_INITIALIZATION                       _tx_initialize_start_interrupts();
373 
374 
375 /* Determine whether or not stack checking is enabled. By default, ThreadX stack checking is
376    disabled. When the following is defined, ThreadX thread stack checking is enabled.  If stack
377    checking is enabled (TX_ENABLE_STACK_CHECKING is defined), the TX_DISABLE_STACK_FILLING
378    define is negated, thereby forcing the stack fill which is necessary for the stack checking
379    logic.  */
380 
381 #ifndef TX_MISRA_ENABLE
382 #ifdef TX_ENABLE_STACK_CHECKING
383 #undef TX_DISABLE_STACK_FILLING
384 #endif
385 #endif
386 
387 
388 /* Define the TX_THREAD control block extensions for this port. The main reason
389    for the multiple macros is so that backward compatibility can be maintained with
390    existing ThreadX kernel awareness modules.  */
391 
392 #define TX_THREAD_EXTENSION_0                                               pthread_t   tx_thread_linux_thread_id; \
393                                                                             sem_t       tx_thread_linux_thread_run_semaphore; \
394                                                                             UINT        tx_thread_linux_suspension_type; \
395                                                                             UINT        tx_thread_linux_int_disabled_flag;
396 
397 #define TX_THREAD_EXTENSION_1                                               VOID       *tx_thread_extension_ptr;
398 #define TX_THREAD_EXTENSION_2
399 #define TX_THREAD_EXTENSION_3
400 
401 
402 /* Define the port extensions of the remaining ThreadX objects.  */
403 
404 #define TX_BLOCK_POOL_EXTENSION
405 #define TX_BYTE_POOL_EXTENSION
406 #define TX_EVENT_FLAGS_GROUP_EXTENSION
407 #define TX_MUTEX_EXTENSION
408 #define TX_QUEUE_EXTENSION
409 #define TX_SEMAPHORE_EXTENSION
410 #define TX_TIMER_EXTENSION
411 
412 
413 /* Define the user extension field of the thread control block.  Nothing
414    additional is needed for this port so it is defined as white space.  */
415 
416 #ifndef TX_THREAD_USER_EXTENSION
417 #define TX_THREAD_USER_EXTENSION
418 #endif
419 
420 
421 /* Define the macros for processing extensions in tx_thread_create, tx_thread_delete,
422    tx_thread_shell_entry, and tx_thread_terminate.  */
423 
424 
425 #define TX_THREAD_CREATE_EXTENSION(thread_ptr)
426 #define TX_THREAD_DELETE_EXTENSION(thread_ptr)
427 #define TX_THREAD_COMPLETED_EXTENSION(thread_ptr)
428 #define TX_THREAD_TERMINATED_EXTENSION(thread_ptr)
429 
430 
431 /* Define the ThreadX object creation extensions for the remaining objects.  */
432 
433 #define TX_BLOCK_POOL_CREATE_EXTENSION(pool_ptr)
434 #define TX_BYTE_POOL_CREATE_EXTENSION(pool_ptr)
435 #define TX_EVENT_FLAGS_GROUP_CREATE_EXTENSION(group_ptr)
436 #define TX_MUTEX_CREATE_EXTENSION(mutex_ptr)
437 #define TX_QUEUE_CREATE_EXTENSION(queue_ptr)
438 #define TX_SEMAPHORE_CREATE_EXTENSION(semaphore_ptr)
439 #define TX_TIMER_CREATE_EXTENSION(timer_ptr)
440 
441 
442 /* Define the ThreadX object deletion extensions for the remaining objects.  */
443 
444 #define TX_BLOCK_POOL_DELETE_EXTENSION(pool_ptr)
445 #define TX_BYTE_POOL_DELETE_EXTENSION(pool_ptr)
446 #define TX_EVENT_FLAGS_GROUP_DELETE_EXTENSION(group_ptr)
447 #define TX_MUTEX_DELETE_EXTENSION(mutex_ptr)
448 #define TX_QUEUE_DELETE_EXTENSION(queue_ptr)
449 #define TX_SEMAPHORE_DELETE_EXTENSION(semaphore_ptr)
450 #define TX_TIMER_DELETE_EXTENSION(timer_ptr)
451 
452 struct TX_THREAD_STRUCT;
453 
454 /* Define post completion processing for tx_thread_delete, so that the Linux thread resources are properly removed.  */
455 
456 void _tx_thread_delete_port_completion(struct TX_THREAD_STRUCT *thread_ptr, UINT tx_saved_posture);
457 #define TX_THREAD_DELETE_PORT_COMPLETION(thread_ptr) _tx_thread_delete_port_completion(thread_ptr, tx_saved_posture);
458 
459 /* Define post completion processing for tx_thread_reset, so that the Linux thread resources are properly removed.  */
460 
461 void _tx_thread_reset_port_completion(struct TX_THREAD_STRUCT *thread_ptr, UINT tx_saved_posture);
462 #define TX_THREAD_RESET_PORT_COMPLETION(thread_ptr) _tx_thread_reset_port_completion(thread_ptr, tx_saved_posture);
463 
464 #if __x86_64__
465 /* Define the ThreadX object deletion extensions for the remaining objects.  */
466 
467 #define TX_BLOCK_POOL_DELETE_EXTENSION(pool_ptr)
468 #define TX_BYTE_POOL_DELETE_EXTENSION(pool_ptr)
469 #define TX_EVENT_FLAGS_GROUP_DELETE_EXTENSION(group_ptr)
470 #define TX_MUTEX_DELETE_EXTENSION(mutex_ptr)
471 #define TX_QUEUE_DELETE_EXTENSION(queue_ptr)
472 #define TX_SEMAPHORE_DELETE_EXTENSION(semaphore_ptr)
473 #define TX_TIMER_DELETE_EXTENSION(timer_ptr)
474 
475 /* Define the internal timer extension to also hold the thread pointer such that _tx_thread_timeout
476    can figure out what thread timeout to process.  */
477 
478 #define TX_TIMER_INTERNAL_EXTENSION             VOID    *tx_timer_internal_extension_ptr;
479 
480 
481 /* Define the thread timeout setup logic in _tx_thread_create.  */
482 
483 #define TX_THREAD_CREATE_TIMEOUT_SETUP(t)    (t) -> tx_thread_timer.tx_timer_internal_timeout_function =    &(_tx_thread_timeout);            \
484                                              (t) -> tx_thread_timer.tx_timer_internal_timeout_param =       0;                                \
485                                              (t) -> tx_thread_timer.tx_timer_internal_extension_ptr =       (VOID *) (t);
486 
487 
488 /* Define the thread timeout pointer setup in _tx_thread_timeout.  */
489 
490 #define TX_THREAD_TIMEOUT_POINTER_SETUP(t)   (t) =  (TX_THREAD *) _tx_timer_expired_timer_ptr -> tx_timer_internal_extension_ptr;
491 #endif /* __x86_64__ */
492 
493 
494 /* Define ThreadX interrupt lockout and restore macros for protection on
495    access of critical kernel information.  The restore interrupt macro must
496    restore the interrupt posture of the running thread prior to the value
497    present prior to the disable macro.  In most cases, the save area macro
498    is used to define a local function save area for the disable and restore
499    macros.  */
500 
501 UINT   _tx_thread_interrupt_disable(void);
502 VOID   _tx_thread_interrupt_restore(UINT previous_posture);
503 
504 #define TX_INTERRUPT_SAVE_AREA      UINT    tx_saved_posture;
505 
506 #ifndef TX_LINUX_DEBUG_ENABLE
507 #define TX_DISABLE                          tx_saved_posture =   _tx_thread_interrupt_disable();
508 #define TX_RESTORE                          _tx_thread_interrupt_restore(tx_saved_posture);
509 #else
510 #define TX_DISABLE                          _tx_linux_debug_entry_insert("DISABLE", __FILE__, __LINE__); \
511                                             tx_saved_posture =   _tx_thread_interrupt_disable();
512 
513 #define TX_RESTORE                          _tx_linux_debug_entry_insert("RESTORE", __FILE__, __LINE__); \
514                                             _tx_thread_interrupt_restore(tx_saved_posture);
515 #endif /* TX_LINUX_DEBUG_ENABLE */
516 #define tx_linux_mutex_lock(p)              pthread_mutex_lock(&p)
517 #define tx_linux_mutex_unlock(p)            pthread_mutex_unlock(&p)
518 #define tx_linux_mutex_recursive_unlock(p)  {\
519                                                 int _recursive_count = (int)tx_linux_mutex_recursive_count;\
520                                                 while(_recursive_count)\
521                                                 {\
522                                                     pthread_mutex_unlock(&p);\
523                                                     _recursive_count--;\
524                                                 }\
525                                             }
526 #define tx_linux_mutex_recursive_count      _tx_linux_mutex.__data.__count
527 #define tx_linux_sem_post(p)                tx_linux_mutex_lock(_tx_linux_mutex);\
528                                             sem_post(p);\
529                                             tx_linux_mutex_unlock(_tx_linux_mutex)
530 #define tx_linux_sem_post_nolock(p)         sem_post(p)
531 #define tx_linux_sem_wait(p)                sem_wait(p)
532 
533 
534 /* Define the interrupt lockout macros for each ThreadX object.  */
535 
536 #define TX_BLOCK_POOL_DISABLE               TX_DISABLE
537 #define TX_BYTE_POOL_DISABLE                TX_DISABLE
538 #define TX_EVENT_FLAGS_GROUP_DISABLE        TX_DISABLE
539 #define TX_MUTEX_DISABLE                    TX_DISABLE
540 #define TX_QUEUE_DISABLE                    TX_DISABLE
541 #define TX_SEMAPHORE_DISABLE                TX_DISABLE
542 
543 
544 /* Define the version ID of ThreadX.  This may be utilized by the application.  */
545 
546 #ifdef TX_THREAD_INIT
547 CHAR                            _tx_version_id[] =
548                                     "Copyright (c) Microsoft Corporation * ThreadX Linux/gcc Version 6.2.1 *";
549 #else
550 extern  CHAR                    _tx_version_id[];
551 #endif
552 
553 
554 /* Define externals for the Linux port of ThreadX.  */
555 
556 extern pthread_mutex_t                          _tx_linux_mutex;
557 extern sem_t                                    _tx_linux_semaphore;
558 extern sem_t                                    _tx_linux_semaphore_no_idle;
559 extern ULONG                                    _tx_linux_global_int_disabled_flag;
560 extern struct timespec                          _tx_linux_time_stamp;
561 extern __thread int                             _tx_linux_threadx_thread;
562 
563 /* Define functions for linux thread. */
564 void    _tx_linux_thread_suspend(pthread_t thread_id);
565 void    _tx_linux_thread_resume(pthread_t thread_id);
566 void    _tx_linux_thread_init();
567 
568 #ifndef TX_LINUX_MEMORY_SIZE
569 #define TX_LINUX_MEMORY_SIZE                    64000
570 #endif
571 
572 /* Define priorities of pthreads. */
573 
574 #define TX_LINUX_PRIORITY_SCHEDULE              (3)
575 #define TX_LINUX_PRIORITY_ISR                   (2)
576 #define TX_LINUX_PRIORITY_USER_THREAD           (1)
577 
578 #endif
579 
580