]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/MAI/bios_emulator/scitech/src/common/galinux.c
* Code cleanup:
[people/ms/u-boot.git] / board / MAI / bios_emulator / scitech / src / common / galinux.c
CommitLineData
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
41static ibool haveRDTSC;
42
43/*-------------------------- Implementation -------------------------------*/
44
45/****************************************************************************
46PARAMETERS:
47path - Local path to the Nucleus driver files.
48
49REMARKS:
50This function is used by the application program to override the location
51of the Nucleus driver files that are loaded. Normally the loader code
52will look in the system Nucleus directories first, then in the 'drivers'
53directory relative to the current working directory, and finally relative
54to the MGL_ROOT environment variable.
55****************************************************************************/
56void NAPI GA_setLocalPath(
57 const char *path)
58{
59 PM_setLocalBPDPath(path);
60}
61
62/****************************************************************************
63RETURNS:
64Pointer to the system wide PM library imports, or the internal version if none
65
66REMARKS:
67In order to support deploying new Nucleus drivers that may require updated
68PM library functions, we check here to see if there is a system wide version
69of the PM functions available. If so we return those functions for use with
70the system wide Nucleus drivers, otherwise the compiled in version of the PM
71library is used with the application local version of Nucleus.
72****************************************************************************/
73PM_imports * NAPI GA_getSystemPMImports(void)
74{
8bde7f77
WD
75 /* TODO: We may very well want to provide a system shared library */
76 /* that eports the PM functions required by the Nucleus library */
77 /* for Linux here. That will eliminate fatal errors loading new */
78 /* drivers on Linux! */
c7de829c
WD
79 return &_PM_imports;
80}
81
82/****************************************************************************
83REMARKS:
84Nothing special for this OS.
85****************************************************************************/
86ibool NAPI GA_getSharedExports(
87 GA_exports *gaExp,
88 ibool shared)
89{
90 (void)gaExp;
91 (void)shared;
92 return false;
93}
94
95#ifndef TEST_HARNESS
96/****************************************************************************
97REMARKS:
98Nothing special for this OS
99****************************************************************************/
100ibool NAPI GA_queryFunctions(
101 GA_devCtx *dc,
102 N_uint32 id,
103 void _FAR_ *funcs)
104{
105 return __GA_exports.GA_queryFunctions(dc,id,funcs);
106}
107
108/****************************************************************************
109REMARKS:
110Nothing special for this OS
111****************************************************************************/
112ibool NAPI REF2D_queryFunctions(
113 REF2D_driver *ref2d,
114 N_uint32 id,
115 void _FAR_ *funcs)
116{
117 return __GA_exports.REF2D_queryFunctions(ref2d,id,funcs);
118}
119#endif
120
121/****************************************************************************
122REMARKS:
123This function initialises the high precision timing functions for the
124Nucleus loader library.
125****************************************************************************/
126ibool NAPI GA_TimerInit(void)
127{
128 if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
8bde7f77 129 haveRDTSC = true;
c7de829c
WD
130 return true;
131}
132
133/****************************************************************************
134REMARKS:
135This function reads the high resolution timer.
136****************************************************************************/
137void NAPI GA_TimerRead(
138 GA_largeInteger *value)
139{
140 if (haveRDTSC)
8bde7f77 141 _GA_readTimeStamp(value);
c7de829c 142 else {
8bde7f77
WD
143 struct timeval t;
144 gettimeofday(&t, NULL);
145 value->low = t.tv_sec*1000000 + t.tv_usec;
146 value->high = 0;
147 }
c7de829c 148}