1 /**************************************************************************//**
2  * @file     sdh_reg.h
3  * @version  V1.00
4  * @brief    SDH register definition header file
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  * @copyright (C) 2017-2020 Nuvoton Technology Corp. All rights reserved.
8  *****************************************************************************/
9 #ifndef __SDH_REG_H__
10 #define __SDH_REG_H__
11 
12 #if defined ( __CC_ARM   )
13 #pragma anon_unions
14 #endif
15 
16 /**
17    @addtogroup REGISTER Control Register
18    @{
19 */
20 
21 /**
22     @addtogroup SDH SD Card Host Interface(SDH)
23     Memory Mapped Structure for SDH Controller
24 @{ */
25 
26 typedef struct
27 {
28 
29     /**
30      * @var SDH_T::FB
31      * Offset: 0x00~0x7C  Shared Buffer (FIFO)
32      * ---------------------------------------------------------------------------------------------------
33      * |Bits    |Field     |Descriptions
34      * | :----: | :----:   | :---- |
35      * |[31:0]  |BUFFER    |Shared Buffer
36      * |        |          |Buffer for DMA transfer
37      * @var SDH_T::DMACTL
38      * Offset: 0x400  DMA Control and Status Register
39      * ---------------------------------------------------------------------------------------------------
40      * |Bits    |Field     |Descriptions
41      * | :----: | :----:   | :---- |
42      * |[0]     |DMAEN     |DMA Engine Enable Bit
43      * |        |          |0 = DMA Disabled.
44      * |        |          |1 = DMA Enabled.
45      * |        |          |If this bit is cleared, DMA will ignore all requests from SD host and force bus master into IDLE state.
46      * |        |          |Note: If target abort is occurred, DMAEN will be cleared.
47      * |[1]     |DMARST    |Software Engine Reset
48      * |        |          |0 = No effect.
49      * |        |          |1 = Reset internal state machine and pointers
50      * |        |          |The contents of control register will not be cleared
51      * |        |          |This bit will auto be cleared after few clock cycles.
52      * |        |          |Note: The software reset DMA related registers.
53      * |[3]     |SGEN      |Scatter-gather Function Enable Bit
54      * |        |          |0 = Scatter-gather function Disabled (DMA will treat the starting address in DMASAR as starting pointer of a single block memory).
55      * |        |          |1 = Scatter-gather function Enabled (DMA will treat the starting address in DMASAR as a starting address of Physical Address Descriptor (PAD) table
56      * |        |          |The format of these Pads' will be described later).
57      * |[9]     |DMABUSY   |DMA Transfer Is in Progress
58      * |        |          |This bit indicates if SD Host is granted and doing DMA transfer or not.
59      * |        |          |0 = DMA transfer is not in progress.
60      * |        |          |1 = DMA transfer is in progress.
61      * @var SDH_T::DMASA
62      * Offset: 0x408  DMA Transfer Starting Address Register
63      * ---------------------------------------------------------------------------------------------------
64      * |Bits    |Field     |Descriptions
65      * | :----: | :----:   | :---- |
66      * |[0]     |ORDER     |Determined to the PAD Table Fetching Is in Order or Out of Order
67      * |        |          |0 = PAD table is fetched in order.
68      * |        |          |1 = PAD table is fetched out of order.
69      * |        |          |Note: the bit0 is valid in scatter-gather mode when SGEN = 1.
70      * |[31:1]  |DMASA     |DMA Transfer Starting Address
71      * |        |          |This field pads 0 as least significant bit indicates a 32-bit starting address of system memory (SRAM) for DMA to retrieve or fill in data.
72      * |        |          |If DMA is not in normal mode, this field will be interpreted as a starting address of Physical Address Descriptor (PAD) table.
73      * |        |          |Note: Starting address of the SRAM must be word aligned, for example, 0x0000_0000, 0x0000_0004.
74      * @var SDH_T::DMABCNT
75      * Offset: 0x40C  DMA Transfer Byte Count Register
76      * ---------------------------------------------------------------------------------------------------
77      * |Bits    |Field     |Descriptions
78      * | :----: | :----:   | :---- |
79      * |[25:0]  |BCNT      |DMA Transfer Byte Count (Read Only)
80      * |        |          |This field indicates the remained byte count of DMA transfer
81      * |        |          |The value of this field is valid only when DMA is busy; otherwise, it is 0.
82      * @var SDH_T::DMAINTEN
83      * Offset: 0x410  DMA Interrupt Enable Control Register
84      * ---------------------------------------------------------------------------------------------------
85      * |Bits    |Field     |Descriptions
86      * | :----: | :----:   | :---- |
87      * |[0]     |ABORTIEN  |DMA Read/Write Target Abort Interrupt Enable Bit
88      * |        |          |0 = Target abort interrupt generation Disabled during DMA transfer.
89      * |        |          |1 = Target abort interrupt generation Enabled during DMA transfer.
90      * |[1]     |WEOTIEN   |Wrong EOT Encountered Interrupt Enable Bit
91      * |        |          |0 = Interrupt generation Disabled when wrong EOT is encountered.
92      * |        |          |1 = Interrupt generation Enabled when wrong EOT is encountered.
93      * @var SDH_T::DMAINTSTS
94      * Offset: 0x414  DMA Interrupt Status Register
95      * ---------------------------------------------------------------------------------------------------
96      * |Bits    |Field     |Descriptions
97      * | :----: | :----:   | :---- |
98      * |[0]     |ABORTIF   |DMA Read/Write Target Abort Interrupt Flag
99      * |        |          |0 = No bus ERROR response received.
100      * |        |          |1 = Bus ERROR response received.
101      * |        |          |Note1: This bit is read only, but can be cleared by writing '1' to it.
102      * |        |          |Note2: When DMA's bus master received ERROR response, it means that target abort is happened
103      * |        |          |DMA will stop transfer and respond this event and then go to IDLE state
104      * |        |          |When target abort occurred or WEOTIF is set, software must reset DMA and SD host, and then transfer those data again.
105      * |[1]     |WEOTIF    |Wrong EOT Encountered Interrupt Flag
106      * |        |          |When DMA Scatter-Gather function is enabled, and EOT of the descriptor is encountered before DMA transfer finished (that means the total sector count of all PAD is less than the sector count of SD host), this bit will be set.
107      * |        |          |0 = No EOT encountered before DMA transfer finished.
108      * |        |          |1 = EOT encountered before DMA transfer finished.
109      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
110      * @var SDH_T::GCTL
111      * Offset: 0x800  Global Control and Status Register
112      * ---------------------------------------------------------------------------------------------------
113      * |Bits    |Field     |Descriptions
114      * | :----: | :----:   | :---- |
115      * |[0]     |GCTLRST   |Software Engine Reset
116      * |        |          |0 = No effect.
117      * |        |          |1 = Reset SD host
118      * |        |          |The contents of control register will not be cleared
119      * |        |          |This bit will auto cleared after reset complete.
120      * |[1]     |SDEN      |Secure Digital Functionality Enable Bit
121      * |        |          |0 = SD functionality disabled.
122      * |        |          |1 = SD functionality enabled.
123      * @var SDH_T::GINTEN
124      * Offset: 0x804  Global Interrupt Control Register
125      * ---------------------------------------------------------------------------------------------------
126      * |Bits    |Field     |Descriptions
127      * | :----: | :----:   | :---- |
128      * |[0]     |DTAIEN    |DMA READ/WRITE Target Abort Interrupt Enable Bit
129      * |        |          |0 = DMA READ/WRITE target abort interrupt generation disabled.
130      * |        |          |1 = DMA READ/WRITE target abort interrupt generation enabled.
131      * @var SDH_T::GINTSTS
132      * Offset: 0x808  Global Interrupt Status Register
133      * ---------------------------------------------------------------------------------------------------
134      * |Bits    |Field     |Descriptions
135      * | :----: | :----:   | :---- |
136      * |[0]     |DTAIF     |DMA READ/WRITE Target Abort Interrupt Flag (Read Only)
137      * |        |          |This bit indicates DMA received an ERROR response from internal AHB bus during DMA read/write operation
138      * |        |          |When Target Abort is occurred, please reset all engine.
139      * |        |          |0 = No bus ERROR response received.
140      * |        |          |1 = Bus ERROR response received.
141      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
142      * @var SDH_T::CTL
143      * Offset: 0x820  SD Control and Status Register
144      * ---------------------------------------------------------------------------------------------------
145      * |Bits    |Field     |Descriptions
146      * | :----: | :----:   | :---- |
147      * |[0]     |COEN      |Command Output Enable Bit
148      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
149      * |        |          |1 = Enabled, SD host will output a command to SD card.
150      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
151      * |[1]     |RIEN      |Response Input Enable Bit
152      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
153      * |        |          |1 = Enabled, SD host will wait to receive a response from SD card.
154      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
155      * |[2]     |DIEN      |Data Input Enable Bit
156      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
157      * |        |          |1 = Enabled, SD host will wait to receive block data and the CRC16 value from SD card.
158      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
159      * |[3]     |DOEN      |Data Output Enable Bit
160      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
161      * |        |          |1 = Enabled, SD host will transfer block data and the CRC16 value to SD card.
162      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
163      * |[4]     |R2EN      |Response R2 Input Enable Bit
164      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
165      * |        |          |1 = Enabled, SD host will wait to receive a response R2 from SD card and store the response data into DMC's flash buffer (exclude CRC7).
166      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
167      * |[5]     |CLK74OEN  |Initial 74 Clock Cycles Output Enable Bit
168      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
169      * |        |          |1 = Enabled, SD host will output 74 clock cycles to SD card.
170      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
171      * |[6]     |CLK8OEN   |Generating 8 Clock Cycles Output Enable Bit
172      * |        |          |0 = No effect. (Please use DMARST (SDH_CTL [0]) to clear this bit.)
173      * |        |          |1 = Enabled, SD host will output 8 clock cycles.
174      * |        |          |Note: When operation is finished, this bit will be cleared automatically, so don't write 0 to this bit (the controller will be abnormal).
175      * |[7]     |CLKKEEP   |SD Clock Enable Control
176      * |        |          |0 = SD host decided when to output clock and when to disable clock output automatically.
177      * |        |          |1 = SD clock always keeps free running.
178      * |[13:8]  |CMDCODE   |SD Command Code
179      * |        |          |This register contains the SD command code (0x00 - 0x3F).
180      * |[14]    |CTLRST    |Software Engine Reset
181      * |        |          |0 = No effect.
182      * |        |          |1 = Reset the internal state machine and counters
183      * |        |          |The contents of control register will not be cleared (but RIEN, DIEN, DOEN and R2_EN will be cleared)
184      * |        |          |This bit will be auto cleared after few clock cycles.
185      * |[15]    |DBW       |SD Data Bus Width (for 1-bit / 4-bit Selection)
186      * |        |          |0 = Data bus width is 1-bit.
187      * |        |          |1 = Data bus width is 4-bit.
188      * |[23:16] |BLKCNT    |Block Counts to Be Transferred or Received
189      * |        |          |This field contains the block counts for data-in and data-out transfer
190      * |        |          |For READ_MULTIPLE_BLOCK and WRITE_MULTIPLE_BLOCK command, software can use this function to accelerate data transfer and improve performance
191      * |        |          |Don't fill 0x0 to this field.
192      * |        |          |Note: For READ_MULTIPLE_BLOCK and WRITE_MULTIPLE_BLOCK command, the actual total length is BLKCNT * (BLKLEN +1).
193      * |[27:24] |SDNWR     |NWR Parameter for Block Write Operation
194      * |        |          |This value indicates the NWR parameter for data block write operation in SD clock counts
195      * |        |          |The actual clock cycle will be SDNWR+1.
196      * @var SDH_T::CMDARG
197      * Offset: 0x824  SD Command Argument Register
198      * ---------------------------------------------------------------------------------------------------
199      * |Bits    |Field     |Descriptions
200      * | :----: | :----:   | :---- |
201      * |[31:0]  |ARGUMENT  |SD Command Argument
202      * |        |          |This register contains a 32-bit value specifies the argument of SD command from host controller to SD card
203      * |        |          |Before trigger COEN (SDH_CTL [0]), software should fill argument in this field.
204      * @var SDH_T::INTEN
205      * Offset: 0x828  SD Interrupt Control Register
206      * ---------------------------------------------------------------------------------------------------
207      * |Bits    |Field     |Descriptions
208      * | :----: | :----:   | :---- |
209      * |[0]     |BLKDIEN   |Block Transfer Done Interrupt Enable Bit
210      * |        |          |0 = BLKDIF (SDH_INTEN[0]) trigger interrupt Disable.
211      * |        |          |1 = BLKDIF (SDH_INTEN[0]) trigger interrupt Enabled.
212      * |[1]     |CRCIEN    |CRC7, CRC16 and CRC Status Error Interrupt Enable Bit
213      * |        |          |0 = CRCIF (SDH_INTEN[1]) trigger interrupt Disable.
214      * |        |          |1 = CRCIF (SDH_INTEN[1]) trigger interrupt Enabled.
215      * |[8]     |CDIEN     |SD Card Detection Interrupt Enable Bit
216      * |        |          |Enable/Disable interrupts generation of SD controller when card is inserted or removed.
217      * |        |          |0 = CDIF (SDH_INTEN[8]) trigger interrupt Disable.
218      * |        |          |1 = CDIF (SDH_INTEN[8]) trigger interrupt Enabled.
219      * |[12]    |RTOIEN    |Response Time-out Interrupt Enable Bit
220      * |        |          |Enable/Disable interrupts generation of SD controller when receiving response or R2 time-out
221      * |        |          |Time-out value is specified at TOUT register.
222      * |        |          |0 = RTOIF (SDH_INTEN[12]) trigger interrupt Disabled.
223      * |        |          |1 = RTOIF (SDH_INTEN[12]) trigger interrupt Enabled.
224      * |[13]    |DITOIEN   |Data Input Time-out Interrupt Enable Bit
225      * |        |          |Enable/Disable interrupts generation of SD controller when data input time-out
226      * |        |          |Time-out value is specified at TOUT register.
227      * |        |          |0 = DITOIF (SDH_INTEN[13]) trigger interrupt Disabled.
228      * |        |          |1 = DITOIF (SDH_INTEN[13]) trigger interrupt Enabled.
229      * |[14]    |WKIEN     |Wake-up Signal Generating Enable Bit
230      * |        |          |Enable/Disable wake-up signal generating of SD host when current using SD card issues an interrupt (wake-up) via DAT [1] to host.
231      * |        |          |0 = SD Card interrupt to wake-up chip Disabled.
232      * |        |          |1 = SD Card interrupt to wake-up chip Enabled.
233      * |[30]    |CDSRC     |SD Card Detect Source Selection
234      * |        |          |0 = From SD card's DAT3 pin.
235      * |        |          |Host need clock to got data on pin DAT3
236      * |        |          |Please make sure CLKKEEP (SDH_CTL[7]) is 1 in order to generate free running clock for DAT3 pin.
237      * |        |          |1 = From GPIO pin.
238      * @var SDH_T::INTSTS
239      * Offset: 0x82C  SD Interrupt Status Register
240      * ---------------------------------------------------------------------------------------------------
241      * |Bits    |Field     |Descriptions
242      * | :----: | :----:   | :---- |
243      * |[0]     |BLKDIF    |Block Transfer Done Interrupt Flag (Read Only)
244      * |        |          |This bit indicates that SD host has finished all data-in or data-out block transfer
245      * |        |          |If there is a CRC16 error or incorrect CRC status during multiple block data transfer, the transfer will be broken and this bit will also be set.
246      * |        |          |0 = Not finished yet.
247      * |        |          |1 = Done.
248      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
249      * |[1]     |CRCIF     |CRC7, CRC16 and CRC Status Error Interrupt Flag (Read Only)
250      * |        |          |This bit indicates that SD host has occurred CRC error during response in, data-in or data-out (CRC status error) transfer
251      * |        |          |When CRC error is occurred, software should reset SD engine
252      * |        |          |Some response (ex
253      * |        |          |R3) doesn't have CRC7 information with it; SD host will still calculate CRC7, get CRC error and set this flag
254      * |        |          |In this condition, software should ignore CRC error and clears this bit manually.
255      * |        |          |0 = No CRC error is occurred.
256      * |        |          |1 = CRC error is occurred.
257      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
258      * |[2]     |CRC7      |CRC7 Check Status (Read Only)
259      * |        |          |SD host will check CRC7 correctness during each response in
260      * |        |          |If that response does not contain CRC7 information (ex
261      * |        |          |R3), then software should turn off CRCIEN (SDH_INTEN[1]) and ignore this bit.
262      * |        |          |0 = Fault.
263      * |        |          |1 = OK.
264      * |[3]     |CRC16     |CRC16 Check Status of Data-in Transfer (Read Only)
265      * |        |          |SD host will check CRC16 correctness after data-in transfer.
266      * |        |          |0 = Fault.
267      * |        |          |1 = OK.
268      * |[6:4]   |CRCSTS    |CRC Status Value of Data-out Transfer (Read Only)
269      * |        |          |SD host will record CRC status of data-out transfer
270      * |        |          |Software could use this value to identify what type of error is during data-out transfer.
271      * |        |          |010 = Positive CRC status.
272      * |        |          |101 = Negative CRC status.
273      * |        |          |111 = SD card programming error occurs.
274      * |[7]     |DAT0STS   |DAT0 Pin Status of Current Selected SD Port (Read Only)
275      * |        |          |This bit is the DAT0 pin status of current selected SD port.
276      * |[8]     |CDIF      |SD Card Detection Interrupt Flag (Read Only)
277      * |        |          |This bit indicates that SD card is inserted or removed
278      * |        |          |Only when CDIEN (SDH_INTEN[8]) is set to 1, this bit is active.
279      * |        |          |0 = No card is inserted or removed.
280      * |        |          |1 = There is a card inserted in or removed from SD.
281      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
282      * |[12]    |RTOIF     |Response Time-out Interrupt Flag (Read Only)
283      * |        |          |This bit indicates that SD host counts to time-out value when receiving response or R2 (waiting start bit).
284      * |        |          |0 = Not time-out.
285      * |        |          |1 = Response time-out.
286      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
287      * |[13]    |DITOIF    |Data Input Time-out Interrupt Flag (Read Only)
288      * |        |          |This bit indicates that SD host counts to time-out value when receiving data (waiting start bit).
289      * |        |          |0 = Not time-out.
290      * |        |          |1 = Data input time-out.
291      * |        |          |Note: This bit is read only, but can be cleared by writing '1' to it.
292      * |[16]    |CDSTS     |Card Detect Status of SD (Read Only)
293      * |        |          |This bit indicates the card detect pin status of SD, and is used for card detection
294      * |        |          |When there is a card inserted in or removed from SD, software should check this bit to confirm if there is really a card insertion or removal.
295      * |        |          |If CDSRC (SDH_INTEN[30]) = 0, to select DAT3 for card detection:.
296      * |        |          |0 = Card removed.
297      * |        |          |1 = Card inserted.
298      * |        |          |If CDSRC (SDH_INTEN[30]) = 1, to select GPIO for card detection:.
299      * |        |          |0 = Card inserted.
300      * |        |          |1 = Card removed.
301      * |[18]    |DAT1STS   |DAT1 Pin Status of SD Port (Read Only)
302      * |        |          |This bit indicates the DAT1 pin status of SD port.
303      * @var SDH_T::RESP0
304      * Offset: 0x830  SD Receiving Response Token Register 0
305      * ---------------------------------------------------------------------------------------------------
306      * |Bits    |Field     |Descriptions
307      * | :----: | :----:   | :---- |
308      * |[31:0]  |RESPTK0   |SD Receiving Response Token 0
309      * |        |          |SD host controller will receive a response token for getting a reply from SD card when RIEN (SDH_CTL[1]) is set
310      * |        |          |This field contains response bit 47-16 of the response token.
311      * @var SDH_T::RESP1
312      * Offset: 0x834  SD Receiving Response Token Register 1
313      * ---------------------------------------------------------------------------------------------------
314      * |Bits    |Field     |Descriptions
315      * | :----: | :----:   | :---- |
316      * |[7:0]   |RESPTK1   |SD Receiving Response Token 1
317      * |        |          |SD host controller will receive a response token for getting a reply from SD card when RIEN (SDH_CTL[1]) is set
318      * |        |          |This register contains the bit 15-8 of the response token.
319      * @var SDH_T::BLEN
320      * Offset: 0x838  SD Block Length Register
321      * ---------------------------------------------------------------------------------------------------
322      * |Bits    |Field     |Descriptions
323      * | :----: | :----:   | :---- |
324      * |[10:0]  |BLKLEN    |SD BLOCK LENGTH in Byte Unit
325      * |        |          |An 11-bit value specifies the SD transfer byte count of a block
326      * |        |          |The actual byte count is equal to BLKLEN+1.
327      * |        |          |Note: The default SD block length is 512 bytes
328      * @var SDH_T::TOUT
329      * Offset: 0x83C  SD Response/Data-in Time-out Register
330      * ---------------------------------------------------------------------------------------------------
331      * |Bits    |Field     |Descriptions
332      * | :----: | :----:   | :---- |
333      * |[23:0]  |TOUT      |SD Response/Data-in Time-out Value
334      * |        |          |A 24-bit value specifies the time-out counts of response and data input
335      * |        |          |SD host controller will wait start bit of response or data-in until this value reached
336      * |        |          |The time period depends on SD engine clock frequency
337      * |        |          |Do not write a small number into this field, or you may never get response or data due to time-out.
338      * |        |          |Note: Filling 0x0 into this field will disable hardware time-out function.
339      */
340 
341     __IO uint32_t FB[32];                /*!< Shared Buffer (FIFO)                                                      */
342     /// @cond HIDDEN_SYMBOLS
343     __I  uint32_t RESERVE0[224];
344     /// @endcond //HIDDEN_SYMBOLS
345     __IO uint32_t DMACTL;                /*!< [0x0400] DMA Control and Status Register                                  */
346     /// @cond HIDDEN_SYMBOLS
347     __I  uint32_t RESERVE1[1];
348     /// @endcond //HIDDEN_SYMBOLS
349     __IO uint32_t DMASA;                 /*!< [0x0408] DMA Transfer Starting Address Register                           */
350     __I  uint32_t DMABCNT;               /*!< [0x040c] DMA Transfer Byte Count Register                                 */
351     __IO uint32_t DMAINTEN;              /*!< [0x0410] DMA Interrupt Enable Control Register                            */
352     __IO uint32_t DMAINTSTS;             /*!< [0x0414] DMA Interrupt Status Register                                    */
353     /// @cond HIDDEN_SYMBOLS
354     __I  uint32_t RESERVE2[250];
355     /// @endcond //HIDDEN_SYMBOLS
356     __IO uint32_t GCTL;                  /*!< [0x0800] Global Control and Status Register                               */
357     __IO uint32_t GINTEN;                /*!< [0x0804] Global Interrupt Control Register                                */
358     __I  uint32_t GINTSTS;               /*!< [0x0808] Global Interrupt Status Register                                 */
359     /// @cond HIDDEN_SYMBOLS
360     __I  uint32_t RESERVE3[5];
361     /// @endcond //HIDDEN_SYMBOLS
362     __IO uint32_t CTL;                   /*!< [0x0820] SD Control and Status Register                                   */
363     __IO uint32_t CMDARG;                /*!< [0x0824] SD Command Argument Register                                     */
364     __IO uint32_t INTEN;                 /*!< [0x0828] SD Interrupt Control Register                                    */
365     __IO uint32_t INTSTS;                /*!< [0x082c] SD Interrupt Status Register                                     */
366     __I  uint32_t RESP0;                 /*!< [0x0830] SD Receiving Response Token Register 0                           */
367     __I  uint32_t RESP1;                 /*!< [0x0834] SD Receiving Response Token Register 1                           */
368     __IO uint32_t BLEN;                  /*!< [0x0838] SD Block Length Register                                         */
369     __IO uint32_t TOUT;                  /*!< [0x083c] SD Response/Data-in Time-out Register                            */
370 
371 } SDH_T;
372 
373 
374 /**
375     @addtogroup SDH_CONST SDH Bit Field Definition
376     Constant Definitions for SDH Controller
377 @{ */
378 
379 #define SDH_DMACTL_DMAEN_Pos             (0)                                               /*!< SDH_T::DMACTL: DMAEN Position          */
380 #define SDH_DMACTL_DMAEN_Msk             (0x1ul << SDH_DMACTL_DMAEN_Pos)                   /*!< SDH_T::DMACTL: DMAEN Mask              */
381 
382 #define SDH_DMACTL_DMARST_Pos            (1)                                               /*!< SDH_T::DMACTL: DMARST Position         */
383 #define SDH_DMACTL_DMARST_Msk            (0x1ul << SDH_DMACTL_DMARST_Pos)                  /*!< SDH_T::DMACTL: DMARST Mask             */
384 
385 #define SDH_DMACTL_SGEN_Pos              (3)                                               /*!< SDH_T::DMACTL: SGEN Position           */
386 #define SDH_DMACTL_SGEN_Msk              (0x1ul << SDH_DMACTL_SGEN_Pos)                    /*!< SDH_T::DMACTL: SGEN Mask               */
387 
388 #define SDH_DMACTL_DMABUSY_Pos           (9)                                               /*!< SDH_T::DMACTL: DMABUSY Position        */
389 #define SDH_DMACTL_DMABUSY_Msk           (0x1ul << SDH_DMACTL_DMABUSY_Pos)                 /*!< SDH_T::DMACTL: DMABUSY Mask            */
390 
391 #define SDH_DMASA_ORDER_Pos              (0)                                               /*!< SDH_T::DMASA: ORDER Position           */
392 #define SDH_DMASA_ORDER_Msk              (0x1ul << SDH_DMASA_ORDER_Pos)                    /*!< SDH_T::DMASA: ORDER Mask               */
393 
394 #define SDH_DMASA_DMASA_Pos              (1)                                               /*!< SDH_T::DMASA: DMASA Position           */
395 #define SDH_DMASA_DMASA_Msk              (0x7ffffffful << SDH_DMASA_DMASA_Pos)             /*!< SDH_T::DMASA: DMASA Mask               */
396 
397 #define SDH_DMABCNT_BCNT_Pos             (0)                                               /*!< SDH_T::DMABCNT: BCNT Position          */
398 #define SDH_DMABCNT_BCNT_Msk             (0x3fffffful << SDH_DMABCNT_BCNT_Pos)             /*!< SDH_T::DMABCNT: BCNT Mask              */
399 
400 #define SDH_DMAINTEN_ABORTIEN_Pos        (0)                                               /*!< SDH_T::DMAINTEN: ABORTIEN Position     */
401 #define SDH_DMAINTEN_ABORTIEN_Msk        (0x1ul << SDH_DMAINTEN_ABORTIEN_Pos)              /*!< SDH_T::DMAINTEN: ABORTIEN Mask         */
402 
403 #define SDH_DMAINTEN_WEOTIEN_Pos         (1)                                               /*!< SDH_T::DMAINTEN: WEOTIEN Position      */
404 #define SDH_DMAINTEN_WEOTIEN_Msk         (0x1ul << SDH_DMAINTEN_WEOTIEN_Pos)               /*!< SDH_T::DMAINTEN: WEOTIEN Mask          */
405 
406 #define SDH_DMAINTSTS_ABORTIF_Pos        (0)                                               /*!< SDH_T::DMAINTSTS: ABORTIF Position     */
407 #define SDH_DMAINTSTS_ABORTIF_Msk        (0x1ul << SDH_DMAINTSTS_ABORTIF_Pos)              /*!< SDH_T::DMAINTSTS: ABORTIF Mask         */
408 
409 #define SDH_DMAINTSTS_WEOTIF_Pos         (1)                                               /*!< SDH_T::DMAINTSTS: WEOTIF Position      */
410 #define SDH_DMAINTSTS_WEOTIF_Msk         (0x1ul << SDH_DMAINTSTS_WEOTIF_Pos)               /*!< SDH_T::DMAINTSTS: WEOTIF Mask          */
411 
412 #define SDH_GCTL_GCTLRST_Pos             (0)                                               /*!< SDH_T::GCTL: GCTLRST Position          */
413 #define SDH_GCTL_GCTLRST_Msk             (0x1ul << SDH_GCTL_GCTLRST_Pos)                   /*!< SDH_T::GCTL: GCTLRST Mask              */
414 
415 #define SDH_GCTL_SDEN_Pos                (1)                                               /*!< SDH_T::GCTL: SDEN Position             */
416 #define SDH_GCTL_SDEN_Msk                (0x1ul << SDH_GCTL_SDEN_Pos)                      /*!< SDH_T::GCTL: SDEN Mask                 */
417 
418 #define SDH_GINTEN_DTAIEN_Pos            (0)                                               /*!< SDH_T::GINTEN: DTAIEN Position         */
419 #define SDH_GINTEN_DTAIEN_Msk            (0x1ul << SDH_GINTEN_DTAIEN_Pos)                  /*!< SDH_T::GINTEN: DTAIEN Mask             */
420 
421 #define SDH_GINTSTS_DTAIF_Pos            (0)                                               /*!< SDH_T::GINTSTS: DTAIF Position         */
422 #define SDH_GINTSTS_DTAIF_Msk            (0x1ul << SDH_GINTSTS_DTAIF_Pos)                  /*!< SDH_T::GINTSTS: DTAIF Mask             */
423 
424 #define SDH_CTL_COEN_Pos                 (0)                                               /*!< SDH_T::CTL: COEN Position              */
425 #define SDH_CTL_COEN_Msk                 (0x1ul << SDH_CTL_COEN_Pos)                       /*!< SDH_T::CTL: COEN Mask                  */
426 
427 #define SDH_CTL_RIEN_Pos                 (1)                                               /*!< SDH_T::CTL: RIEN Position              */
428 #define SDH_CTL_RIEN_Msk                 (0x1ul << SDH_CTL_RIEN_Pos)                       /*!< SDH_T::CTL: RIEN Mask                  */
429 
430 #define SDH_CTL_DIEN_Pos                 (2)                                               /*!< SDH_T::CTL: DIEN Position              */
431 #define SDH_CTL_DIEN_Msk                 (0x1ul << SDH_CTL_DIEN_Pos)                       /*!< SDH_T::CTL: DIEN Mask                  */
432 
433 #define SDH_CTL_DOEN_Pos                 (3)                                               /*!< SDH_T::CTL: DOEN Position              */
434 #define SDH_CTL_DOEN_Msk                 (0x1ul << SDH_CTL_DOEN_Pos)                       /*!< SDH_T::CTL: DOEN Mask                  */
435 
436 #define SDH_CTL_R2EN_Pos                 (4)                                               /*!< SDH_T::CTL: R2EN Position              */
437 #define SDH_CTL_R2EN_Msk                 (0x1ul << SDH_CTL_R2EN_Pos)                       /*!< SDH_T::CTL: R2EN Mask                  */
438 
439 #define SDH_CTL_CLK74OEN_Pos             (5)                                               /*!< SDH_T::CTL: CLK74OEN Position          */
440 #define SDH_CTL_CLK74OEN_Msk             (0x1ul << SDH_CTL_CLK74OEN_Pos)                   /*!< SDH_T::CTL: CLK74OEN Mask              */
441 
442 #define SDH_CTL_CLK8OEN_Pos              (6)                                               /*!< SDH_T::CTL: CLK8OEN Position           */
443 #define SDH_CTL_CLK8OEN_Msk              (0x1ul << SDH_CTL_CLK8OEN_Pos)                    /*!< SDH_T::CTL: CLK8OEN Mask               */
444 
445 #define SDH_CTL_CLKKEEP_Pos              (7)                                               /*!< SDH_T::CTL: CLKKEEP Position          */
446 #define SDH_CTL_CLKKEEP_Msk              (0x1ul << SDH_CTL_CLKKEEP_Pos)                    /*!< SDH_T::CTL: CLKKEEP Mask              */
447 
448 #define SDH_CTL_CMDCODE_Pos              (8)                                               /*!< SDH_T::CTL: CMDCODE Position           */
449 #define SDH_CTL_CMDCODE_Msk              (0x3ful << SDH_CTL_CMDCODE_Pos)                   /*!< SDH_T::CTL: CMDCODE Mask               */
450 
451 #define SDH_CTL_CTLRST_Pos               (14)                                              /*!< SDH_T::CTL: CTLRST Position            */
452 #define SDH_CTL_CTLRST_Msk               (0x1ul << SDH_CTL_CTLRST_Pos)                     /*!< SDH_T::CTL: CTLRST Mask                */
453 
454 #define SDH_CTL_DBW_Pos                  (15)                                              /*!< SDH_T::CTL: DBW Position               */
455 #define SDH_CTL_DBW_Msk                  (0x1ul << SDH_CTL_DBW_Pos)                        /*!< SDH_T::CTL: DBW Mask                   */
456 
457 #define SDH_CTL_BLKCNT_Pos               (16)                                              /*!< SDH_T::CTL: BLKCNT Position            */
458 #define SDH_CTL_BLKCNT_Msk               (0xfful << SDH_CTL_BLKCNT_Pos)                    /*!< SDH_T::CTL: BLKCNT Mask                */
459 
460 #define SDH_CTL_SDNWR_Pos                (24)                                              /*!< SDH_T::CTL: SDNWR Position             */
461 #define SDH_CTL_SDNWR_Msk                (0xful << SDH_CTL_SDNWR_Pos)                      /*!< SDH_T::CTL: SDNWR Mask                 */
462 
463 #define SDH_CMDARG_ARGUMENT_Pos          (0)                                               /*!< SDH_T::CMDARG: ARGUMENT Position       */
464 #define SDH_CMDARG_ARGUMENT_Msk          (0xfffffffful << SDH_CMDARG_ARGUMENT_Pos)         /*!< SDH_T::CMDARG: ARGUMENT Mask           */
465 
466 #define SDH_INTEN_BLKDIEN_Pos            (0)                                               /*!< SDH_T::INTEN: BLKDIEN Position         */
467 #define SDH_INTEN_BLKDIEN_Msk            (0x1ul << SDH_INTEN_BLKDIEN_Pos)                  /*!< SDH_T::INTEN: BLKDIEN Mask             */
468 
469 #define SDH_INTEN_CRCIEN_Pos             (1)                                               /*!< SDH_T::INTEN: CRCIEN Position          */
470 #define SDH_INTEN_CRCIEN_Msk             (0x1ul << SDH_INTEN_CRCIEN_Pos)                   /*!< SDH_T::INTEN: CRCIEN Mask              */
471 
472 #define SDH_INTEN_CDIEN_Pos              (8)                                               /*!< SDH_T::INTEN: CDIEN Position          */
473 #define SDH_INTEN_CDIEN_Msk              (0x1ul << SDH_INTEN_CDIEN_Pos)                    /*!< SDH_T::INTEN: CDIEN Mask              */
474 
475 #define SDH_INTEN_RTOIEN_Pos             (12)                                              /*!< SDH_T::INTEN: RTOIEN Position          */
476 #define SDH_INTEN_RTOIEN_Msk             (0x1ul << SDH_INTEN_RTOIEN_Pos)                   /*!< SDH_T::INTEN: RTOIEN Mask              */
477 
478 #define SDH_INTEN_DITOIEN_Pos            (13)                                              /*!< SDH_T::INTEN: DITOIEN Position         */
479 #define SDH_INTEN_DITOIEN_Msk            (0x1ul << SDH_INTEN_DITOIEN_Pos)                  /*!< SDH_T::INTEN: DITOIEN Mask             */
480 
481 #define SDH_INTEN_WKIEN_Pos              (14)                                              /*!< SDH_T::INTEN: WKIEN Position           */
482 #define SDH_INTEN_WKIEN_Msk              (0x1ul << SDH_INTEN_WKIEN_Pos)                    /*!< SDH_T::INTEN: WKIEN Mask               */
483 
484 #define SDH_INTEN_CDSRC_Pos              (30)                                              /*!< SDH_T::INTEN: CDSRC Position          */
485 #define SDH_INTEN_CDSRC_Msk              (0x1ul << SDH_INTEN_CDSRC_Pos)                    /*!< SDH_T::INTEN: CDSRC Mask              */
486 
487 #define SDH_INTSTS_BLKDIF_Pos            (0)                                               /*!< SDH_T::INTSTS: BLKDIF Position         */
488 #define SDH_INTSTS_BLKDIF_Msk            (0x1ul << SDH_INTSTS_BLKDIF_Pos)                  /*!< SDH_T::INTSTS: BLKDIF Mask             */
489 
490 #define SDH_INTSTS_CRCIF_Pos             (1)                                               /*!< SDH_T::INTSTS: CRCIF Position          */
491 #define SDH_INTSTS_CRCIF_Msk             (0x1ul << SDH_INTSTS_CRCIF_Pos)                   /*!< SDH_T::INTSTS: CRCIF Mask              */
492 
493 #define SDH_INTSTS_CRC7_Pos              (2)                                               /*!< SDH_T::INTSTS: CRC7 Position           */
494 #define SDH_INTSTS_CRC7_Msk              (0x1ul << SDH_INTSTS_CRC7_Pos)                    /*!< SDH_T::INTSTS: CRC7 Mask               */
495 
496 #define SDH_INTSTS_CRC16_Pos             (3)                                               /*!< SDH_T::INTSTS: CRC16 Position          */
497 #define SDH_INTSTS_CRC16_Msk             (0x1ul << SDH_INTSTS_CRC16_Pos)                   /*!< SDH_T::INTSTS: CRC16 Mask              */
498 
499 #define SDH_INTSTS_CRCSTS_Pos            (4)                                               /*!< SDH_T::INTSTS: CRCSTS Position         */
500 #define SDH_INTSTS_CRCSTS_Msk            (0x7ul << SDH_INTSTS_CRCSTS_Pos)                  /*!< SDH_T::INTSTS: CRCSTS Mask             */
501 
502 #define SDH_INTSTS_DAT0STS_Pos           (7)                                               /*!< SDH_T::INTSTS: DAT0STS Position        */
503 #define SDH_INTSTS_DAT0STS_Msk           (0x1ul << SDH_INTSTS_DAT0STS_Pos)                 /*!< SDH_T::INTSTS: DAT0STS Mask            */
504 
505 #define SDH_INTSTS_CDIF_Pos              (8)                                               /*!< SDH_T::INTSTS: CDIF Position          */
506 #define SDH_INTSTS_CDIF_Msk              (0x1ul << SDH_INTSTS_CDIF_Pos)                    /*!< SDH_T::INTSTS: CDIF Mask              */
507 
508 #define SDH_INTSTS_RTOIF_Pos             (12)                                              /*!< SDH_T::INTSTS: RTOIF Position          */
509 #define SDH_INTSTS_RTOIF_Msk             (0x1ul << SDH_INTSTS_RTOIF_Pos)                   /*!< SDH_T::INTSTS: RTOIF Mask              */
510 
511 #define SDH_INTSTS_DITOIF_Pos            (13)                                              /*!< SDH_T::INTSTS: DITOIF Position         */
512 #define SDH_INTSTS_DITOIF_Msk            (0x1ul << SDH_INTSTS_DITOIF_Pos)                  /*!< SDH_T::INTSTS: DITOIF Mask             */
513 
514 #define SDH_INTSTS_CDSTS_Pos             (16)                                              /*!< SDH_T::INTSTS: CDSTS Position         */
515 #define SDH_INTSTS_CDSTS_Msk             (0x1ul << SDH_INTSTS_CDSTS_Pos)                   /*!< SDH_T::INTSTS: CDSTS Mask             */
516 
517 #define SDH_INTSTS_DAT1STS_Pos           (18)                                              /*!< SDH_T::INTSTS: DAT1STS Position        */
518 #define SDH_INTSTS_DAT1STS_Msk           (0x1ul << SDH_INTSTS_DAT1STS_Pos)                 /*!< SDH_T::INTSTS: DAT1STS Mask            */
519 
520 #define SDH_RESP0_RESPTK0_Pos            (0)                                               /*!< SDH_T::RESP0: RESPTK0 Position         */
521 #define SDH_RESP0_RESPTK0_Msk            (0xfffffffful << SDH_RESP0_RESPTK0_Pos)           /*!< SDH_T::RESP0: RESPTK0 Mask             */
522 
523 #define SDH_RESP1_RESPTK1_Pos            (0)                                               /*!< SDH_T::RESP1: RESPTK1 Position         */
524 #define SDH_RESP1_RESPTK1_Msk            (0xfful << SDH_RESP1_RESPTK1_Pos)                 /*!< SDH_T::RESP1: RESPTK1 Mask             */
525 
526 #define SDH_BLEN_BLKLEN_Pos              (0)                                               /*!< SDH_T::BLEN: BLKLEN Position           */
527 #define SDH_BLEN_BLKLEN_Msk              (0x7fful << SDH_BLEN_BLKLEN_Pos)                  /*!< SDH_T::BLEN: BLKLEN Mask               */
528 
529 #define SDH_TOUT_TOUT_Pos                (0)                                               /*!< SDH_T::TOUT: TOUT Position             */
530 #define SDH_TOUT_TOUT_Msk                (0xfffffful << SDH_TOUT_TOUT_Pos)                 /*!< SDH_T::TOUT: TOUT Mask                 */
531 
532 /**@}*/ /* SDH_CONST */
533 /**@}*/ /* end of SDH register group */
534 /**@}*/ /* end of REGISTER group */
535 
536 #if defined ( __CC_ARM   )
537 #pragma no_anon_unions
538 #endif
539 
540 #endif /* __SDH_REG_H__ */
541 
542