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