/[gxemul]/upstream/0.4.4/src/include/adb_viareg.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /upstream/0.4.4/src/include/adb_viareg.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (hide annotations)
Mon Oct 8 16:21:26 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 7608 byte(s)
0.4.4
1 dpavlin 22 /* GXemul: $Id: adb_viareg.h,v 1.1 2005/11/29 05:25:29 debug Exp $ */
2     /* $NetBSD: viareg.h,v 1.4 2001/06/19 12:02:56 simonb Exp $ */
3    
4     #ifndef ADB_VIAREG_H
5     #define ADB_VIAREG_H
6    
7     /*-
8     * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
9     * Michael L. Finch, Bradley A. Grantham, and
10     * Lawrence A. Kesteloot
11     * All rights reserved.
12     *
13     * Redistribution and use in source and binary forms, with or without
14     * modification, are permitted provided that the following conditions
15     * are met:
16     * 1. Redistributions of source code must retain the above copyright
17     * notice, this list of conditions and the following disclaimer.
18     * 2. Redistributions in binary form must reproduce the above copyright
19     * notice, this list of conditions and the following disclaimer in the
20     * documentation and/or other materials provided with the distribution.
21     * 3. All advertising materials mentioning features or use of this software
22     * must display the following acknowledgement:
23     * This product includes software developed by the Alice Group.
24     * 4. The names of the Alice Group or any of its members may not be used
25     * to endorse or promote products derived from this software without
26     * specific prior written permission.
27     *
28     * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
29     * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30     * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
31     * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
32     * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
33     * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38     *
39     */
40     /*
41    
42     Prototype VIA control definitions
43    
44     06/04/92,22:33:57 BG Let's see what I can do.
45    
46     */
47    
48    
49     /* VIA1 data register A */
50     #define DA1I_vSCCWrReq 0x80
51     #define DA1O_vPage2 0x40
52     #define DA1I_CPU_ID1 0x40
53     #define DA1O_vHeadSel 0x20
54     #define DA1O_vOverlay 0x10
55     #define DA1O_vSync 0x08
56     #define DA1O_RESERVED2 0x04
57     #define DA1O_RESERVED1 0x02
58     #define DA1O_RESERVED0 0x01
59    
60     /* VIA1 data register B */
61     #define DB1I_Par_Err 0x80
62     #define DB1O_vSndEnb 0x80
63     #define DB1O_Par_Enb 0x40
64     #define DB1O_vFDesk2 0x20
65     #define DB1O_vFDesk1 0x10
66     #define DB1I_vFDBInt 0x08
67     #define DB1O_rTCEnb 0x04
68     #define DB1O_rTCCLK 0x02
69     #define DB1O_rTCData 0x01
70     #define DB1I_rTCData 0x01
71    
72     /* VIA2 data register A */
73     #define DA2O_v2Ram1 0x80
74     #define DA2O_v2Ram0 0x40
75     #define DA2I_v2IRQ0 0x40
76     #define DA2I_v2IRQE 0x20
77     #define DA2I_v2IRQD 0x10
78     #define DA2I_v2IRQC 0x08
79     #define DA2I_v2IRQB 0x04
80     #define DA2I_v2IRQA 0x02
81     #define DA2I_v2IRQ9 0x01
82    
83     /* VIA2 data register B */
84     #define DB2O_v2VBL 0x80
85     #define DB2O_Par_Test 0x80
86     #define DB2I_v2SNDEXT 0x40
87     #define DB2I_v2TM0A 0x20
88     #define DB2I_v2TM1A 0x10
89     #define DB2I_vFC3 0x08
90     #define DB2O_vFC3 0x08
91     #define DB2O_v2PowerOff 0x04
92     #define DB2O_v2BusLk 0x02
93     #define DB2O_vCDis 0x01
94     #define DB2O_CEnable 0x01
95    
96     /*
97     * VIA1 interrupts
98     */
99     #define VIA1_T1 6
100     #define VIA1_T2 5
101     #define VIA1_ADBCLK 4
102     #define VIA1_ADBDATA 3
103     #define VIA1_ADBRDY 2
104     #define VIA1_VBLNK 1
105     #define VIA1_ONESEC 0
106    
107     /* VIA1 interrupt bits */
108     #define V1IF_IRQ 0x80
109     #define V1IF_T1 (1 << VIA1_T1)
110     #define V1IF_T2 (1 << VIA1_T2)
111     #define V1IF_ADBCLK (1 << VIA1_ADBCLK)
112     #define V1IF_ADBDATA (1 << VIA1_ADBDATA)
113     #define V1IF_ADBRDY (1 << VIA1_ADBRDY)
114     #define V1IF_VBLNK (1 << VIA1_VBLNK)
115     #define V1IF_ONESEC (1 << VIA1_ONESEC)
116    
117     /*
118     * VIA2 interrupts
119     */
120     #define VIA2_T1 6
121     #define VIA2_T2 5
122     #define VIA2_ASC 4
123     #define VIA2_SCSIIRQ 3
124     #define VIA2_EXPIRQ 2
125     #define VIA2_SLOTINT 1
126     #define VIA2_SCSIDRQ 0
127    
128     /* VIA2 interrupt bits */
129     #define V2IF_IRQ 0x80
130     #define V2IF_T1 (1 << VIA2_T1)
131     #define V2IF_T2 (1 << VIA2_T2)
132     #define V2IF_ASC (1 << VIA2_ASC)
133     #define V2IF_SCSIIRQ (1 << VIA2_SCSIIRQ)
134     #define V2IF_EXPIRQ (1 << VIA2_EXPIRQ)
135     #define V2IF_SLOTINT (1 << VIA2_SLOTINT)
136     #define V2IF_SCSIDRQ (1 << VIA2_SCSIDRQ)
137    
138     #define VIA1_INTS (V1IF_T1 | V1IF_ADBRDY)
139     #define VIA2_INTS (V2IF_T1 | V2IF_ASC | V2IF_SCSIIRQ | V2IF_SLOTINT | \
140     V2IF_SCSIDRQ)
141    
142     #define RBV_INTS (V2IF_T1 | V2IF_ASC | V2IF_SCSIIRQ | V2IF_SLOTINT | \
143     V2IF_SCSIDRQ | V1IF_ADBRDY)
144    
145     #define ACR_T1LATCH 0x40
146    
147     #if 0
148     extern volatile unsigned char *Via1Base;
149     #endif
150     #define VIA1_addr Via1Base /* at PA 0x50f00000 */
151     #define VIA2OFF 1 /* VIA2 addr = VIA1_addr * 0x2000 */
152     #define RBVOFF 0x13 /* RBV addr = VIA1_addr * 0x13000 */
153    
154     #define VIA1 0
155     #define VIA2 0
156    
157     /* VIA interface registers */
158     #define vBufB 0x0000 /* register B */
159     #define vBufA 0x0200 /* register A */
160     #define vDirB 0x0400 /* data direction register */
161     #define vDirA 0x0600 /* data direction register */
162     #define vT1C 0x0800
163     #define vT1CH 0x0a00
164     #define vT1L 0x0c00
165     #define vT1LH 0x0e00
166     #define vT2C 0x1000
167     #define vT2CH 0x1200
168     #define vSR 0x1400 /* shift register */
169     #define vACR 0x1600 /* aux control register */
170     #define vPCR 0x1800 /* peripheral control register */
171     #define vIFR 0x1a00 /* interrupt flag register */
172     #define vIER 0x1c00 /* interrupt enable register */
173    
174     /* RBV interface registers */
175     #define rBufB 0 /* register B */
176     #define rBufA 2 /* register A */
177     #define rIFR 0x3 /* interrupt flag register (writes?) */
178     #define rIER 0x13 /* interrupt enable register */
179     #define rMonitor 0x10 /* Monitor type */
180     #define rSlotInt 0x12 /* Slot interrupt */
181    
182     /* RBV monitor type flags and masks */
183     #define RBVDepthMask 0x07 /* depth in bits */
184     #define RBVMonitorMask 0x38 /* Type numbers */
185     #define RBVOff 0x40 /* monitor turn off */
186     #define RBVMonIDNone 0x38 /* What RBV actually has for no video */
187     #define RBVMonIDOff 0x0 /* What rbv_vidstatus() returns for no video */
188     #define RBVMonID15BWP 0x08 /* BW portrait */
189     #define RBVMonIDRGB 0x10 /* color monitor */
190     #define RBVMonIDRGB15 0x28 /* 15 inch RGB */
191     #define RBVMonIDBW 0x30 /* No internal video */
192    
193     #define via_reg(v, r) (*(Via1Base + (r)))
194    
195     #if 0
196     #include <machine/pio.h>
197    
198     static __inline void via_reg_and(int, int, int);
199     static __inline void via_reg_or(int, int, int);
200     static __inline void via_reg_xor(int, int, int);
201     static __inline void write_via_reg(int, int, int);
202     static __inline int read_via_reg(int, int);
203    
204     static __inline void
205     via_reg_and(ign, reg, val)
206     int ign, reg, val;
207     {
208     volatile unsigned char *addr = Via1Base + reg;
209    
210     out8(addr, in8(addr) & val);
211     }
212    
213     static __inline void
214     via_reg_or(ign, reg, val)
215     int ign, reg, val;
216     {
217     volatile unsigned char *addr = Via1Base + reg;
218    
219     out8(addr, in8(addr) | val);
220     }
221    
222     static __inline void
223     via_reg_xor(ign, reg, val)
224     int ign, reg, val;
225     {
226     volatile unsigned char *addr = Via1Base + reg;
227    
228     out8(addr, in8(addr) ^ val);
229     }
230    
231     static __inline int
232     read_via_reg(ign, reg)
233     int ign, reg;
234     {
235     volatile unsigned char *addr = Via1Base + reg;
236    
237     return in8(addr);
238     }
239    
240     static __inline void
241     write_via_reg(ign, reg, val)
242     int ign, reg, val;
243     {
244     volatile unsigned char *addr = Via1Base + reg;
245    
246     out8(addr, val);
247     }
248    
249    
250    
251     #define vDirA_ADBState 0x30
252    
253     void via_init __P((void));
254     int rbv_vidstatus __P((void));
255     void via_shutdown __P((void));
256     void via_set_modem __P((int));
257     int add_nubus_intr __P((int, void (*) __P((void *, int)), void *));
258     void enable_nubus_intr __P((void));
259     void via1_register_irq __P((int, void (*)(void *), void *));
260     void via2_register_irq __P((int, void (*)(void *), void *));
261    
262     extern void (*via1itab[7]) __P((void *));
263     extern void (*via2itab[7]) __P((void *));
264     #endif
265    
266     #endif /* ADB_VIAREG_H */

  ViewVC Help
Powered by ViewVC 1.1.26