1 /******************************************************************************
3 * Copyright (C) 2013 - 2015 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
37 * This header file contains the identifiers and basic HW access driver
38 * functions (or macros) that can be used to access the device. Other driver
39 * functions are defined in xsdps.h.
42 * MODIFICATION HISTORY:
44 * Ver Who Date Changes
45 * ----- --- -------- -----------------------------------------------
46 * 1.00a hk/sg 10/17/13 Initial release
50 ******************************************************************************/
59 /***************************** Include Files *********************************/
61 #include "xil_types.h"
62 #include "xil_assert.h"
64 #include "xparameters.h"
66 /************************** Constant Definitions *****************************/
68 /** @name Register Map
70 * Register offsets from the base address of an SD device.
74 #define XSDPS_SDMA_SYS_ADDR_OFFSET 0x00 /**< SDMA System Address
76 #define XSDPS_BLK_SIZE_OFFSET 0x04 /**< Block Size Register */
77 #define XSDPS_BLK_CNT_OFFSET 0x06 /**< Block Count Register */
78 #define XSDPS_ARGMT_OFFSET 0x08 /**< Argument Register */
79 #define XSDPS_XFER_MODE_OFFSET 0x0C /**< Transfer Mode Register */
80 #define XSDPS_CMD_OFFSET 0x0E /**< Command Register */
81 #define XSDPS_RESP0_OFFSET 0x10 /**< Response0 Register */
82 #define XSDPS_RESP1_OFFSET 0x14 /**< Response1 Register */
83 #define XSDPS_RESP2_OFFSET 0x18 /**< Response2 Register */
84 #define XSDPS_RESP3_OFFSET 0x1C /**< Response3 Register */
85 #define XSDPS_BUF_DAT_PORT_OFFSET 0x20 /**< Buffer Data Port */
86 #define XSDPS_PRES_STATE_OFFSET 0x24 /**< Present State */
87 #define XSDPS_HOST_CTRL1_OFFSET 0x28 /**< Host Control 1 */
88 #define XSDPS_POWER_CTRL_OFFSET 0x29 /**< Power Control */
89 #define XSDPS_BLK_GAP_CTRL_OFFSET 0x2A /**< Block Gap Control */
90 #define XSDPS_WAKE_UP_CTRL_OFFSET 0x2B /**< Wake Up Control */
91 #define XSDPS_CLK_CTRL_OFFSET 0x2C /**< Clock Control */
92 #define XSDPS_TIMEOUT_CTRL_OFFSET 0x2E /**< Timeout Control */
93 #define XSDPS_SW_RST_OFFSET 0x2F /**< Software Reset */
94 #define XSDPS_NORM_INTR_STS_OFFSET 0x30 /**< Normal Interrupt
96 #define XSDPS_ERR_INTR_STS_OFFSET 0x32 /**< Error Interrupt
98 #define XSDPS_NORM_INTR_STS_EN_OFFSET 0x34 /**< Normal Interrupt
99 Status Enable Register */
100 #define XSDPS_ERR_INTR_STS_EN_OFFSET 0x36 /**< Error Interrupt
101 Status Enable Register */
102 #define XSDPS_NORM_INTR_SIG_EN_OFFSET 0x38 /**< Normal Interrupt
103 Signal Enable Register */
104 #define XSDPS_ERR_INTR_SIG_EN_OFFSET 0x3A /**< Error Interrupt
105 Signal Enable Register */
107 #define XSDPS_AUTO_CMD12_ERR_STS_OFFSET 0x3C /**< Auto CMD12 Error Status
109 #define XSDPS_HOST_CTRL2_OFFSET 0x3E /**< Host Control2 Register */
110 #define XSDPS_CAPS_OFFSET 0x40 /**< Capabilities Register */
111 #define XSDPS_CAPS_EXT_OFFSET 0x44 /**< Capabilities Extended */
112 #define XSDPS_MAX_CURR_CAPS_OFFSET 0x48 /**< Maximum Current
113 Capabilities Register */
114 #define XSDPS_MAX_CURR_CAPS_EXT_OFFSET 0x4C /**< Maximum Current
115 Capabilities Ext Register */
116 #define XSDPS_FE_ERR_INT_STS_OFFSET 0x52 /**< Force Event for
117 Error Interrupt Status */
118 #define XSDPS_FE_AUTO_CMD12_EIS_OFFSET 0x50 /**< Auto CM12 Error Interrupt
120 #define XSDPS_ADMA_ERR_STS_OFFSET 0x54 /**< ADMA Error Status
122 #define XSDPS_ADMA_SAR_OFFSET 0x58 /**< ADMA System Address
124 #define XSDPS_ADMA_SAR_EXT_OFFSET 0x5C /**< ADMA System Address
126 #define XSDPS_PRE_VAL_1_OFFSET 0x60 /**< Preset Value Register */
127 #define XSDPS_PRE_VAL_2_OFFSET 0x64 /**< Preset Value Register */
128 #define XSDPS_PRE_VAL_3_OFFSET 0x68 /**< Preset Value Register */
129 #define XSDPS_PRE_VAL_4_OFFSET 0x6C /**< Preset Value Register */
130 #define XSDPS_SHARED_BUS_CTRL_OFFSET 0xE0 /**< Shared Bus Control
132 #define XSDPS_SLOT_INTR_STS_OFFSET 0xFC /**< Slot Interrupt Status
134 #define XSDPS_HOST_CTRL_VER_OFFSET 0xFE /**< Host Controller Version
139 /** @name Control Register - Host control, Power control,
140 * Block Gap control and Wakeup control
142 * This register contains bits for various configuration options of
143 * the SD host controller. Read/Write apart from the reserved bits.
147 #define XSDPS_HC_LED_MASK 0x00000001 /**< LED Control */
148 #define XSDPS_HC_WIDTH_MASK 0x00000002 /**< Bus width */
149 #define XSDPS_HC_SPEED_MASK 0x00000004 /**< High Speed */
150 #define XSDPS_HC_DMA_MASK 0x00000018 /**< DMA Mode Select */
151 #define XSDPS_HC_DMA_SDMA_MASK 0x00000000 /**< SDMA Mode */
152 #define XSDPS_HC_DMA_ADMA1_MASK 0x00000008 /**< ADMA1 Mode */
153 #define XSDPS_HC_DMA_ADMA2_32_MASK 0x00000010 /**< ADMA2 Mode - 32 bit */
154 #define XSDPS_HC_DMA_ADMA2_64_MASK 0x00000018 /**< ADMA2 Mode - 64 bit */
155 #define XSDPS_HC_EXT_BUS_WIDTH 0x00000020 /**< Bus width - 8 bit */
156 #define XSDPS_HC_CARD_DET_TL_MASK 0x00000040 /**< Card Detect Tst Lvl */
157 #define XSDPS_HC_CARD_DET_SD_MASK 0x00000080 /**< Card Detect Sig Det */
159 #define XSDPS_PC_BUS_PWR_MASK 0x00000001 /**< Bus Power Control */
160 #define XSDPS_PC_BUS_VSEL_MASK 0x0000000E /**< Bus Voltage Select */
161 #define XSDPS_PC_BUS_VSEL_3V3_MASK 0x0000000E /**< Bus Voltage 3.3V */
162 #define XSDPS_PC_BUS_VSEL_3V0_MASK 0x0000000C /**< Bus Voltage 3.0V */
163 #define XSDPS_PC_BUS_VSEL_1V8_MASK 0x0000000A /**< Bus Voltage 1.8V */
165 #define XSDPS_BGC_STP_REQ_MASK 0x00000001 /**< Block Gap Stop Req */
166 #define XSDPS_BGC_CNT_REQ_MASK 0x00000002 /**< Block Gap Cont Req */
167 #define XSDPS_BGC_RWC_MASK 0x00000004 /**< Block Gap Rd Wait */
168 #define XSDPS_BGC_INTR_MASK 0x00000008 /**< Block Gap Intr */
169 #define XSDPS_BGC_SPI_MODE_MASK 0x00000010 /**< Block Gap SPI Mode */
170 #define XSDPS_BGC_BOOT_EN_MASK 0x00000020 /**< Block Gap Boot Enb */
171 #define XSDPS_BGC_ALT_BOOT_EN_MASK 0x00000040 /**< Block Gap Alt BootEn */
172 #define XSDPS_BGC_BOOT_ACK_MASK 0x00000080 /**< Block Gap Boot Ack */
174 #define XSDPS_WC_WUP_ON_INTR_MASK 0x00000001 /**< Wakeup Card Intr */
175 #define XSDPS_WC_WUP_ON_INSRT_MASK 0x00000002 /**< Wakeup Card Insert */
176 #define XSDPS_WC_WUP_ON_REM_MASK 0x00000004 /**< Wakeup Card Removal */
180 /** @name Control Register - Clock control, Timeout control & Software reset
182 * This register contains bits for configuration options of clock, timeout and
184 * Read/Write except for Inter_Clock_Stable bit (read only) and reserved bits.
188 #define XSDPS_CC_INT_CLK_EN_MASK 0x00000001
189 #define XSDPS_CC_INT_CLK_STABLE_MASK 0x00000002
190 #define XSDPS_CC_SD_CLK_EN_MASK 0x00000004
191 #define XSDPS_CC_SD_CLK_GEN_SEL_MASK 0x00000020
192 #define XSDPS_CC_SDCLK_FREQ_SEL_EXT_MASK 0x000000C0
193 #define XSDPS_CC_SDCLK_FREQ_SEL_MASK 0x0000FF00
194 #define XSDPS_CC_SDCLK_FREQ_D256_MASK 0x00008000
195 #define XSDPS_CC_SDCLK_FREQ_D128_MASK 0x00004000
196 #define XSDPS_CC_SDCLK_FREQ_D64_MASK 0x00002000
197 #define XSDPS_CC_SDCLK_FREQ_D32_MASK 0x00001000
198 #define XSDPS_CC_SDCLK_FREQ_D16_MASK 0x00000800
199 #define XSDPS_CC_SDCLK_FREQ_D8_MASK 0x00000400
200 #define XSDPS_CC_SDCLK_FREQ_D4_MASK 0x00000200
201 #define XSDPS_CC_SDCLK_FREQ_D2_MASK 0x00000100
202 #define XSDPS_CC_SDCLK_FREQ_BASE_MASK 0x00000000
204 #define XSDPS_TC_CNTR_VAL_MASK 0x0000000F
206 #define XSDPS_SWRST_ALL_MASK 0x00000001
207 #define XSDPS_SWRST_CMD_LINE_MASK 0x00000002
208 #define XSDPS_SWRST_DAT_LINE_MASK 0x00000004
210 #define XSDPS_CC_MAX_NUM_OF_DIV 9
211 #define XSDPS_CC_DIV_SHIFT 8
215 /** @name SD Interrupt Registers
217 * <b> Normal and Error Interrupt Status Register </b>
218 * This register shows the normal and error interrupt status.
219 * Status enable register affects reads of this register.
220 * If Signal enable register is set and the corresponding status bit is set,
221 * interrupt is generated.
222 * Write to clear except
223 * Error_interrupt and Card_Interrupt bits - Read only
225 * <b> Normal and Error Interrupt Status Enable Register </b>
226 * Setting this register bits enables Interrupt status.
227 * Read/Write except Fixed_to_0 bit (Read only)
229 * <b> Normal and Error Interrupt Signal Enable Register </b>
230 * This register is used to select which interrupt status is
231 * indicated to the Host System as the interrupt.
232 * Read/Write except Fixed_to_0 bit (Read only)
234 * All three registers have same bit definitions
238 #define XSDPS_INTR_CC_MASK 0x00000001 /**< Command Complete */
239 #define XSDPS_INTR_TC_MASK 0x00000002 /**< Transfer Complete */
240 #define XSDPS_INTR_BGE_MASK 0x00000004 /**< Block Gap Event */
241 #define XSDPS_INTR_DMA_MASK 0x00000008 /**< DMA Interrupt */
242 #define XSDPS_INTR_BWR_MASK 0x00000010 /**< Buffer Write Ready */
243 #define XSDPS_INTR_BRR_MASK 0x00000020 /**< Buffer Read Ready */
244 #define XSDPS_INTR_CARD_INSRT_MASK 0x00000040 /**< Card Insert */
245 #define XSDPS_INTR_CARD_REM_MASK 0x00000080 /**< Card Remove */
246 #define XSDPS_INTR_CARD_MASK 0x00000100 /**< Card Interrupt */
247 #define XSDPS_INTR_INT_A_MASK 0x00000200 /**< INT A Interrupt */
248 #define XSDPS_INTR_INT_B_MASK 0x00000400 /**< INT B Interrupt */
249 #define XSDPS_INTR_INT_C_MASK 0x00000800 /**< INT C Interrupt */
250 #define XSDPS_INTR_RE_TUNING_MASK 0x00001000 /**< Re-Tuning Interrupt */
251 #define XSDPS_INTR_BOOT_TERM_MASK 0x00002000 /**< Boot Terminate
253 #define XSDPS_INTR_BOOT_ACK_RECV_MASK 0x00004000 /**< Boot Ack Recv
255 #define XSDPS_INTR_ERR_MASK 0x00008000 /**< Error Interrupt */
256 #define XSDPS_NORM_INTR_ALL_MASK 0x0000FFFF
258 #define XSDPS_INTR_ERR_CT_MASK 0x00000001 /**< Command Timeout
260 #define XSDPS_INTR_ERR_CCRC_MASK 0x00000002 /**< Command CRC Error */
261 #define XSDPS_INTR_ERR_CEB_MASK 0x00000004 /**< Command End Bit
263 #define XSDPS_INTR_ERR_CI_MASK 0x00000008 /**< Command Index Error */
264 #define XSDPS_INTR_ERR_DT_MASK 0x00000010 /**< Data Timeout Error */
265 #define XSDPS_INTR_ERR_DCRC_MASK 0x00000020 /**< Data CRC Error */
266 #define XSDPS_INTR_ERR_DEB_MASK 0x00000040 /**< Data End Bit Error */
267 #define XSDPS_INTR_ERR_I_LMT_MASK 0x00000080 /**< Current Limit Error */
268 #define XSDPS_INTR_ERR_AUTO_CMD12_MASK 0x00000100 /**< Auto CMD12 Error */
269 #define XSDPS_INTR_ERR_ADMA_MASK 0x00000200 /**< ADMA Error */
270 #define XSDPS_INTR_ERR_TR_MASK 0x00001000 /**< Tuning Error */
271 #define XSDPS_INTR_VEND_SPF_ERR_MASK 0x0000E000 /**< Vendor Specific
273 #define XSDPS_ERROR_INTR_ALL_MASK 0x0000F3FF /**< Mask for error bits */
276 /** @name Block Size and Block Count Register
278 * This register contains the block count for current transfer,
279 * block size and SDMA buffer size.
280 * Read/Write except for reserved bits.
284 #define XSDPS_BLK_SIZE_MASK 0x00000FFF /**< Transfer Block Size */
285 #define XSDPS_SDMA_BUFF_SIZE_MASK 0x00007000 /**< Host SDMA Buffer Size */
286 #define XSDPS_BLK_CNT_MASK 0x0000FFFF /**< Block Count for
291 /** @name Transfer Mode and Command Register
293 * The Transfer Mode register is used to control the data transfers and
294 * Command register is used for command generation
295 * Read/Write except for reserved bits.
299 #define XSDPS_TM_DMA_EN_MASK 0x00000001 /**< DMA Enable */
300 #define XSDPS_TM_BLK_CNT_EN_MASK 0x00000002 /**< Block Count Enable */
301 #define XSDPS_TM_AUTO_CMD12_EN_MASK 0x00000004 /**< Auto CMD12 Enable */
302 #define XSDPS_TM_DAT_DIR_SEL_MASK 0x00000010 /**< Data Transfer
304 #define XSDPS_TM_MUL_SIN_BLK_SEL_MASK 0x00000020 /**< Multi/Single
307 #define XSDPS_CMD_RESP_SEL_MASK 0x00000003 /**< Response Type
309 #define XSDPS_CMD_RESP_NONE_MASK 0x00000000 /**< No Response */
310 #define XSDPS_CMD_RESP_L136_MASK 0x00000001 /**< Response length 138 */
311 #define XSDPS_CMD_RESP_L48_MASK 0x00000002 /**< Response length 48 */
312 #define XSDPS_CMD_RESP_L48_BSY_CHK_MASK 0x00000003 /**< Response length 48 &
315 #define XSDPS_CMD_CRC_CHK_EN_MASK 0x00000008 /**< Command CRC Check
317 #define XSDPS_CMD_INX_CHK_EN_MASK 0x00000010 /**< Command Index Check
319 #define XSDPS_DAT_PRESENT_SEL_MASK 0x00000020 /**< Data Present Select */
320 #define XSDPS_CMD_TYPE_MASK 0x000000C0 /**< Command Type */
321 #define XSDPS_CMD_TYPE_NORM_MASK 0x00000000 /**< CMD Type - Normal */
322 #define XSDPS_CMD_TYPE_SUSPEND_MASK 0x00000040 /**< CMD Type - Suspend */
323 #define XSDPS_CMD_TYPE_RESUME_MASK 0x00000080 /**< CMD Type - Resume */
324 #define XSDPS_CMD_TYPE_ABORT_MASK 0x000000C0 /**< CMD Type - Abort */
325 #define XSDPS_CMD_MASK 0x00003F00 /**< Command Index Mask -
331 /** @name Capabilities Register
333 * Capabilities register is a read only register which contains
334 * information about the host controller.
335 * Sufficient if read once after power on.
339 #define XSDPS_CAP_TOUT_CLK_FREQ_MASK 0x0000003F /**< Timeout clock freq
341 #define XSDPS_CAP_TOUT_CLK_UNIT_MASK 0x00000080 /**< Timeout clock unit -
343 #define XSDPS_CAP_MAX_BLK_LEN_MASK 0x00030000 /**< Max block length */
344 #define XSDPS_CAP_MAX_BLK_LEN_512B_MASK 0x00000000 /**< Max block 512 bytes */
345 #define XSDPS_CAP_EXT_MEDIA_BUS_MASK 0x00040000 /**< Extended media bus */
346 #define XSDPS_CAP_ADMA2_MASK 0x00080000 /**< ADMA2 support */
347 #define XSDPS_CAP_HIGH_SPEED_MASK 0x00200000 /**< High speed support */
348 #define XSDPS_CAP_SDMA_MASK 0x00400000 /**< SDMA support */
349 #define XSDPS_CAP_SUSP_RESUME_MASK 0x00800000 /**< Suspend/Resume
351 #define XSDPS_CAP_VOLT_3V3_MASK 0x01000000 /**< 3.3V support */
352 #define XSDPS_CAP_VOLT_3V0_MASK 0x02000000 /**< 3.0V support */
353 #define XSDPS_CAP_VOLT_1V8_MASK 0x04000000 /**< 1.8V support */
354 #define XSDPS_CAP_INTR_MODE_MASK 0x08000000 /**< Interrupt mode
356 #define XSDPS_CAP_SYS_BUS_64_MASK 0x10000000 /**< 64 bit system bus
358 #define XSDPS_CAP_SPI_MODE_MASK 0x20000000 /**< SPI mode */
359 #define XSDPS_CAP_SPI_BLOCK_MODE_MASK 0x20000000 /**< SPI block mode */
362 /** @name Present State Register
364 * Gives the current status of the host controller
369 #define XSDPS_PSR_INHIBIT_CMD_MASK 0x00000001 /**< Command inhibit - CMD */
370 #define XSDPS_PSR_INHIBIT_DAT_MASK 0x00000002 /**< Command Inhibit - DAT */
371 #define XSDPS_PSR_DAT_ACTIVE_MASK 0x00000004 /**< DAT line active */
372 #define XSDPS_PSR_WR_ACTIVE_MASK 0x00000100 /**< Write transfer active */
373 #define XSDPS_PSR_RD_ACTIVE_MASK 0x00000200 /**< Read transfer active */
374 #define XSDPS_PSR_BUFF_WR_EN_MASK 0x00000400 /**< Buffer write enable */
375 #define XSDPS_PSR_BUFF_RD_EN_MASK 0x00000800 /**< Buffer read enable */
376 #define XSDPS_PSR_CARD_INSRT_MASK 0x00010000 /**< Card inserted */
377 #define XSDPS_PSR_CARD_STABLE_MASK 0x00020000 /**< Card state stable */
378 #define XSDPS_PSR_CARD_DPL_MASK 0x00040000 /**< Card detect pin level */
379 #define XSDPS_PSR_WPS_PL_MASK 0x00080000 /**< Write protect switch
384 /** @name Block size mask for 512 bytes
386 * Block size mask for 512 bytes - This is the default block size.
390 #define XSDPS_BLK_SIZE_512_MASK 0x200
396 * Constant definitions for commands and response related to SD
400 #define XSDPS_APP_CMD_PREFIX 0x8000
408 #define ACMD6 (XSDPS_APP_CMD_PREFIX + 0x0600)
414 #define ACMD13 (XSDPS_APP_CMD_PREFIX + 0x0D00)
419 #define ACMD23 (XSDPS_APP_CMD_PREFIX + 0x1700)
423 #define ACMD41 (XSDPS_APP_CMD_PREFIX + 0x2900)
424 #define ACMD42 (XSDPS_APP_CMD_PREFIX + 0x2A00)
425 #define ACMD51 (XSDPS_APP_CMD_PREFIX + 0x3300)
430 #define RESP_NONE XSDPS_CMD_RESP_NONE_MASK
431 #define RESP_R1 XSDPS_CMD_RESP_L48_MASK | XSDPS_CMD_CRC_CHK_EN_MASK | \
432 XSDPS_CMD_INX_CHK_EN_MASK
434 #define RESP_R1B XSDPS_CMD_RESP_L48_BSY_CHK_MASK | \
435 XSDPS_CMD_CRC_CHK_EN_MASK | XSDPS_CMD_INX_CHK_EN_MASK
437 #define RESP_R2 XSDPS_CMD_RESP_L136_MASK | XSDPS_CMD_CRC_CHK_EN_MASK
438 #define RESP_R3 XSDPS_CMD_RESP_L48_MASK
440 #define RESP_R6 XSDPS_CMD_RESP_L48_BSY_CHK_MASK | \
441 XSDPS_CMD_CRC_CHK_EN_MASK | XSDPS_CMD_INX_CHK_EN_MASK
445 /** @name ADMA2 Descriptor related definitions
447 * ADMA2 Descriptor related definitions
451 #define XSDPS_DESC_MAX_LENGTH 65536
453 #define XSDPS_DESC_VALID (0x1 << 0)
454 #define XSDPS_DESC_END (0x1 << 1)
455 #define XSDPS_DESC_INT (0x1 << 2)
456 #define XSDPS_DESC_TRAN (0x2 << 4)
460 /**************************** Type Definitions *******************************/
462 /***************** Macros (Inline Functions) Definitions *********************/
464 #define XSdPs_In32 Xil_In32
465 #define XSdPs_Out32 Xil_Out32
467 #define XSdPs_In16 Xil_In16
468 #define XSdPs_Out16 Xil_Out16
470 #define XSdPs_In8 Xil_In8
471 #define XSdPs_Out8 Xil_Out8
473 /****************************************************************************/
477 * @param BaseAddress contains the base address of the device.
478 * @param RegOffset contains the offset from the 1st register of the
479 * device to the target register.
481 * @return The value read from the register.
483 * @note C-Style signature:
484 * u32 XSdPs_ReadReg(u32 BaseAddress. int RegOffset)
486 ******************************************************************************/
487 #define XSdPs_ReadReg(BaseAddress, RegOffset) \
488 XSdPs_In32((BaseAddress) + (RegOffset))
490 /***************************************************************************/
492 * Write to a register.
494 * @param BaseAddress contains the base address of the device.
495 * @param RegOffset contains the offset from the 1st register of the
496 * device to target register.
497 * @param RegisterValue is the value to be written to the register.
501 * @note C-Style signature:
502 * void XSdPs_WriteReg(u32 BaseAddress, int RegOffset,
505 ******************************************************************************/
506 #define XSdPs_WriteReg(BaseAddress, RegOffset, RegisterValue) \
507 XSdPs_Out32((BaseAddress) + (RegOffset), (RegisterValue))
509 /****************************************************************************/
513 * @param BaseAddress contains the base address of the device.
514 * @param RegOffset contains the offset from the 1st register of the
515 * device to the target register.
517 * @return The value read from the register.
519 * @note C-Style signature:
520 * u16 XSdPs_ReadReg(u32 BaseAddress. int RegOffset)
522 ******************************************************************************/
523 #define XSdPs_ReadReg16(BaseAddress, RegOffset) \
524 XSdPs_In16((BaseAddress) + (RegOffset))
526 /***************************************************************************/
528 * Write to a register.
530 * @param BaseAddress contains the base address of the device.
531 * @param RegOffset contains the offset from the 1st register of the
532 * device to target register.
533 * @param RegisterValue is the value to be written to the register.
537 * @note C-Style signature:
538 * void XSdPs_WriteReg(u32 BaseAddress, int RegOffset,
541 ******************************************************************************/
542 #define XSdPs_WriteReg16(BaseAddress, RegOffset, RegisterValue) \
543 XSdPs_Out16((BaseAddress) + (RegOffset), (RegisterValue))
545 /****************************************************************************/
549 * @param BaseAddress contains the base address of the device.
550 * @param RegOffset contains the offset from the 1st register of the
551 * device to the target register.
553 * @return The value read from the register.
555 * @note C-Style signature:
556 * u8 XSdPs_ReadReg(u32 BaseAddress. int RegOffset)
558 ******************************************************************************/
559 #define XSdPs_ReadReg8(BaseAddress, RegOffset) \
560 XSdPs_In8((BaseAddress) + (RegOffset))
562 /***************************************************************************/
564 * Write to a register.
566 * @param BaseAddress contains the base address of the device.
567 * @param RegOffset contains the offset from the 1st register of the
568 * device to target register.
569 * @param RegisterValue is the value to be written to the register.
573 * @note C-Style signature:
574 * void XSdPs_WriteReg(u32 BaseAddress, int RegOffset,
577 ******************************************************************************/
578 #define XSdPs_WriteReg8(BaseAddress, RegOffset, RegisterValue) \
579 XSdPs_Out8((BaseAddress) + (RegOffset), (RegisterValue))
581 /***************************************************************************/
583 * Macro to get present status register
585 * @param BaseAddress contains the base address of the device.
589 * @note C-Style signature:
590 * void XSdPs_WriteReg(u32 BaseAddress, int RegOffset,
593 ******************************************************************************/
594 #define XSdPs_GetPresentStatusReg(BaseAddress) \
595 XSdPs_In32((BaseAddress) + (XSDPS_PRES_STATE_OFFSET))
597 /************************** Function Prototypes ******************************/
599 /************************** Variable Definitions *****************************/
605 #endif /* SD_HW_H_ */