pccreg.h revision 1.9.6.2 1 1.9.6.2 scw /* $NetBSD: pccreg.h,v 1.9.6.2 2001/08/12 18:33:14 scw Exp $ */
2 1.9.6.2 scw
3 1.9.6.2 scw /*
4 1.9.6.2 scw *
5 1.9.6.2 scw * Copyright (c) 1995 Charles D. Cranor
6 1.9.6.2 scw * All rights reserved.
7 1.9.6.2 scw *
8 1.9.6.2 scw * Redistribution and use in source and binary forms, with or without
9 1.9.6.2 scw * modification, are permitted provided that the following conditions
10 1.9.6.2 scw * are met:
11 1.9.6.2 scw * 1. Redistributions of source code must retain the above copyright
12 1.9.6.2 scw * notice, this list of conditions and the following disclaimer.
13 1.9.6.2 scw * 2. Redistributions in binary form must reproduce the above copyright
14 1.9.6.2 scw * notice, this list of conditions and the following disclaimer in the
15 1.9.6.2 scw * documentation and/or other materials provided with the distribution.
16 1.9.6.2 scw * 3. All advertising materials mentioning features or use of this software
17 1.9.6.2 scw * must display the following acknowledgement:
18 1.9.6.2 scw * This product includes software developed by Charles D. Cranor.
19 1.9.6.2 scw * 4. The name of the author may not be used to endorse or promote products
20 1.9.6.2 scw * derived from this software without specific prior written permission.
21 1.9.6.2 scw *
22 1.9.6.2 scw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.9.6.2 scw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.9.6.2 scw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.9.6.2 scw * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.9.6.2 scw * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.9.6.2 scw * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.9.6.2 scw * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.9.6.2 scw * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.9.6.2 scw * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.9.6.2 scw * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.9.6.2 scw */
33 1.9.6.2 scw
34 1.9.6.2 scw /*
35 1.9.6.2 scw * peripheral channel controller on mvme147
36 1.9.6.2 scw */
37 1.9.6.2 scw #ifndef __MVME68K_PCCREG_H
38 1.9.6.2 scw #define __MVME68K_PCCREG_H
39 1.9.6.2 scw
40 1.9.6.2 scw /*
41 1.9.6.2 scw * Offsets to the MVME147's onboard device registers.
42 1.9.6.2 scw * (Relative to the bus_space_tag_t passed in from 'mainbus')
43 1.9.6.2 scw */
44 1.9.6.2 scw #define PCC_LE_OFF 0x0800 /* offset of LANCE ethernet chip */
45 1.9.6.2 scw #define PCC_VME_OFF 0x1000 /* offset of VME chip */
46 1.9.6.2 scw #define PCC_LPT_OFF 0x1800 /* offset of parallel port register */
47 1.9.6.2 scw #define PCC_ZS0_OFF 0x2000 /* offset of first 8530 UART */
48 1.9.6.2 scw #define PCC_ZS1_OFF 0x2800 /* offset of second 8530 UART */
49 1.9.6.2 scw #define PCC_WDSC_OFF 0x3000 /* offset of 33c93 SCSI chip */
50 1.9.6.2 scw
51 1.9.6.2 scw /*
52 1.9.6.2 scw * This is needed to figure out the boot device.
53 1.9.6.2 scw * (The physical address of the boot device's registers are passed in
54 1.9.6.2 scw * from the Boot ROM)
55 1.9.6.2 scw */
56 1.9.6.2 scw #define PCC_PADDR(off) ((void *)(0xfffe0000u + (off)))
57 1.9.6.2 scw
58 1.9.6.2 scw /*
59 1.9.6.2 scw * The PCC chip's own registers. These are 8-bits wide, unless
60 1.9.6.2 scw * otherwise indicated.
61 1.9.6.2 scw */
62 1.9.6.2 scw #define PCCREG_DMA_TABLE_ADDR 0x00 /* DMA table address (32-bit) */
63 1.9.6.2 scw #define PCCREG_DMA_DATA_ADDR 0x04 /* DMA data address (32-bit) */
64 1.9.6.2 scw #define PCCREG_DMA_BYTE_COUNT 0x08 /* DMA byte count (32-bit) */
65 1.9.6.2 scw #define PCCREG_DMA_DATA_HOLD 0x0c /* DMA data hold register (32-bit) */
66 1.9.6.2 scw #define PCCREG_TMR1_PRELOAD 0x10 /* Timer1 preload (16-bit) */
67 1.9.6.2 scw #define PCCREG_TMR1_COUNT 0x12 /* Timer1 count (16-bit) */
68 1.9.6.2 scw #define PCCREG_TMR2_PRELOAD 0x14 /* Timer2 preload (16-bit) */
69 1.9.6.2 scw #define PCCREG_TMR2_COUNT 0x16 /* Timer2 count (16-bit) */
70 1.9.6.2 scw #define PCCREG_TMR1_INTR_CTRL 0x18 /* Timer1 interrupt ctrl */
71 1.9.6.2 scw #define PCCREG_TMR1_CONTROL 0x19 /* Timer1 ctrl reg */
72 1.9.6.2 scw #define PCCREG_TMR2_INTR_CTRL 0x1a /* Timer2 interrupt ctrl */
73 1.9.6.2 scw #define PCCREG_TMR2_CONTROL 0x1b /* Timer2 ctrl reg */
74 1.9.6.2 scw #define PCCREG_ACFAIL_INTR_CTRL 0x1c /* ACFAIL intr reg */
75 1.9.6.2 scw #define PCCREG_WDOG_INTR_CTRL 0x1d /* Watchdog intr reg */
76 1.9.6.2 scw #define PCCREG_PRNT_INTR_CTRL 0x1e /* Printer intr reg */
77 1.9.6.2 scw #define PCCREG_PRNT_CONTROL 0x1f /* Printer ctrl */
78 1.9.6.2 scw #define PCCREG_DMA_INTR_CTRL 0x20 /* DMA interrupt control */
79 1.9.6.2 scw #define PCCREG_DMA_CONTROL 0x21 /* DMA csr */
80 1.9.6.2 scw #define PCCREG_BUSERR_INTR_CTRL 0x22 /* Bus error interrupt */
81 1.9.6.2 scw #define PCCREG_DMA_STATUS 0x23 /* DMA status register */
82 1.9.6.2 scw #define PCCREG_ABORT_INTR_CTRL 0x24 /* ABORT interrupt control reg */
83 1.9.6.2 scw #define PCCREG_TABLE_ADDR_FC 0x25 /* Table address function code reg */
84 1.9.6.2 scw #define PCCREG_SERIAL_INTR_CTRL 0x26 /* Serial interrupt reg */
85 1.9.6.2 scw #define PCCREG_GENERAL_CONTROL 0x27 /* General control register */
86 1.9.6.2 scw #define PCCREG_LANCE_INTR_CTRL 0x28 /* Ethernet interrupt */
87 1.9.6.2 scw #define PCCREG_GENERAL_STATUS 0x29 /* General status */
88 1.9.6.2 scw #define PCCREG_SCSI_INTR_CTRL 0x2a /* SCSI interrupt reg */
89 1.9.6.2 scw #define PCCREG_SLAVE_BASE_ADDR 0x2b /* Slave base addr reg */
90 1.9.6.2 scw #define PCCREG_SOFT1_INTR_CTRL 0x2c /* Software interrupt #1 cr */
91 1.9.6.2 scw #define PCCREG_VECTOR_BASE 0x2d /* Interrupt base vector register */
92 1.9.6.2 scw #define PCCREG_SOFT2_INTR_CTRL 0x2e /* Software interrupt #2 cr */
93 1.9.6.2 scw #define PCCREG_REVISION 0x2f /* Revision level */
94 1.9.6.2 scw
95 1.9.6.2 scw #define PCCREG_SIZE 0x30
96 1.9.6.2 scw
97 1.9.6.2 scw /*
98 1.9.6.2 scw * Convenience macros for reading the PCC chip's registers
99 1.9.6.2 scw * through bus_space.
100 1.9.6.2 scw */
101 1.9.6.2 scw #define pcc_reg_read(sc,r) \
102 1.9.6.2 scw bus_space_read_1((sc)->sc_bust, (sc)->sc_bush, (r))
103 1.9.6.2 scw #define pcc_reg_read16(sc,r) \
104 1.9.6.2 scw bus_space_read_2((sc)->sc_bust, (sc)->sc_bush, (r))
105 1.9.6.2 scw #define pcc_reg_read32(sc,r) \
106 1.9.6.2 scw bus_space_read_4((sc)->sc_bust, (sc)->sc_bush, (r))
107 1.9.6.2 scw #define pcc_reg_write(sc,r,v) \
108 1.9.6.2 scw bus_space_write_1((sc)->sc_bust, (sc)->sc_bush, (r), (v))
109 1.9.6.2 scw #define pcc_reg_write16(sc,r,v) \
110 1.9.6.2 scw bus_space_write_2((sc)->sc_bust, (sc)->sc_bush, (r), (v))
111 1.9.6.2 scw #define pcc_reg_write32(sc,r,v) \
112 1.9.6.2 scw bus_space_write_4((sc)->sc_bust, (sc)->sc_bush, (r), (v))
113 1.9.6.2 scw
114 1.9.6.2 scw
115 1.9.6.2 scw /*
116 1.9.6.2 scw * we lock off our interrupt vector at 0x40.
117 1.9.6.2 scw */
118 1.9.6.2 scw
119 1.9.6.2 scw #define PCC_VECBASE 0x40
120 1.9.6.2 scw #define PCC_NVEC 12
121 1.9.6.2 scw
122 1.9.6.2 scw /*
123 1.9.6.2 scw * vectors we use
124 1.9.6.2 scw */
125 1.9.6.2 scw
126 1.9.6.2 scw #define PCCV_ACFAIL 0
127 1.9.6.2 scw #define PCCV_BERR 1
128 1.9.6.2 scw #define PCCV_ABORT 2
129 1.9.6.2 scw #define PCCV_ZS 3
130 1.9.6.2 scw #define PCCV_LE 4
131 1.9.6.2 scw #define PCCV_SCSI 5
132 1.9.6.2 scw #define PCCV_DMA 6
133 1.9.6.2 scw #define PCCV_PRINTER 7
134 1.9.6.2 scw #define PCCV_TIMER1 8
135 1.9.6.2 scw #define PCCV_TIMER2 9
136 1.9.6.2 scw #define PCCV_SOFT1 10
137 1.9.6.2 scw #define PCCV_SOFT2 11
138 1.9.6.2 scw
139 1.9.6.2 scw /*
140 1.9.6.2 scw * enable interrupt
141 1.9.6.2 scw */
142 1.9.6.2 scw
143 1.9.6.2 scw #define PCC_ICLEAR 0x80
144 1.9.6.2 scw #define PCC_IENABLE 0x08
145 1.9.6.2 scw
146 1.9.6.2 scw /*
147 1.9.6.2 scw * interrupt mask
148 1.9.6.2 scw */
149 1.9.6.2 scw
150 1.9.6.2 scw #define PCC_IMASK 0x7
151 1.9.6.2 scw
152 1.9.6.2 scw /*
153 1.9.6.2 scw * clock/timer
154 1.9.6.2 scw */
155 1.9.6.2 scw
156 1.9.6.2 scw #define PCC_TIMERACK 0x80 /* ack intr */
157 1.9.6.2 scw #define PCC_TIMER100HZ 63936 /* load value for 100Hz */
158 1.9.6.2 scw #define PCC_TIMERCLEAR 0x0 /* reset and clear timer */
159 1.9.6.2 scw #define PCC_TIMERENABLE 0x1 /* Enable clock */
160 1.9.6.2 scw #define PCC_TIMERSTOP 0x3 /* stop clock, but don't clear it */
161 1.9.6.2 scw #define PCC_TIMERSTART 0x7 /* start timer */
162 1.9.6.2 scw #define PCC_TIMEROVFLSHIFT 4
163 1.9.6.2 scw
164 1.9.6.2 scw #define pcc_timer_hz2lim(hz) (65536 - (160000/(hz)))
165 1.9.6.2 scw #define pcc_timer_us2lim(us) (65536 - (160000/(1000000/(us))))
166 1.9.6.2 scw #define pcc_timer_cnt2us(cnt) ((((cnt) - PCC_TIMER100HZ) * 25) / 4)
167 1.9.6.2 scw
168 1.9.6.2 scw /*
169 1.9.6.2 scw * serial control
170 1.9.6.2 scw */
171 1.9.6.2 scw
172 1.9.6.2 scw #define PCC_ZSEXTERN 0x10 /* let PCC supply vector */
173 1.9.6.2 scw
174 1.9.6.2 scw /*
175 1.9.6.2 scw * abort switch
176 1.9.6.2 scw */
177 1.9.6.2 scw
178 1.9.6.2 scw #define PCC_ABORT_IEN 0x08 /* enable interrupt */
179 1.9.6.2 scw #define PCC_ABORT_ABS 0x40 /* current state of switch */
180 1.9.6.2 scw #define PCC_ABORT_ACK 0x80 /* interrupt active; write to ack */
181 1.9.6.2 scw
182 1.9.6.2 scw /*
183 1.9.6.2 scw * general control register
184 1.9.6.2 scw */
185 1.9.6.2 scw
186 1.9.6.2 scw #define PCC_GENCR_IEN 0x10 /* global interrupt enable */
187 1.9.6.2 scw
188 1.9.6.2 scw /*
189 1.9.6.2 scw * slave base address register
190 1.9.6.2 scw */
191 1.9.6.2 scw #define PCC_SLAVE_BASE_MASK (0x01fu)
192 1.9.6.2 scw
193 1.9.6.2 scw #endif /* __MVME68K_PCCREG_H */
194