3 * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23 * This is a very simple standalone application demonstrating
24 * catching IRQs on the MPC52xx architecture.
26 * The interrupt to be intercepted can be specified as an argument
27 * to the application. Specifying nothing will intercept IRQ1 on the
28 * MPC5200 platform. On the CR825 carrier board from MicroSys this
29 * maps to the ABORT switch :)
31 * Note that the specified vector is only a logical number specified
32 * by the respective header file.
39 #if defined(CONFIG_MPC5xxx)
40 #define DFL_IRQ MPC5XXX_IRQ1
45 static void irq_handler (void *arg);
47 int interrupt (int argc, char *argv[])
54 irq = simple_strtoul (argv[1], NULL, 0);
55 if ((irq < 0) || (irq > NR_IRQS))
58 printf ("Installing handler for irq vector %d and doing busy wait\n",
60 printf ("Press 'q' to quit\n");
62 /* Install interrupt handler */
63 install_hdlr (irq, irq_handler, NULL);
64 while ((c = getc ()) != 'q') {
65 printf ("Ok, ok, I am still alive!\n");
69 printf ("\nInterrupt handler has been uninstalled\n");
75 * Handler for interrupt
77 static void irq_handler (void *arg)
79 /* just for demonstration */