base/include/asm-x86_64/rtai_usi.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1999-2005 Paolo Mantegazza <mantegazza@aero.polimi.it>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef _RTAI_ASM_X8664_USI_H
00020 #define _RTAI_ASM_X8664_USI_H
00021 
00022 #define USI_SRQ_MASK  0xFFFFFFF0
00023 
00024 #define _STARTUP_IRQ       1
00025 #define _SHUTDOWN_IRQ      2
00026 #define _ENABLE_IRQ        3
00027 #define _DISABLE_IRQ       4
00028 #define _MASK_AND_ACK_IRQ  5
00029 #define _ACK_IRQ           6
00030 #define _UNMASK_IRQ        7
00031 #define _DISINT            8
00032 #define _ENINT             9
00033 #define _SAVE_FLAGS_CLI   10
00034 #define _RESTORE_FLAGS    11
00035 
00036 #ifdef __KERNEL__
00037 
00038 #ifdef CONFIG_RTAI_USI
00039 
00040 static void usi_cli(unsigned long arg, unsigned long *eflags) 
00041 {
00042     clear_bit(RTAI_IFLAG, eflags);
00043 }
00044 
00045 static void usi_sti(unsigned long arg, unsigned long *eflags)
00046 {
00047     set_bit(RTAI_IFLAG, eflags);
00048 }
00049 
00050 static unsigned long usi_save_flags_and_cli(unsigned long arg, unsigned long *eflags)
00051 {
00052     unsigned long flags = *eflags;
00053     clear_bit(RTAI_IFLAG, eflags);
00054     return flags;
00055 }
00056 
00057 static void usi_restore_flags(unsigned long flags, unsigned long *eflags)
00058 {
00059     if (test_bit(RTAI_IFLAG, &flags)) {
00060         set_bit(RTAI_IFLAG, eflags);
00061     } else {
00062         clear_bit(RTAI_IFLAG, eflags);
00063     }
00064 }
00065 
00066 static unsigned long (*usi_fun_entry[ ])(unsigned long, unsigned long *) = {
00067     [_STARTUP_IRQ]      = (void *)rt_startup_irq,
00068     [_SHUTDOWN_IRQ]     = (void *)rt_shutdown_irq,
00069     [_ENABLE_IRQ]       = (void *)rt_enable_irq,
00070     [_DISABLE_IRQ]      = (void *)rt_disable_irq,
00071     [_MASK_AND_ACK_IRQ] = (void *)rt_mask_and_ack_irq,
00072     [_ACK_IRQ]      = (void *)rt_ack_irq,
00073     [_UNMASK_IRQ]       = (void *)rt_unmask_irq,
00074     [_DISINT]       = (void *)usi_cli,
00075     [_ENINT]        = (void *)usi_sti,
00076     [_SAVE_FLAGS_CLI]   = (void *)usi_save_flags_and_cli,
00077     [_RESTORE_FLAGS]    = (void *)usi_restore_flags
00078 };
00079 
00080 #define IF_IS_A_USI_SRQ_CALL_IT(srq, args, retval, psr, retpath) \
00081     if (srq > USI_SRQ_MASK) { \
00082         *retval = usi_fun_entry[srq & ~USI_SRQ_MASK](args, &(psr)); \
00083         return retpath; \
00084     }
00085 #else
00086 
00087 #define IF_IS_A_USI_SRQ_CALL_IT(srq, args, retval, psr, retpath)
00088 
00089 #endif
00090 
00091 #endif /* __KERNEL__ */
00092 
00093 #endif /* !_RTAI_ASM_X8664_USI_H */

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