irq.c

Go to the documentation of this file.
00001 
00041 #include "irq.h"
00042 
00043 #include <cfg/module.h>
00044 #include <kern/proc_p.h>
00045 #include <kern/proc.h>
00046 
00047 #include "cfg/cfg_proc.h"
00048 
00049 #include <unistd.h> // FIXME: move POSIX stuff to irq_posix.h
00050 
00051 MOD_DEFINE(irq)
00052 
00053 // FIXME
00054 static void (*irq_handlers[100])(void);
00055 
00056 /* signal handler */
00057 void irq_entry(int signum)
00058 {
00059     irq_handlers[signum]();
00060 }
00061 
00062 void irq_register(int irq, void (*callback)(void))
00063 {
00064     irq_handlers[irq] = callback;
00065 }
00066 
00067 void irq_init(void)
00068 {
00069     struct sigaction act;
00070 
00071     act.sa_handler = irq_entry;
00072     sigemptyset(&act.sa_mask);
00073     //sigaddset(&act.sa_mask, irq);
00074     act.sa_flags = SA_RESTART; // | SA_SIGINFO;
00075 
00076     sigaction(SIGUSR1, &act, NULL);
00077     sigaction(SIGALRM, &act, NULL);
00078 
00079     MOD_INIT(irq);
00080 }