2 * @brief SD Card Interface Registers and control functions
5 * Copyright(C) NXP Semiconductors, 2012
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
35 #include "sys_config.h"
42 /** @defgroup IP_SDC_001 IP: SDC register block and driver
44 * SD/MMC card Interface
49 * @brief SD/MMC card Interface (SDC) register block structure
52 __IO uint32_t POWER; /*!< Power Control register */
53 __IO uint32_t CLOCK; /*!< Clock control regsiter */
54 __IO uint32_t ARGUMENT; /*!< Command argument register */
55 __IO uint32_t COMMAND; /*!< Command register */
56 __I uint32_t RESPCMD; /*!< Command response register */
57 __I uint32_t RESPONSE[4]; /*!< Response registers */
58 __IO uint32_t DATATIMER; /*!< Data timer register */
59 __IO uint32_t DATALENGTH; /*!< Data length register */
60 __IO uint32_t DATACTRL; /*!< Data control register */
61 __I uint32_t DATACNT; /*!< Data count register */
62 __I uint32_t STATUS; /*!< Status register */
63 __O uint32_t CLEAR; /*!< Clear register */
64 __IO uint32_t MASK0; /*!< Mask 0 register */
65 uint32_t RESERVED0[2];
66 __I uint32_t FIFOCNT; /*!< FIFO count register */
67 uint32_t RESERVED1[13];
68 __IO uint32_t FIFO[16]; /*!< FIFO registers */
72 * @brief SDC Power Control Register bit definitions
74 /** SDC Power Control Register Bitmask */
75 #define SDC_PWR_BITMASK ((uint32_t) 0xC3)
76 /** SDC Power Control Bit Mask */
77 #define SDC_PWR_CTRL_BITMASK (((uint32_t) 0x03) << 0)
78 /** SDC Power Control */
79 #define SDC_PWR_CTRL(n) (((uint32_t) (n & 0x03)) << 0)
80 /** SD_CMD Output Control */
81 #define SDC_PWR_OPENDRAIN (((uint32_t) 1) << 6)
83 #define SDC_PWR_ROD (((uint32_t) 1) << 7)
86 * @brief SDC Clock Control Register bit definitions
88 /** SDC Clock Control Register Bitmask */
89 #define SDC_CLOCK_BITMASK ((uint32_t) 0xFFF)
90 /** SDC Clock Divider Bitmask */
91 #define SDC_CLOCK_CLKDIV_BITMASK (((uint32_t) 0xFF ) << 0)
92 /** Set SDC Clock Divide value */
93 #define SDC_CLOCK_CLKDIV(n) (((uint32_t) (n & 0x0FF)) << 0)
96 * @brief SDC Command Register bit definitions
98 /** SDC Command Register Bitmask */
99 #define SDC_COMMAND_BITMASK ((uint32_t) 0x7FF)
100 /** SDC Command Index Bitmask */
101 #define SDC_COMMAND_INDEX_BITMASK ((uint32_t) 0x3F)
102 /** Set SDC Command Index */
103 #define SDC_COMMAND_INDEX(n) ((uint32_t) n & 0x3F)
104 /** No response is expected */
105 #define SDC_COMMAND_NO_RSP (((uint32_t) 0 ) << 6)
106 /** Short response is expected */
107 #define SDC_COMMAND_SHORT_RSP (((uint32_t) 1 ) << 6)
108 /** Long response is expected */
109 #define SDC_COMMAND_LONG_RSP (((uint32_t) 3 ) << 6)
110 /** Response bit mask */
111 #define SDC_COMMAND_RSP_BITMASK (((uint32_t) 3 ) << 6)
112 /** Mark that command timer is disabled and CPSM waits for interrupt request */
113 #define SDC_COMMAND_INTERRUPT (((uint32_t) 1 ) << 8)
114 /** Mark that CPSM waits for CmdPend before starting sending a command*/
115 #define SDC_COMMAND_PENDING (((uint32_t) 1 ) << 9)
117 #define SDC_COMMAND_ENABLE (((uint32_t) 1 ) << 10)
120 * @brief SDC Command Response Register bit definitions
122 /** SDC Command Response value */
123 #define SDC_RESPCOMMAND_VAL(n) ((uint32_t) n & 0x3F)
126 * @brief SDC Data Length Register bit definitions
128 /** SDC Data Length set */
129 #define SDC_DATALENGTH_LEN(n) ((uint32_t) n & 0xFFFF)
132 * @brief SDC Data Control Register bit definitions
134 /** SDC Data Control Register Bitmask */
135 #define SDC_DATACTRL_BITMASK ((uint32_t) 0xFF)
136 /** Enable Data Transfer */
137 #define SDC_DATACTRL_ENABLE (((uint32_t) 1 ) << 0)
138 /** Mark that Data is transfer from card to controller */
139 #define SDC_DATACTRL_DIR_FROMCARD (((uint32_t) 1 ) << 1)
140 /** Mark that Data is transfer from controller to card */
141 #define SDC_DATACTRL_DIR_TOCARD ((uint32_t) 0)
142 /** Mark that the transfer mode is Stream Data Transfer */
143 #define SDC_DATACTRL_XFER_MODE_STREAM (((uint32_t) 1 ) << 2)
144 /** Mark that the transfer mode is Block Data Transfer */
145 #define SDC_DATACTRL_XFER_MODE_BLOCK ((uint32_t) 0)
147 #define SDC_DATACTRL_DMA_ENABLE (((uint32_t) 1 ) << 3)
148 /** Set Data Block size */
149 #define SDC_DATACTRL_BLOCKSIZE(n) (((uint32_t) (n & 0x0F) ) << 4)
150 /** Get Data Block size value */
151 #define SDC_DATACTRL_BLOCKSIZE_VAL(n) (((uint32_t) 1) << n)
154 * @brief SDC Data Counter Register bit definitions
156 #define SDC_DATACNT_VAL(n) ((uint32_t) n & 0xFFFF)
159 * @brief SDC Status Register bit definitions
161 /** Command Response received (CRC check failed) */
162 #define SDC_STATUS_CMDCRCFAIL (((uint32_t) 1 ) << 0)
163 /** Data block sent/received (CRC check failed). */
164 #define SDC_STATUS_DATACRCFAIL (((uint32_t) 1 ) << 1)
165 /** Command response timeout.. */
166 #define SDC_STATUS_CMDTIMEOUT (((uint32_t) 1 ) << 2)
168 #define SDC_STATUS_DATATIMEOUT (((uint32_t) 1 ) << 3)
169 /** Transmit FIFO underrun error. */
170 #define SDC_STATUS_TXUNDERRUN (((uint32_t) 1 ) << 4)
171 /** Receive FIFO overrun error. */
172 #define SDC_STATUS_RXOVERRUN (((uint32_t) 1 ) << 5)
173 /** Command response received (CRC check passed). */
174 #define SDC_STATUS_CMDRESPEND (((uint32_t) 1 ) << 6)
175 /** Command sent (no response required).*/
176 #define SDC_STATUS_CMDSENT (((uint32_t) 1 ) << 7)
177 /** Data end (data counter is zero).*/
178 #define SDC_STATUS_DATAEND (((uint32_t) 1 ) << 8)
179 /** Start bit not detected on all data signals in wide bus mode..*/
180 #define SDC_STATUS_STARTBITERR (((uint32_t) 1 ) << 9)
181 /** Data block sent/received (CRC check passed).*/
182 #define SDC_STATUS_DATABLOCKEND (((uint32_t) 1 ) << 10)
183 /** Command transfer in progress.*/
184 #define SDC_STATUS_CMDACTIVE (((uint32_t) 1 ) << 11)
185 /** Data transmit in progress.*/
186 #define SDC_STATUS_TXACTIVE (((uint32_t) 1 ) << 12)
187 /** Data receive in progress.*/
188 #define SDC_STATUS_RXACTIVE (((uint32_t) 1 ) << 13)
189 /** Transmit FIFO half empty.*/
190 #define SDC_STATUS_TXFIFOHALFEMPTY (((uint32_t) 1 ) << 14)
191 /** Receive FIFO half full.*/
192 #define SDC_STATUS_RXFIFOHALFFULL (((uint32_t) 1 ) << 15)
193 /** Transmit FIFO full.*/
194 #define SDC_STATUS_TXFIFOFULL (((uint32_t) 1 ) << 16)
195 /** Receive FIFO full.*/
196 #define SDC_STATUS_RXFIFOFULL (((uint32_t) 1 ) << 17)
197 /** Transmit FIFO empty.*/
198 #define SDC_STATUS_TXFIFOEMPTY (((uint32_t) 1 ) << 18)
199 /** Receive FIFO empty.*/
200 #define SDC_STATUS_RXFIFOEMPTY (((uint32_t) 1 ) << 19)
201 /** Data available in transmit FIFO.*/
202 #define SDC_STATUS_TXDATAAVLBL (((uint32_t) 1 ) << 20)
203 /** Data available in receive FIFO.*/
204 #define SDC_STATUS_RXDATAAVLBL (((uint32_t) 1 ) << 21)
205 /** Command Error Status */
206 #define SDC_STATUS_CMDERR (SDC_STATUS_CMDCRCFAIL | SDC_STATUS_CMDTIMEOUT | SDC_STATUS_STARTBITERR)
207 /** Data Error Status */
208 #define SDC_STATUS_DATAERR (SDC_STATUS_DATACRCFAIL | SDC_STATUS_DATATIMEOUT | SDC_STATUS_TXUNDERRUN \
209 | SDC_STATUS_RXOVERRUN | SDC_STATUS_STARTBITERR)
211 #define SDC_STATUS_FIFO (SDC_STATUS_TXFIFOHALFEMPTY | SDC_STATUS_RXFIFOHALFFULL \
212 | SDC_STATUS_TXFIFOFULL | SDC_STATUS_RXFIFOFULL \
213 | SDC_STATUS_TXFIFOEMPTY | SDC_STATUS_RXFIFOEMPTY \
214 | SDC_STATUS_DATABLOCKEND)
216 /** Data Transfer Status*/
217 #define SDC_STATUS_DATA (SDC_STATUS_DATAEND )
220 * @brief SDC Clear Register bit definitions
222 /** Clear all status flag*/
223 #define SDC_CLEAR_ALL ((uint32_t) 0x7FF)
224 /** Clears CmdCrcFail flag.*/
225 #define SDC_CLEAR_CMDCRCFAIL (((uint32_t) 1 ) << 0)
226 /** Clears DataCrcFail flag. */
227 #define SDC_CLEAR_DATACRCFAIL (((uint32_t) 1 ) << 1)
228 /** Clears CmdTimeOut flag. */
229 #define SDC_CLEAR_CMDTIMEOUT (((uint32_t) 1 ) << 2)
230 /** Clears DataTimeOut flag. */
231 #define SDC_CLEAR_DATATIMEOUT (((uint32_t) 1 ) << 3)
232 /** Clears TxUnderrun flag. */
233 #define SDC_CLEAR_TXUNDERRUN (((uint32_t) 1 ) << 4)
234 /**Clears RxOverrun flag. */
235 #define SDC_CLEAR_RXOVERRUN (((uint32_t) 1 ) << 5)
236 /** Clears CmdRespEnd flag. */
237 #define SDC_CLEAR_CMDRESPEND (((uint32_t) 1 ) << 6)
238 /** Clears CmdSent flag.*/
239 #define SDC_CLEAR_CMDSENT (((uint32_t) 1 ) << 7)
240 /**Clears DataEnd flag.*/
241 #define SDC_CLEAR_DATAEND (((uint32_t) 1 ) << 8)
242 /** Clears StartBitErr flag.*/
243 #define SDC_CLEAR_STARTBITERR (((uint32_t) 1 ) << 9)
244 /** Clears DataBlockEnd flag.*/
245 #define SDC_CLEAR_DATABLOCKEND (((uint32_t) 1 ) << 10)
248 * @brief SDC Interrupt Mask Register bit definitions
250 /** Mask CmdCrcFail flag.*/
251 #define SDC_MASK0_CMDCRCFAIL (((uint32_t) 1 ) << 0)
252 /** Mask DataCrcFail flag. */
253 #define SDC_MASK0_DATACRCFAIL (((uint32_t) 1 ) << 1)
254 /** Mask CmdTimeOut flag. */
255 #define SDC_MASK0_CMDTIMEOUT (((uint32_t) 1 ) << 2)
256 /** Mask DataTimeOut flag. */
257 #define SDC_MASK0_DATATIMEOUT (((uint32_t) 1 ) << 3)
258 /** Mask TxUnderrun flag. */
259 #define SDC_MASK0_TXUNDERRUN (((uint32_t) 1 ) << 4)
260 /** Mask RxOverrun flag. */
261 #define SDC_MASK0_RXOVERRUN (((uint32_t) 1 ) << 5)
262 /** Mask CmdRespEnd flag. */
263 #define SDC_MASK0_CMDRESPEND (((uint32_t) 1 ) << 6)
264 /** Mask CmdSent flag.*/
265 #define SDC_MASK0_CMDSENT (((uint32_t) 1 ) << 7)
266 /** Mask DataEnd flag.*/
267 #define SDC_MASK0_DATAEND (((uint32_t) 1 ) << 8)
268 /** Mask StartBitErr flag.*/
269 #define SDC_MASK0_STARTBITERR (((uint32_t) 1 ) << 9)
270 /** Mask DataBlockEnd flag.*/
271 #define SDC_MASK0_DATABLOCKEND (((uint32_t) 1 ) << 10)
272 /** Mask CmdActive flag.*/
273 #define SDC_MASK0_CMDACTIVE (((uint32_t) 1 ) << 11)
274 /** Mask TxActive flag.*/
275 #define SDC_MASK0_TXACTIVE (((uint32_t) 1 ) << 12)
276 /** Mask RxActive flag.*/
277 #define SDC_MASK0_RXACTIVE (((uint32_t) 1 ) << 13)
278 /** Mask TxFifoHalfEmpty flag.*/
279 #define SDC_MASK0_TXFIFOHALFEMPTY (((uint32_t) 1 ) << 14)
280 /** Mask RxFifoHalfFull flag.*/
281 #define SDC_MASK0_RXFIFOHALFFULL (((uint32_t) 1 ) << 15)
282 /** Mask TxFifoFull flag.*/
283 #define SDC_MASK0_TXFIFOFULL (((uint32_t) 1 ) << 16)
284 /** Mask RxFifoFull flag.*/
285 #define SDC_MASK0_RXFIFOFULL (((uint32_t) 1 ) << 17)
286 /** Mask TxFifoEmpty flag.*/
287 #define SDC_MASK0_TXFIFOEMPTY (((uint32_t) 1 ) << 18)
288 /** Mask RxFifoEmpty flag.*/
289 #define SDC_MASK0_RXFIFOEMPTY (((uint32_t) 1 ) << 19)
290 /** Mask TxDataAvlbl flag.*/
291 #define SDC_MASK0_TXDATAAVLBL (((uint32_t) 1 ) << 20)
292 /** Mask RxDataAvlbl flag.*/
293 #define SDC_MASK0_RXDATAAVLBL (((uint32_t) 1 ) << 21)
294 /** CMD error interrupt mask */
295 #define SDC_MASK0_CMDERR (SDC_MASK0_CMDCRCFAIL | SDC_MASK0_CMDTIMEOUT | SDC_MASK0_STARTBITERR)
296 /** Data Transmit Error interrupt mask */
297 #define SDC_MASK0_TXDATAERR (SDC_MASK0_DATACRCFAIL | SDC_MASK0_DATATIMEOUT | SDC_MASK0_TXUNDERRUN | \
298 SDC_MASK0_STARTBITERR)
300 /** Data Receive Error interrupt mask */
301 #define SDC_MASK0_RXDATAERR (SDC_MASK0_DATACRCFAIL | SDC_MASK0_DATATIMEOUT | SDC_MASK0_RXOVERRUN | \
302 SDC_MASK0_STARTBITERR)
303 /** TX FIFO interrupt mask*/
304 #define SDC_MASK0_TXFIFO (SDC_MASK0_TXFIFOHALFEMPTY | SDC_MASK0_DATABLOCKEND )
305 /** RX FIFO interrupt mask*/
306 #define SDC_MASK0_RXFIFO (SDC_MASK0_RXFIFOHALFFULL | SDC_MASK0_DATABLOCKEND )
308 /** Data Transfer interrupt mask*/
309 #define SDC_MASK0_DATA (SDC_MASK0_DATAEND | SDC_MASK0_DATABLOCKEND )
312 * @brief SDC FIFO Counter Register bit definitions
314 #define SDC_FIFOCNT_VAL(n) ((uint32_t) n & 0x7FFF)
316 /* The number of bytes used to store card status*/
317 #define SDC_CARDSTATUS_BYTENUM ((uint32_t) 4)
320 * @brief SDC Power Control Options
322 typedef enum IP_SDC_001_PWR_CTRL {
323 SDC_POWER_OFF = 0, /*!< Power-off */
324 SDC_POWER_UP = 2, /*!< Power-up */
325 SDC_POWER_ON = 3, /*!< Power-on */
326 } IP_SDC_001_PWR_CTRL_T;
329 * @brief SDC Clock Control Options
331 typedef enum IP_SDC_001_CLOCK_CTRL {
332 SDC_CLOCK_ENABLE = 8, /*!< Enable SD Card Bus Clock */
333 SDC_CLOCK_POWER_SAVE = 9, /*!< Disable SD_CLK output when bus is idle */
334 SDC_CLOCK_DIVIDER_BYPASS = 10, /*!< Enable bypass of clock divide logic */
335 SDC_CLOCK_WIDEBUS_MODE = 11, /*!< Enable wide bus mode (SD_DAT[3:0] is used instead of SD_DAT[0]) */
336 } IP_SDC_001_CLOCK_CTRL_T;
339 * @brief SDC Response type
341 typedef enum IP_SDC_001_RESPONSE {
342 SDC_NO_RESPONSE = SDC_COMMAND_NO_RSP, /*!< No response */
343 SDC_SHORT_RESPONSE = SDC_COMMAND_SHORT_RSP, /*!< Short response */
344 SDC_LONG_RESPONSE = SDC_COMMAND_LONG_RSP, /*!< Long response */
345 } IP_SDC_001_RESPONSE_T;
348 * @brief SDC Data Transfer Direction definitions
350 typedef enum IP_SDC_001_TRANSFER_DIR {
351 SDC_TRANSFER_DIR_FROMCARD = SDC_DATACTRL_DIR_FROMCARD, /*!< Transfer from card */
352 SDC_TRANSFER_DIR_TOCARD = SDC_DATACTRL_DIR_TOCARD, /*!< Transfer to card */
353 } IP_SDC_001_TRANSFER_DIR_T;
356 * @brief SDC Data Transfer Mode definitions
358 typedef enum IP_SDC_001_TRANSFER_MODE {
359 SDC_TRANSFER_MODE_STREAM = SDC_DATACTRL_XFER_MODE_STREAM, /*!< Stream transfer mode */
360 SDC_TRANSFER_MODE_BLOCK = SDC_DATACTRL_XFER_MODE_BLOCK, /*!< Block transfer mode */
361 } IP_SDC_001_TRANSFER_MODE_T;
364 * @brief SDC Data Block size definitions (in bytes)
366 typedef enum IP_SDC_001_BLOCK_SIZE {
367 SDC_BLOCK_SIZE_1 = 0, /*!< Block size - 1 byte */
368 SDC_BLOCK_SIZE_2, /*!< Block size - 2 bytes */
369 SDC_BLOCK_SIZE_4, /*!< Block size - 4 bytes */
370 SDC_BLOCK_SIZE_8, /*!< Block size - 8 bytes */
371 SDC_BLOCK_SIZE_16, /*!< Block size - 16 bytes */
372 SDC_BLOCK_SIZE_32, /*!< Block size - 32 bytes */
373 SDC_BLOCK_SIZE_64, /*!< Block size - 64 bytes */
374 SDC_BLOCK_SIZE_128, /*!< Block size - 128 bytes */
375 SDC_BLOCK_SIZE_256, /*!< Block size - 256 bytes */
376 SDC_BLOCK_SIZE_512, /*!< Block size - 512 bytes */
377 SDC_BLOCK_SIZE_1024, /*!< Block size - 1024 bytes */
378 SDC_BLOCK_SIZE_2048, /*!< Block size - 2048 bytes */
379 } IP_SDC_001_BLOCK_SIZE_T;
382 * @brief SDC Command Response structure
385 uint8_t CmdIndex; /*!< Command Index of the command response received */
386 uint32_t Data[SDC_CARDSTATUS_BYTENUM]; /* Card Status which can be stored in 1 or 4 bytes */
390 * @brief SDC Data Transfer Setup structure
393 uint16_t BlockNum; /*!< The number of block which will be transfered */
394 IP_SDC_001_BLOCK_SIZE_T BlockSize; /*!< Data Block Length */
395 IP_SDC_001_TRANSFER_DIR_T Dir; /*!< Direction */
396 IP_SDC_001_TRANSFER_MODE_T Mode; /*!< Mode */
397 bool DMAUsed; /*!< true: DMA used */
398 uint32_t Timeout; /*!< Data Transfer timeout periods (in Card Bus Clock)*/
399 } IP_SDC_001_DATA_TRANSFER_T;
402 * @brief Set the power state of SDC peripheral
403 * @param pSDC : Pointer to SDC register block
404 * @param pwrMode : Power mode
405 * @param flag : Output control flag
407 * @note When the external power supply is switched on, the software first enters the power-up
408 * state, and waits until the supply output is stable before moving to the power-on state.
409 * During the power-up state, SD_PWR is set HIGH. The card bus outlets are disabled
410 * during both states.
411 * flag is or-ed bit value of SDC_PWR_OPENDRAIN and SDC_PWR_ROD
413 void IP_SDC_PowerControl(IP_SDC_001_T *pSDC, IP_SDC_001_PWR_CTRL_T pwrMode, uint32_t flag);
416 * @brief Set clock divider value for SDC peripheral
417 * @param pSDC : Pointer to SDC register block
418 * @param div : clock divider
420 * @note While the SD card interface is in identification mode, the SD_CLK frequency must be less
421 * than 400 kHz. The clock frequency can be changed to the maximum card bus frequency
422 * when relative card addresses are assigned to all cards.
423 * SD_CLK frequency = MCLK / [2x(ClkDiv+1)].
425 void IP_SDC_SetClockDiv(IP_SDC_001_T *pSDC, uint8_t div);
428 * @brief Set or Reset clock control of SDC peripheral
429 * @param pSDC : Pointer to SDC register block
430 * @param ctrlType : Clock Control type
431 * @param NewState : New State to set
434 void IP_SDC_ClockControl(IP_SDC_001_T *pSDC, IP_SDC_001_CLOCK_CTRL_T ctrlType,
435 FunctionalState NewState);
438 * @brief Set SDC Command Information
439 * @param pSDC : Pointer to SDC register block
440 * @param Cmd : Command value
441 * @param Arg : Argument for the command
444 void IP_SDC_SetCommand(IP_SDC_001_T *pSDC, uint32_t Cmd, uint32_t Arg);
447 * @brief Reset SDC Command Information
448 * @param pSDC : Pointer to SDC register block
451 void IP_SDC_ResetCommand(IP_SDC_001_T *pSDC);
454 * @brief Get SDC Response
455 * @param pSDC : Pointer to SDC register block
456 * @param pResp : Pointer to buffer storing response data
459 void IP_SDC_GetResp(IP_SDC_001_T *pSDC, IP_SDC_001_RESP_T *pResp);
462 * @brief Set SDC Data Timeout Period
463 * @param pSDC : Pointer to SDC register block
464 * @param timeout : Data timeout value in card bus clock periods
467 STATIC INLINE void IP_SDC_SetDataTimer(IP_SDC_001_T *pSDC, uint32_t timeout)
469 pSDC->DATATIMER = timeout;
473 * @brief Set SDC Data Transfer Information
474 * @param pSDC : Pointer to SDC register block
475 * @param pTransfer : Pointer to Data Transfer structure
478 void IP_SDC_SetDataTransfer(IP_SDC_001_T *pSDC, IP_SDC_001_DATA_TRANSFER_T *pTransfer);
481 * @brief Write Data to FIFO
482 * @param pSDC : Pointer to SDC register block
483 * @param pSrc : Pointer to data buffer
484 * @param bFirstHalf : true (write to the first half of FIFO) false (write to the second half of FIFO)
487 void IP_SDC_WriteFIFO(IP_SDC_001_T *pSDC, uint32_t *pSrc, bool bFirstHalf);
490 * @brief Write Data to FIFO
491 * @param pSDC : Pointer to SDC register block
492 * @param pDst : The buffer hold the data read
493 * @param bFirstHalf : true (read the first half of FIFO) false (read the second half of FIFO)
496 void IP_SDC_ReadFIFO(IP_SDC_001_T *pSDC, uint32_t *pDst, bool bFirstHalf);
499 * @brief Get status of SDC Peripheral
500 * @param pSDC : Pointer to SDC register block
501 * @return Status (Or-ed bit value of SDC_STATUS_*)
503 STATIC INLINE uint32_t IP_SDC_GetStatus(IP_SDC_001_T *pSDC)
509 * @brief Clear status of SDC Peripheral
510 * @param pSDC : Pointer to SDC register block
511 * @param flag : Status flag(s) to be cleared (Or-ed bit value of SDC_CLEAR_*)
514 STATIC INLINE void IP_SDC_ClearStatus(IP_SDC_001_T *pSDC, uint32_t flag)
520 * @brief Set interrupt mask for SDC Peripheral
521 * @param pSDC : Pointer to SDC register block
522 * @param mask : Interrupt mask (Or-ed bit value of SDC_MASK0_*)
525 STATIC INLINE void IP_SDC_SetIntMask(IP_SDC_001_T *pSDC, uint32_t mask)
531 * @brief Initialize the SDC card controller
532 * @param pSDC : Pointer to SDC register block
535 void IP_SDC_Init(IP_SDC_001_T *pSDC);
538 * @brief Deinitialise the SDC peripheral
539 * @param pSDC : Pointer to SDC register block
542 STATIC INLINE void IP_SDC_DeInit(IP_SDC_001_T *pSDC)
544 IP_SDC_PowerControl(pSDC, SDC_POWER_OFF, 0);
555 #endif /* __SDC_001_H_ */