]>
Commit | Line | Data |
---|---|---|
c7de829c WD |
1 | /**************************************************************************** |
2 | * | |
3 | * SciTech Nucleus Graphics Architecture | |
4 | * | |
5 | * Copyright (C) 1991-1998 SciTech Software, Inc. | |
6 | * All rights reserved. | |
7 | * | |
8 | * ====================================================================== | |
9 | * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| | |
10 | * | | | |
11 | * |This copyrighted computer code contains proprietary technology | | |
12 | * |owned by SciTech Software, Inc., located at 505 Wall Street, | | |
13 | * |Chico, CA 95928 USA (http://www.scitechsoft.com). | | |
14 | * | | | |
15 | * |The contents of this file are subject to the SciTech Nucleus | | |
16 | * |License; you may *not* use this file or related software except in | | |
17 | * |compliance with the License. You may obtain a copy of the License | | |
18 | * |at http://www.scitechsoft.com/nucleus-license.txt | | |
19 | * | | | |
20 | * |Software distributed under the License is distributed on an | | |
21 | * |"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | | |
22 | * |implied. See the License for the specific language governing | | |
23 | * |rights and limitations under the License. | | |
24 | * | | | |
25 | * |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| | |
26 | * ====================================================================== | |
27 | * | |
28 | * Language: ANSI C | |
29 | * Environment: Linux | |
30 | * | |
31 | * Description: OS specific Nucleus Graphics Architecture services for | |
32 | * the Linux operating system. | |
33 | * | |
34 | ****************************************************************************/ | |
35 | ||
36 | #include "nucleus/graphics.h" | |
37 | #include <sys/time.h> | |
38 | ||
39 | /*---------------------------- Global Variables ---------------------------*/ | |
40 | ||
41 | static ibool haveRDTSC; | |
42 | ||
43 | /*-------------------------- Implementation -------------------------------*/ | |
44 | ||
45 | /**************************************************************************** | |
46 | REMARKS: | |
47 | Nothing special for this OS. | |
48 | ****************************************************************************/ | |
49 | GA_sharedInfo * NAPI GA_getSharedInfo( | |
50 | int device) | |
51 | { | |
52 | (void)device; | |
53 | return NULL; | |
54 | } | |
55 | ||
56 | /**************************************************************************** | |
57 | REMARKS: | |
58 | Nothing special for this OS. | |
59 | ****************************************************************************/ | |
60 | ibool NAPI GA_getSharedExports( | |
61 | GA_exports *gaExp) | |
62 | { | |
63 | (void)gaExp; | |
64 | return false; | |
65 | } | |
66 | ||
67 | /**************************************************************************** | |
68 | REMARKS: | |
69 | This function initialises the high precision timing functions for the | |
70 | Nucleus loader library. | |
71 | ****************************************************************************/ | |
72 | ibool NAPI GA_TimerInit(void) | |
73 | { | |
74 | if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) | |
8bde7f77 | 75 | haveRDTSC = true; |
c7de829c WD |
76 | return true; |
77 | } | |
78 | ||
79 | /**************************************************************************** | |
80 | REMARKS: | |
81 | This function reads the high resolution timer. | |
82 | ****************************************************************************/ | |
83 | void NAPI GA_TimerRead( | |
84 | GA_largeInteger *value) | |
85 | { | |
86 | if (haveRDTSC) | |
8bde7f77 | 87 | _GA_readTimeStamp(value); |
c7de829c | 88 | else { |
8bde7f77 WD |
89 | struct timeval t; |
90 | gettimeofday(&t, NULL); | |
91 | value->low = t.tv_sec*1000000 + t.tv_usec; | |
92 | value->high = 0; | |
93 | } | |
c7de829c | 94 | } |