amd/addrlib: Add support for ETC2 and ASTC formats.
[mesa.git] / src / amd / addrlib / addrtypes.h
1 /*
2 * Copyright © 2014 Advanced Micro Devices, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 */
26
27 /**
28 ****************************************************************************************************
29 * @file addrtypes.h
30 * @brief Contains the helper function and constants
31 ****************************************************************************************************
32 */
33 #ifndef __ADDR_TYPES_H__
34 #define __ADDR_TYPES_H__
35
36 #if defined(__APPLE__) && !defined(HAVE_TSERVER)
37 // External definitions header maintained by Apple driver team, but not for diag team under Mac.
38 // Helps address compilation issues & reduces code covered by NDA
39 #include "addrExtDef.h"
40
41 #else
42
43 // Windows and/or Linux
44 #if !defined(VOID)
45 typedef void VOID;
46 #endif
47
48 #if !defined(FLOAT)
49 typedef float FLOAT;
50 #endif
51
52 #if !defined(CHAR)
53 typedef char CHAR;
54 #endif
55
56 #if !defined(INT)
57 typedef int INT;
58 #endif
59
60 #include <stdarg.h> // va_list...etc need this header
61
62 #endif // defined (__APPLE__) && !defined(HAVE_TSERVER)
63
64 /**
65 ****************************************************************************************************
66 * Calling conventions
67 ****************************************************************************************************
68 */
69 #ifndef ADDR_CDECL
70 #if defined(__GNUC__)
71 #define ADDR_CDECL __attribute__((cdecl))
72 #else
73 #define ADDR_CDECL __cdecl
74 #endif
75 #endif
76
77 #ifndef ADDR_STDCALL
78 #if defined(__GNUC__)
79 #if defined(__AMD64__)
80 #define ADDR_STDCALL
81 #else
82 #define ADDR_STDCALL __attribute__((stdcall))
83 #endif
84 #else
85 #define ADDR_STDCALL __stdcall
86 #endif
87 #endif
88
89 #ifndef ADDR_FASTCALL
90 #if defined(__GNUC__)
91 #if defined(__i386__)
92 #define ADDR_FASTCALL __attribute__((regparm(0)))
93 #else
94 #define ADDR_FASTCALL
95 #endif
96 #else
97 #define ADDR_FASTCALL __fastcall
98 #endif
99 #endif
100
101 #ifndef GC_CDECL
102 #define GC_CDECL ADDR_CDECL
103 #endif
104
105 #ifndef GC_STDCALL
106 #define GC_STDCALL ADDR_STDCALL
107 #endif
108
109 #ifndef GC_FASTCALL
110 #define GC_FASTCALL ADDR_FASTCALL
111 #endif
112
113
114 #if defined(__GNUC__)
115 #define ADDR_INLINE static inline // inline needs to be static to link
116 #else
117 // win32, win64, other platforms
118 #define ADDR_INLINE __inline
119 #endif // #if defined(__GNUC__)
120
121 #define ADDR_API ADDR_FASTCALL //default call convention is fast call
122
123 /**
124 ****************************************************************************************************
125 * Global defines used by other modules
126 ****************************************************************************************************
127 */
128 #if !defined(TILEINDEX_INVALID)
129 #define TILEINDEX_INVALID -1
130 #endif
131
132 #if !defined(TILEINDEX_LINEAR_GENERAL)
133 #define TILEINDEX_LINEAR_GENERAL -2
134 #endif
135
136 #if !defined(TILEINDEX_LINEAR_ALIGNED)
137 #define TILEINDEX_LINEAR_ALIGNED 8
138 #endif
139
140 /**
141 ****************************************************************************************************
142 * Return codes
143 ****************************************************************************************************
144 */
145 typedef enum _ADDR_E_RETURNCODE
146 {
147 // General Return
148 ADDR_OK = 0,
149 ADDR_ERROR = 1,
150
151 // Specific Errors
152 ADDR_OUTOFMEMORY,
153 ADDR_INVALIDPARAMS,
154 ADDR_NOTSUPPORTED,
155 ADDR_NOTIMPLEMENTED,
156 ADDR_PARAMSIZEMISMATCH,
157 ADDR_INVALIDGBREGVALUES,
158
159 } ADDR_E_RETURNCODE;
160
161 /**
162 ****************************************************************************************************
163 * @brief
164 * Neutral enums that define tile modes for all H/W
165 * @note
166 * R600/R800 tiling mode can be cast to hw enums directly but never cast into HW enum from
167 * ADDR_TM_2D_TILED_XTHICK
168 *
169 ****************************************************************************************************
170 */
171 typedef enum _AddrTileMode
172 {
173 ADDR_TM_LINEAR_GENERAL = 0, ///< Least restrictions, pitch: multiple of 8 if not buffer
174 ADDR_TM_LINEAR_ALIGNED = 1, ///< Requests pitch or slice to be multiple of 64 pixels
175 ADDR_TM_1D_TILED_THIN1 = 2, ///< Linear array of 8x8 tiles
176 ADDR_TM_1D_TILED_THICK = 3, ///< Linear array of 8x8x4 tiles
177 ADDR_TM_2D_TILED_THIN1 = 4, ///< A set of macro tiles consist of 8x8 tiles
178 ADDR_TM_2D_TILED_THIN2 = 5, ///< 600 HWL only, macro tile ratio is 1:4
179 ADDR_TM_2D_TILED_THIN4 = 6, ///< 600 HWL only, macro tile ratio is 1:16
180 ADDR_TM_2D_TILED_THICK = 7, ///< A set of macro tiles consist of 8x8x4 tiles
181 ADDR_TM_2B_TILED_THIN1 = 8, ///< 600 HWL only, with bank swap
182 ADDR_TM_2B_TILED_THIN2 = 9, ///< 600 HWL only, with bank swap and ratio is 1:4
183 ADDR_TM_2B_TILED_THIN4 = 10, ///< 600 HWL only, with bank swap and ratio is 1:16
184 ADDR_TM_2B_TILED_THICK = 11, ///< 600 HWL only, with bank swap, consists of 8x8x4 tiles
185 ADDR_TM_3D_TILED_THIN1 = 12, ///< Macro tiling w/ pipe rotation between slices
186 ADDR_TM_3D_TILED_THICK = 13, ///< Macro tiling w/ pipe rotation bwtween slices, thick
187 ADDR_TM_3B_TILED_THIN1 = 14, ///< 600 HWL only, with bank swap
188 ADDR_TM_3B_TILED_THICK = 15, ///< 600 HWL only, with bank swap, thick
189 ADDR_TM_2D_TILED_XTHICK = 16, ///< Tile is 8x8x8, valid from NI
190 ADDR_TM_3D_TILED_XTHICK = 17, ///< Tile is 8x8x8, valid from NI
191 ADDR_TM_POWER_SAVE = 18, ///< Power save mode, only used by KMD on NI
192 ADDR_TM_PRT_TILED_THIN1 = 19, ///< No bank/pipe rotation or hashing beyond macrotile size
193 ADDR_TM_PRT_2D_TILED_THIN1 = 20, ///< Same as 2D_TILED_THIN1, PRT only
194 ADDR_TM_PRT_3D_TILED_THIN1 = 21, ///< Same as 3D_TILED_THIN1, PRT only
195 ADDR_TM_PRT_TILED_THICK = 22, ///< No bank/pipe rotation or hashing beyond macrotile size
196 ADDR_TM_PRT_2D_TILED_THICK = 23, ///< Same as 2D_TILED_THICK, PRT only
197 ADDR_TM_PRT_3D_TILED_THICK = 24, ///< Same as 3D_TILED_THICK, PRT only
198 ADDR_TM_UNKNOWN = 25, ///< Unkown tile mode, should be decided by address lib
199 ADDR_TM_COUNT = 26, ///< Must be the value of the last tile mode
200 } AddrTileMode;
201
202 /**
203 ****************************************************************************************************
204 * AddrFormat
205 *
206 * @brief
207 * Neutral enum for SurfaceFormat
208 *
209 ****************************************************************************************************
210 */
211 typedef enum _AddrFormat {
212 ADDR_FMT_INVALID = 0x00000000,
213 ADDR_FMT_8 = 0x00000001,
214 ADDR_FMT_4_4 = 0x00000002,
215 ADDR_FMT_3_3_2 = 0x00000003,
216 ADDR_FMT_RESERVED_4 = 0x00000004,
217 ADDR_FMT_16 = 0x00000005,
218 ADDR_FMT_16_FLOAT = 0x00000006,
219 ADDR_FMT_8_8 = 0x00000007,
220 ADDR_FMT_5_6_5 = 0x00000008,
221 ADDR_FMT_6_5_5 = 0x00000009,
222 ADDR_FMT_1_5_5_5 = 0x0000000a,
223 ADDR_FMT_4_4_4_4 = 0x0000000b,
224 ADDR_FMT_5_5_5_1 = 0x0000000c,
225 ADDR_FMT_32 = 0x0000000d,
226 ADDR_FMT_32_FLOAT = 0x0000000e,
227 ADDR_FMT_16_16 = 0x0000000f,
228 ADDR_FMT_16_16_FLOAT = 0x00000010,
229 ADDR_FMT_8_24 = 0x00000011,
230 ADDR_FMT_8_24_FLOAT = 0x00000012,
231 ADDR_FMT_24_8 = 0x00000013,
232 ADDR_FMT_24_8_FLOAT = 0x00000014,
233 ADDR_FMT_10_11_11 = 0x00000015,
234 ADDR_FMT_10_11_11_FLOAT = 0x00000016,
235 ADDR_FMT_11_11_10 = 0x00000017,
236 ADDR_FMT_11_11_10_FLOAT = 0x00000018,
237 ADDR_FMT_2_10_10_10 = 0x00000019,
238 ADDR_FMT_8_8_8_8 = 0x0000001a,
239 ADDR_FMT_10_10_10_2 = 0x0000001b,
240 ADDR_FMT_X24_8_32_FLOAT = 0x0000001c,
241 ADDR_FMT_32_32 = 0x0000001d,
242 ADDR_FMT_32_32_FLOAT = 0x0000001e,
243 ADDR_FMT_16_16_16_16 = 0x0000001f,
244 ADDR_FMT_16_16_16_16_FLOAT = 0x00000020,
245 ADDR_FMT_RESERVED_33 = 0x00000021,
246 ADDR_FMT_32_32_32_32 = 0x00000022,
247 ADDR_FMT_32_32_32_32_FLOAT = 0x00000023,
248 ADDR_FMT_RESERVED_36 = 0x00000024,
249 ADDR_FMT_1 = 0x00000025,
250 ADDR_FMT_1_REVERSED = 0x00000026,
251 ADDR_FMT_GB_GR = 0x00000027,
252 ADDR_FMT_BG_RG = 0x00000028,
253 ADDR_FMT_32_AS_8 = 0x00000029,
254 ADDR_FMT_32_AS_8_8 = 0x0000002a,
255 ADDR_FMT_5_9_9_9_SHAREDEXP = 0x0000002b,
256 ADDR_FMT_8_8_8 = 0x0000002c,
257 ADDR_FMT_16_16_16 = 0x0000002d,
258 ADDR_FMT_16_16_16_FLOAT = 0x0000002e,
259 ADDR_FMT_32_32_32 = 0x0000002f,
260 ADDR_FMT_32_32_32_FLOAT = 0x00000030,
261 ADDR_FMT_BC1 = 0x00000031,
262 ADDR_FMT_BC2 = 0x00000032,
263 ADDR_FMT_BC3 = 0x00000033,
264 ADDR_FMT_BC4 = 0x00000034,
265 ADDR_FMT_BC5 = 0x00000035,
266 ADDR_FMT_BC6 = 0x00000036,
267 ADDR_FMT_BC7 = 0x00000037,
268 ADDR_FMT_32_AS_32_32_32_32 = 0x00000038,
269 ADDR_FMT_APC3 = 0x00000039,
270 ADDR_FMT_APC4 = 0x0000003a,
271 ADDR_FMT_APC5 = 0x0000003b,
272 ADDR_FMT_APC6 = 0x0000003c,
273 ADDR_FMT_APC7 = 0x0000003d,
274 ADDR_FMT_CTX1 = 0x0000003e,
275 ADDR_FMT_RESERVED_63 = 0x0000003f,
276 ADDR_FMT_ASTC_4x4 = 0x00000040,
277 ADDR_FMT_ASTC_5x4 = 0x00000041,
278 ADDR_FMT_ASTC_5x5 = 0x00000042,
279 ADDR_FMT_ASTC_6x5 = 0x00000043,
280 ADDR_FMT_ASTC_6x6 = 0x00000044,
281 ADDR_FMT_ASTC_8x5 = 0x00000045,
282 ADDR_FMT_ASTC_8x6 = 0x00000046,
283 ADDR_FMT_ASTC_8x8 = 0x00000047,
284 ADDR_FMT_ASTC_10x5 = 0x00000048,
285 ADDR_FMT_ASTC_10x6 = 0x00000049,
286 ADDR_FMT_ASTC_10x8 = 0x0000004a,
287 ADDR_FMT_ASTC_10x10 = 0x0000004b,
288 ADDR_FMT_ASTC_12x10 = 0x0000004c,
289 ADDR_FMT_ASTC_12x12 = 0x0000004d,
290 } AddrFormat;
291
292 /**
293 ****************************************************************************************************
294 * AddrDepthFormat
295 *
296 * @brief
297 * Neutral enum for addrFlt32ToDepthPixel
298 *
299 ****************************************************************************************************
300 */
301 typedef enum _AddrDepthFormat
302 {
303 ADDR_DEPTH_INVALID = 0x00000000,
304 ADDR_DEPTH_16 = 0x00000001,
305 ADDR_DEPTH_X8_24 = 0x00000002,
306 ADDR_DEPTH_8_24 = 0x00000003,
307 ADDR_DEPTH_X8_24_FLOAT = 0x00000004,
308 ADDR_DEPTH_8_24_FLOAT = 0x00000005,
309 ADDR_DEPTH_32_FLOAT = 0x00000006,
310 ADDR_DEPTH_X24_8_32_FLOAT = 0x00000007,
311
312 } AddrDepthFormat;
313
314 /**
315 ****************************************************************************************************
316 * AddrColorFormat
317 *
318 * @brief
319 * Neutral enum for ColorFormat
320 *
321 ****************************************************************************************************
322 */
323 typedef enum _AddrColorFormat
324 {
325 ADDR_COLOR_INVALID = 0x00000000,
326 ADDR_COLOR_8 = 0x00000001,
327 ADDR_COLOR_4_4 = 0x00000002,
328 ADDR_COLOR_3_3_2 = 0x00000003,
329 ADDR_COLOR_RESERVED_4 = 0x00000004,
330 ADDR_COLOR_16 = 0x00000005,
331 ADDR_COLOR_16_FLOAT = 0x00000006,
332 ADDR_COLOR_8_8 = 0x00000007,
333 ADDR_COLOR_5_6_5 = 0x00000008,
334 ADDR_COLOR_6_5_5 = 0x00000009,
335 ADDR_COLOR_1_5_5_5 = 0x0000000a,
336 ADDR_COLOR_4_4_4_4 = 0x0000000b,
337 ADDR_COLOR_5_5_5_1 = 0x0000000c,
338 ADDR_COLOR_32 = 0x0000000d,
339 ADDR_COLOR_32_FLOAT = 0x0000000e,
340 ADDR_COLOR_16_16 = 0x0000000f,
341 ADDR_COLOR_16_16_FLOAT = 0x00000010,
342 ADDR_COLOR_8_24 = 0x00000011,
343 ADDR_COLOR_8_24_FLOAT = 0x00000012,
344 ADDR_COLOR_24_8 = 0x00000013,
345 ADDR_COLOR_24_8_FLOAT = 0x00000014,
346 ADDR_COLOR_10_11_11 = 0x00000015,
347 ADDR_COLOR_10_11_11_FLOAT = 0x00000016,
348 ADDR_COLOR_11_11_10 = 0x00000017,
349 ADDR_COLOR_11_11_10_FLOAT = 0x00000018,
350 ADDR_COLOR_2_10_10_10 = 0x00000019,
351 ADDR_COLOR_8_8_8_8 = 0x0000001a,
352 ADDR_COLOR_10_10_10_2 = 0x0000001b,
353 ADDR_COLOR_X24_8_32_FLOAT = 0x0000001c,
354 ADDR_COLOR_32_32 = 0x0000001d,
355 ADDR_COLOR_32_32_FLOAT = 0x0000001e,
356 ADDR_COLOR_16_16_16_16 = 0x0000001f,
357 ADDR_COLOR_16_16_16_16_FLOAT = 0x00000020,
358 ADDR_COLOR_RESERVED_33 = 0x00000021,
359 ADDR_COLOR_32_32_32_32 = 0x00000022,
360 ADDR_COLOR_32_32_32_32_FLOAT = 0x00000023,
361 } AddrColorFormat;
362
363 /**
364 ****************************************************************************************************
365 * AddrSurfaceNumber
366 *
367 * @brief
368 * Neutral enum for SurfaceNumber
369 *
370 ****************************************************************************************************
371 */
372 typedef enum _AddrSurfaceNumber {
373 ADDR_NUMBER_UNORM = 0x00000000,
374 ADDR_NUMBER_SNORM = 0x00000001,
375 ADDR_NUMBER_USCALED = 0x00000002,
376 ADDR_NUMBER_SSCALED = 0x00000003,
377 ADDR_NUMBER_UINT = 0x00000004,
378 ADDR_NUMBER_SINT = 0x00000005,
379 ADDR_NUMBER_SRGB = 0x00000006,
380 ADDR_NUMBER_FLOAT = 0x00000007,
381 } AddrSurfaceNumber;
382
383 /**
384 ****************************************************************************************************
385 * AddrSurfaceSwap
386 *
387 * @brief
388 * Neutral enum for SurfaceSwap
389 *
390 ****************************************************************************************************
391 */
392 typedef enum _AddrSurfaceSwap {
393 ADDR_SWAP_STD = 0x00000000,
394 ADDR_SWAP_ALT = 0x00000001,
395 ADDR_SWAP_STD_REV = 0x00000002,
396 ADDR_SWAP_ALT_REV = 0x00000003,
397 } AddrSurfaceSwap;
398
399 /**
400 ****************************************************************************************************
401 * AddrHtileBlockSize
402 *
403 * @brief
404 * Size of HTILE blocks, valid values are 4 or 8 for now
405 ****************************************************************************************************
406 */
407 typedef enum _AddrHtileBlockSize
408 {
409 ADDR_HTILE_BLOCKSIZE_4 = 4,
410 ADDR_HTILE_BLOCKSIZE_8 = 8,
411 } AddrHtileBlockSize;
412
413
414 /**
415 ****************************************************************************************************
416 * AddrPipeCfg
417 *
418 * @brief
419 * The pipe configuration field specifies both the number of pipes and
420 * how pipes are interleaved on the surface.
421 * The expression of number of pipes, the shader engine tile size, and packer tile size
422 * is encoded in a PIPE_CONFIG register field.
423 * In general the number of pipes usually matches the number of memory channels of the
424 * hardware configuration.
425 * For hw configurations w/ non-pow2 memory number of memory channels, it usually matches
426 * the number of ROP units(? TODO: which registers??)
427 * The enum value = hw enum + 1 which is to reserve 0 for requesting default.
428 ****************************************************************************************************
429 */
430 typedef enum _AddrPipeCfg
431 {
432 ADDR_PIPECFG_INVALID = 0,
433 ADDR_PIPECFG_P2 = 1, /// 2 pipes,
434 ADDR_PIPECFG_P4_8x16 = 5, /// 4 pipes,
435 ADDR_PIPECFG_P4_16x16 = 6,
436 ADDR_PIPECFG_P4_16x32 = 7,
437 ADDR_PIPECFG_P4_32x32 = 8,
438 ADDR_PIPECFG_P8_16x16_8x16 = 9, /// 8 pipes
439 ADDR_PIPECFG_P8_16x32_8x16 = 10,
440 ADDR_PIPECFG_P8_32x32_8x16 = 11,
441 ADDR_PIPECFG_P8_16x32_16x16 = 12,
442 ADDR_PIPECFG_P8_32x32_16x16 = 13,
443 ADDR_PIPECFG_P8_32x32_16x32 = 14,
444 ADDR_PIPECFG_P8_32x64_32x32 = 15,
445 ADDR_PIPECFG_P16_32x32_8x16 = 17, /// 16 pipes
446 ADDR_PIPECFG_P16_32x32_16x16 = 18,
447 ADDR_PIPECFG_MAX = 19,
448 } AddrPipeCfg;
449
450 /**
451 ****************************************************************************************************
452 * AddrTileType
453 *
454 * @brief
455 * Neutral enums that specifies micro tile type (MICRO_TILE_MODE)
456 ****************************************************************************************************
457 */
458 typedef enum _AddrTileType
459 {
460 ADDR_DISPLAYABLE = 0, ///< Displayable tiling
461 ADDR_NON_DISPLAYABLE = 1, ///< Non-displayable tiling, a.k.a thin micro tiling
462 ADDR_DEPTH_SAMPLE_ORDER = 2, ///< Same as non-displayable plus depth-sample-order
463 ADDR_ROTATED = 3, ///< Rotated displayable tiling
464 ADDR_THICK = 4, ///< Thick micro-tiling, only valid for THICK and XTHICK
465 } AddrTileType;
466
467 ////////////////////////////////////////////////////////////////////////////////////////////////////
468 //
469 // Type definitions: short system-independent names for address library types
470 //
471 ////////////////////////////////////////////////////////////////////////////////////////////////////
472
473 #if !defined(__APPLE__) || defined(HAVE_TSERVER)
474
475 #ifndef BOOL_32 // no bool type in C
476 /// @brief Boolean type, since none is defined in C
477 /// @ingroup type
478 #define BOOL_32 int
479 #endif
480
481 #ifndef INT_32
482 #define INT_32 int
483 #endif
484
485 #ifndef UINT_32
486 #define UINT_32 unsigned int
487 #endif
488
489 #ifndef INT_16
490 #define INT_16 short
491 #endif
492
493 #ifndef UINT_16
494 #define UINT_16 unsigned short
495 #endif
496
497 #ifndef INT_8
498 #define INT_8 char
499 #endif
500
501 #ifndef UINT_8
502 #define UINT_8 unsigned char
503 #endif
504
505 #ifndef NULL
506 #define NULL 0
507 #endif
508
509 #ifndef TRUE
510 #define TRUE 1
511 #endif
512
513 #ifndef FALSE
514 #define FALSE 0
515 #endif
516
517 //
518 // 64-bit integer types depend on the compiler
519 //
520 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
521 #define INT_64 long long
522 #define UINT_64 unsigned long long
523
524 #elif defined( _WIN32 )
525 #define INT_64 __int64
526 #define UINT_64 unsigned __int64
527
528 #else
529 #error Unsupported compiler and/or operating system for 64-bit integers
530
531 /// @brief 64-bit signed integer type (compiler dependent)
532 /// @ingroup type
533 ///
534 /// The addrlib defines a 64-bit signed integer type for either
535 /// Gnu/Watcom compilers (which use the first syntax) or for
536 /// the Windows VCC compiler (which uses the second syntax).
537 #define INT_64 long long OR __int64
538
539 /// @brief 64-bit unsigned integer type (compiler dependent)
540 /// @ingroup type
541 ///
542 /// The addrlib defines a 64-bit unsigned integer type for either
543 /// Gnu/Watcom compilers (which use the first syntax) or for
544 /// the Windows VCC compiler (which uses the second syntax).
545 ///
546 #define UINT_64 unsigned long long OR unsigned __int64
547 #endif
548
549 #endif // #if !defined(__APPLE__) || defined(HAVE_TSERVER)
550
551 // ADDR64X is used to print addresses in hex form on both Windows and Linux
552 //
553 #if defined( __GNUC__ ) || defined( __WATCOMC__ )
554 #define ADDR64X "llx"
555 #define ADDR64D "lld"
556
557 #elif defined( _WIN32 )
558 #define ADDR64X "I64x"
559 #define ADDR64D "I64d"
560
561 #else
562 #error Unsupported compiler and/or operating system for 64-bit integers
563
564 /// @brief Addrlib device address 64-bit printf tag (compiler dependent)
565 /// @ingroup type
566 ///
567 /// This allows printf to display an ADDR_64 for either the Windows VCC compiler
568 /// (which used this value) or the Gnu/Watcom compilers (which use "llx".
569 /// An example of use is printf("addr 0x%"ADDR64X"\n", address);
570 ///
571 #define ADDR64X "llx" OR "I64x"
572 #define ADDR64D "lld" OR "I64d"
573 #endif
574
575
576 /// @brief Union for storing a 32-bit float or 32-bit integer
577 /// @ingroup type
578 ///
579 /// This union provides a simple way to convert between a 32-bit float
580 /// and a 32-bit integer. It also prevents the compiler from producing
581 /// code that alters NaN values when assiging or coying floats.
582 /// Therefore, all address library routines that pass or return 32-bit
583 /// floating point data do so by passing or returning a FLT_32.
584 ///
585 typedef union {
586 INT_32 i;
587 UINT_32 u;
588 float f;
589 } ADDR_FLT_32;
590
591
592 ////////////////////////////////////////////////////////////////////////////////////////////////////
593 //
594 // Macros for controlling linking and building on multiple systems
595 //
596 ////////////////////////////////////////////////////////////////////////////////////////////////////
597 #if defined(_MSC_VER)
598 #if defined(va_copy)
599 #undef va_copy //redefine va_copy to support VC2013
600 #endif
601 #endif
602
603 #if !defined(va_copy)
604 #define va_copy(dst, src) \
605 ((void) memcpy(&(dst), &(src), sizeof(va_list)))
606 #endif
607
608 #endif // __ADDR_TYPES_H__
609