intr.h revision 1.1 1 1.1 kiyohara /* $NetBSD: intr.h,v 1.1 2013/04/28 12:11:26 kiyohara Exp $ */
2 1.1 kiyohara
3 1.1 kiyohara /*
4 1.1 kiyohara * Copyright (c) 2001, 2003 Wasabi Systems, Inc.
5 1.1 kiyohara * All rights reserved.
6 1.1 kiyohara *
7 1.1 kiyohara * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.1 kiyohara *
9 1.1 kiyohara * Redistribution and use in source and binary forms, with or without
10 1.1 kiyohara * modification, are permitted provided that the following conditions
11 1.1 kiyohara * are met:
12 1.1 kiyohara * 1. Redistributions of source code must retain the above copyright
13 1.1 kiyohara * notice, this list of conditions and the following disclaimer.
14 1.1 kiyohara * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 kiyohara * notice, this list of conditions and the following disclaimer in the
16 1.1 kiyohara * documentation and/or other materials provided with the distribution.
17 1.1 kiyohara * 3. All advertising materials mentioning features or use of this software
18 1.1 kiyohara * must display the following acknowledgement:
19 1.1 kiyohara * This product includes software developed for the NetBSD Project by
20 1.1 kiyohara * Wasabi Systems, Inc.
21 1.1 kiyohara * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.1 kiyohara * or promote products derived from this software without specific prior
23 1.1 kiyohara * written permission.
24 1.1 kiyohara *
25 1.1 kiyohara * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.1 kiyohara * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.1 kiyohara * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.1 kiyohara * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.1 kiyohara * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.1 kiyohara * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.1 kiyohara * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.1 kiyohara * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.1 kiyohara * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.1 kiyohara * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.1 kiyohara * POSSIBILITY OF SUCH DAMAGE.
36 1.1 kiyohara */
37 1.1 kiyohara
38 1.1 kiyohara #ifndef _EPOC32_INTR_H_
39 1.1 kiyohara #define _EPOC32_INTR_H_
40 1.1 kiyohara
41 1.1 kiyohara #ifdef _KERNEL
42 1.1 kiyohara
43 1.1 kiyohara /* Interrupt priority "levels". */
44 1.1 kiyohara #define IPL_NONE 0 /* nothing */
45 1.1 kiyohara #define IPL_SOFTCLOCK 1 /* timeouts */
46 1.1 kiyohara #define IPL_SOFTBIO 2 /* block I/O */
47 1.1 kiyohara #define IPL_SOFTNET 3 /* software network interrupt */
48 1.1 kiyohara #define IPL_SOFTSERIAL 4 /* software serial interrupt */
49 1.1 kiyohara #define IPL_VM 5 /* memory allocation */
50 1.1 kiyohara #define IPL_SCHED 6 /* clock interrupt */
51 1.1 kiyohara #define IPL_HIGH 7 /* everything */
52 1.1 kiyohara
53 1.1 kiyohara #define NIPL 8
54 1.1 kiyohara
55 1.1 kiyohara /* Interrupt sharing types. */
56 1.1 kiyohara #define IST_NONE 0 /* none */
57 1.1 kiyohara #define IST_PULSE 1 /* pulsed */
58 1.1 kiyohara #define IST_EDGE 2 /* edge-triggered */
59 1.1 kiyohara #define IST_LEVEL 3 /* level-triggered */
60 1.1 kiyohara
61 1.1 kiyohara #define __NEWINTR /* enables new hooks in cpu_fork()/cpu_switch() */
62 1.1 kiyohara
63 1.1 kiyohara #define ARM_IRQ_HANDLER _C_LABEL(epoc32_irq_handler)
64 1.1 kiyohara
65 1.1 kiyohara #ifndef _LOCORE
66 1.1 kiyohara
67 1.1 kiyohara #include <sys/queue.h>
68 1.1 kiyohara
69 1.1 kiyohara #if defined(_LKM)
70 1.1 kiyohara
71 1.1 kiyohara int _splraise(int);
72 1.1 kiyohara int _spllower(int);
73 1.1 kiyohara void splx(int);
74 1.1 kiyohara
75 1.1 kiyohara #else /* _LKM */
76 1.1 kiyohara
77 1.1 kiyohara #define PIC_MAXSOURCES 16
78 1.1 kiyohara #define PIC_MAXMAXSOURCES 16
79 1.1 kiyohara
80 1.1 kiyohara #include <arm/pic/picvar.h>
81 1.1 kiyohara
82 1.1 kiyohara #endif /* _LKM */
83 1.1 kiyohara
84 1.1 kiyohara #define splsoft() _splraise(IPL_SOFT)
85 1.1 kiyohara
86 1.1 kiyohara typedef uint8_t ipl_t;
87 1.1 kiyohara typedef struct {
88 1.1 kiyohara ipl_t _ipl;
89 1.1 kiyohara } ipl_cookie_t;
90 1.1 kiyohara
91 1.1 kiyohara static inline ipl_cookie_t
92 1.1 kiyohara makeiplcookie(ipl_t ipl)
93 1.1 kiyohara {
94 1.1 kiyohara
95 1.1 kiyohara return (ipl_cookie_t){._ipl = ipl};
96 1.1 kiyohara }
97 1.1 kiyohara
98 1.1 kiyohara static inline int
99 1.1 kiyohara splraiseipl(ipl_cookie_t icookie)
100 1.1 kiyohara {
101 1.1 kiyohara
102 1.1 kiyohara return _splraise(icookie._ipl);
103 1.1 kiyohara }
104 1.1 kiyohara
105 1.1 kiyohara #define spl0() _spllower(IPL_NONE)
106 1.1 kiyohara
107 1.1 kiyohara #include <sys/spl.h>
108 1.1 kiyohara
109 1.1 kiyohara #endif /* ! _LOCORE */
110 1.1 kiyohara
111 1.1 kiyohara #endif /* _KERNEL */
112 1.1 kiyohara
113 1.1 kiyohara #endif /* _EPOC32_INTR_H_ */
114