summaryrefslogtreecommitdiff
path: root/drivers/mxc/amd-gpu/os/include/os_types.h
blob: e7ecd90f89521007aae167f0732dab6f042f4b53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 /* Copyright (c) 2008-2010, QUALCOMM Incorporated. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of QUALCOMM Incorporated nor
 *       the names of its contributors may be used to endorse or promote
 *       products derived from this software without specific prior written
 *       permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */

#ifndef __OSTYPES_H
#define __OSTYPES_H

//////////////////////////////////////////////////////////////////////////////
//   status
//////////////////////////////////////////////////////////////////////////////
#define OS_SUCCESS                       0
#define OS_FAILURE                      -1
#define OS_FAILURE_SYSTEMERROR          -2
#define OS_FAILURE_DEVICEERROR          -3
#define OS_FAILURE_OUTOFMEM             -4
#define OS_FAILURE_BADPARAM             -5
#define OS_FAILURE_NOTSUPPORTED         -6
#define OS_FAILURE_NOMOREAVAILABLE      -7
#define OS_FAILURE_NOTINITIALIZED       -8
#define OS_FAILURE_ALREADYINITIALIZED   -9
#define OS_FAILURE_TIMEOUT              -10


//////////////////////////////////////////////////////////////////////////////
// inline
//////////////////////////////////////////////////////////////////////////////
#ifndef OSINLINE
#ifdef _LINUX
#define OSINLINE    static __inline
#else
#define OSINLINE    __inline
#endif
#endif // OSINLINE


//////////////////////////////////////////////////////////////////////////////
//  values
//////////////////////////////////////////////////////////////////////////////
#define OS_INFINITE             0xFFFFFFFF
#define OS_TLS_OUTOFINDEXES     0xFFFFFFFF
#define OS_TRUE                         1
#define OS_FALSE                        0

#ifndef NULL
#define NULL                    (void *)0x0
#endif  // !NULL

//////////////////////////////////////////////////////////////////////////////
// types
//////////////////////////////////////////////////////////////////////////////


//
// oshandle_t
//
typedef void *          oshandle_t;
#define OS_HANDLE_NULL  (oshandle_t)0x0

//
// os_sysinfo_t
//
typedef struct _os_sysinfo_t {
    int     cpu_mhz;
    int     cpu_type;
    int     cpu_version;
    int     os_type;
    int     os_version;
    int     sysmem_size;
    int     page_size;
    int     max_path;
    int     tls_slots;
    int     endianness;     // 0 == little_endian, 1 == big_endian
} os_sysinfo_t;


//
// os_stats_t
//
#ifdef _LINUX
typedef long long __int64;
typedef unsigned long long __uint64;
#else
typedef unsigned __int64 __uint64;
#endif

typedef struct _os_stats_t {
    __int64     heap_allocs;
    __int64     heap_frees;
    __int64     heap_alloc_bytes;
    __int64     shared_heap_allocs;
    __int64     shared_heap_frees;
    __int64     shared_heap_alloc_bytes;
    __int64     objects_alloc;
    __int64     objects_free;
} os_stats_t;


typedef enum {
    OS_PROTECTION_GLOBAL,   // inter process
    OS_PROTECTION_LOCAL,    // process local
    OS_PROTECTION_NONE,     // none
} os_protection_t;

typedef struct _os_cputimer_t {
    int refcount;                   // Reference count
    int enabled;                    // Counter is enabled
    int size;                       // Number of counters
    __int64  start_time;            // start time in cpu ticks
    __int64  end_time;              // end time in cpu ticks
    __int64  timer_frequency;       // cpu ticks per second
    __int64  *counter_array;        // number of ticks for each counter
} os_cputimer_t;

#endif  // __OSTYPES_H