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