base/include/asm-arm/rtai_lxrt.h

Go to the documentation of this file.
00001 /* 00002 * Stuff related to hard-realtime in user-space. 00003 * 00004 * Original RTAI/x86 layer implementation: 00005 * Copyright (c) 2000 Paolo Mantegazza (mantegazza@aero.polimi.it) 00006 * Copyright (c) 2000 Steve Papacharalambous (stevep@zentropix.com) 00007 * Copyright (c) 2000 Stuart Hughes 00008 * and others. 00009 * 00010 * RTAI/x86 rewrite over Adeos: 00011 * Copyright (c) 2002 Philippe Gerum (rpm@xenomai.org) 00012 * 00013 * Original RTAI/ARM RTHAL implementation: 00014 * Copyright (c) 2000 Pierre Cloutier (pcloutier@poseidoncontrols.com) 00015 * Copyright (c) 2001 Alex Züpke, SYSGO RTS GmbH (azu@sysgo.de) 00016 * Copyright (c) 2002 Guennadi Liakhovetski DSA GmbH (gl@dsa-ac.de) 00017 * Copyright (c) 2002 Steve Papacharalambous (stevep@zentropix.com) 00018 * Copyright (c) 2002 Wolfgang Müller (wolfgang.mueller@dsa-ac.de) 00019 * Copyright (c) 2003 Bernard Haible, Marconi Communications 00020 * Copyright (c) 2003 Thomas Gleixner (tglx@linutronix.de) 00021 * Copyright (c) 2003 Philippe Gerum (rpm@xenomai.org) 00022 * 00023 * RTAI/ARM over Adeos rewrite: 00024 * Copyright (c) 2004-2005 Michael Neuhauser, Firmix Software GmbH (mike@firmix.at) 00025 * 00026 * 00027 * This library is free software; you can redistribute it and/or modify it under 00028 * the terms of the GNU Lesser General Public License as published by the Free 00029 * Software Foundation; either version 2 of the License, or (at your option) any 00030 * later version. 00031 * 00032 * This library is distributed in the hope that it will be useful, but WITHOUT 00033 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00034 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00035 * details. You should have received a copy of the GNU Lesser General Public 00036 * License along with this library; if not, write to the Free Software 00037 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00038 */ 00039 #ifndef _RTAI_ASM_ARM_LXRT_H 00040 #define _RTAI_ASM_ARM_LXRT_H 00041 00042 #include <asm/rtai_vectors.h> 00043 00044 /* define registers (pt_regs) that hold syscall related information for 00045 * lxrt_intercept_syscall_prologue() (see entry-common.S:vector_swi & 00046 * adeos.c:__adeos_enter_syscall() in linux/arch/arm/kernel) */ 00047 #define RTAI_SYSCALL_NR ARM_ip /* syscall number */ 00048 #define RTAI_SYSCALL_ARGS ARM_r0 /* syscall argument */ 00049 #define SET_LXRT_RETVAL_IN_SYSCALL(retval) /* set long long syscall return value */ \ 00050 (*(long long)&r->r0 = (retval)) 00051 00052 #define LINUX_SYSCALL_NR ARM_ip 00053 #define LINUX_SYSCALL_REG1 ARM_r0 00054 #define LINUX_SYSCALL_REG2 ARM_r1 00055 #define LINUX_SYSCALL_REG3 ARM_r2 00056 #define LINUX_SYSCALL_REG4 ARM_r3 00057 #define LINUX_SYSCALL_REG5 ARM_r4 00058 #define LINUX_SYSCALL_REG6 ARM_r5 00059 #define LINUX_SYSCALL_RETREG ARM_r0 00060 00061 /* endianess */ 00062 #define LOW 0 00063 #define HIGH 1 00064 00065 /* for scheduler */ 00066 #define USE_LINUX_TIMER 1 00067 #define TIMER_NAME RTAI_TIMER_NAME 00068 #define TIMER_FREQ RTAI_TIMER_FREQ 00069 #define TIMER_LATENCY RTAI_TIMER_LATENCY 00070 #define TIMER_SETUP_TIME RTAI_TIMER_SETUP_TIME 00071 #define ONESHOT_SPAN \ 00072 (((long long)RTAI_TIMER_MAXVAL * RTAI_TSC_FREQ) / RTAI_TIMER_FREQ) 00073 #define update_linux_timer(cpuid) __adeos_pend_uncond(RTAI_TIMER_IRQ, cpuid) 00074 /* Adeos/ARM calls all event handlers with hw-interrupts enabled (both in threaded 00075 * and unthreaded mode), so there is no need for RTAI to do it again. */ 00076 #define IN_INTERCEPT_IRQ_ENABLE() do { /* nop */ } while (0) 00077 00078 union rtai_lxrt_t { 00079 RTIME rt; 00080 int i[2]; 00081 void *v[2]; 00082 }; 00083 00084 #ifdef __cplusplus 00085 extern "C" { 00086 #endif /* __cplusplus */ 00087 00088 #ifdef __KERNEL__ 00089 00090 #include <asm/system.h> 00091 #include <asm/mmu_context.h> 00092 00093 /* use "extern inline" to force inlining (gcc 3.3.2 does not inline it into 00094 * lxrt_context_switch() if "static inline" is used) */ 00095 extern inline void 00096 _lxrt_context_switch(struct task_struct *prev, struct task_struct *next, int cpuid) 00097 { 00098 struct mm_struct *oldmm = prev->active_mm; 00099 00100 ADEOS_PARANOIA_ASSERT(adeos_hw_irqs_disabled()); 00101 ADEOS_PARANOIA_ASSERT(next->active_mm); 00102 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 00103 switch_mm(oldmm, next->active_mm, next, cpuid); 00104 if (!next->mm) 00105 enter_lazy_tlb(oldmm, next, cpuid); 00106 #else /* >= 2.6.0 */ 00107 switch_mm(oldmm, next->active_mm, next); 00108 if (!next->mm) 00109 enter_lazy_tlb(oldmm, next); 00110 #endif /* < 2.6.0 */ 00111 switch_to(prev, next, prev); 00112 ADEOS_PARANOIA_ASSERT(adeos_hw_irqs_disabled()); 00113 } 00114 00115 #else /* !__KERNEL__ */ 00116 00117 static inline union rtai_lxrt_t 00118 rtai_lxrt(short int dynx, short int lsize, int srq, void *arg) 00119 { 00120 union rtai_lxrt_t retval; 00121 retval.rt = RTAI_DO_SWI(RTAI_SYS_VECTOR, ENCODE_LXRT_REQ(dynx, srq, lsize), arg); 00122 return retval; 00123 } 00124 00125 #define rtai_iopl() do { /* nop */ } while (0) 00126 00127 #endif /* __KERNEL__ */ 00128 00129 #ifdef __cplusplus 00130 } 00131 #endif /* __cplusplus */ 00132 00133 #endif /* !_RTAI_ASM_ARM_LXRT_H */

Generated on Thu Nov 20 11:49:48 2008 for RTAI API by doxygen 1.3.8