]> git.sesse.net Git - pistorm/blob - platforms/amiga/Gayle.h
Remove IDE emulation, update default.cfg with a note about it
[pistorm] / platforms / amiga / Gayle.h
1 //
2 //  Gayle.h
3 //  Omega
4 //
5 //  Created by Matt Parsons on 06/03/2019.
6 //  Copyright © 2019 Matt Parsons. All rights reserved.
7 //
8
9 #ifndef Gayle_h
10 #define Gayle_h
11
12 #define GAYLE_MAX_HARDFILES 8
13
14 #include <stdio.h>
15 #include <stdint.h>
16
17 void InitGayle(void);
18 void writeGayleB(unsigned int address, unsigned value);
19 void writeGayle(unsigned int address, unsigned value);
20 void writeGayleL(unsigned int address, unsigned value);
21 uint8_t readGayleB(unsigned int address);
22 uint16_t readGayle(unsigned int address);
23 uint32_t readGayleL(unsigned int address);
24
25 // Gayle Addresses
26 #define GAYLE_IDE_BASE_A1200 0xDA2000 //16bit base
27 #define GAYLE_IDE_BASE_A4000 0xDD2020
28
29 // Gayle IDE Reads
30 #define GERROR 0xda2004   // Error
31 #define GSTATUS 0xda201C  // Status
32 #define GERROR_A4000 GAYLE_IDE_BASE_A4000 + 0x06   // Error
33 #define GSTATUS_A4000 GAYLE_IDE_BASE_A4000 + 0x1E  // Status
34
35 // Gayle IDE read offsets
36 #define GERROR_OFFSET 0x04
37 #define GSTATUS_OFFSET 0x1C
38 // Gayle IDE write offsets
39 #define GFEAT_OFFSET 0x04
40 #define GCMD_OFFSET 0x1C
41 // Gayle IDE RW offsets
42 #define GDATA_OFFSET 0x00
43 #define GSECTCOUNT_OFFSET 0x08
44 #define GSECTNUM_OFFSET 0x0C
45 #define GCYLLOW_OFFSET 0x10
46 #define GCYLHIGH_OFFSET 0x14
47 #define GDEVHEAD_OFFSET 0x18
48 #define GCTRL_OFFSET 0x1018
49 #define GIRQ_OFFSET 0x7000
50 #define GIRQ_4000_OFFSET 0x1002
51
52 // Gayle IDE Writes
53 #define GFEAT 0xda2004  // Write : Feature
54 #define GCMD 0xda201c   // Write : Command
55 #define GFEAT_A4000 GAYLE_IDE_BASE_A4000 + 0x06  // Write : Feature
56 #define GCMD_A4000 GAYLE_IDE_BASE_A4000 + 0x1E   // Write : Command
57 #define GMODEREG0_A4000 0x0DD1020   // D31, PIO modes (00,01,10)
58 #define GMODEREG1_A4000 0x0DD1022   // D31, (MSB)
59
60 // Gayle IDE RW
61 #define GDATA 0xda2000     // Data - 16 bit
62 #define GSECTCNT 0xda2008  // SectorCount
63 #define GSECTNUM 0xda200c  // SectorNumber
64 #define GCYLLOW 0xda2010   // CylinderLow
65 #define GCYLHIGH 0xda2014  // CylinderHigh
66 #define GDEVHEAD 0xda2018  // Device/Head
67 #define GCTRL 0xda3018     // Control
68
69 #define GDATA_A4000 GAYLE_IDE_BASE_A4000     // Data
70 #define GSECTCNT_A4000 GAYLE_IDE_BASE_A4000 + 0x0a  // SectorCount
71 #define GSECTNUM_A4000 GAYLE_IDE_BASE_A4000 + 0x0e  // SectorNumber
72 #define GCYLLOW_A4000 GAYLE_IDE_BASE_A4000 + 0x12   // CylinderLow
73 #define GCYLHIGH_A4000 GAYLE_IDE_BASE_A4000 + 0x16  // CylinderHigh
74 #define GDEVHEAD_A4000 GAYLE_IDE_BASE_A4000 + 0x1a  // Device/Head
75 #define GCTRL_A4000 GAYLE_IDE_BASE_A4000 + 0x101a     // Control
76
77 // For A4000 there's no need to populate other areas, just GIRQ
78 #define GIRQ_A4000 GAYLE_IDE_BASE_A4000 + 0x1000  // IRQ  0xDD3020
79
80 // Gayle Ident
81 #define GIDENT 0xDE1000
82
83 // Gayle IRQ/CC
84 #define GCS 0xDA8000   // Card Control
85 #define GIRQ 0xDA9000  // IRQ
86 #define GINT 0xDAA000  // Int enable
87 #define GCONF 0xDAB000  // Gayle Config
88
89 /* DA8000 */
90 #define GAYLE_CS_IDE 0x80   /* IDE int status */
91 #define GAYLE_CS_CCDET 0x40 /* credit card detect */
92 #define GAYLE_CS_BVD1 0x20  /* battery voltage detect 1 */
93 #define GAYLE_CS_SC 0x20    /* credit card status change */
94 #define GAYLE_CS_BVD2 0x10  /* battery voltage detect 2 */
95 #define GAYLE_CS_DA 0x10    /* digital audio */
96 #define GAYLE_CS_WR 0x08    /* write enable (1 == enabled) */
97 #define GAYLE_CS_BSY 0x04   /* credit card busy */
98 #define GAYLE_CS_IRQ 0x04   /* interrupt request */
99 #define GAYLE_CS_DAEN 0x02  /* enable digital audio */
100 #define GAYLE_CS_DIS 0x01   /* disable PCMCIA slot */
101
102 /* DA9000 */
103 #define GAYLE_IRQ_IDE 0x80
104 #define GAYLE_IRQ_CCDET 0x40 /* credit card detect */
105 #define GAYLE_IRQ_BVD1 0x20  /* battery voltage detect 1 */
106 #define GAYLE_IRQ_SC 0x20    /* credit card status change */
107 #define GAYLE_IRQ_BVD2 0x10  /* battery voltage detect 2 */
108 #define GAYLE_IRQ_DA 0x10    /* digital audio */
109 #define GAYLE_IRQ_WR 0x08    /* write enable (1 == enabled) */
110 #define GAYLE_IRQ_BSY 0x04   /* credit card busy */
111 #define GAYLE_IRQ_IRQ 0x04   /* interrupt request */
112 #define GAYLE_IRQ_RESET 0x02 /* reset machine after CCDET change */
113 #define GAYLE_IRQ_BERR 0x01  /* generate bus error after CCDET change */
114
115 /* DAA000 */
116 #define GAYLE_INT_IDE 0x80     /* IDE interrupt enable */
117 #define GAYLE_INT_CCDET 0x40   /* credit card detect change enable */
118 #define GAYLE_INT_BVD1 0x20    /* battery voltage detect 1 change enable */
119 #define GAYLE_INT_SC 0x20      /* credit card status change enable */
120 #define GAYLE_INT_BVD2 0x10    /* battery voltage detect 2 change enable */
121 #define GAYLE_INT_DA 0x10      /* digital audio change enable */
122 #define GAYLE_INT_WR 0x08      /* write enable change enabled */
123 #define GAYLE_INT_BSY 0x04     /* credit card busy */
124 #define GAYLE_INT_IRQ 0x04     /* credit card interrupt request */
125 #define GAYLE_INT_BVD_LEV 0x02 /* BVD int level, 0=lev2,1=lev6 */
126 #define GAYLE_INT_BSY_LEV 0x01 /* BSY int level, 0=lev2,1=lev6 */
127
128 #endif /* Gayle_h */