u_cpu_detect.h

Go to the documentation of this file.
00001 /**************************************************************************
00002  * 
00003  * Copyright 2008 Dennis Smit
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining a
00007  * copy of this software and associated documentation files (the "Software"),
00008  * to deal in the Software without restriction, including without limitation
00009  * on the rights to use, copy, modify, merge, publish, distribute, sub
00010  * license, and/or sell copies of the Software, and to permit persons to whom
00011  * the Software is furnished to do so, subject to the following conditions:
00012  *
00013  * The above copyright notice and this permission notice (including the next
00014  * paragraph) shall be included in all copies or substantial portions of the
00015  * Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00018  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
00020  * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
00021  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
00022  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
00023  * USE OR OTHER DEALINGS IN THE SOFTWARE.
00024  *
00025  ***************************************************************************/
00026 
00027 /*
00028  * Based on the work of Eric Anholt <anholt@FreeBSD.org>
00029  */
00030 
00031 #ifndef _CPU_DETECT_H
00032 #define _CPU_DETECT_H
00033 
00034 typedef enum {
00035         CPU_DETECT_TYPE_MIPS,
00036         CPU_DETECT_TYPE_ALPHA,
00037         CPU_DETECT_TYPE_SPARC,
00038         CPU_DETECT_TYPE_X86,
00039         CPU_DETECT_TYPE_POWERPC,
00040         CPU_DETECT_TYPE_OTHER
00041 } cpu_detect_type;
00042 
00043 struct cpu_detect_caps {
00044         cpu_detect_type type;
00045         int             nrcpu;
00046 
00047         /* Feature flags */
00048         int             x86cpuType;
00049         int             cacheline;
00050 
00051         int             hasTSC;
00052         int             hasMMX;
00053         int             hasMMX2;
00054         int             hasSSE;
00055         int             hasSSE2;
00056         int             hasSSE3;
00057         int             hasSSSE3;
00058         int             has3DNow;
00059         int             has3DNowExt;
00060         int             hasAltiVec;
00061 };
00062 
00063 /* prototypes */
00064 void cpu_detect_initialize(void);
00065 struct cpu_detect_caps *cpu_detect_get_caps(void);
00066 
00067 int cpu_detect_get_tsc(void);
00068 int cpu_detect_get_mmx(void);
00069 int cpu_detect_get_mmx2(void);
00070 int cpu_detect_get_sse(void);
00071 int cpu_detect_get_sse2(void);
00072 int cpu_detect_get_sse3(void);
00073 int cpu_detect_get_ssse3(void);
00074 int cpu_detect_get_3dnow(void);
00075 int cpu_detect_get_3dnow2(void);
00076 int cpu_detect_get_altivec(void);
00077 
00078 #endif /* _CPU_DETECT_H */

Generated on Tue Sep 29 06:25:15 2009 for Gallium3D by  doxygen 1.5.4