2 * Copyright (c) 2010-2011 Matthias Rustler
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #include <exec/execbase.h>
26 #include <graphics/gfxbase.h>
27 #include <aros/inquire.h>
28 #include <resources/battclock.h>
29 #include <resources/processor.h>
31 #include <proto/exec.h>
32 #include <proto/aros.h>
33 #include <proto/graphics.h>
34 #include <proto/battclock.h>
35 #include <proto/processor.h>
37 #include "identify_intern.h"
40 /*****************************************************************************
43 #include <proto/identify.h>
45 AROS_LH2(ULONG
, IdHardwareNum
,
48 AROS_LHA(ULONG
, type
, D0
),
49 AROS_LHA(struct TagItem
*, taglist
, A0
),
52 struct IdentifyBaseIntern
*, IdentifyBase
, 9, Identify
)
55 Gets information about the current system environment. The result
56 is returned numerical. This function is fully DraCo compatible!
58 Once a information has been read, it will be cached internally, so
59 changes will be ignored. Use IdHardwareUpdate() to clear the cache
63 Type -- (ULONG) Information type. These types are known
64 (see include file and NOTE for detailed description):
66 IDHW_SYSTEM -- What system is used?
67 (include file: IDSYS_...)
69 IDHW_CPU -- What kind of CPU is available?
70 (include file: IDCPU_...)
72 IDHW_FPU -- What kind of FPU is available?
73 (include file: IDFPU_...)
75 IDHW_MMU -- What kind of MMU is available?
76 (include file: IDMMU_...)
78 IDHW_OSVER -- What OS version is used?
81 IDHW_EXECVER -- What exec version is used?
84 IDHW_WBVER -- What WorkBench version is used?
85 (version, revision; 0 if not available)
87 IDHW_ROMSIZE -- Size of AmigaOS ROM
90 IDHW_CHIPSET -- What Chipset is available?
91 (include file: IDCS_...)
93 IDHW_GFXSYS -- What Graphic OS is used?
94 (include file: IDGOS_...)
96 IDHW_CHIPRAM -- Size of complete Chip RAM
99 IDHW_FASTRAM -- Size of complete Fast RAM
102 IDHW_RAM -- Size of complete System RAM
105 IDHW_SETPATCHVER -- Version of current SetPatch
106 (version, revision; 0 if not available)
108 IDHW_AUDIOSYS -- What Audio OS is used?
109 (include file: IDAOS_...)
111 IDHW_OSNR -- What AmigaOS is used?
112 (include file: IDOS_...)
114 IDHW_VMMCHIPRAM -- Size of virtual Chip RAM
117 IDHW_VMMFASTRAM -- Size of virtual Fast RAM
120 IDHW_VMMRAM -- Size of total virtual RAM
123 IDHW_PLNCHIPRAM -- Size of non-virtual Chip RAM
126 IDHW_PLNFASTRAM -- Size of non-virtual Fast RAM
129 IDHW_PLNRAM -- Size of total non-virtual RAM
132 IDHW_VBR -- Vector Base Register contents
135 IDHW_LASTALERT -- Last Alert code
136 (ULONG, 0xFFFFFFFF: no last alert yet)
138 IDHW_VBLANKFREQ -- VBlank frequency (see execbase.h)
141 IDHW_POWERFREQ -- Power supply frequency (see execbase.h)
144 IDHW_ECLOCK -- System E clock frequency
147 IDHW_SLOWRAM -- A500/A2000 "Slow" RAM expansion
150 IDHW_GARY -- GARY revision
151 (include file: IDGRY_...)
153 IDHW_RAMSEY -- RAMSEY revision
154 (include file: IDRSY_...)
156 IDHW_BATTCLOCK -- Battery backed up clock present?
159 IDHW_CHUNKYPLANAR -- [V7] Chunky to planar hardware present?
162 IDHW_POWERPC -- [V7] PowerPC CPU present?
163 (include file: IDPPC_...)
165 IDHW_PPCCLOCK -- [V7] PowerPC processor clock
166 (ULONG clock in MHz units, or 0: not available)
168 IDHW_CPUREV -- [V8] Revision of the main processor
169 (LONG revision or -1 if not available)
171 IDHW_CPUCLOCK -- [V8] CPU clock
172 (ULONG clock in MHz units)
174 IDHW_FPUCLOCK -- [V8] FPU clock, if available
175 (ULONG clock in MHz units, or 0: not available)
177 IDHW_RAMACCESS -- [V8] Access time of the main board RAM
178 (ULONG in ns units, or 0: not available)
180 IDHW_RAMWIDTH -- [V8] Width of the main board RAM
181 (ULONG in bit, or 0: not available)
183 IDHW_RAMCAS -- [V8] CAS mode of the main board RAM
184 (include file: IDCAS_...)
186 IDHW_RAMBANDWIDTH -- [V8] Bandwidth of the main board RAM
187 (ULONG in times, or 0: not available)
189 IDHW_TCPIP -- [V9] Used TCP/IP stack
190 (include file: IDTCP_...)
192 IDHW_PPCOS -- [V9] Used PowerPC OS
193 (include file: IDPOS_...)
195 IDHW_AGNUS -- [V9] Agnus chip type and revision
196 (include file: IDAG_...)
198 IDHW_AGNUSMODE -- [V9] Agnus chip mode
199 (include file: IDAM_...)
201 IDHW_DENISE -- [V10] Denise chip type
202 (include file: IDDN_...)
204 IDHW_DENISEREV -- [V10] Denise chip revision
205 (LONG, -1 means not available)
207 TagList -- (struct TagItem *) tags that describe further
208 options. You may provide NULL.
214 Result -- (ULONG) Numerical result containing the desired
218 Some results are nonsense on AROS.
220 If you queried a version, you'll find the version in the *lower*
221 UWORD (because it is more important) and the revision in the
224 All memory sizes are always in bytes.
226 Boolean results are ==0 for FALSE, !=0 for TRUE.
228 If you have to look up the result in the include file, you might
229 also get a numerical result that is beyond the maximum value you'll
230 find there. Be prepared for it! In this case, just print "not known"
231 or anything similar, or use the IdHardware() result.
238 IdHardware(), IdHardwareUpdate()
245 *****************************************************************************/
259 #elif defined __x86_64__
261 #elif defined __mc68000__
263 #elif defined __powerpc__
265 #elif defined __arm__
268 return IDCPU_unknown
;
283 AI_ArosReleaseMajor
, &version
,
284 AI_ArosReleaseMinor
, &revision
,
287 return version
| (revision
<< 16);
292 ((struct Library
*)SysBase
)->lib_Version
294 (((struct Library
*)SysBase
)->lib_Revision
<< 16);
297 return 40; // i.e. OS3.1
302 ArosInquire(AI_KickstartSize
, &storage
, TAG_DONE
);
307 return IDCS_OCS
; // FIXME: there's no IDCS_NONE
313 return AvailMem(MEMF_CHIP
|MEMF_TOTAL
);
316 return AvailMem(MEMF_FAST
|MEMF_TOTAL
);
319 return AvailMem(MEMF_ANY
|MEMF_TOTAL
);
321 case IDHW_SETPATCHVER
:
330 case IDHW_VMMCHIPRAM
:
333 case IDHW_VMMFASTRAM
:
339 case IDHW_PLNCHIPRAM
:
340 return AvailMem(MEMF_CHIP
|MEMF_TOTAL
);
342 case IDHW_PLNFASTRAM
:
343 return AvailMem(MEMF_FAST
|MEMF_TOTAL
);
346 return AvailMem(MEMF_ANY
|MEMF_TOTAL
);
352 return SysBase
->LastAlert
[0];
354 case IDHW_VBLANKFREQ
:
355 return SysBase
->VBlankFrequency
;
358 return SysBase
->PowerSupplyFrequency
;
361 return SysBase
->ex_EClockFrequency
;
374 struct Library
*BattClockBase
= OpenResource(BATTCLOCKNAME
);
377 return ReadBattClock() ? TRUE
: FALSE
;
382 case IDHW_CHUNKYPLANAR
:
383 return GfxBase
->ChunkyToPlanarPtr
? FALSE
: TRUE
;
397 APTR ProcessorBase
= OpenResource(PROCESSORNAME
);
400 struct TagItem tags
[] =
402 { GCIT_ProcessorSpeed
, (IPTR
)&speed
},
407 return speed
/ 1000000;
416 if (GfxBase
->MemType
& 1)
422 if (GfxBase
->MemType
& 2)
427 case IDHW_RAMBANDWIDTH
:
463 case IDHW_HOSTMACHINE
:
476 } /* IdHardwareNum */