]>
git.ipfire.org Git - people/ms/u-boot.git/blob - examples/standalone/interrupt.c
3 * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
7 * This is a very simple standalone application demonstrating
8 * catching IRQs on the MPC52xx architecture.
10 * The interrupt to be intercepted can be specified as an argument
11 * to the application. Specifying nothing will intercept IRQ1 on the
12 * MPC5200 platform. On the CR825 carrier board from MicroSys this
13 * maps to the ABORT switch :)
15 * Note that the specified vector is only a logical number specified
16 * by the respective header file.
23 #if defined(CONFIG_MPC5xxx)
24 #define DFL_IRQ MPC5XXX_IRQ1
29 static void irq_handler (void *arg
);
31 int interrupt (int argc
, char * const argv
[])
38 irq
= simple_strtoul (argv
[1], NULL
, 0);
39 if ((irq
< 0) || (irq
> NR_IRQS
))
42 printf ("Installing handler for irq vector %d and doing busy wait\n",
44 printf ("Press 'q' to quit\n");
46 /* Install interrupt handler */
47 install_hdlr (irq
, irq_handler
, NULL
);
48 while ((c
= getc ()) != 'q') {
49 printf ("Ok, ok, I am still alive!\n");
53 printf ("\nInterrupt handler has been uninstalled\n");
59 * Handler for interrupt
61 static void irq_handler (void *arg
)
63 /* just for demonstration */