2 * (c) 2008-2009 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU General Public License 2.
5 * Please see the COPYING-GPL-2 file for details.
8 * This example shall show how to use the libirq.
11 #include <l4/irq/irq.h>
12 #include <l4/util/util.h>
18 static void isr_handler(void *data)
21 printf("Got IRQ %d\n", IRQ_NO);
26 const int seconds = 5;
29 if (!(irqdesc = l4irq_request(IRQ_NO, isr_handler, 0, 0xff, 0)))
31 printf("Requesting IRQ %d failed\n", IRQ_NO);
35 printf("Attached to key IRQ %d\nPress keys now, will terminate in %d seconds\n",
38 l4_sleep(seconds * 1000);
40 if (l4irq_release(irqdesc))
42 printf("Failed to release IRQ\n");