Main Page   File List  

irq.h

00001 /* $Id: irq.h 28276 2007-04-10 12:44:30Z adam $ */
00011 /* (c) 2003 Technische Universitaet Dresden
00012  * This file is part of DROPS, which is distributed under the terms of the
00013  * GNU General Public License 2. Please see the COPYING file for details. */
00014 
00015 #ifndef __L4_IRQ_H__ 
00016 #define __L4_IRQ_H__ 
00017 
00018 #include <l4/sys/compiler.h>
00019 #include <l4/util/port_io.h>
00020 
00021 EXTERN_C_BEGIN
00022 
00026 L4_INLINE void
00027 l4util_irq_acknowledge(unsigned int irq);
00028 
00031 static inline void
00032 l4util_cli (void)
00033 {
00034   __asm__ __volatile__ ("cli" : : : "memory");
00035 }
00036 
00039 static inline void
00040 l4util_sti (void)
00041 {
00042   __asm__ __volatile__ ("sti" : : : "memory");
00043 }
00044 
00048 static inline void
00049 l4util_flags_save (l4_umword_t *flags)
00050 {
00051   __asm__ __volatile__ ("pushf ; popq %0 " :"=g" (*flags) : :"memory");
00052 }
00053 
00056 static inline void
00057 l4util_flags_restore (l4_umword_t *flags)
00058 {
00059   __asm__ __volatile__ ("pushq %0 ; popf" : :"g" (*flags) : "memory");
00060 }
00061 
00062 L4_INLINE void
00063 l4util_irq_acknowledge(unsigned int irq)
00064 {
00065   if (irq > 7)
00066     {
00067       l4util_out8(0x60+(irq & 7), 0xA0);
00068       l4util_out8(0x0B,0xA0);
00069       if (l4util_in8(0xA0) == 0)
00070         l4util_out8(0x60 + 2, 0x20);
00071     } 
00072   else
00073     l4util_out8(0x60+irq, 0x20);     /* acknowledge the irq */
00074 };
00075 
00076 EXTERN_C_END
00077 
00078 #endif

L4 Utilities, part of DROPS  © 2000-2003