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 * Name         : img_types.h
     29 * Title        : Global types for use by IMG APIs
     30 * Author(s)    : Imagination Technologies
     31 * Created      : 1st August 2003
     32 *
     33 * Description  : Defines type aliases for use by IMG APIs
     34 *
     35 * Platform     : Generic
     36 *
     37 * Modifications:-
     38 * $Log: img_types.h $
     39 ******************************************************************************/
     40 
     41 #ifndef __IMG_TYPES_H__
     42 #define __IMG_TYPES_H__
     43 
     44 #include "img_defs.h"
     45 
     46 typedef unsigned int    IMG_UINT,      *IMG_PUINT;
     47 typedef signed int      IMG_INT,       *IMG_PINT;
     48 
     49 typedef unsigned char   IMG_UINT8,     *IMG_PUINT8;
     50 typedef unsigned char   IMG_BYTE,      *IMG_PBYTE;
     51 typedef signed char     IMG_INT8,      *IMG_PINT8;
     52 typedef char            IMG_CHAR,      *IMG_PCHAR;
     53 
     54 typedef unsigned short  IMG_UINT16,    *IMG_PUINT16;
     55 typedef signed short    IMG_INT16,     *IMG_PINT16;
     56 typedef unsigned int    IMG_UINT32,    *IMG_PUINT32;
     57 typedef signed int      IMG_INT32,     *IMG_PINT32;
     58 typedef unsigned long long IMG_UINT64, *IMG_PUINT64;
     59 typedef signed long long IMG_INT64,    *IMG_PINT64;
     60 
     61 typedef unsigned char	IMG_BOOL8,     *IMG_PBOOL8;
     62 typedef unsigned short	IMG_BOOL16,    *IMG_PBOOL16;
     63 typedef unsigned int    IMG_BOOL32,    *IMG_PBOOL32;
     64 
     65 #if defined(_WIN32)
     66 
     67 typedef unsigned __int64   IMG_UINT64, *IMG_PUINT64;
     68 typedef __int64            IMG_INT64,  *IMG_PINT64;
     69 
     70 #else
     71 #if defined(LINUX) || defined (__SYMBIAN32__) || defined(_UITRON_)
     72 
     73 #else
     74 
     75 #error("define an OS")
     76 
     77 #endif
     78 #endif
     79 
     80 #if !(defined(LINUX) && defined (__KERNEL__))
     81 /* Linux kernel mode does not use floating point */
     82 typedef float                   IMG_FLOAT,      *IMG_PFLOAT;
     83 typedef double                  IMG_DOUBLE, *IMG_PDOUBLE;
     84 #endif
     85 
     86 typedef enum tag_img_bool {
     87     IMG_FALSE           = 0,
     88     IMG_TRUE            = 1,
     89     IMG_FORCE_ALIGN = 0x7FFFFFFF
     90 } IMG_BOOL, *IMG_PBOOL;
     91 
     92 typedef void                    IMG_VOID,       *IMG_PVOID;
     93 
     94 typedef IMG_INT32               IMG_RESULT;
     95 
     96 typedef unsigned long           IMG_UINTPTR_T;
     97 
     98 typedef IMG_PVOID       IMG_HANDLE;
     99 
    100 typedef void**                  IMG_HVOID,      * IMG_PHVOID;
    101 
    102 typedef IMG_UINT32      IMG_SIZE_T;
    103 
    104 #define IMG_NULL                0
    105 
    106 
    107 /*
    108  * Address types.
    109  * All types used to refer to a block of memory are wrapped in structures
    110  * to enforce some type degree of type safety, i.e. a IMG_DEV_VIRTADDR cannot
    111  * be assigned to a variable of type IMG_DEV_PHYSADDR because they are not the
    112  * same thing.
    113  *
    114  * There is an assumption that the system contains at most one non-cpu mmu,
    115  * and a memory block is only mapped by the MMU once.
    116  *
    117  * Different devices could have offset views of the physical address space.
    118  *
    119  */
    120 
    121 
    122 /*
    123  *
    124  * +------------+    +------------+      +------------+        +------------+
    125  * |    CPU     |    |    DEV     |      |    DEV     |        |    DEV     |
    126  * +------------+    +------------+      +------------+        +------------+
    127  *       |                 |                   |                     |
    128  *       | PVOID           |IMG_DEV_VIRTADDR   |IMG_DEV_VIRTADDR     |
    129  *       |                 \-------------------/                     |
    130  *       |                          |                                |
    131  * +------------+             +------------+                         |
    132  * |    MMU     |             |    MMU     |                         |
    133  * +------------+             +------------+                         |
    134  *       |                          |                                |
    135  *       |                          |                                |
    136  *       |                          |                                |
    137  *   +--------+                +---------+                      +--------+
    138  *   | Offset |                | (Offset)|                      | Offset |
    139  *   +--------+                +---------+                      +--------+
    140  *       |                          |                IMG_DEV_PHYADDR |
    141  *       |                          |                                |
    142  *       |                          | IMG_DEV_PHYADDR                |
    143  * +---------------------------------------------------------------------+
    144  * |                         System Address bus                          |
    145  * +---------------------------------------------------------------------+
    146  *
    147  */
    148 
    149 typedef IMG_PVOID IMG_CPU_VIRTADDR;
    150 
    151 /* cpu physical address */
    152 typedef struct {
    153     IMG_UINT32 uiAddr;
    154 } IMG_CPU_PHYADDR;
    155 
    156 /* device virtual address */
    157 typedef struct {
    158     IMG_UINT32 uiAddr;
    159 } IMG_DEV_VIRTADDR;
    160 
    161 /* device physical address */
    162 typedef struct {
    163     IMG_UINT32 uiAddr;
    164 } IMG_DEV_PHYADDR;
    165 
    166 /* system physical address */
    167 typedef struct {
    168     IMG_UINT32 uiAddr;
    169 } IMG_SYS_PHYADDR;
    170 
    171 /*
    172         system physical structure.
    173         specifies contiguous and non-contiguous system physical addresses
    174 */
    175 typedef struct _SYSTEM_ADDR_ {
    176     /* if zero this is contiguous */
    177     IMG_UINT32  ui32PageCount;
    178     union {
    179         /*
    180                 contiguous address:
    181                 basic system address
    182         */
    183         IMG_SYS_PHYADDR sContig;
    184 
    185         /*
    186                 non-contiguous address:
    187                 multiple system page addresses representing system pages
    188                 of which a single allocation is composed
    189                 Note: if non-contiguous allocations don't always start at a
    190                 page boundary then a page offset word is also required.
    191         */
    192         IMG_SYS_PHYADDR asNonContig[1];
    193     } u;
    194 } SYSTEM_ADDR;
    195 
    196 #endif  /* __IMG_TYPES_H__ */
    197 /******************************************************************************
    198  End of file (img_types.h)
    199 ******************************************************************************/
    200