Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | extern unsigned long amiga_model; |
| 26 | |
| 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) |
| 43 | |
| 44 | |
| 45 | /* |
| 46 | * Chipsets |
| 47 | */ |
| 48 | |
| 49 | extern unsigned long amiga_chipset; |
| 50 | |
| 51 | #define CS_STONEAGE (0) |
| 52 | #define CS_OCS (1) |
| 53 | #define CS_ECS (2) |
| 54 | #define CS_AGA (3) |
| 55 | |
| 56 | |
| 57 | /* |
| 58 | * Miscellaneous |
| 59 | */ |
| 60 | |
| 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 */ |
| 67 | |
| 68 | |
| 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) |
| 72 | |
| 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(GG2_ISA); /* GG2 Zorro2ISA Bridge */ |
| 110 | AMIGAHW_DECLARE(ZORRO); /* Zorro AutoConfig */ |
| 111 | AMIGAHW_DECLARE(ZORRO3); /* Zorro III */ |
| 112 | }; |
| 113 | |
| 114 | extern struct amiga_hw_present amiga_hw_present; |
| 115 | |
| 116 | struct CUSTOM { |
| 117 | unsigned short bltddat; |
| 118 | unsigned short dmaconr; |
| 119 | unsigned short vposr; |
| 120 | unsigned short vhposr; |
| 121 | unsigned short dskdatr; |
| 122 | unsigned short joy0dat; |
| 123 | unsigned short joy1dat; |
| 124 | unsigned short clxdat; |
| 125 | unsigned short adkconr; |
| 126 | unsigned short pot0dat; |
| 127 | unsigned short pot1dat; |
| 128 | unsigned short potgor; |
| 129 | unsigned short serdatr; |
| 130 | unsigned short dskbytr; |
| 131 | unsigned short intenar; |
| 132 | unsigned short intreqr; |
| 133 | unsigned char *dskptr; |
| 134 | unsigned short dsklen; |
| 135 | unsigned short dskdat; |
| 136 | unsigned short refptr; |
| 137 | unsigned short vposw; |
| 138 | unsigned short vhposw; |
| 139 | unsigned short copcon; |
| 140 | unsigned short serdat; |
| 141 | unsigned short serper; |
| 142 | unsigned short potgo; |
| 143 | unsigned short joytest; |
| 144 | unsigned short strequ; |
| 145 | unsigned short strvbl; |
| 146 | unsigned short strhor; |
| 147 | unsigned short strlong; |
| 148 | unsigned short bltcon0; |
| 149 | unsigned short bltcon1; |
| 150 | unsigned short bltafwm; |
| 151 | unsigned short bltalwm; |
| 152 | unsigned char *bltcpt; |
| 153 | unsigned char *bltbpt; |
| 154 | unsigned char *bltapt; |
| 155 | unsigned char *bltdpt; |
| 156 | unsigned short bltsize; |
| 157 | unsigned char pad2d; |
| 158 | unsigned char bltcon0l; |
| 159 | unsigned short bltsizv; |
| 160 | unsigned short bltsizh; |
| 161 | unsigned short bltcmod; |
| 162 | unsigned short bltbmod; |
| 163 | unsigned short bltamod; |
| 164 | unsigned short bltdmod; |
| 165 | unsigned short spare2[4]; |
| 166 | unsigned short bltcdat; |
| 167 | unsigned short bltbdat; |
| 168 | unsigned short bltadat; |
| 169 | unsigned short spare3[3]; |
| 170 | unsigned short deniseid; |
| 171 | unsigned short dsksync; |
| 172 | unsigned short *cop1lc; |
| 173 | unsigned short *cop2lc; |
| 174 | unsigned short copjmp1; |
| 175 | unsigned short copjmp2; |
| 176 | unsigned short copins; |
| 177 | unsigned short diwstrt; |
| 178 | unsigned short diwstop; |
| 179 | unsigned short ddfstrt; |
| 180 | unsigned short ddfstop; |
| 181 | unsigned short dmacon; |
| 182 | unsigned short clxcon; |
| 183 | unsigned short intena; |
| 184 | unsigned short intreq; |
| 185 | unsigned short adkcon; |
| 186 | struct { |
| 187 | unsigned short *audlc; |
| 188 | unsigned short audlen; |
| 189 | unsigned short audper; |
| 190 | unsigned short audvol; |
| 191 | unsigned short auddat; |
| 192 | unsigned short audspare[2]; |
| 193 | } aud[4]; |
| 194 | unsigned char *bplpt[8]; |
| 195 | unsigned short bplcon0; |
| 196 | unsigned short bplcon1; |
| 197 | unsigned short bplcon2; |
| 198 | unsigned short bplcon3; |
| 199 | unsigned short bpl1mod; |
| 200 | unsigned short bpl2mod; |
| 201 | unsigned short bplcon4; |
| 202 | unsigned short clxcon2; |
| 203 | unsigned short bpldat[8]; |
| 204 | unsigned char *sprpt[8]; |
| 205 | struct { |
| 206 | unsigned short pos; |
| 207 | unsigned short ctl; |
| 208 | unsigned short dataa; |
| 209 | unsigned short datab; |
| 210 | } spr[8]; |
| 211 | unsigned short color[32]; |
| 212 | unsigned short htotal; |
| 213 | unsigned short hsstop; |
| 214 | unsigned short hbstrt; |
| 215 | unsigned short hbstop; |
| 216 | unsigned short vtotal; |
| 217 | unsigned short vsstop; |
| 218 | unsigned short vbstrt; |
| 219 | unsigned short vbstop; |
| 220 | unsigned short sprhstrt; |
| 221 | unsigned short sprhstop; |
| 222 | unsigned short bplhstrt; |
| 223 | unsigned short bplhstop; |
| 224 | unsigned short hhposw; |
| 225 | unsigned short hhposr; |
| 226 | unsigned short beamcon0; |
| 227 | unsigned short hsstrt; |
| 228 | unsigned short vsstrt; |
| 229 | unsigned short hcenter; |
| 230 | unsigned short diwhigh; |
| 231 | unsigned short spare4[11]; |
| 232 | unsigned short fmode; |
| 233 | }; |
| 234 | |
| 235 | /* |
| 236 | * DMA register bits |
| 237 | */ |
| 238 | #define DMAF_SETCLR (0x8000) |
| 239 | #define DMAF_AUD0 (0x0001) |
| 240 | #define DMAF_AUD1 (0x0002) |
| 241 | #define DMAF_AUD2 (0x0004) |
| 242 | #define DMAF_AUD3 (0x0008) |
| 243 | #define DMAF_DISK (0x0010) |
| 244 | #define DMAF_SPRITE (0x0020) |
| 245 | #define DMAF_BLITTER (0x0040) |
| 246 | #define DMAF_COPPER (0x0080) |
| 247 | #define DMAF_RASTER (0x0100) |
| 248 | #define DMAF_MASTER (0x0200) |
| 249 | #define DMAF_BLITHOG (0x0400) |
| 250 | #define DMAF_BLTNZERO (0x2000) |
| 251 | #define DMAF_BLTDONE (0x4000) |
| 252 | #define DMAF_ALL (0x01FF) |
| 253 | |
| 254 | struct CIA { |
| 255 | unsigned char pra; char pad0[0xff]; |
| 256 | unsigned char prb; char pad1[0xff]; |
| 257 | unsigned char ddra; char pad2[0xff]; |
| 258 | unsigned char ddrb; char pad3[0xff]; |
| 259 | unsigned char talo; char pad4[0xff]; |
| 260 | unsigned char tahi; char pad5[0xff]; |
| 261 | unsigned char tblo; char pad6[0xff]; |
| 262 | unsigned char tbhi; char pad7[0xff]; |
| 263 | unsigned char todlo; char pad8[0xff]; |
| 264 | unsigned char todmid; char pad9[0xff]; |
| 265 | unsigned char todhi; char pada[0x1ff]; |
| 266 | unsigned char sdr; char padb[0xff]; |
| 267 | unsigned char icr; char padc[0xff]; |
| 268 | unsigned char cra; char padd[0xff]; |
| 269 | unsigned char crb; char pade[0xff]; |
| 270 | }; |
| 271 | |
| 272 | #define zTwoBase (0x80000000) |
| 273 | #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase) |
| 274 | #define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase) |
| 275 | |
| 276 | #define CUSTOM_PHYSADDR (0xdff000) |
| 277 | #define custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR))) |
| 278 | |
| 279 | #define CIAA_PHYSADDR (0xbfe001) |
| 280 | #define CIAB_PHYSADDR (0xbfd000) |
| 281 | #define ciaa ((*(volatile struct CIA *)(zTwoBase + CIAA_PHYSADDR))) |
| 282 | #define ciab ((*(volatile struct CIA *)(zTwoBase + CIAB_PHYSADDR))) |
| 283 | |
| 284 | #define CHIP_PHYSADDR (0x000000) |
| 285 | |
| 286 | void amiga_chip_init (void); |
| 287 | void *amiga_chip_alloc(unsigned long size, const char *name); |
| 288 | void *amiga_chip_alloc_res(unsigned long size, struct resource *res); |
| 289 | void amiga_chip_free(void *ptr); |
| 290 | unsigned long amiga_chip_avail( void ); /*MILAN*/ |
| 291 | extern volatile unsigned short amiga_audio_min_period; |
| 292 | |
| 293 | static inline void amifb_video_off(void) |
| 294 | { |
| 295 | if (amiga_chipset == CS_ECS || amiga_chipset == CS_AGA) { |
| 296 | /* program Denise/Lisa for a higher maximum play rate */ |
| 297 | custom.htotal = 113; /* 31 kHz */ |
| 298 | custom.vtotal = 223; /* 70 Hz */ |
| 299 | custom.beamcon0 = 0x4390; /* HARDDIS, VAR{BEAM,VSY,HSY,CSY}EN */ |
| 300 | /* suspend the monitor */ |
| 301 | custom.hsstrt = custom.hsstop = 116; |
| 302 | custom.vsstrt = custom.vsstop = 226; |
| 303 | amiga_audio_min_period = 57; |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | struct tod3000 { |
| 308 | unsigned int :28, second2:4; /* lower digit */ |
| 309 | unsigned int :28, second1:4; /* upper digit */ |
| 310 | unsigned int :28, minute2:4; /* lower digit */ |
| 311 | unsigned int :28, minute1:4; /* upper digit */ |
| 312 | unsigned int :28, hour2:4; /* lower digit */ |
| 313 | unsigned int :28, hour1:4; /* upper digit */ |
| 314 | unsigned int :28, weekday:4; |
| 315 | unsigned int :28, day2:4; /* lower digit */ |
| 316 | unsigned int :28, day1:4; /* upper digit */ |
| 317 | unsigned int :28, month2:4; /* lower digit */ |
| 318 | unsigned int :28, month1:4; /* upper digit */ |
| 319 | unsigned int :28, year2:4; /* lower digit */ |
| 320 | unsigned int :28, year1:4; /* upper digit */ |
| 321 | unsigned int :28, cntrl1:4; /* control-byte 1 */ |
| 322 | unsigned int :28, cntrl2:4; /* control-byte 2 */ |
| 323 | unsigned int :28, cntrl3:4; /* control-byte 3 */ |
| 324 | }; |
| 325 | #define TOD3000_CNTRL1_HOLD 0 |
| 326 | #define TOD3000_CNTRL1_FREE 9 |
| 327 | #define tod_3000 ((*(volatile struct tod3000 *)(zTwoBase+0xDC0000))) |
| 328 | |
| 329 | struct tod2000 { |
| 330 | unsigned int :28, second2:4; /* lower digit */ |
| 331 | unsigned int :28, second1:4; /* upper digit */ |
| 332 | unsigned int :28, minute2:4; /* lower digit */ |
| 333 | unsigned int :28, minute1:4; /* upper digit */ |
| 334 | unsigned int :28, hour2:4; /* lower digit */ |
| 335 | unsigned int :28, hour1:4; /* upper digit */ |
| 336 | unsigned int :28, day2:4; /* lower digit */ |
| 337 | unsigned int :28, day1:4; /* upper digit */ |
| 338 | unsigned int :28, month2:4; /* lower digit */ |
| 339 | unsigned int :28, month1:4; /* upper digit */ |
| 340 | unsigned int :28, year2:4; /* lower digit */ |
| 341 | unsigned int :28, year1:4; /* upper digit */ |
| 342 | unsigned int :28, weekday:4; |
| 343 | unsigned int :28, cntrl1:4; /* control-byte 1 */ |
| 344 | unsigned int :28, cntrl2:4; /* control-byte 2 */ |
| 345 | unsigned int :28, cntrl3:4; /* control-byte 3 */ |
| 346 | }; |
| 347 | |
| 348 | #define TOD2000_CNTRL1_HOLD (1<<0) |
| 349 | #define TOD2000_CNTRL1_BUSY (1<<1) |
| 350 | #define TOD2000_CNTRL3_24HMODE (1<<2) |
| 351 | #define TOD2000_HOUR1_PM (1<<2) |
| 352 | #define tod_2000 ((*(volatile struct tod2000 *)(zTwoBase+0xDC0000))) |
| 353 | |
| 354 | #endif /* _M68K_AMIGAHW_H */ |