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 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Port Specific                                                       */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 /**************************************************************************/
23 /*                                                                        */
24 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
25 /*                                                                        */
26 /*    gx_port.h                                          Win32/Visual     */
27 /*                                                           6.1.10       */
28 /*  AUTHOR                                                                */
29 /*                                                                        */
30 /*    Kenneth Maxwell, Microsoft Corporation                              */
31 /*                                                                        */
32 /*  DESCRIPTION                                                           */
33 /*                                                                        */
34 /*    This file contains data type definitions and constants specific     */
35 /*    to the implementation of high-performance GUIX UI framework.        */
36 /*                                                                        */
37 /*  RELEASE HISTORY                                                       */
38 /*                                                                        */
39 /*    DATE              NAME                      DESCRIPTION             */
40 /*                                                                        */
41 /*  09-30-2020     Kenneth Maxwell          Initial Version 6.1           */
42 /*  12-31-2020     Kenneth Maxwell          Modified comment(s),          */
43 /*                                            added new defines,          */
44 /*                                            resulting in version 6.1.3  */
45 /*  04-02-2021     Kenneth Maxwell          Modified comment(s),          */
46 /*                                            added new defines,          */
47 /*                                            resulting in version 6.1.6  */
48 /*  06-02-2021     Kenneth Maxwell          Modified comment(s),          */
49 /*                                            defined GX_DISABLE_THREADX_ */
50 /*                                            TIMER_SOURCE,               */
51 /*                                            resulting in version 6.1.7  */
52 /*  08-02-2021     Kenneth Maxwell          Modified comment(s), removed  */
53 /*                                            GX_SYSTEM_TIMER_TICKS and   */
54 /*                                            GX_TICKS_SECOND definitions,*/
55 /*                                            resulting in version 6.1.8  */
56 /*  01-31-2022     Ting Zhu                 Modified comment(s), modified */
57 /*                                            event thread create logic,  */
58 /*                                            resulting in version 6.1.10 */
59 /*                                                                        */
60 /**************************************************************************/
61 
62 #ifndef GX_PORT_H
63 #define GX_PORT_H
64 
65 /* define target for build */
66 #define GX_TARGET_WIN32
67 
68 /* Determine if the optional GUIX user define file should be used.  */
69 
70 #ifdef GX_INCLUDE_USER_DEFINE_FILE
71 
72 /* Include the user defines in gx_user.h. The defines in this file may
73    alternately be defined on the command line.  */
74 
75 #include "gx_user.h"
76 #endif
77 
78 typedef INT    GX_BOOL;
79 
80 typedef SHORT  GX_VALUE;
81 
82 /* Disable ThreadX timer.  */
83 #define GX_DISABLE_THREADX_TIMER_SOURCE
84 
85 #define GX_VALUE_MAX                        0x7FFF
86 
87 /* For the win32 port, the entry point is WinMain, which is defined
88    in the win32 driver file.  The entry point for GUIX demo is gx_main(). */
89 
90 #define main(a, b)                          gx_main(a, b)
91 
92 #define GX_WIDGET_USER_DATA
93 
94 /* Define Win32 event thread create. */
95 #define GX_WIN32_EVENT_THREAD_CREATE(driver_data, thread_name) driver_data->win32_driver_thread_handle = CreateThread(NULL, GX_WIN32_STACK_SIZE, (LPTHREAD_START_ROUTINE)gx_win32_driver_thread_entry, driver_data, 0, 0);
96 
97 /* Define Win32 event thread exit. */
98 #define GX_WIN32_EVENT_THREAD_EXIT(code)                       exit(code)
99 
100 #define GX_WIN32_DISPLAY_DRIVER_EXTRA_MEMBERS_DECLEARE
101 
102 /* Define the basic system parameters.  */
103 
104 #ifndef GX_THREAD_STACK_SIZE
105 #define GX_THREAD_STACK_SIZE                4096
106 #endif
107 
108 #define GX_CONST                            const
109 
110 #define GX_INCLUDE_DEFAULT_COLORS
111 
112 #define GX_MAX_ACTIVE_TIMERS                32
113 
114 #define GX_MAX_VIEWS                        32
115 
116 #define GX_MAX_DISPLAY_HEIGHT               800
117 
118 
119 /* Define several macros for the error checking shell in GUIX.  */
120 
121 #ifndef TX_TIMER_PROCESS_IN_ISR
122 
123 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
124                                             extern  TX_THREAD           _tx_timer_thread; \
125                                             extern  volatile ULONG      _tx_thread_system_state;
126 
127 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
128                                                 (_tx_thread_current_ptr == TX_NULL) || \
129                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
130                                                 return(GX_CALLER_ERROR);
131 
132 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) || \
133                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
134                                                 return(GX_CALLER_ERROR);
135 
136 
137 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
138                                                 return(GX_CALLER_ERROR);
139 
140 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
141                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
142                                             return(GX_CALLER_ERROR);
143 
144 
145 #else
146 
147 
148 
149 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
150                                             extern  volatile ULONG      _tx_thread_system_state;
151 
152 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((_tx_thread_system_state) || \
153                                                 (_tx_thread_current_ptr == TX_NULL)) \
154                                                 return(GX_CALLER_ERROR);
155 
156 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0)))) \
157                                                 return(GX_CALLER_ERROR);
158 
159 #define GX_NOT_ISR_CALLER_CHECKING          if ((_tx_thread_system_state) && (_tx_thread_system_state < ((ULONG) 0xF0F0F0F0))) \
160                                                 return(GX_CALLER_ERROR);
161 
162 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
163                                                ((_tx_thread_current_ptr == NX_NULL) || (_tx_thread_system_state))) \
164                                             return(GX_CALLER_ERROR);
165 
166 #endif
167 
168 
169 /* Define the version ID of GUIX.  This may be utilized by the application.  */
170 
171 #ifdef GX_SYSTEM_INIT
172 CHAR _gx_version_id[] =
173     "Copyright (c) Microsoft Corporation. All rights reserved.  *  GUIX Win32/Visual Version 6.2.1 *";
174 #else
175 extern  CHAR _gx_version_id[];
176 #endif
177 
178 #endif
179 
180