1 | #include "License.h"␊ |
2 | #include "SD_Misc.h"␊ |
3 | ␊ |
4 | struct __attribute__ ((__packed__)) SDHCIRegMap_t {␊ |
5 | ␉volatile UInt32 SDMASysAddr;␉␉␉␉//0x00␊ |
6 | ␉volatile UInt16 BlockSize;␉␉␉␉␉//0x04␊ |
7 | ␉volatile UInt16 BlockCount;␉␉␉␉␉//0x06␊ |
8 | ␉volatile UInt32 Argument;␉␉␉␉␉//0x08␊ |
9 | ␉volatile UInt16 TransferMode;␉␉␉␉//0x0C␊ |
10 | ␉volatile UInt16 Command;␉␉␉␉␉//0x0E␊ |
11 | ␉volatile UInt32 Response[4];␉␉␉␉//0x10␊ |
12 | ␉volatile UInt32 BufferDataPort;␉␉␉␉//0x20␊ |
13 | ␉volatile UInt32 PresentState;␉␉␉␉//0x24␊ |
14 | ␉volatile UInt8 HostControl;␉␉␉␉//0x28␊ |
15 | ␉volatile UInt8 PowerControl;␉␉␉␉//0x29␊ |
16 | ␉volatile UInt8 BlockGapControl;␉␉␉//0x2A␊ |
17 | ␉volatile UInt8 WakeupControl;␉␉␉␉//0x2B␊ |
18 | ␉volatile UInt16 ClockControl;␉␉␉␉//0x2C␊ |
19 | ␉volatile UInt8 TimeoutControl;␉␉␉␉//0x2E␊ |
20 | ␉volatile UInt8 SoftwareReset;␉␉␉␉//0x2F␊ |
21 | ␉volatile UInt16 NormalIntStatus;␉␉␉//0x30␊ |
22 | ␉volatile UInt16 ErrorIntStatus;␉␉␉␉//0x32␊ |
23 | ␉volatile UInt16 NormalIntStatusEn;␉␉␉//0x34␊ |
24 | ␉volatile UInt16 ErrorIntStatusEn;␉␉␉//0x36␊ |
25 | ␉volatile UInt16 NormalIntSignalEn;␉␉␉//0x38␊ |
26 | ␉volatile UInt16 ErrorIntSignalEn;␉␉␉//0x3A␊ |
27 | ␉volatile UInt16 CMD12ErrorStatus;␉␉␉//0x3C␊ |
28 | ␉volatile UInt16 Reserved0;␉␉␉␉␉//0x3E␊ |
29 | ␉volatile UInt32 Capabilities[2];␉␉␉//0x40␊ |
30 | ␉volatile UInt32 MaxCurrentCap[2];␉␉␉//0x48␊ |
31 | ␉volatile UInt16 ForceEventCMD12ErrStatus;␉//0x50␊ |
32 | ␉volatile UInt16 ForceEventErrorIntStatus;␉//0x52␊ |
33 | ␉volatile UInt8 AMDAErrorStatus;␉␉␉//0x54␊ |
34 | ␉volatile UInt8 Reserved1;␉␉␉␉␉//0x55␊ |
35 | ␉volatile UInt16 Reserved2;␉␉␉␉␉//0x56␊ |
36 | ␉volatile UInt32 ADMASystemAddr[2];␉␉␉//0x58␊ |
37 | ␉volatile UInt16 ReservedArray[78];␉␉␉//0x60␊ |
38 | ␉volatile UInt16 SlotIntStatus;␉␉␉␉//0xFC␊ |
39 | ␉volatile UInt16 HostControllerVer;␉␉␉//0xFE␊ |
40 | };␊ |
41 | ␊ |
42 | //PresentState␊ |
43 | #define CMDLineLevel␉BIT24␊ |
44 | #define DAT3Level␉␉BIT23␊ |
45 | #define DAT2Level␉␉BIT22␊ |
46 | #define DAT1Level␉␉BIT21␊ |
47 | #define DAT0Level␉␉BIT20␊ |
48 | #define WPSwitchLevel␉BIT19␊ |
49 | #define CardDetectLevel␉BIT18␊ |
50 | #define CardStateStable BIT17␊ |
51 | #define CardInserted␉BIT16␊ |
52 | #define BuffReadEn␉␉BIT11␊ |
53 | #define BuffWriteEn␉␉BIT10␊ |
54 | #define ReadXferActive␉BIT9␊ |
55 | #define WriteXferActive␉BIT8␊ |
56 | #define DATLineActive␉BIT2␊ |
57 | #define ComInhibitDAT␉BIT1␊ |
58 | #define ComInhibitCMD␉BIT0␊ |
59 | ␊ |
60 | //HostControl␊ |
61 | #define CDSigSelection␉BIT7␊ |
62 | #define CDTestLevel␉␉BIT6␊ |
63 | #define DMASelSDMA␉␉0␊ |
64 | #define DMASel32ADMA2␉BIT3␊ |
65 | #define DMASel64ADMA2␉BIT4|BIT3␊ |
66 | #define HighSpeedEn␉␉BIT2␊ |
67 | #define DataXferWidth␉BIT1␊ |
68 | #define LedControl␉␉BIT0␊ |
69 | ␊ |
70 | //PowerControl␊ |
71 | #define HC3v3␉␉␉0xE␊ |
72 | #define HC3v0␉␉␉0xD␊ |
73 | #define HC1v8␉␉␉0xA␊ |
74 | #define SDPower␉␉␉BIT0␊ |
75 | ␊ |
76 | //ClockControl␊ |
77 | #define DIV256␉␉␉BIT16␊ |
78 | #define DIV128␉␉␉BIT15␊ |
79 | #define␉DIV64␉␉␉BIT14␊ |
80 | #define DIV32␉␉␉BIT13␊ |
81 | #define DIV16␉␉␉BIT12␊ |
82 | #define DIV8␉␉␉BIT11␊ |
83 | #define DIV4␉␉␉BIT10␊ |
84 | #define␉DIV2␉␉␉BIT9␊ |
85 | #define SDClockEn␉␉BIT2␊ |
86 | #define SDClockStable␉BIT1␊ |
87 | #define InternalClockEn BIT0␊ |
88 | ␊ |
89 | //Capabilities␊ |
90 | #define CR64SysBus␉␉BIT28␊ |
91 | #define␉CR1v8Support␉BIT26␊ |
92 | #define CR3v0Support␉BIT25␊ |
93 | #define CR3v3Support␉BIT24␊ |
94 | #define SusRsmSupport␉BIT23␊ |
95 | #define SDMASupport␉␉BIT22␊ |
96 | #define HighSpSupport␉BIT21␊ |
97 | #define ADMA2Support␉BIT19␊ |
98 | #define BlockLen512␉␉0␊ |
99 | #define BlockLen1024␉BIT16␊ |
100 | #define BlockLen2048␉BIT17␊ |
101 | #define BaseClockMask␉BIT13|BIT12|BIT11|BIT10|BIT9|BIT8␊ |
102 | #define TOutClockUnit␉BIT7␊ |
103 | #define TOutClockMask␉BIT5|BIT4|BIT3|BIT2|BIT1|BIT0␊ |
104 | ␊ |
105 | //MaxCurrentCap␊ |
106 | #define MaxCur1v8Mask␉BIT23|BIT22|BIT21|BIT20|BIT19|BIT18|BIT17|BIT16␊ |
107 | #define MaxCur3v0Mask␉BIT15|BIT14|BIT13|BIT12|BIT11|BIT10|BIT9|BIT8␊ |
108 | #define MaxCur3v3Mask␉BIT7|BIT6|BIT5|BIT4|BIT3|BIT2|BIT1|BIT0␊ |
109 | ␊ |
110 | //HostControllerVer␊ |
111 | #define VendorVerMask␉BIT15|BIT14|BIT13|BIT12|BIT11|BIT10|BIT9|BIT8␊ |
112 | #define SpecVerMask␉␉BIT7|BIT6|BIT5|BIT4|BIT3|BIT2|BIT1|BIT0␊ |
113 | ␊ |
114 | //SoftwareReset␊ |
115 | #define CMD_RESET␉␉BIT1␊ |
116 | #define DAT_RESET␉␉BIT2␊ |
117 | #define FULL_RESET␉␉BIT0␊ |
118 | ␊ |
119 | //NormalIntStatus␊ |
120 | #define ErrorInterrupt␉BIT15␊ |
121 | #define CardInterrupt␉BIT8␊ |
122 | #define CardRemoval␉␉BIT7␊ |
123 | #define CardInsertion␉BIT6␊ |
124 | #define BuffReadReady␉BIT5␊ |
125 | #define BuffWriteReady␉BIT4␊ |
126 | #define␉DMAInterrupt␉BIT3␊ |
127 | #define BlockGapEvent␉BIT2␊ |
128 | #define␉XferComplete␉BIT1␊ |
129 | #define␉CmdComplete␉␉BIT0␊ |
130 | ␊ |
131 | //ErrorIntStatus␊ |
132 | #define ADMAError␉␉BIT9␊ |
133 | #define AutoCMD12Error␉BIT8␊ |
134 | #define CurLimitError␉BIT7␊ |
135 | #define DatEndBitError␉BIT6␊ |
136 | #define DatCRCError␉␉BIT5␊ |
137 | #define DatTimeoutError␉BIT4␊ |
138 | #define CmdIndexError␉BIT3␊ |
139 | #define CmdEndBitError␉BIT2␊ |
140 | #define CmdCRCError␉␉BIT1␊ |
141 | #define CmdTimeoutError␉BIT0␊ |
142 | ␊ |
143 | |