base/include/asm-arm/rtai_vectors.h

Go to the documentation of this file.
00001 /*
00002  * Support for user to kernel-space feature.
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  * RTAI/ARM over Adeos rewrite for PXA255_2.6.7:
00027  *   Copyright (c) 2005 Stefano Gafforelli (stefano.gafforelli@tiscali.it)
00028  *   Copyright (c) 2005 Luca Pizzi (lucapizzi@hotmail.com)
00029  *
00030  * This program is free software; you can redistribute it and/or modify it under
00031  * the terms of the GNU General Public License as published by the Free Software
00032  * Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, USA; either version 2 of
00033  * the License, or (at your option) any later version.
00034  *
00035  * This program is distributed in the hope that it will be useful, but WITHOUT
00036  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00037  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00038  * details.
00039  *
00040  * You should have received a copy of the GNU General Public License along with
00041  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00042  * Place - Suite 330, Boston, MA 02111-1307, USA.
00043  */
00044 #ifndef _RTAI_ASM_ARM_VECTORS_H
00045 #define _RTAI_ASM_ARM_VECTORS_H
00046 
00047 #include <rtai_config.h>
00048 
00049 /*
00050  * ARM SWI assembler instructen = 8 bit SWI op-code + 24 bit info
00051  *
00052  * SWI info = 4 bit OS-number (Linux = 9) + 20 bit syscall number
00053  *
00054  * SWI info for Linux syscall:  ..9x_xxxx (syscall number: 0_0000 - f_ffff)
00055  *
00056  * Linux syscall number range:  ..90_0000 - ..9e_ffff
00057  * ARM private syscalls:    ..9f_0000 - ..9f_ffef
00058  * RTAI syscalls:       ..9f_fff0 - ..9f_ffff
00059  *
00060  * Old style "vectors" could be in least signigicant half-byte of SWI info (but
00061  * currently only one RTAI syscall is used ..9f_fff0).
00062  */
00063 
00064 #define RTAI_NUM_VECTORS    16      /* number of usable vectors */
00065 #define RTAI_SWI_SCNO_MASK  0x00FFFFF0
00066 #define RTAI_SWI_VEC_MASK   0x0000000F
00067 
00068 #define RTAI_SYS_VECTOR     0x0     /* only one used (-> LXRT requests and SRQs) */
00069 #if 0
00070 /* shm not implemented yet (trouble with virtual addresses in cache) and when it
00071  * will be implemented it's unlikely that a seperate vector will be used) */
00072 #define RTAI_SHM_VECTOR     0x2
00073 #endif
00074 
00075 /* The "memory" clobber constraint is essential! It forces the compiler to not
00076  * cache in registers across this call (e.g. data that is written to a user
00077  * structure by the call might not be (re)read after the call without the
00078  * constraint. (glibc implements syscalls pretty much the same way) */
00079 
00080 #define _RTAI_DO_SWI(scno_magic, srq, parg) ({                  \
00081     union {                                 \
00082     long long ll;                               \
00083     struct {                                \
00084         unsigned long low;                          \
00085         unsigned long high;                         \
00086     } l;                                    \
00087     } _retval;                                  \
00088     {                                       \
00089     register int _r0 asm ("r0") = (int)(srq);               \
00090     register int _r1 asm ("r1") = (int)(parg);              \
00091     asm volatile("swi %[nr]"                        \
00092         : "+r" (_r0), "+r" (_r1)                        \
00093         : [nr] "i" (scno_magic)                     \
00094         : "memory"                              \
00095     );                                  \
00096     _retval.l.low = _r0;                            \
00097     _retval.l.high = _r1;                           \
00098     }                                       \
00099     _retval.ll;                                 \
00100 })
00101 
00102 #ifdef CONFIG_ARCH_PXA
00103 #   define RTAI_SWI_SCNO_MAGIC      0x00404404
00104 #   define RTAI_DO_SWI(vector, srq, parg)   _RTAI_DO_SWI(RTAI_SWI_SCNO_MAGIC, srq, parg)
00105 #else /* !CONFIG_ARCH_PXA */
00106 #   define RTAI_SWI_SCNO_MAGIC      0x009FFFF0
00107 #   define RTAI_DO_SWI(vector, srq, parg)   _RTAI_DO_SWI((RTAI_SWI_SCNO_MAGIC | ((vector) & RTAI_SWI_VEC_MASK)), srq, parg)
00108 #endif /* CONFIG_ARCH_PXA */
00109 
00110 #endif /* _RTAI_ASM_ARM_VECTORS_H */

Generated on Tue Feb 2 17:46:05 2010 for RTAI API by  doxygen 1.4.7