1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#ifndef _M68K_AMIGAHW_H
17#define _M68K_AMIGAHW_H
18
19#include <linux/ioport.h>
20
21
22
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
45
46
47extern 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
57
58
59extern unsigned long amiga_eclock;
60extern unsigned long amiga_colorclock;
61extern unsigned long amiga_chip_size;
62extern unsigned char amiga_vblank;
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
69struct amiga_hw_present {
70
71 AMIGAHW_DECLARE(AMI_VIDEO);
72 AMIGAHW_DECLARE(AMI_BLITTER);
73 AMIGAHW_DECLARE(AMBER_FF);
74
75 AMIGAHW_DECLARE(AMI_AUDIO);
76
77 AMIGAHW_DECLARE(AMI_FLOPPY);
78 AMIGAHW_DECLARE(A3000_SCSI);
79 AMIGAHW_DECLARE(A4000_SCSI);
80 AMIGAHW_DECLARE(A1200_IDE);
81 AMIGAHW_DECLARE(A4000_IDE);
82 AMIGAHW_DECLARE(CD_ROM);
83
84 AMIGAHW_DECLARE(AMI_KEYBOARD);
85 AMIGAHW_DECLARE(AMI_MOUSE);
86 AMIGAHW_DECLARE(AMI_SERIAL);
87 AMIGAHW_DECLARE(AMI_PARALLEL);
88
89 AMIGAHW_DECLARE(A2000_CLK);
90 AMIGAHW_DECLARE(A3000_CLK);
91
92 AMIGAHW_DECLARE(CHIP_RAM);
93 AMIGAHW_DECLARE(PAULA);
94 AMIGAHW_DECLARE(DENISE);
95 AMIGAHW_DECLARE(DENISE_HR);
96 AMIGAHW_DECLARE(LISA);
97 AMIGAHW_DECLARE(AGNUS_PAL);
98 AMIGAHW_DECLARE(AGNUS_NTSC);
99 AMIGAHW_DECLARE(AGNUS_HR_PAL);
100 AMIGAHW_DECLARE(AGNUS_HR_NTSC);
101 AMIGAHW_DECLARE(ALICE_PAL);
102 AMIGAHW_DECLARE(ALICE_NTSC);
103 AMIGAHW_DECLARE(MAGIC_REKICK);
104 AMIGAHW_DECLARE(PCMCIA);
105 AMIGAHW_DECLARE(ZORRO);
106 AMIGAHW_DECLARE(ZORRO3);
107};
108
109extern struct amiga_hw_present amiga_hw_present;
110
111struct CUSTOM {
112 unsigned short bltddat;
113 unsigned short dmaconr;
114 unsigned short vposr;
115 unsigned short vhposr;
116 unsigned short dskdatr;
117 unsigned short joy0dat;
118 unsigned short joy1dat;
119 unsigned short clxdat;
120 unsigned short adkconr;
121 unsigned short pot0dat;
122 unsigned short pot1dat;
123 unsigned short potgor;
124 unsigned short serdatr;
125 unsigned short dskbytr;
126 unsigned short intenar;
127 unsigned short intreqr;
128 unsigned char *dskptr;
129 unsigned short dsklen;
130 unsigned short dskdat;
131 unsigned short refptr;
132 unsigned short vposw;
133 unsigned short vhposw;
134 unsigned short copcon;
135 unsigned short serdat;
136 unsigned short serper;
137 unsigned short potgo;
138 unsigned short joytest;
139 unsigned short strequ;
140 unsigned short strvbl;
141 unsigned short strhor;
142 unsigned short strlong;
143 unsigned short bltcon0;
144 unsigned short bltcon1;
145 unsigned short bltafwm;
146 unsigned short bltalwm;
147 unsigned char *bltcpt;
148 unsigned char *bltbpt;
149 unsigned char *bltapt;
150 unsigned char *bltdpt;
151 unsigned short bltsize;
152 unsigned char pad2d;
153 unsigned char bltcon0l;
154 unsigned short bltsizv;
155 unsigned short bltsizh;
156 unsigned short bltcmod;
157 unsigned short bltbmod;
158 unsigned short bltamod;
159 unsigned short bltdmod;
160 unsigned short spare2[4];
161 unsigned short bltcdat;
162 unsigned short bltbdat;
163 unsigned short bltadat;
164 unsigned short spare3[3];
165 unsigned short deniseid;
166 unsigned short dsksync;
167 unsigned short *cop1lc;
168 unsigned short *cop2lc;
169 unsigned short copjmp1;
170 unsigned short copjmp2;
171 unsigned short copins;
172 unsigned short diwstrt;
173 unsigned short diwstop;
174 unsigned short ddfstrt;
175 unsigned short ddfstop;
176 unsigned short dmacon;
177 unsigned short clxcon;
178 unsigned short intena;
179 unsigned short intreq;
180 unsigned short adkcon;
181 struct {
182 unsigned short *audlc;
183 unsigned short audlen;
184 unsigned short audper;
185 unsigned short audvol;
186 unsigned short auddat;
187 unsigned short audspare[2];
188 } aud[4];
189 unsigned char *bplpt[8];
190 unsigned short bplcon0;
191 unsigned short bplcon1;
192 unsigned short bplcon2;
193 unsigned short bplcon3;
194 unsigned short bpl1mod;
195 unsigned short bpl2mod;
196 unsigned short bplcon4;
197 unsigned short clxcon2;
198 unsigned short bpldat[8];
199 unsigned char *sprpt[8];
200 struct {
201 unsigned short pos;
202 unsigned short ctl;
203 unsigned short dataa;
204 unsigned short datab;
205 } spr[8];
206 unsigned short color[32];
207 unsigned short htotal;
208 unsigned short hsstop;
209 unsigned short hbstrt;
210 unsigned short hbstop;
211 unsigned short vtotal;
212 unsigned short vsstop;
213 unsigned short vbstrt;
214 unsigned short vbstop;
215 unsigned short sprhstrt;
216 unsigned short sprhstop;
217 unsigned short bplhstrt;
218 unsigned short bplhstop;
219 unsigned short hhposw;
220 unsigned short hhposr;
221 unsigned short beamcon0;
222 unsigned short hsstrt;
223 unsigned short vsstrt;
224 unsigned short hcenter;
225 unsigned short diwhigh;
226 unsigned short spare4[11];
227 unsigned short fmode;
228};
229
230
231
232
233#define DMAF_SETCLR (0x8000)
234#define DMAF_AUD0 (0x0001)
235#define DMAF_AUD1 (0x0002)
236#define DMAF_AUD2 (0x0004)
237#define DMAF_AUD3 (0x0008)
238#define DMAF_DISK (0x0010)
239#define DMAF_SPRITE (0x0020)
240#define DMAF_BLITTER (0x0040)
241#define DMAF_COPPER (0x0080)
242#define DMAF_RASTER (0x0100)
243#define DMAF_MASTER (0x0200)
244#define DMAF_BLITHOG (0x0400)
245#define DMAF_BLTNZERO (0x2000)
246#define DMAF_BLTDONE (0x4000)
247#define DMAF_ALL (0x01FF)
248
249struct CIA {
250 unsigned char pra; char pad0[0xff];
251 unsigned char prb; char pad1[0xff];
252 unsigned char ddra; char pad2[0xff];
253 unsigned char ddrb; char pad3[0xff];
254 unsigned char talo; char pad4[0xff];
255 unsigned char tahi; char pad5[0xff];
256 unsigned char tblo; char pad6[0xff];
257 unsigned char tbhi; char pad7[0xff];
258 unsigned char todlo; char pad8[0xff];
259 unsigned char todmid; char pad9[0xff];
260 unsigned char todhi; char pada[0x1ff];
261 unsigned char sdr; char padb[0xff];
262 unsigned char icr; char padc[0xff];
263 unsigned char cra; char padd[0xff];
264 unsigned char crb; char pade[0xff];
265};
266
267#define zTwoBase (0x80000000)
268#define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
269#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase)
270
271#define CUSTOM_PHYSADDR (0xdff000)
272#define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
273
274#define CIAA_PHYSADDR (0xbfe001)
275#define CIAB_PHYSADDR (0xbfd000)
276#define ciaa ((*(volatile struct CIA *)(zTwoBase + CIAA_PHYSADDR)))
277#define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR)))
278
279#define CHIP_PHYSADDR (0x000000)
280
281void amiga_chip_init (void);
282void *amiga_chip_alloc(unsigned long size, const char *name);
283void *amiga_chip_alloc_res(unsigned long size, struct resource *res);
284void amiga_chip_free(void *ptr);
285unsigned long amiga_chip_avail( void );
286extern volatile unsigned short amiga_audio_min_period;
287
288static inline void amifb_video_off(void)
289{
290 if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) {
291
292 amiga_custom.htotal = 113;
293 amiga_custom.vtotal = 223;
294 amiga_custom.beamcon0 = 0x4390;
295
296 amiga_custom.hsstrt = amiga_custom.hsstop = 116;
297 amiga_custom.vsstrt = amiga_custom.vsstop = 226;
298 amiga_audio_min_period = 57;
299 }
300}
301
302struct tod3000 {
303 unsigned int :28, second2:4;
304 unsigned int :28, second1:4;
305 unsigned int :28, minute2:4;
306 unsigned int :28, minute1:4;
307 unsigned int :28, hour2:4;
308 unsigned int :28, hour1:4;
309 unsigned int :28, weekday:4;
310 unsigned int :28, day2:4;
311 unsigned int :28, day1:4;
312 unsigned int :28, month2:4;
313 unsigned int :28, month1:4;
314 unsigned int :28, year2:4;
315 unsigned int :28, year1:4;
316 unsigned int :28, cntrl1:4;
317 unsigned int :28, cntrl2:4;
318 unsigned int :28, cntrl3:4;
319};
320#define TOD3000_CNTRL1_HOLD 0
321#define TOD3000_CNTRL1_FREE 9
322#define tod_3000 ((*(volatile struct tod3000 *)(zTwoBase+0xDC0000)))
323
324struct tod2000 {
325 unsigned int :28, second2:4;
326 unsigned int :28, second1:4;
327 unsigned int :28, minute2:4;
328 unsigned int :28, minute1:4;
329 unsigned int :28, hour2:4;
330 unsigned int :28, hour1:4;
331 unsigned int :28, day2:4;
332 unsigned int :28, day1:4;
333 unsigned int :28, month2:4;
334 unsigned int :28, month1:4;
335 unsigned int :28, year2:4;
336 unsigned int :28, year1:4;
337 unsigned int :28, weekday:4;
338 unsigned int :28, cntrl1:4;
339 unsigned int :28, cntrl2:4;
340 unsigned int :28, cntrl3:4;
341};
342
343#define TOD2000_CNTRL1_HOLD (1<<0)
344#define TOD2000_CNTRL1_BUSY (1<<1)
345#define TOD2000_CNTRL3_24HMODE (1<<2)
346#define TOD2000_HOUR1_PM (1<<2)
347#define tod_2000 ((*(volatile struct tod2000 *)(zTwoBase+0xDC0000)))
348
349#endif
350