00001 /* 00002 * Copyright (C) 2001,2002,2003,2004,2005 Philippe Gerum <rpm@xenomai.org>. 00003 * 00004 * RTAI/fusion is free software; you can redistribute it and/or modify it 00005 * under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * RTAI/fusion is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with RTAI/fusion; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00017 * 02111-1307, USA. 00018 */ 00019 00020 #ifndef _RTAI_ASM_I386_CALIBRATION_H 00021 #define _RTAI_ASM_I386_CALIBRATION_H 00022 00023 #include <rtai_config.h> 00024 #include <asm/processor.h> 00025 00026 #define __bogomips (current_cpu_data.loops_per_jiffy/(500000/HZ)) 00027 00028 static inline unsigned long xnarch_get_sched_latency (void) 00029 00030 { 00031 #if CONFIG_RTAI_HW_SCHED_LATENCY != 0 00032 #define __sched_latency CONFIG_RTAI_HW_SCHED_LATENCY 00033 #else 00034 00035 #ifdef CONFIG_X86_LOCAL_APIC 00036 #define __sched_latency 4800 00037 #else /* !CONFIG_X86_LOCAL_APIC */ 00038 00039 /* Use the bogomips formula to identify low-end x86 boards when using 00040 the 8254 PIT. The following is still grossly experimental and needs 00041 work (i.e. more specific cases), but the approach is definitely 00042 saner than previous attempts to guess such value dynamically. */ 00043 #define __sched_latency (__bogomips < 250 ? 23200 : \ 00044 __bogomips < 2500 ? 10200 : \ 00045 6700) 00046 00047 #endif /* CONFIG_X86_LOCAL_APIC */ 00048 #endif /* CONFIG_RTAI_HW_SCHED_LATENCY */ 00049 00050 return __sched_latency; 00051 } 00052 00053 #undef __sched_latency 00054 #undef __bogomips 00055 00056 #endif /* !_RTAI_ASM_I386_CALIBRATION_H */