1 /*        $NetBSD: esp_isavar.h,v 1.5 2008/04/13 04:55:53 tsutsui Exp $         */
2 
3 /*
4  * Copyright (c) 1997 Allen Briggs.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *        This product includes software developed by Peter Galbavy.
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * Copyright (c) 1997 Eric S. Hvozda (hvozda@netcom.com)
35  * All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  * 1. Redistributions of source code must retain the above copyright
41  *    notice, this list of conditions and the following disclaimer.
42  * 2. Redistributions in binary form must reproduce the above copyright
43  *    notice, this list of conditions and the following disclaimer in the
44  *    documentation and/or other materials provided with the distribution.
45  * 3. All advertising materials mentioning features or use of this software
46  *    must display the following acknowledgement:
47  *      This product includes software developed by Eric S. Hvozda.
48  * 4. The name of Eric S. Hvozda may not be used to endorse or promote products
49  *    derived from this software without specific prior written permission.
50  *
51  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61  */
62 
63 struct esp_isa_softc {
64           struct ncr53c9x_softc         sc_ncr53c9x;        /* glue to MI code */
65 
66           int                 sc_active;                    /* Pseudo-DMA state vars */
67           int                 sc_tc;
68           int                 sc_datain;
69           size_t              sc_dmasize;
70           size_t              sc_dmatrans;
71           uint8_t             **sc_dmaaddr;
72           size_t              *sc_pdmalen;
73 
74           bus_space_tag_t sc_iot;
75           bus_space_handle_t sc_ioh;
76           void *sc_ih;
77           int sc_irq;
78           int sc_drq;
79 
80 #ifdef ESP_DEBUG
81           int sc_debug;
82 #endif
83 };
84 
85 struct esp_isa_probe_data {
86           int sc_irq;
87           int sc_isncr;
88           int sc_rev;
89           int sc_isfast;
90           int sc_msize;
91           int sc_parity;
92           int sc_sync;
93           int sc_id;
94           uint8_t sc_cfg4, sc_cfg5;
95 };
96 
97 #define ESP_ISA_IOSIZE  16
98 
99 int       esp_isa_find(bus_space_tag_t, bus_space_handle_t,
100               struct esp_isa_probe_data *);
101 void    esp_isa_init(struct esp_isa_softc *, struct esp_isa_probe_data *);
102 
103 #ifdef ESP_DEBUG
104 extern int esp_isa_debug;
105 
106 #define ESP_SHOWTRAC    0x01
107 #define ESP_SHOWREGS    0x02
108 #define ESP_SHOWMISC    0x04
109 
110 #define ESP_TRACE(str)  \
111         do {if (esp_isa_debug & ESP_SHOWTRAC) printf str;} while (0)
112 #define ESP_REGS(str)  \
113         do {if (esp_isa_debug & ESP_SHOWREGS) printf str;} while (0)
114 #define ESP_MISC(str)  \
115         do {if (esp_isa_debug & ESP_SHOWMISC) printf str;} while (0)
116 #else
117 #define ESP_TRACE(str)
118 #define ESP_REGS(str)
119 #define ESP_MISC(str)
120 #endif
121