Home | History | Annotate | Download | only in hwdefs
      1 /*
      2  * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
      3  * Copyright (c) Imagination Technologies Limited, UK
      4  *
      5  * Permission is hereby granted, free of charge, to any person obtaining a
      6  * 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 above copyright notice and this permission notice (including the
     14  * next paragraph) shall be included in all copies or substantial portions
     15  * of the Software.
     16  *
     17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     20  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
     21  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     24  */
     25 
     26 
     27 /*!****************************************************************************
     28 @File                   img_defs.h
     29 
     30 @Title                  Common header containing type definitions for portability
     31 
     32 @Author                 Imagination Technologies
     33 
     34 @date                   August 2001
     35 
     36 @Platform               cross platform / environment
     37 
     38 @Description    Contains variable and structure definitions. Any platform
     39                                 specific types should be defined in this file.
     40 
     41 @DoxygenVer
     42 
     43 ******************************************************************************/
     44 
     45 /******************************************************************************
     46 Modifications :-
     47 
     48 $Log: img_defs.h $
     49 *****************************************************************************/
     50 #if !defined (__IMG_DEFS_H__)
     51 #define __IMG_DEFS_H__
     52 
     53 #include "img_types.h"
     54 
     55 /*!
     56  *****************************************************************************
     57  *      These types should be changed on a per-platform basis to retain
     58  *      the indicated number of bits per type. e.g.: A DP_INT_16 should be
     59  *      always reflect a signed 16 bit value.
     60  *****************************************************************************/
     61 
     62 typedef         enum    img_tag_TriStateSwitch {
     63     IMG_ON              =       0x00,
     64     IMG_OFF,
     65     IMG_IGNORE
     66 
     67 } img_TriStateSwitch, * img_pTriStateSwitch;
     68 
     69 #define         IMG_SUCCESS                             0
     70 #define     IMG_FAILED             -1
     71 
     72 #define         IMG_NULL                                0
     73 #define         IMG_NO_REG                              1
     74 
     75 #if defined (NO_INLINE_FUNCS)
     76 #define INLINE
     77 #define FORCE_INLINE
     78 #else
     79 #if defined(_UITRON_)
     80 #define INLINE
     81 #define FORCE_INLINE                    static
     82 #define INLINE_IS_PRAGMA
     83 #else
     84 #if defined (__cplusplus)
     85 #define INLINE                                  inline
     86 #define FORCE_INLINE                    inline
     87 #else
     88 #define INLINE                                  __inline
     89 #if defined(UNDER_CE) || defined(UNDER_XP) || defined(UNDER_VISTA)
     90 #define FORCE_INLINE                    __forceinline
     91 #else
     92 #define FORCE_INLINE                    static __inline
     93 #endif
     94 #endif
     95 #endif
     96 #endif
     97 
     98 /* Use this in any file, or use attributes under GCC - see below */
     99 #ifndef PVR_UNREFERENCED_PARAMETER
    100 #define PVR_UNREFERENCED_PARAMETER(param) (param) = (param)
    101 #endif
    102 
    103 /* The best way to supress unused parameter warnings using GCC is to use a
    104  * variable attribute.  Place the unref__ between the type and name of an
    105  * unused parameter in a function parameter list, eg `int unref__ var'. This
    106  * should only be used in GCC build environments, for example, in files that
    107  * compile only on Linux. Other files should use UNREFERENCED_PARAMETER */
    108 #ifdef __GNUC__
    109 #define unref__ __attribute__ ((unused))
    110 #else
    111 #define unref__
    112 #endif
    113 
    114 #if defined(UNDER_CE)
    115 
    116 /* This may need to be _stdcall */
    117 #define IMG_CALLCONV
    118 #define IMG_INTERNAL
    119 #define IMG_RESTRICT
    120 
    121 #define IMG_EXPORT
    122 #define IMG_IMPORT      IMG_EXPORT
    123 
    124 #ifdef DEBUG
    125 #define IMG_ABORT()     TerminateProcess(GetCurrentProcess(), 0)
    126 #else
    127 #define IMG_ABORT()     for(;;);
    128 #endif
    129 #else
    130 #if defined(_WIN32)
    131 
    132 #define IMG_CALLCONV __stdcall
    133 #define IMG_INTERNAL
    134 #define IMG_EXPORT      __declspec(dllexport)
    135 #define IMG_RESTRICT __restrict
    136 
    137 
    138 /* IMG_IMPORT is defined as IMG_EXPORT so that headers and implementations match.
    139  * Some compilers require the header to be declared IMPORT, while the implementation is declared EXPORT
    140  */
    141 #define IMG_IMPORT      IMG_EXPORT
    142 #if defined( UNDER_VISTA ) && !defined(USE_CODE)
    143 #ifndef _INC_STDLIB
    144 void __cdecl abort(void);
    145 #endif
    146 __forceinline void __declspec(noreturn) img_abort(void)
    147 {
    148     for (;;) abort();
    149 }
    150 #define IMG_ABORT()     img_abort()
    151 #endif
    152 #else
    153 #if defined (__SYMBIAN32__)
    154 
    155 #if defined (__GNUC__)
    156 #define IMG_IMPORT
    157 #define IMG_EXPORT      __declspec(dllexport)
    158 #define IMG_RESTRICT __restrict__
    159 #define NONSHARABLE_CLASS(x) class x
    160 #else
    161 #if defined (__CC_ARM)
    162 #define IMG_IMPORT __declspec(dllimport)
    163 #define IMG_EXPORT __declspec(dllexport)
    164 #pragma warning("Please make sure that you've enabled the --restrict mode t")
    165 /* The ARMCC compiler currently requires that you've enabled the --restrict mode
    166    to permit the use of this keyword */
    167 # define IMG_RESTRICT /*restrict*/
    168 #endif
    169 #endif
    170 
    171 #define IMG_CALLCONV
    172 #define IMG_INTERNAL
    173 #define IMG_EXTERNAL
    174 
    175 #else
    176 #if defined(__linux__)
    177 
    178 #define IMG_CALLCONV
    179 #define IMG_INTERNAL    __attribute__ ((visibility ("hidden")))
    180 #define IMG_EXPORT
    181 #define IMG_IMPORT
    182 #define IMG_RESTRICT    __restrict__
    183 
    184 #else
    185 #if defined(_UITRON_)
    186 #define IMG_CALLCONV
    187 #define IMG_INTERNAL
    188 #define IMG_EXPORT
    189 #define IMG_RESTRICT
    190 
    191 #define __cdecl
    192 
    193 /* IMG_IMPORT is defined as IMG_EXPORT so that headers and implementations match.
    194 * Some compilers require the header to be declared IMPORT, while the implementation is declared EXPORT
    195 */
    196 #define IMG_IMPORT      IMG_EXPORT
    197 #ifndef USE_CODE
    198 void SysAbort(char const *pMessage);
    199 #define IMG_ABORT()     SysAbort("ImgAbort")
    200 #endif
    201 #else
    202 #error("define an OS")
    203 #endif
    204 #endif
    205 #endif
    206 #endif
    207 #endif
    208 
    209 // Use default definition if not overridden
    210 #ifndef IMG_ABORT
    211 #define IMG_ABORT()     abort()
    212 #endif
    213 
    214 
    215 #endif /* #if !defined (__IMG_DEFS_H__) */
    216 /*****************************************************************************
    217  End of file (IMG_DEFS.H)
    218 *****************************************************************************/
    219 
    220