base/include/asm-ppc/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_USI_H 00020 #define _RTAI_ASM_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 static void usi_cli(unsigned long arg, unsigned long *eflags) 00039 { 00040 set_bit(RTAI_IFLAG, eflags); 00041 } 00042 00043 static void usi_sti(unsigned long arg, unsigned long *eflags) 00044 { 00045 clear_bit(RTAI_IFLAG, eflags); 00046 } 00047 00048 static unsigned long usi_save_flags_and_cli(unsigned long arg, unsigned long *eflags) 00049 { 00050 unsigned long flags = *eflags; 00051 set_bit(RTAI_IFLAG, eflags); 00052 return flags; 00053 } 00054 00055 static void usi_restore_flags(unsigned long flags, unsigned long *eflags) 00056 { 00057 if (test_bit(RTAI_IFLAG, &flags)) { 00058 set_bit(RTAI_IFLAG, eflags); 00059 } else { 00060 clear_bit(RTAI_IFLAG, eflags); 00061 } 00062 } 00063 00064 static unsigned long (*usi_fun_entry[ ])(unsigned long, unsigned long *) = { 00065 [_STARTUP_IRQ] = (void *)rt_startup_irq, 00066 [_SHUTDOWN_IRQ] = (void *)rt_shutdown_irq, 00067 [_ENABLE_IRQ] = (void *)rt_enable_irq, 00068 [_DISABLE_IRQ] = (void *)rt_disable_irq, 00069 [_MASK_AND_ACK_IRQ] = (void *)rt_mask_and_ack_irq, 00070 [_ACK_IRQ] = (void *)rt_ack_irq, 00071 [_UNMASK_IRQ] = (void *)rt_unmask_irq, 00072 [_DISINT] = (void *)usi_cli, 00073 [_ENINT] = (void *)usi_sti, 00074 [_SAVE_FLAGS_CLI] = (void *)usi_save_flags_and_cli, 00075 [_RESTORE_FLAGS] = (void *)usi_restore_flags 00076 }; 00077 00078 #define IF_IS_A_USI_SRQ_CALL_IT() \ 00079 if (srq > USI_SRQ_MASK) { \ 00080 *(long long*)&regs->ARM_r0 \ 00081 = usi_fun_entry[srq & ~USI_SRQ_MASK](arg, &regs->ARM_cpsr); \ 00082 return 1; \ 00083 } \ 00084 00085 #endif /* __KERNEL__ */ 00086 00087 #endif /* !_RTAI_ASM_USI_H */

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