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 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   Port Specific                                                       */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 /**************************************************************************/
22 /*                                                                        */
23 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
24 /*                                                                        */
25 /*    gx_port.h                                           Linux/GNU       */
26 /*                                                          6.1.8         */
27 /*  AUTHOR                                                                */
28 /*                                                                        */
29 /*    Kenneth Maxwell, Microsoft Corporation                              */
30 /*                                                                        */
31 /*  DESCRIPTION                                                           */
32 /*                                                                        */
33 /*    This file contains data type definitions and constants specific     */
34 /*    to the implementation of high-performance GUIX UI framework.        */
35 /*                                                                        */
36 /*  RELEASE HISTORY                                                       */
37 /*                                                                        */
38 /*    DATE              NAME                      DESCRIPTION             */
39 /*                                                                        */
40 /*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
41 /*  08-02-2021     Kenneth Maxwell          Modified comment(s), removed  */
42 /*                                            GX_SYSTEM_TIMER_TICKS and   */
43 /*                                            GX_TICKS_SECOND definitions,*/
44 /*                                            resulting in version 6.1.8  */
45 /*                                                                        */
46 /**************************************************************************/
47 
48 #ifndef GX_PORT_H
49 #define GX_PORT_H
50 
51 /* Determine if the optional GUIX user define file should be used.  */
52 
53 #ifdef GX_INCLUDE_USER_DEFINE_FILE
54 
55 /* Include the user defines in gx_user.h. The defines in this file may
56    alternately be defined on the command line.  */
57 
58 #include "gx_user.h"
59 #endif
60 
61 typedef INT    GX_BOOL;
62 
63 typedef SHORT  GX_VALUE;
64 
65 #define GX_VALUE_MAX                        0x7FFF
66 
67 
68 /* Define the basic system parameters.  */
69 
70 #ifndef GX_THREAD_STACK_SIZE
71 #define GX_THREAD_STACK_SIZE                4096
72 #endif
73 
74 #define GX_CONST                            const
75 
76 #define GX_INCLUDE_DEFAULT_COLORS
77 
78 #define GX_MAX_ACTIVE_TIMERS                32
79 
80 #define GX_MAX_VIEWS                        32
81 
82 #define GX_MAX_DISPLAY_HEIGHT               800
83 
84 
85 /* Define several macros for the error checking shell in GUIX.  */
86 
87 #ifndef TX_TIMER_PROCESS_IN_ISR
88 
89 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
90                                             extern  TX_THREAD           _tx_timer_thread; \
91                                             extern  volatile ULONG      _tx_thread_system_state;
92 
93 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
94                                                 (_tx_thread_current_ptr == TX_NULL) || \
95                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
96                                                 return(GX_CALLER_ERROR);
97 
98 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) || \
99                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
100                                                 return(GX_CALLER_ERROR);
101 
102 
103 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
104                                                 return(GX_CALLER_ERROR);
105 
106 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
107                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
108                                             return(GX_CALLER_ERROR);
109 
110 
111 #else
112 
113 
114 
115 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
116                                             extern  volatile ULONG      _tx_thread_system_state;
117 
118 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
119                                                 (_tx_thread_current_ptr == TX_NULL)) \
120                                                 return(GX_CALLER_ERROR);
121 
122 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0)))) \
123                                                 return(GX_CALLER_ERROR);
124 
125 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
126                                                 return(GX_CALLER_ERROR);
127 
128 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
129                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state))) \
130                                             return(GX_CALLER_ERROR);
131 
132 #endif
133 
134 
135 /* Define the version ID of GUIX.  This may be utilized by the application.  */
136 
137 #ifdef GX_SYSTEM_INIT
138 CHAR _gx_version_id[] =
139     "Copyright (c) 2024 Microsoft Corporation.  *  GUIX Linux/GNU Version 6.4.1 *";
140 #else
141 extern  CHAR _gx_version_id[];
142 #endif
143 
144 #endif
145 
146