1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef COM_DTYPES_H
18 #define COM_DTYPES_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /* For NT apps we want to use the Win32 definitions and/or those
25  supplied by the Win32 compiler for things like NULL, MAX, MIN
26  abs, labs, etc.
27 */
28 #ifdef T_WINNT
29    #ifndef WIN32
30       #define WIN32
31    #endif
32    #include <stdlib.h>
33 #endif
34 
35 /* ------------------------------------------------------------------------
36 ** Constants
37 ** ------------------------------------------------------------------------ */
38 
39 #ifdef TRUE
40 #undef TRUE
41 #endif
42 
43 #ifdef FALSE
44 #undef FALSE
45 #endif
46 
47 /** @addtogroup utils_services
48 @{ */
49 
50 /** @name Macros for Common Data Types
51 @{ */
52 #define TRUE   1   /**< Boolean TRUE value. */
53 #define FALSE  0   /**< Boolean FALSE value. */
54 
55 #define  ON   1    /**< ON value. */
56 #define  OFF  0    /**< OFF value. */
57 
58 #ifndef NULL
59   #define NULL  0  /**< NULL value. */
60 #endif
61 /** @} */ /* end_name_group Macros for Common Data Types */
62 
63 /* -----------------------------------------------------------------------
64 ** Standard Types
65 ** ----------------------------------------------------------------------- */
66 
67 /** @} */ /* end_addtogroup utils_services */
68 
69 /* The following definitions are the same across platforms.  This first
70  group are the sanctioned types.
71 */
72 #ifndef _ARM_ASM_
73 #ifndef _BOOLEAN_DEFINED
74 
75 /** @addtogroup utils_services
76 @{ */
77 /** Boolean value type.
78 */
79 typedef  unsigned char      boolean;
80 #define _BOOLEAN_DEFINED
81 #endif
82 
83 /** @cond
84 */
85 #if defined(DALSTDDEF_H) /* guards against a known re-definer */
86 #define _BOOLEAN_DEFINED
87 #define _UINT32_DEFINED
88 #define _UINT16_DEFINED
89 #define _UINT8_DEFINED
90 #define _INT32_DEFINED
91 #define _INT16_DEFINED
92 #define _INT8_DEFINED
93 #define _UINT64_DEFINED
94 #define _INT64_DEFINED
95 #define _BYTE_DEFINED
96 #endif /* #if !defined(DALSTDDEF_H) */
97 /** @endcond */
98 
99 #ifndef _UINT32_DEFINED
100 /** Unsigned 32-bit value.
101 */
102 typedef  unsigned int  uint32;
103 #define _UINT32_DEFINED
104 #endif
105 
106 #ifndef _UINT16_DEFINED
107 /** Unsigned 16-bit value.
108 */
109 typedef  unsigned short     uint16;
110 #define _UINT16_DEFINED
111 #endif
112 
113 #ifndef _UINT8_DEFINED
114 /** Unsigned 8-bit value.
115 */
116 typedef  unsigned char      uint8;
117 #define _UINT8_DEFINED
118 #endif
119 
120 #ifndef _INT32_DEFINED
121 /** Signed 32-bit value.
122 */
123 typedef  signed int    int32;
124 #define _INT32_DEFINED
125 #endif
126 
127 #ifndef _INT16_DEFINED
128 /** Signed 16-bit value.
129 */
130 typedef  signed short       int16;
131 #define _INT16_DEFINED
132 #endif
133 
134 #ifndef _INT8_DEFINED
135 /** Signed 8-bit value.
136 */
137 typedef  signed char        int8;
138 #define _INT8_DEFINED
139 #endif
140 
141 /** @cond
142 */
143 /* This group are the deprecated types.  Their use should be
144 ** discontinued and new code should use the types above
145 */
146 #ifndef _BYTE_DEFINED
147 /** DEPRECATED: Unsigned 8  bit value type.
148 */
149 typedef  unsigned char      byte;
150 #define  _BYTE_DEFINED
151 #endif
152 
153 /** DEPRECATED: Unsinged 16 bit value type.
154 */
155 typedef  unsigned short     word;
156 /** DEPRECATED: Unsigned 32 bit value type.
157 */
158 typedef  unsigned long      dword;
159 
160 /** DEPRECATED: Unsigned 8  bit value type.
161 */
162 typedef  unsigned char      uint1;
163 /** DEPRECATED: Unsigned 16 bit value type.
164 */
165 typedef  unsigned short     uint2;
166 /** DEPRECATED: Unsigned 32 bit value type.
167 */
168 typedef  unsigned long      uint4;
169 
170 /** DEPRECATED: Signed 8  bit value type.
171 */
172 typedef  signed char        int1;
173 /** DEPRECATED: Signed 16 bit value type.
174 */
175 typedef  signed short       int2;
176 /** DEPRECATED: Signed 32 bit value type.
177 */
178 typedef  long int           int4;
179 
180 /** DEPRECATED: Signed 32 bit value.
181 */
182 typedef  signed long        sint31;
183 /** DEPRECATED: Signed 16 bit value.
184 */
185 typedef  signed short       sint15;
186 /** DEPRECATED: Signed 8  bit value.
187 */
188 typedef  signed char        sint7;
189 
190 typedef uint16 UWord16 ;
191 typedef uint32 UWord32 ;
192 typedef int32  Word32 ;
193 typedef int16  Word16 ;
194 typedef uint8  UWord8 ;
195 typedef int8   Word8 ;
196 typedef int32  Vect32 ;
197 /** @endcond */
198 
199 #if (! defined T_WINNT) && (! defined __GNUC__)
200   /* Non WinNT Targets */
201   #ifndef _INT64_DEFINED
202     /** Signed 64-bit value.
203 	*/
204     typedef long long     int64;
205     #define _INT64_DEFINED
206   #endif
207   #ifndef _UINT64_DEFINED
208     /** Unsigned 64-bit value.
209 	*/
210     typedef  unsigned long long  uint64;
211     #define _UINT64_DEFINED
212   #endif
213 #else /* T_WINNT || TARGET_OS_SOLARIS || __GNUC__ */
214   /* WINNT or SOLARIS based targets */
215   #if (defined __GNUC__)
216     #ifndef _INT64_DEFINED
217       typedef long long           int64;
218       #define _INT64_DEFINED
219     #endif
220     #ifndef _UINT64_DEFINED
221       typedef unsigned long long  uint64;
222       #define _UINT64_DEFINED
223     #endif
224   #else
225     typedef  __int64              int64;       /* Signed 64-bit value */
226     #ifndef _UINT64_DEFINED
227       typedef  unsigned __int64   uint64;      /* Unsigned 64-bit value */
228       #define _UINT64_DEFINED
229     #endif
230   #endif
231 #endif /* T_WINNT */
232 
233 #endif /* _ARM_ASM_ */
234 
235 #ifdef __cplusplus
236 }
237 #endif
238 
239 /** @} */ /* end_addtogroup utils_services */
240 #endif  /* COM_DTYPES_H */
241