Import 2.1.125pre1
[davej-history.git] / arch / m68k / mac / via6522.h
blob91ba1d58e051fff27d1ce10d019705da873902e3
1 /*
2 * 6522 Versatile Interface Adapter (VIA)
4 * There are two of these on the Mac II. Some IRQ's are vectored
5 * via them as are assorted bits and bobs - eg rtc, adb. The picture
6 * is a bit incomplete as the Mac documentation doesnt cover this well
7 */
9 #ifndef _ASM_VIA6522_H_
10 #define _ASM_VIA6522_H_
12 #define VIABASE 0x50F00000
13 #define VIABASE2 0x50F02000
16 * Not all of these are true post MacII I think
19 #define VIA1A_vSccWrReq 0x80 /* SCC write */
20 #define VIA1A_vRev8 0x40 /* Revision 8 board ??? */
21 #define VIA1A_vHeadSel 0x20 /* Head select for IWM */
22 #define VIA1A_vOverlay 0x10
23 #define VIA1A_vSync 0x08
24 #define VIA1A_vVolume 0x07 /* Audio volume mask */
26 #define VIA1B_vSound 0x80 /* Audio on/off */
27 #define VIA1B_vMystery 0x40
28 #define VIA1B_vADBS2 0x20 /* ADB state 2 */
29 #define VIA1B_vADBS1 0x10 /* ADB state 1 */
30 #define VIA1B_vADBInt 0x08 /* ADB interrupt */
31 #define VIA1B_vRTCEnb 0x04 /* Real time clock */
32 #define VIA1B_vRTCClk 0x02
33 #define VIA1B_vRTCData 0x01
36 * VIA2 A register is the interrupt lines raised off the nubus
37 * slots.
40 #define VIA2A_vIRQE 0x20
41 #define VIA2A_vIRQD 0x10
42 #define VIA2A_vIRQC 0x08
43 #define VIA2A_vIRQB 0x04
44 #define VIA2A_vIRQA 0x02
45 #define VIA2A_vIRQ9 0x01
48 * Register B has the fun stuff in it
51 #define VIA2B_vMode32 0x08 /* 24/32bit switch - doubles as cache flush */
52 #define VIA2B_vPower 0x04 /* Off switch */
53 #define VIA2B_vBusLk 0x02 /* Nubus in use ?? */
54 #define VIA2B_vCDis 0x01 /* Cache disable */
57 * The 6522 via is a 2MHz part, and needs a delay. MacOS seems to
58 * execute MOV (Ax),(Ax) for this... Oh and we can't use udelay
59 * here... see we need the via to calibrate the udelay loop ...
62 extern volatile long *via_memory_bogon;
64 extern __inline__ void via_write(volatile unsigned char *via,int reg, int v)
66 *via_memory_bogon;
67 *via_memory_bogon;
68 *via_memory_bogon;
69 via[reg]=v;
72 extern __inline__ int via_read(volatile unsigned char *via,int reg)
74 *via_memory_bogon;
75 *via_memory_bogon;
76 *via_memory_bogon;
77 return (int)via[reg];
80 extern volatile unsigned char *via1,*via2;
83 * 6522 registers - see databook
86 #define vBufB 0x0000
87 #define vBufA 0x0200
88 #define vDirB 0x0400
89 #define vDirA 0x0600
90 #define vT1CL 0x0800
91 #define vT1CH 0x0a00
92 #define vT1LL 0x0c00
93 #define vT1LH 0x0e00
94 #define vT2CL 0x1000
95 #define vT2CH 0x1200
96 #define vSR 0x1400
97 #define vACR 0x1600
98 #define vPCR 0x1800
99 #define vIFR 0x1a00
100 #define vIER 0x1c00
101 #define vANH 0x1e00 /* register A (no shake) */
103 #define rBufB 0x00
104 #define rBufA 0x02
105 /*#define rIFR 0x03*/
106 #define rIFR 0x1A03
107 #define rVideo 0x10
108 #define rSlot 0x12
109 /*#define rIER 0x13*/
110 #define rIER 0x1C13
112 #define R_rIFR 0x03
113 #define R_rIER 0x13
114 #define W_rIFR 0x1A03
115 #define W_rIER 0x1C13
118 * VIA interrupt
121 struct via_irq_tab
123 void (*vector[8])(int, void *, struct pt_regs *);
126 extern void via1_irq(int, void *, struct pt_regs *);
127 extern void via2_irq(int, void *, struct pt_regs *);
129 extern void via_setup_keyboard(void);
131 #endif /* _ASM_VIA6522_H_ */