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