1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#include <common.h>
20#include <exports.h>
21#include <config.h>
22
23#if defined(CONFIG_MPC5xxx)
24#define DFL_IRQ MPC5XXX_IRQ1
25#else
26#define DFL_IRQ 0
27#endif
28
29static void irq_handler (void *arg);
30
31int interrupt (int argc, char * const argv[])
32{
33 int c, irq = -1;
34
35 app_startup (argv);
36
37 if (argc > 1)
38 irq = simple_strtoul (argv[1], NULL, 0);
39 if ((irq < 0) || (irq > NR_IRQS))
40 irq = DFL_IRQ;
41
42 printf ("Installing handler for irq vector %d and doing busy wait\n",
43 irq);
44 printf ("Press 'q' to quit\n");
45
46
47 install_hdlr (irq, irq_handler, NULL);
48 while ((c = getc ()) != 'q') {
49 printf ("Ok, ok, I am still alive!\n");
50 }
51
52 free_hdlr (irq);
53 printf ("\nInterrupt handler has been uninstalled\n");
54
55 return (0);
56}
57
58
59
60
61static void irq_handler (void *arg)
62{
63
64 printf ("+");
65}
66