Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / mvme / pcctwovar.h
blob521bd4af592996ad0ec6f231038b3cddedfa2f0b
1 /* $NetBSD: pcctwovar.h,v 1.3 2005/12/11 12:22:48 christos Exp $ */
3 /*-
4 * Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Steve C. Woodford
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MVME_PCCTWOVAR_H
33 #define _MVME_PCCTWOVAR_H
36 * Structure used to attach PCC devices.
38 struct pcctwo_attach_args {
39 const char *pa_name; /* name of device */
40 int pa_ipl; /* interrupt level */
41 bus_dma_tag_t pa_dmat; /* DMA tag */
42 bus_space_tag_t pa_bust; /* Bus tag */
43 bus_addr_t pa_offset; /* Offset with 'Bus tag' bus space */
45 bus_addr_t _pa_base;
49 * Structure used to describe a device for autoconfiguration purposes.
51 struct pcctwo_device {
52 const char *pcc_name; /* name of device (e.g. "clock") */
53 bus_addr_t pcc_offset; /* offset from PCC2 base */
57 * Macroes to make life easy when converting vector offset to interrupt
58 * control register, and how to initialise the ICSR.
60 #define VEC2ICSR(r,v) ((r) | (((v) | PCCTWO_ICR_IEN) << 8))
61 #define VEC2ICSR_REG(x) ((x) & 0xff)
62 #define VEC2ICSR_INIT(x) ((x) >> 8)
64 /* Shorthand for locators. */
65 #include "locators.h"
66 #define pcctwocf_ipl cf_loc[PCCTWOCF_IPL]
69 * PCCChip2 driver's soft state structure
71 struct pcctwo_softc {
72 struct device sc_dev;
73 bus_space_tag_t sc_bust; /* PCCChip2's register tag */
74 bus_space_handle_t sc_bush; /* PCCChip2's register handle */
75 bus_dma_tag_t sc_dmat; /* PCCChip2's dma tag (unused)*/
76 int *sc_vec2icsr; /* Translate vector to ICSR */
77 int sc_vecbase;
78 void *sc_isrcookie;
79 void (*sc_isrlink)(void *, int (*)(void *), void *,
80 int, int, struct evcnt *);
81 void (*sc_isrunlink)(void *, int);
82 struct evcnt * (*sc_isrevcnt)(void *, int);
83 #if defined(MVME162) || defined(MVME172)
84 struct evcnt sc_evcnt;
85 #endif
88 extern struct pcctwo_softc *sys_pcctwo;
90 extern void pcctwo_init(struct pcctwo_softc *,
91 const struct pcctwo_device *, int);
92 extern struct evcnt *pcctwointr_evcnt(int);
93 extern void pcctwointr_establish(int, int (*)(void *), int, void *,
94 struct evcnt *);
95 extern void pcctwointr_disestablish(int);
97 #endif /* _MVME_PCCTWOVAR_H */