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