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                                            RX/CCRX        */
26 /*                                                           6.1.9        */
27 /*  AUTHOR                                                                */
28 /*                                                                        */
29 /*    Kenneth Maxwell, Microsoft Corporation                              */
30 /*                                                                        */
31 /*  DESCRIPTION                                                           */
32 /*                                                                        */
33 /*    This file contains data type definitions and constants that work    */
34 /*    with the Renesas CCRX compiler.                                     */
35 /*                                                                        */
36 /*  RELEASE HISTORY                                                       */
37 /*                                                                        */
38 /*    DATE              NAME                      DESCRIPTION             */
39 /*                                                                        */
40 /*  10-15-2021     Kenneth Maxwell          Initial Version 6.1.9         */
41 /*                                                                        */
42 /**************************************************************************/
43 
44 #ifndef GX_PORT_H
45 #define GX_PORT_H
46 
47 /* Determine if the optional GUIX user define file should be used.  */
48 
49 #ifdef GX_INCLUDE_USER_DEFINE_FILE
50 
51 /* Include the user defines in gx_user.h. The defines in this file may
52    alternately be defined on the command line.  */
53 
54 #include "gx_user.h"
55 #endif
56 
57 typedef INT    GX_BOOL;
58 typedef SHORT  GX_VALUE;
59 typedef unsigned char GX_UCHAR;
60 
61 #define NULL   ((void *)(0))
62 #include "string.h"
63 
64 #define GX_VALUE_MAX                        0x7FFF
65 
66 #define GX_DISABLE_DEPRECATED_STRING_API
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_PALETTE_MODE_AA_TEXT_COLORS      16
79 
80 #define GX_MAX_ACTIVE_TIMERS                32
81 
82 #define GX_MAX_VIEWS                        32
83 
84 #define GX_MAX_DISPLAY_HEIGHT               800
85 
86 
87 /* Define several macros for the error checking shell in GUIX.  */
88 
89 #ifdef GX_DISABLE_THREADX_BINDING
90 
91 /* Here if not running with ThreadX RTOS */
92 #define GX_CALLER_CHECKING_EXTERNS
93 #define GX_THREADS_ONLY_CALLER_CHECKING
94 #define GX_INIT_AND_THREADS_CALLER_CHECKING
95 #define GX_NOT_ISR_CALLER_CHECKING
96 #define GX_THREAD_WAIT_CALLER_CHECKING
97 
98 #else
99 
100 #ifdef TX_TIMER_PROCESS_IN_ISR
101 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
102                                             extern  volatile ULONG      _tx_thread_system_state;
103 
104 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((TX_THREAD_GET_SYSTEM_STATE()) || \
105                                                 (_tx_thread_current_ptr == TX_NULL)) \
106                                                 return(GX_CALLER_ERROR);
107 
108 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0)))) \
109                                                 return(GX_CALLER_ERROR);
110 
111 #define GX_NOT_ISR_CALLER_CHECKING          if ((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) \
112                                                 return(GX_CALLER_ERROR);
113 
114 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
115                                                ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()))) \
116                                             return(GX_CALLER_ERROR);
117 
118 #else
119 
120 #define GX_CALLER_CHECKING_EXTERNS          extern  TX_THREAD           *_tx_thread_current_ptr; \
121                                             extern  TX_THREAD           _tx_timer_thread; \
122                                             extern  volatile ULONG      _tx_thread_system_state;
123 
124 #define GX_THREADS_ONLY_CALLER_CHECKING     if ((TX_THREAD_GET_SYSTEM_STATE()) || \
125                                                 (_tx_thread_current_ptr == TX_NULL) || \
126                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
127                                                 return(GX_CALLER_ERROR);
128 
129 #define GX_INIT_AND_THREADS_CALLER_CHECKING if (((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) || \
130                                                 (_tx_thread_current_ptr == &_tx_timer_thread)) \
131                                                 return(GX_CALLER_ERROR);
132 
133 
134 #define GX_NOT_ISR_CALLER_CHECKING          if ((TX_THREAD_GET_SYSTEM_STATE()) && ((TX_THREAD_GET_SYSTEM_STATE()) < ((ULONG) 0xF0F0F0F0))) \
135                                                 return(GX_CALLER_ERROR);
136 
137 #define GX_THREAD_WAIT_CALLER_CHECKING      if ((wait_option) && \
138                                                ((_tx_thread_current_ptr == NX_NULL) || (TX_THREAD_GET_SYSTEM_STATE()) || (_tx_thread_current_ptr == &_tx_timer_thread))) \
139                                             return(GX_CALLER_ERROR);
140 
141 #endif
142 #endif
143 
144 /* Define the version ID of GUIX.  This may be utilized by the application.  */
145 
146 #ifdef GX_SYSTEM_INIT
147 CHAR _gx_version_id[] =
148     "Copyright (c) 2024 Microsoft Corporation.  *  GUIX Version 6.4.1 *";
149 #else
150 extern  CHAR _gx_version_id[];
151 #endif
152 
153 #endif
154 
155