]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/lpc_core/lpc_chip/chip_18xx_43xx/sdif_18xx_43xx.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / lpc_core / lpc_chip / chip_18xx_43xx / sdif_18xx_43xx.h
1 /*\r
2  * @brief LPC18xx/43xx SD/SDIO driver\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6  * All rights reserved.\r
7  *\r
8  * @par\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
22  *\r
23  * @par\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
29  * this code.\r
30  */\r
31 \r
32 #ifndef __SDIF_18XX_43XX_H_\r
33 #define __SDIF_18XX_43XX_H_\r
34 \r
35 #ifdef __cplusplus\r
36 extern "C" {\r
37 #endif\r
38 \r
39 /** @defgroup SDIF_18XX_43XX CHIP: LPC18xx/43xx SD/SDIO driver\r
40  * @ingroup CHIP_18XX_43XX_Drivers\r
41  * @{\r
42  */\r
43 \r
44 /** @brief Setup options for the SDIO driver\r
45  */\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
56 \r
57 /**\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
63  */\r
64 STATIC INLINE int32_t Chip_SDIF_CardNDetect(LPC_SDMMC_T *pSDMMC)\r
65 {\r
66         return IP_SDMMC_CardNDetect(pSDMMC);\r
67 }\r
68 \r
69 /**\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
75  */\r
76 STATIC INLINE int32_t Chip_SDIF_CardWpOn(LPC_SDMMC_T *pSDMMC)\r
77 {\r
78         return IP_SDMMC_CardWpOn(pSDMMC);\r
79 }\r
80 \r
81 /**\r
82  * @brief       Initializes the SD/MMC card controller\r
83  * @param       pSDMMC  : SDMMC peripheral selected\r
84  * @return      None\r
85  */\r
86 void Chip_SDIF_Init(LPC_SDMMC_T *pSDMMC);\r
87 \r
88 /**\r
89  * @brief       Shutdown the SD/MMC card controller\r
90  * @param       pSDMMC  : SDMMC peripheral selected\r
91  * @return      None\r
92  */\r
93 void Chip_SDIF_DeInit(LPC_SDMMC_T *pSDMMC);\r
94 \r
95 /**\r
96  * @brief       Disable slot power\r
97  * @param       pSDMMC  : SDMMC peripheral selected\r
98  * @return      None\r
99  * @note        Uses SD_POW pin, set to low.\r
100  */\r
101 STATIC INLINE void Chip_SDIF_PowerOff(LPC_SDMMC_T *pSDMMC)\r
102 {\r
103         IP_SDMMC_PowerOff(pSDMMC);\r
104 }\r
105 \r
106 /**\r
107  * @brief       Enable slot power\r
108  * @param       pSDMMC  : SDMMC peripheral selected\r
109  * @return      None\r
110  * @note        Uses SD_POW pin, set to high.\r
111  */\r
112 STATIC INLINE void Chip_SDIF_PowerOn(LPC_SDMMC_T *pSDMMC)\r
113 {\r
114         IP_SDMMC_PowerOn(pSDMMC);\r
115 }\r
116 \r
117 /**\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
121  * @return      None\r
122  */\r
123 STATIC INLINE void Chip_SDIF_SetIntMask(LPC_SDMMC_T *pSDMMC, uint32_t iVal)\r
124 {\r
125         IP_SDMMC_SetIntMask(pSDMMC, iVal);\r
126 }\r
127 \r
128 /**\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
132  */\r
133 uint32_t Chip_SDIF_GetIntStatus(LPC_SDMMC_T *pSDMMC);\r
134 \r
135 /**\r
136  * @}\r
137  */\r
138 \r
139 #ifdef __cplusplus\r
140 }\r
141 #endif\r
142 \r
143 #endif /* __SDIF_18XX_43XX_H_ */\r