Ok. I didn't make 2.4.0 in 2000. Tough. I tried, but we had some
[davej-history.git] / include / asm-m68k / amigahw.h
blob3e5a2770cbac6b22a482e97fe61663600c42ff4f
1 /*
2 ** asm-m68k/amigahw.h -- This header defines some macros and pointers for
3 ** the various Amiga custom hardware registers.
4 ** The naming conventions used here conform to those
5 ** used in the Amiga Hardware Reference Manual, 3rd Edition
6 **
7 ** Copyright 1992 by Greg Harp
8 **
9 ** This file is subject to the terms and conditions of the GNU General Public
10 ** License. See the file COPYING in the main directory of this archive
11 ** for more details.
13 ** Created: 9/24/92 by Greg Harp
16 #ifndef _M68K_AMIGAHW_H
17 #define _M68K_AMIGAHW_H
19 #include <linux/ioport.h>
22 * Different Amiga models
25 extern unsigned long amiga_model;
27 #define AMI_UNKNOWN (0)
28 #define AMI_500 (1)
29 #define AMI_500PLUS (2)
30 #define AMI_600 (3)
31 #define AMI_1000 (4)
32 #define AMI_1200 (5)
33 #define AMI_2000 (6)
34 #define AMI_2500 (7)
35 #define AMI_3000 (8)
36 #define AMI_3000T (9)
37 #define AMI_3000PLUS (10)
38 #define AMI_4000 (11)
39 #define AMI_4000T (12)
40 #define AMI_CDTV (13)
41 #define AMI_CD32 (14)
42 #define AMI_DRACO (15)
46 * Chipsets
49 extern unsigned long amiga_chipset;
51 #define CS_STONEAGE (0)
52 #define CS_OCS (1)
53 #define CS_ECS (2)
54 #define CS_AGA (3)
58 * Miscellaneous
61 extern unsigned long amiga_eclock; /* 700 kHz E Peripheral Clock */
62 extern unsigned long amiga_masterclock; /* 28 MHz Master Clock */
63 extern unsigned long amiga_colorclock; /* 3.5 MHz Color Clock */
64 extern unsigned long amiga_chip_size; /* Chip RAM Size (bytes) */
65 extern unsigned char amiga_vblank; /* VBLANK Frequency */
66 extern unsigned char amiga_psfreq; /* Power Supply Frequency */
69 #define AMIGAHW_DECLARE(name) unsigned name : 1
70 #define AMIGAHW_SET(name) (amiga_hw_present.name = 1)
71 #define AMIGAHW_PRESENT(name) (amiga_hw_present.name)
73 struct amiga_hw_present {
74 /* video hardware */
75 AMIGAHW_DECLARE(AMI_VIDEO); /* Amiga Video */
76 AMIGAHW_DECLARE(AMI_BLITTER); /* Amiga Blitter */
77 AMIGAHW_DECLARE(AMBER_FF); /* Amber Flicker Fixer */
78 /* sound hardware */
79 AMIGAHW_DECLARE(AMI_AUDIO); /* Amiga Audio */
80 /* disk storage interfaces */
81 AMIGAHW_DECLARE(AMI_FLOPPY); /* Amiga Floppy */
82 AMIGAHW_DECLARE(A3000_SCSI); /* SCSI (wd33c93, A3000 alike) */
83 AMIGAHW_DECLARE(A4000_SCSI); /* SCSI (ncr53c710, A4000T alike) */
84 AMIGAHW_DECLARE(A1200_IDE); /* IDE (A1200 alike) */
85 AMIGAHW_DECLARE(A4000_IDE); /* IDE (A4000 alike) */
86 AMIGAHW_DECLARE(CD_ROM); /* CD ROM drive */
87 /* other I/O hardware */
88 AMIGAHW_DECLARE(AMI_KEYBOARD); /* Amiga Keyboard */
89 AMIGAHW_DECLARE(AMI_MOUSE); /* Amiga Mouse */
90 AMIGAHW_DECLARE(AMI_SERIAL); /* Amiga Serial */
91 AMIGAHW_DECLARE(AMI_PARALLEL); /* Amiga Parallel */
92 /* real time clocks */
93 AMIGAHW_DECLARE(A2000_CLK); /* Hardware Clock (A2000 alike) */
94 AMIGAHW_DECLARE(A3000_CLK); /* Hardware Clock (A3000 alike) */
95 /* supporting hardware */
96 AMIGAHW_DECLARE(CHIP_RAM); /* Chip RAM */
97 AMIGAHW_DECLARE(PAULA); /* Paula (8364) */
98 AMIGAHW_DECLARE(DENISE); /* Denise (8362) */
99 AMIGAHW_DECLARE(DENISE_HR); /* Denise (8373) */
100 AMIGAHW_DECLARE(LISA); /* Lisa (8375) */
101 AMIGAHW_DECLARE(AGNUS_PAL); /* Normal/Fat PAL Agnus (8367/8371) */
102 AMIGAHW_DECLARE(AGNUS_NTSC); /* Normal/Fat NTSC Agnus (8361/8370) */
103 AMIGAHW_DECLARE(AGNUS_HR_PAL); /* Fat Hires PAL Agnus (8372) */
104 AMIGAHW_DECLARE(AGNUS_HR_NTSC); /* Fat Hires NTSC Agnus (8372) */
105 AMIGAHW_DECLARE(ALICE_PAL); /* PAL Alice (8374) */
106 AMIGAHW_DECLARE(ALICE_NTSC); /* NTSC Alice (8374) */
107 AMIGAHW_DECLARE(MAGIC_REKICK); /* A3000 Magic Hard Rekick */
108 AMIGAHW_DECLARE(PCMCIA); /* PCMCIA Slot */
109 AMIGAHW_DECLARE(ZORRO); /* Zorro AutoConfig */
110 AMIGAHW_DECLARE(ZORRO3); /* Zorro III */
113 extern struct amiga_hw_present amiga_hw_present;
115 struct CUSTOM {
116 unsigned short bltddat;
117 unsigned short dmaconr;
118 unsigned short vposr;
119 unsigned short vhposr;
120 unsigned short dskdatr;
121 unsigned short joy0dat;
122 unsigned short joy1dat;
123 unsigned short clxdat;
124 unsigned short adkconr;
125 unsigned short pot0dat;
126 unsigned short pot1dat;
127 unsigned short potgor;
128 unsigned short serdatr;
129 unsigned short dskbytr;
130 unsigned short intenar;
131 unsigned short intreqr;
132 unsigned char *dskptr;
133 unsigned short dsklen;
134 unsigned short dskdat;
135 unsigned short refptr;
136 unsigned short vposw;
137 unsigned short vhposw;
138 unsigned short copcon;
139 unsigned short serdat;
140 unsigned short serper;
141 unsigned short potgo;
142 unsigned short joytest;
143 unsigned short strequ;
144 unsigned short strvbl;
145 unsigned short strhor;
146 unsigned short strlong;
147 unsigned short bltcon0;
148 unsigned short bltcon1;
149 unsigned short bltafwm;
150 unsigned short bltalwm;
151 unsigned char *bltcpt;
152 unsigned char *bltbpt;
153 unsigned char *bltapt;
154 unsigned char *bltdpt;
155 unsigned short bltsize;
156 unsigned char pad2d;
157 unsigned char bltcon0l;
158 unsigned short bltsizv;
159 unsigned short bltsizh;
160 unsigned short bltcmod;
161 unsigned short bltbmod;
162 unsigned short bltamod;
163 unsigned short bltdmod;
164 unsigned short spare2[4];
165 unsigned short bltcdat;
166 unsigned short bltbdat;
167 unsigned short bltadat;
168 unsigned short spare3[3];
169 unsigned short deniseid;
170 unsigned short dsksync;
171 unsigned short *cop1lc;
172 unsigned short *cop2lc;
173 unsigned short copjmp1;
174 unsigned short copjmp2;
175 unsigned short copins;
176 unsigned short diwstrt;
177 unsigned short diwstop;
178 unsigned short ddfstrt;
179 unsigned short ddfstop;
180 unsigned short dmacon;
181 unsigned short clxcon;
182 unsigned short intena;
183 unsigned short intreq;
184 unsigned short adkcon;
185 struct {
186 unsigned short *audlc;
187 unsigned short audlen;
188 unsigned short audper;
189 unsigned short audvol;
190 unsigned short auddat;
191 unsigned short audspare[2];
192 } aud[4];
193 unsigned char *bplpt[8];
194 unsigned short bplcon0;
195 unsigned short bplcon1;
196 unsigned short bplcon2;
197 unsigned short bplcon3;
198 unsigned short bpl1mod;
199 unsigned short bpl2mod;
200 unsigned short bplcon4;
201 unsigned short clxcon2;
202 unsigned short bpldat[8];
203 unsigned char *sprpt[8];
204 struct {
205 unsigned short pos;
206 unsigned short ctl;
207 unsigned short dataa;
208 unsigned short datab;
209 } spr[8];
210 unsigned short color[32];
211 unsigned short htotal;
212 unsigned short hsstop;
213 unsigned short hbstrt;
214 unsigned short hbstop;
215 unsigned short vtotal;
216 unsigned short vsstop;
217 unsigned short vbstrt;
218 unsigned short vbstop;
219 unsigned short sprhstrt;
220 unsigned short sprhstop;
221 unsigned short bplhstrt;
222 unsigned short bplhstop;
223 unsigned short hhposw;
224 unsigned short hhposr;
225 unsigned short beamcon0;
226 unsigned short hsstrt;
227 unsigned short vsstrt;
228 unsigned short hcenter;
229 unsigned short diwhigh;
230 unsigned short spare4[11];
231 unsigned short fmode;
235 * DMA register bits
237 #define DMAF_SETCLR (0x8000)
238 #define DMAF_AUD0 (0x0001)
239 #define DMAF_AUD1 (0x0002)
240 #define DMAF_AUD2 (0x0004)
241 #define DMAF_AUD3 (0x0008)
242 #define DMAF_DISK (0x0010)
243 #define DMAF_SPRITE (0x0020)
244 #define DMAF_BLITTER (0x0040)
245 #define DMAF_COPPER (0x0080)
246 #define DMAF_RASTER (0x0100)
247 #define DMAF_MASTER (0x0200)
248 #define DMAF_BLITHOG (0x0400)
249 #define DMAF_BLTNZERO (0x2000)
250 #define DMAF_BLTDONE (0x4000)
251 #define DMAF_ALL (0x01FF)
253 struct CIA {
254 unsigned char pra; char pad0[0xff];
255 unsigned char prb; char pad1[0xff];
256 unsigned char ddra; char pad2[0xff];
257 unsigned char ddrb; char pad3[0xff];
258 unsigned char talo; char pad4[0xff];
259 unsigned char tahi; char pad5[0xff];
260 unsigned char tblo; char pad6[0xff];
261 unsigned char tbhi; char pad7[0xff];
262 unsigned char todlo; char pad8[0xff];
263 unsigned char todmid; char pad9[0xff];
264 unsigned char todhi; char pada[0x1ff];
265 unsigned char sdr; char padb[0xff];
266 unsigned char icr; char padc[0xff];
267 unsigned char cra; char padd[0xff];
268 unsigned char crb; char pade[0xff];
271 #define zTwoBase (0x80000000)
272 #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
273 #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
275 #define CUSTOM_PHYSADDR (0xdff000)
276 #define custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
278 #define CIAA_PHYSADDR (0xbfe001)
279 #define CIAB_PHYSADDR (0xbfd000)
280 #define ciaa ((*(volatile struct CIA *)(zTwoBase + CIAA_PHYSADDR)))
281 #define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR)))
283 #define CHIP_PHYSADDR (0x000000)
285 void amiga_chip_init (void);
286 void *amiga_chip_alloc(unsigned long size, const char *name);
287 void *amiga_chip_alloc_res(unsigned long size, struct resource *res);
288 void amiga_chip_free(void *ptr);
289 unsigned long amiga_chip_avail( void ); /*MILAN*/
290 extern volatile unsigned short amiga_audio_min_period;
292 static inline void amifb_video_off(void)
294 if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) {
295 /* program Denise/Lisa for a higher maximum play rate */
296 custom.htotal = 113; /* 31 kHz */
297 custom.vtotal = 223; /* 70 Hz */
298 custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */
299 /* suspend the monitor */
300 custom.hsstrt = custom.hsstop = 116;
301 custom.vsstrt = custom.vsstop = 226;
302 amiga_audio_min_period = 57;
306 struct tod3000 {
307 unsigned int :28, second2:4; /* lower digit */
308 unsigned int :28, second1:4; /* upper digit */
309 unsigned int :28, minute2:4; /* lower digit */
310 unsigned int :28, minute1:4; /* upper digit */
311 unsigned int :28, hour2:4; /* lower digit */
312 unsigned int :28, hour1:4; /* upper digit */
313 unsigned int :28, weekday:4;
314 unsigned int :28, day2:4; /* lower digit */
315 unsigned int :28, day1:4; /* upper digit */
316 unsigned int :28, month2:4; /* lower digit */
317 unsigned int :28, month1:4; /* upper digit */
318 unsigned int :28, year2:4; /* lower digit */
319 unsigned int :28, year1:4; /* upper digit */
320 unsigned int :28, cntrl1:4; /* control-byte 1 */
321 unsigned int :28, cntrl2:4; /* control-byte 2 */
322 unsigned int :28, cntrl3:4; /* control-byte 3 */
324 #define TOD3000_CNTRL1_HOLD 0
325 #define TOD3000_CNTRL1_FREE 9
326 #define TOD_3000 ((struct tod3000 *)(zTwoBase+0xDC0000))
328 struct tod2000 {
329 unsigned int :28, second2:4; /* lower digit */
330 unsigned int :28, second1:4; /* upper digit */
331 unsigned int :28, minute2:4; /* lower digit */
332 unsigned int :28, minute1:4; /* upper digit */
333 unsigned int :28, hour2:4; /* lower digit */
334 unsigned int :28, hour1:4; /* upper digit */
335 unsigned int :28, day2:4; /* lower digit */
336 unsigned int :28, day1:4; /* upper digit */
337 unsigned int :28, month2:4; /* lower digit */
338 unsigned int :28, month1:4; /* upper digit */
339 unsigned int :28, year2:4; /* lower digit */
340 unsigned int :28, year1:4; /* upper digit */
341 unsigned int :28, weekday:4;
342 unsigned int :28, cntrl1:4; /* control-byte 1 */
343 unsigned int :28, cntrl2:4; /* control-byte 2 */
344 unsigned int :28, cntrl3:4; /* control-byte 3 */
347 #define TOD2000_CNTRL1_HOLD (1<<0)
348 #define TOD2000_CNTRL1_BUSY (1<<1)
349 #define TOD2000_CNTRL3_24HMODE (1<<2)
350 #define TOD2000_HOUR1_PM (1<<2)
351 #define TOD_2000 ((struct tod2000 *)(zTwoBase+0xDC0000))
353 #endif /* _M68K_AMIGAHW_H */