1 /* $OpenBSD: intc.h,v 1.2 2014/03/29 18:09:28 guenther Exp $ */
3 * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #ifndef _OMAPINTC_INTR_H_
19 #define _OMAPINTC_INTR_H_
23 #include <arm/armreg.h>
24 #include <arm/cpufunc.h>
25 #include <machine/intr.h>
26 #include <arm/softintr.h>
28 extern volatile int current_spl_level
;
29 extern volatile int softint_pending
;
30 void intc_do_pending(void);
32 #define SI_TO_IRQBIT(si) (1U<<(si))
33 void intc_setipl(int new);
34 void intc_splx(int new);
35 int intc_splraise(int ipl
);
36 int intc_spllower(int ipl
);
37 void intc_setsoftintr(int si
);
40 * An useful function for interrupt handlers.
41 * XXX: This shouldn't be here.
44 find_first_bit( uint32_t bits
)
48 /* since CLZ is available only on ARMv5, this isn't portable
49 * to all ARM CPUs. This file is for OMAPINTC processor.
51 asm( "clz %0, %1" : "=r" (count
) : "r" (bits
) );
57 * This function *MUST* be called very early on in a port's
58 * initarm() function, before ANY spl*() functions are called.
60 * The parameter is the virtual address of the OMAPINTC's Interrupt
61 * Controller registers.
63 void intc_intr_bootstrap(vaddr_t
);
65 void intc_irq_handler(void *);
66 void *intc_intr_establish(int irqno
, int level
, int (*func
)(void *),
67 void *cookie
, char *name
);
68 void intc_intr_disestablish(void *cookie
);
69 const char *intc_intr_string(void *cookie
);
71 #endif /* ! _LOCORE */
73 #endif /* _OMAPINTC_INTR_H_ */