1 /*************************************************************************/ /*!
2 @Title Common header containing type definitions for portability
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description Contains variable and structure definitions. Any platform
5 specific types should be defined in this file.
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
33 "MIT-COPYING".
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
43 #if !defined (__IMG_DEFS_H__)
44 #define __IMG_DEFS_H__
46 #include "img_types.h"
48 typedef enum img_tag_TriStateSwitch
49 {
50 IMG_ON = 0x00,
51 IMG_OFF,
52 IMG_IGNORE
54 } img_TriStateSwitch, * img_pTriStateSwitch;
56 #define IMG_SUCCESS 0
58 #define IMG_NO_REG 1
60 #if defined (NO_INLINE_FUNCS)
61 #define INLINE
62 #define FORCE_INLINE
63 #else
64 #if defined (__cplusplus)
65 #define INLINE inline
66 #define FORCE_INLINE inline
67 #else
68 #if !defined(INLINE)
69 #define INLINE __inline
70 #endif
71 #define FORCE_INLINE static __inline
72 #endif
73 #endif
76 /* Use this in any file, or use attributes under GCC - see below */
77 #ifndef PVR_UNREFERENCED_PARAMETER
78 #define PVR_UNREFERENCED_PARAMETER(param) (param) = (param)
79 #endif
81 /* The best way to supress unused parameter warnings using GCC is to use a
82 * variable attribute. Place the unref__ between the type and name of an
83 * unused parameter in a function parameter list, eg `int unref__ var'. This
84 * should only be used in GCC build environments, for example, in files that
85 * compile only on Linux. Other files should use UNREFERENCED_PARAMETER */
86 #ifdef __GNUC__
87 #define unref__ __attribute__ ((unused))
88 #else
89 #define unref__
90 #endif
92 /*
93 Wide character definitions
94 */
95 #ifndef _TCHAR_DEFINED
96 #if defined(UNICODE)
97 typedef unsigned short TCHAR, *PTCHAR, *PTSTR;
98 #else /* #if defined(UNICODE) */
99 typedef char TCHAR, *PTCHAR, *PTSTR;
100 #endif /* #if defined(UNICODE) */
101 #define _TCHAR_DEFINED
102 #endif /* #ifndef _TCHAR_DEFINED */
105 #if defined(__linux__) || defined(__QNXNTO__) || defined(__METAG)
107 #define IMG_CALLCONV
108 #define IMG_INTERNAL __attribute__((visibility("hidden")))
109 #define IMG_EXPORT __attribute__((visibility("default")))
110 #define IMG_IMPORT
111 #define IMG_RESTRICT __restrict__
113 #else
114 #error("define an OS")
115 #endif
117 // Use default definition if not overridden
118 #ifndef IMG_ABORT
119 #define IMG_ABORT() abort()
120 #endif
122 #ifndef IMG_MALLOC
123 #define IMG_MALLOC(A) malloc (A)
124 #endif
126 #ifndef IMG_FREE
127 #define IMG_FREE(A) free (A)
128 #endif
130 #define IMG_CONST const
132 #if defined(__GNUC__)
133 #define IMG_FORMAT_PRINTF(x,y) __attribute__((format(printf,x,y)))
134 #else
135 #define IMG_FORMAT_PRINTF(x,y)
136 #endif
138 /*
139 * Cleanup request defines
140 */
141 #define CLEANUP_WITH_POLL IMG_FALSE
142 #define FORCE_CLEANUP IMG_TRUE
144 #if defined (_WIN64)
145 #define IMG_UNDEF (~0ULL)
146 #else
147 #define IMG_UNDEF (~0UL)
148 #endif
150 #endif /* #if !defined (__IMG_DEFS_H__) */
151 /*****************************************************************************
152 End of file (IMG_DEFS.H)
153 *****************************************************************************/