2 * @brief LPC18xx/43xx SD/SDIO driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __SDIF_18XX_43XX_H_
\r
33 #define __SDIF_18XX_43XX_H_
\r
39 /** @defgroup SDIF_18XX_43XX CHIP: LPC18xx/43xx SD/SDIO driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
44 /** @brief Setup options for the SDIO driver
\r
46 #define US_TIMEOUT 1000000 /*!< give 1 atleast 1 sec for the card to respond */
\r
47 #define MS_ACQUIRE_DELAY (10) /*!< inter-command acquire oper condition delay in msec*/
\r
48 #define INIT_OP_RETRIES 50 /*!< initial OP_COND retries */
\r
49 #define SET_OP_RETRIES 1000 /*!< set OP_COND retries */
\r
50 #define SDIO_BUS_WIDTH 4 /*!< Max bus width supported */
\r
51 #define SD_MMC_ENUM_CLOCK 400000 /*!< Typical enumeration clock rate */
\r
52 #define MMC_MAX_CLOCK 20000000 /*!< Max MMC clock rate */
\r
53 #define MMC_LOW_BUS_MAX_CLOCK 26000000 /*!< Type 0 MMC card max clock rate */
\r
54 #define MMC_HIGH_BUS_MAX_CLOCK 52000000 /*!< Type 1 MMC card max clock rate */
\r
55 #define SD_MAX_CLOCK 25000000 /*!< Max SD clock rate */
\r
58 * @brief Detect if an SD card is inserted
\r
59 * @param pSDMMC : SDMMC peripheral selected
\r
60 * @return Returns 0 if a card is detected, otherwise 1
\r
61 * @note Detect if an SD card is inserted
\r
62 * (uses SD_CD pin, returns 0 on card detect)
\r
64 STATIC INLINE int32_t Chip_SDIF_CardNDetect(LPC_SDMMC_T *pSDMMC)
\r
66 return IP_SDMMC_CardNDetect(pSDMMC);
\r
70 * @brief Detect if write protect is enabled
\r
71 * @param pSDMMC : SDMMC peripheral selected
\r
72 * @return Returns 1 if card is write protected, otherwise 0
\r
73 * @note Detect if write protect is enabled
\r
74 * (uses SD_WP pin, returns 1 if card is write protected)
\r
76 STATIC INLINE int32_t Chip_SDIF_CardWpOn(LPC_SDMMC_T *pSDMMC)
\r
78 return IP_SDMMC_CardWpOn(pSDMMC);
\r
82 * @brief Initializes the SD/MMC card controller
\r
83 * @param pSDMMC : SDMMC peripheral selected
\r
86 void Chip_SDIF_Init(LPC_SDMMC_T *pSDMMC);
\r
89 * @brief Shutdown the SD/MMC card controller
\r
90 * @param pSDMMC : SDMMC peripheral selected
\r
93 void Chip_SDIF_DeInit(LPC_SDMMC_T *pSDMMC);
\r
96 * @brief Disable slot power
\r
97 * @param pSDMMC : SDMMC peripheral selected
\r
99 * @note Uses SD_POW pin, set to low.
\r
101 STATIC INLINE void Chip_SDIF_PowerOff(LPC_SDMMC_T *pSDMMC)
\r
103 IP_SDMMC_PowerOff(pSDMMC);
\r
107 * @brief Enable slot power
\r
108 * @param pSDMMC : SDMMC peripheral selected
\r
110 * @note Uses SD_POW pin, set to high.
\r
112 STATIC INLINE void Chip_SDIF_PowerOn(LPC_SDMMC_T *pSDMMC)
\r
114 IP_SDMMC_PowerOn(pSDMMC);
\r
118 * @brief Sets the SD interface interrupt mask
\r
119 * @param pSDMMC : SDMMC peripheral selected
\r
120 * @param iVal : Interrupts to enable, Or'ed values MCI_INT_*
\r
123 STATIC INLINE void Chip_SDIF_SetIntMask(LPC_SDMMC_T *pSDMMC, uint32_t iVal)
\r
125 IP_SDMMC_SetIntMask(pSDMMC, iVal);
\r
129 * @brief Returns the current SD status, clears pending ints, and disables all ints
\r
130 * @param pSDMMC : SDMMC peripheral selected
\r
131 * @return Current pending interrupt status of Or'ed values MCI_INT_*
\r
133 uint32_t Chip_SDIF_GetIntStatus(LPC_SDMMC_T *pSDMMC);
\r
143 #endif /* __SDIF_18XX_43XX_H_ */
\r