NVIDIA DriveOS Linux NSR SDK API Reference
7.0.3.0 Release
cpuopsys.h
Go to the documentation of this file.
1
26
#ifndef CPUOPSYS_H
27
#define CPUOPSYS_H
28
29
/*****************************************************************************/
30
/* Define all OS/CPU-Chip related symbols */
31
32
/* ***** WINDOWS variations */
33
#if defined(_WIN32) || defined(_WIN16)
34
# define NV_WINDOWS
35
36
# if defined(_WIN32_WINNT)
37
# define NV_WINDOWS_NT
38
# elif defined(_WIN32_WCE)
39
# define NV_WINDOWS_CE
40
# elif !defined(NV_MODS)
41
# define NV_WINDOWS_9X
42
# endif
43
#endif
/* _WIN32 || defined(_WIN16) */
44
45
/* ***** Unix variations */
46
#if defined(__linux__) && !defined(NV_LINUX) && !defined(NV_VMWARE)
47
# define NV_LINUX
48
#endif
/* defined(__linux__) */
49
50
#if defined(__VMWARE__) && !defined(NV_VMWARE)
51
# define NV_VMWARE
52
#endif
/* defined(__VMWARE__) */
53
54
/* SunOS + gcc */
55
#if defined(__sun__) && defined(__svr4__) && !defined(NV_SUNOS)
56
# define NV_SUNOS
57
#endif
/* defined(__sun__) && defined(__svr4__) */
58
59
/* SunOS + Sun Compiler (named SunPro, Studio or Forte) */
60
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
61
# define NV_SUNPRO_C
62
# define NV_SUNOS
63
#endif
/* defined(_SUNPRO_C) || defined(__SUNPRO_CC) */
64
65
#if defined(__FreeBSD__) && !defined(NV_BSD)
66
# define NV_BSD
67
#endif
/* defined(__FreeBSD__) */
68
69
/* XXXar don't define NV_UNIX on MacOSX or vxworks or QNX */
70
#if (defined(__unix__) || defined(__unix) || defined(__INTEGRITY) ) && !defined(nvmacosx) && !defined(vxworks) && !defined(NV_UNIX) && !defined(__QNX__) && !defined(__QNXNTO__)
/* XXX until removed from Makefiles */
71
# define NV_UNIX
72
#endif
/* defined(__unix__) */
73
74
#if (defined(__QNX__) || defined(__QNXNTO__)) && !defined(NV_QNX)
75
# define NV_QNX
76
#endif
77
78
#if (defined(__ANDROID__) || defined(ANDROID)) && !defined(NV_ANDROID)
79
# define NV_ANDROID
80
#endif
81
82
#if defined(__hos__) && !defined(NV_HOS)
83
# define NV_HOS
84
#endif
85
86
/* ***** Apple variations */
87
#if defined(macintosh) || defined(__APPLE__)
88
# define NV_MACINTOSH
89
# if defined(__MACH__)
90
# define NV_MACINTOSH_OSX
91
# else
92
# define NV_MACINTOSH_OS9
93
# endif
94
# if defined(__LP64__)
95
# define NV_MACINTOSH_64
96
# endif
97
#endif
/* defined(macintosh) */
98
99
/* ***** VxWorks */
100
/* Tornado 2.21 is gcc 2.96 and #defines __vxworks. */
101
/* Tornado 2.02 is gcc 2.7.2 and doesn't define any OS symbol, so we rely on */
102
/* the build system #defining vxworks. */
103
#if defined(__vxworks) || defined(vxworks)
104
# define NV_VXWORKS
105
#endif
106
107
/* ***** Integrity OS */
108
#if defined(__INTEGRITY)
109
# if !defined(NV_INTEGRITY)
110
# define NV_INTEGRITY
111
# endif
112
#endif
113
114
/* ***** Processor type variations */
115
/* Note: The prefix NV_CPU_* is taken by \\sw\main\sdk\nvidia\inc\Nvcm.h */
116
117
#if ((defined(_M_IX86) || defined(__i386__) || defined(__i386)) && !defined(NVCPU_X86))
/* XXX until removed from Makefiles */
118
/* _M_IX86 for windows, __i386__ for Linux (or any x86 using gcc) */
119
/* __i386 for Studio compiler on Solaris x86 */
120
# define NVCPU_X86
/* any IA32 machine (not x86-64) */
121
# define NVCPU_MIN_PAGE_SHIFT 12
122
#endif
123
124
#if defined(_WIN32) && defined(_M_IA64)
125
# define NVCPU_IA64_WINDOWS
/* any IA64 for Windows opsys */
126
#endif
127
#if defined(NV_LINUX) && defined(__ia64__)
128
# define NVCPU_IA64_LINUX
/* any IA64 for Linux opsys */
129
#endif
130
#if defined(NVCPU_IA64_WINDOWS) || defined(NVCPU_IA64_LINUX) || defined(IA64)
131
# define NVCPU_IA64
/* any IA64 for any opsys */
132
#endif
133
134
#if (defined(NV_MACINTOSH) && !(defined(__i386__) || defined(__x86_64__))) || defined(__PPC__) || defined(__ppc)
135
# if defined(__powerpc64__) && defined(__LITTLE_ENDIAN__)
136
# ifndef NVCPU_PPC64LE
137
# define NVCPU_PPC64LE
/* PPC 64-bit little endian */
138
# endif
139
# else
140
# ifndef NVCPU_PPC
141
# define NVCPU_PPC
/* any non-PPC64LE PowerPC architecture */
142
# endif
143
# ifndef NV_BIG_ENDIAN
144
# define NV_BIG_ENDIAN
145
# endif
146
# endif
147
# define NVCPU_FAMILY_PPC
148
#endif
149
150
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
151
# define NVCPU_X86_64
/* any x86-64 for any opsys */
152
#endif
153
154
#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
155
# define NVCPU_FAMILY_X86
156
#endif
157
158
#if defined(__arm__) || defined(_M_ARM)
159
/*
160
* 32-bit instruction set on, e.g., ARMv7 or AArch32 execution state
161
* on ARMv8
162
*/
163
# define NVCPU_ARM
164
# define NVCPU_MIN_PAGE_SHIFT 12
165
#endif
166
167
#if defined(__aarch64__) || defined(__ARM64__)
168
# define NVCPU_AARCH64
/* 64-bit A64 instruction set on ARMv8 */
169
# define NVCPU_MIN_PAGE_SHIFT 12
170
#endif
171
172
#if defined(NVCPU_ARM) || defined(NVCPU_AARCH64)
173
# define NVCPU_FAMILY_ARM
174
#endif
175
176
#if defined(__SH4__)
177
# ifndef NVCPU_SH4
178
# define NVCPU_SH4
/* Renesas (formerly Hitachi) SH4 */
179
# endif
180
# if defined NV_WINDOWS_CE
181
# define NVCPU_MIN_PAGE_SHIFT 12
182
# endif
183
#endif
184
185
/* For Xtensa processors */
186
#if defined(__XTENSA__)
187
# define NVCPU_XTENSA
188
# if defined(__XTENSA_EB__)
189
# define NV_BIG_ENDIAN
190
# endif
191
#endif
192
193
194
/*
195
* Other flavors of CPU type should be determined at run-time.
196
* For example, an x86 architecture with/without SSE.
197
* If it can compile, then there's no need for a compile time option.
198
* For some current GCC limitations, these may be fixed by using the Intel
199
* compiler for certain files in a Linux build.
200
*/
201
202
/* The minimum page size can be determined from the minimum page shift */
203
#if defined(NVCPU_MIN_PAGE_SHIFT)
204
#define NVCPU_MIN_PAGE_SIZE (1 << NVCPU_MIN_PAGE_SHIFT)
205
#endif
206
207
#if defined(NVCPU_IA64) || defined(NVCPU_X86_64) || \
208
defined(NV_MACINTOSH_64) || defined(NVCPU_AARCH64) || \
209
defined(NVCPU_PPC64LE)
210
# define NV_64_BITS
/* all architectures where pointers are 64 bits */
211
#else
212
/* we assume 32 bits. I don't see a need for NV_16_BITS. */
213
#endif
214
215
/*
216
* NOTE: NV_INT64_OK is not needed in the OpenGL driver for any platform
217
* we care about these days. The only consideration is that Linux does not
218
* have a 64-bit divide on the server. To get around this, we convert the
219
* expression to (double) for the division.
220
*/
221
#if (!(defined(macintosh) || defined(vxworks) || defined(__INTEL_COMPILER)) || defined(NV_LINUX)) && !defined(NV_INT64_OK)
222
#define NV_INT64_OK
223
#endif
224
225
/* For verification-only features not intended to be included in normal drivers */
226
#if defined(NV_MODS) && defined(DEBUG) && !defined(DISABLE_VERIF_FEATURES)
227
#define NV_VERIF_FEATURES
228
#endif
229
230
/*
231
* New, safer family of #define's -- these ones use 0 vs. 1 rather than
232
* defined/!defined. This is advantageous because if you make a typo, say:
233
*
234
* #if NVCPU_IS_BIG_ENDAIN
235
*
236
* ...some compilers can give you a warning telling you that you screwed up.
237
* The compiler can also give you a warning if you forget to #include
238
* "cpuopsys.h" in your code before the point where you try to use these
239
* conditionals.
240
*
241
* Also, the names have been prefixed in more cases with "CPU" or "OS" for
242
* increased clarity. You can tell the names apart from the old ones because
243
* they all use "_IS_" in the name.
244
*
245
* Finally, these can be used in "if" statements and not just in #if's. For
246
* example:
247
*
248
* if (NVCPU_IS_BIG_ENDIAN) x = Swap32(x);
249
*
250
* Maybe some day in the far-off future these can replace the old #define's.
251
*/
252
#if defined(NV_WINDOWS)
253
#define NVOS_IS_WINDOWS 1
254
#else
255
#define NVOS_IS_WINDOWS 0
256
#endif
257
#if defined(NV_WINDOWS_CE)
258
#define NVOS_IS_WINDOWS_CE 1
259
#else
260
#define NVOS_IS_WINDOWS_CE 0
261
#endif
262
#if defined(NV_LINUX)
263
#define NVOS_IS_LINUX 1
264
#else
265
#define NVOS_IS_LINUX 0
266
#endif
267
#if defined(NV_UNIX)
268
#define NVOS_IS_UNIX 1
269
#else
270
#define NVOS_IS_UNIX 0
271
#endif
272
#if defined(NV_BSD)
273
#define NVOS_IS_FREEBSD 1
274
#else
275
#define NVOS_IS_FREEBSD 0
276
#endif
277
#if defined(NV_SUNOS)
278
#define NVOS_IS_SOLARIS 1
279
#else
280
#define NVOS_IS_SOLARIS 0
281
#endif
282
#if defined(NV_VMWARE)
283
#define NVOS_IS_VMWARE 1
284
#else
285
#define NVOS_IS_VMWARE 0
286
#endif
287
#if defined(NV_QNX)
288
#define NVOS_IS_QNX 1
289
#else
290
#define NVOS_IS_QNX 0
291
#endif
292
#if defined(NV_ANDROID)
293
#define NVOS_IS_ANDROID 1
294
#else
295
#define NVOS_IS_ANDROID 0
296
#endif
297
#if defined(NV_MACINTOSH)
298
#define NVOS_IS_MACINTOSH 1
299
#else
300
#define NVOS_IS_MACINTOSH 0
301
#endif
302
#if defined(NV_VXWORKS)
303
#define NVOS_IS_VXWORKS 1
304
#else
305
#define NVOS_IS_VXWORKS 0
306
#endif
307
#if defined(NV_INTEGRITY)
308
#define NVOS_IS_INTEGRITY 1
309
#else
310
#define NVOS_IS_INTEGRITY 0
311
#endif
312
#if defined(NV_HOS)
313
#define NVOS_IS_HOS 1
314
#else
315
#define NVOS_IS_HOS 0
316
#endif
317
#if defined(NVCPU_X86)
318
#define NVCPU_IS_X86 1
319
#else
320
#define NVCPU_IS_X86 0
321
#endif
322
#if defined(NVCPU_IA64)
323
#define NVCPU_IS_IA64 1
324
#else
325
#define NVCPU_IS_IA64 0
326
#endif
327
#if defined(NVCPU_X86_64)
328
#define NVCPU_IS_X86_64 1
329
#else
330
#define NVCPU_IS_X86_64 0
331
#endif
332
#if defined(NVCPU_FAMILY_X86)
333
#define NVCPU_IS_FAMILY_X86 1
334
#else
335
#define NVCPU_IS_FAMILY_X86 0
336
#endif
337
#if defined(NVCPU_PPC)
338
#define NVCPU_IS_PPC 1
339
#else
340
#define NVCPU_IS_PPC 0
341
#endif
342
#if defined(NVCPU_PPC64LE)
343
#define NVCPU_IS_PPC64LE 1
344
#else
345
#define NVCPU_IS_PPC64LE 0
346
#endif
347
#if defined(NVCPU_FAMILY_PPC)
348
#define NVCPU_IS_FAMILY_PPC 1
349
#else
350
#define NVCPU_IS_FAMILY_PPC 0
351
#endif
352
#if defined(NVCPU_ARM)
353
#define NVCPU_IS_ARM 1
354
#else
355
#define NVCPU_IS_ARM 0
356
#endif
357
#if defined(NVCPU_AARCH64)
358
#define NVCPU_IS_AARCH64 1
359
#else
360
#define NVCPU_IS_AARCH64 0
361
#endif
362
#if defined(NVCPU_FAMILY_ARM)
363
#define NVCPU_IS_FAMILY_ARM 1
364
#else
365
#define NVCPU_IS_FAMILY_ARM 0
366
#endif
367
#if defined(NVCPU_SH4)
368
#define NVCPU_IS_SH4 1
369
#else
370
#define NVCPU_IS_SH4 0
371
#endif
372
#if defined(NVCPU_XTENSA)
373
#define NVCPU_IS_XTENSA 1
374
#else
375
#define NVCPU_IS_XTENSA 0
376
#endif
377
#if defined(NV_BIG_ENDIAN)
378
#define NVCPU_IS_BIG_ENDIAN 1
379
#else
380
#define NVCPU_IS_BIG_ENDIAN 0
381
#endif
382
#if defined(NV_64_BITS)
383
#define NVCPU_IS_64_BITS 1
384
#else
385
#define NVCPU_IS_64_BITS 0
386
#endif
387
#if defined(NVCPU_FAMILY_ARM)
388
#define NVCPU_IS_PCIE_CACHE_COHERENT 0
389
#else
390
#define NVCPU_IS_PCIE_CACHE_COHERENT 1
391
#endif
392
/*****************************************************************************/
393
394
#endif
/* CPUOPSYS_H */
Privacy Policy
|
Manage My Privacy
|
Do Not Sell or Share My Data
|
Terms of Service
|
Accessibility
|
Corporate Policies
|
Product Security
|
Contact
© 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Subject to Change | For test and development only.
Thu May 8 2025 00:05:06 | PR-10721-6.0