Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / arm / pic / picvar.h
blob8b329e051bf82769142bcef2fa960e2e8e1fef9f
1 /* $NetBSD: picvar.h,v 1.3 2008/04/28 20:23:14 martin Exp $ */
2 /*-
3 * Copyright (c) 2008 The NetBSD Foundation, Inc.
4 * All rights reserved.
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
30 #ifndef _ARM_PIC_PICVAR_H_
31 #define _ARM_PIC_PICVAR_H_
33 int _splraise(int);
34 int _spllower(int);
35 void splx(int);
36 const char *
37 intr_typename(int);
39 struct pic_softc;
40 struct intrsource;
42 int pic_handle_intr(void *);
43 void pic_mark_pending(struct pic_softc *pic, int irq);
44 void pic_mark_pending_source(struct pic_softc *pic, struct intrsource *is);
45 uint32_t pic_mark_pending_sources(struct pic_softc *pic, size_t irq_base,
46 uint32_t pending);
47 void *pic_establish_intr(struct pic_softc *pic, int irq, int ipl, int type,
48 int (*func)(void *), void *arg);
49 int pic_alloc_irq(struct pic_softc *pic);
50 void pic_disestablish_source(struct intrsource *is);
51 void pic_do_pending_ints(register_t psw, int newipl, void *frame);
52 void pic_dispatch(struct intrsource *is, void *frame);
54 void *intr_establish(int irq, int ipl, int type, int (*func)(void *),
55 void *arg);
56 void intr_disestablish(void *);
58 #ifdef _INTR_PRIVATE
60 #ifndef PIC_MAXPICS
61 #define PIC_MAXPICS 32
62 #endif
63 #ifndef PIC_MAXSOURCES
64 #define PIC_MAXSOURCES 64
65 #endif
66 #ifndef PIC_MAXMAXSOURCES
67 #define PIC_MAXMAXSOURCES 128
68 #endif
70 struct intrsource {
71 int (*is_func)(void *);
72 void *is_arg;
73 struct pic_softc *is_pic; /* owning PIC */
74 uint8_t is_type; /* IST_xxx */
75 uint8_t is_ipl; /* IPL_xxx */
76 uint8_t is_irq; /* local to pic */
77 uint8_t is_iplidx;
78 struct evcnt is_ev;
79 char is_source[16];
82 struct pic_softc {
83 const struct pic_ops *pic_ops;
84 struct intrsource **pic_sources;
85 volatile uint32_t pic_pending_irqs[(PIC_MAXSOURCES + 31) / 32];
86 volatile uint32_t pic_blocked_irqs[(PIC_MAXSOURCES + 31) / 32];
87 volatile uint32_t pic_pending_ipls;
88 size_t pic_maxsources;
89 uint8_t pic_id;
90 int16_t pic_irqbase;
91 char pic_name[14];
94 struct pic_ops {
95 void (*pic_unblock_irqs)(struct pic_softc *, size_t, uint32_t);
96 void (*pic_block_irqs)(struct pic_softc *, size_t, uint32_t);
97 int (*pic_find_pending_irqs)(struct pic_softc *);
99 void (*pic_establish_irq)(struct pic_softc *, struct intrsource *);
100 void (*pic_source_name)(struct pic_softc *, int, char *, size_t);
104 void pic_add(struct pic_softc *, int);
105 void pic_do_pending_int(void);
107 extern struct pic_softc * pic_list[PIC_MAXPICS];
108 #endif /* _INTR_PRIVATE */
110 #endif /* _ARM_PIC_PICVAR_H_ */