Annotation of sys/arch/arm/xscale/pxa2x0_intr.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: pxa2x0_intr.h,v 1.11 2007/05/19 15:47:16 miod Exp $ */
2: /* $NetBSD: pxa2x0_intr.h,v 1.4 2003/07/05 06:53:08 dogcow Exp $ */
3:
4: /* Derived from i80321_intr.h */
5:
6: /*
7: * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
8: * All rights reserved.
9: *
10: * Written by Jason R. Thorpe for Wasabi Systems, Inc.
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
20: * 3. All advertising materials mentioning features or use of this software
21: * must display the following acknowledgement:
22: * This product includes software developed for the NetBSD Project by
23: * Wasabi Systems, Inc.
24: * 4. The name of Wasabi Systems, Inc. may not be used to endorse
25: * or promote products derived from this software without specific prior
26: * written permission.
27: *
28: * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
29: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
32: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38: * POSSIBILITY OF SUCH DAMAGE.
39: */
40:
41: #ifndef _PXA2X0_INTR_H_
42: #define _PXA2X0_INTR_H_
43:
44: #define ARM_IRQ_HANDLER _C_LABEL(pxa2x0_irq_handler)
45:
46: #ifndef _LOCORE
47:
48: #include <arm/armreg.h>
49: #include <arm/cpufunc.h>
50: #include <arm/softintr.h>
51:
52: extern vaddr_t pxaic_base; /* Shared with pxa2x0_irq.S */
53: #define read_icu(offset) (*(volatile uint32_t *)(pxaic_base+(offset)))
54: #define write_icu(offset,value) \
55: (*(volatile uint32_t *)(pxaic_base+(offset))=(value))
56:
57: extern __volatile int current_spl_level;
58: extern __volatile int softint_pending;
59: extern int pxa2x0_imask[];
60: void pxa2x0_do_pending(void);
61:
62: void pxa2x0_setipl(int new);
63: void pxa2x0_splx(int new);
64: int pxa2x0_splraise(int ipl);
65: int pxa2x0_spllower(int ipl);
66: void pxa2x0_setsoftintr(int si);
67:
68:
69: /*
70: * An useful function for interrupt handlers.
71: * XXX: This shouldn't be here.
72: */
73: static __inline int
74: find_first_bit( uint32_t bits )
75: {
76: int count;
77:
78: /* since CLZ is available only on ARMv5, this isn't portable
79: * to all ARM CPUs. This file is for PXA2[15]0 processor.
80: */
81: asm( "clz %0, %1" : "=r" (count) : "r" (bits) );
82: return 31-count;
83: }
84:
85:
86: int _splraise(int);
87: int _spllower(int);
88: void splx(int);
89: void _setsoftintr(int);
90:
91: /*
92: * This function *MUST* be called very early on in a port's
93: * initarm() function, before ANY spl*() functions are called.
94: *
95: * The parameter is the virtual address of the PXA2x0's Interrupt
96: * Controller registers.
97: */
98: void pxa2x0_intr_bootstrap(vaddr_t);
99:
100: void pxa2x0_irq_handler(void *);
101: void *pxa2x0_intr_establish(int irqno, int level, int (*func)(void *),
102: void *cookie, char *name);
103: void pxa2x0_intr_disestablish(void *cookie);
104: const char *pxa2x0_intr_string(void *cookie);
105:
106: #ifdef DIAGNOSTIC
107: /*
108: * Although this function is implemented in MI code, it must be in this MD
109: * header because we don't want this header to include MI includes.
110: */
111: void splassert_fail(int, int, const char *);
112: extern int splassert_ctl;
113: void pxa2x0_splassert_check(int, const char *);
114: #define splassert(__wantipl) do { \
115: if (splassert_ctl > 0) { \
116: pxa2x0_splassert_check(__wantipl, __func__); \
117: } \
118: } while (0)
119: #else
120: #define splassert(wantipl) do { /* nothing */ } while (0)
121: #endif
122:
123: #endif /* ! _LOCORE */
124:
125: #endif /* _PXA2X0_INTR_H_ */
CVSweb