| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
CHIP: LPC18xx/43xx SD/SDIO driver
LPC18xx/43xx chip specific drivers

## Detailed Description

## Macros
#define | US_TIMEOUT 1000000
| Setup options for the SDIO driver.
#define | MS_ACQUIRE_DELAY (10)
#define | INIT_OP_RETRIES 50
#define | SET_OP_RETRIES 1000
#define | SDIO_BUS_WIDTH 4
#define | SD_MMC_ENUM_CLOCK 400000
#define | MMC_MAX_CLOCK 20000000
#define | MMC_LOW_BUS_MAX_CLOCK 26000000
#define | MMC_HIGH_BUS_MAX_CLOCK 52000000
#define | SD_MAX_CLOCK 25000000

## Functions
STATIC INLINE int32_t | Chip_SDIF_CardNDetect (LPC_SDMMC_T *pSDMMC)
| Detect if an SD card is inserted.
STATIC INLINE int32_t | Chip_SDIF_CardWpOn (LPC_SDMMC_T *pSDMMC)
| Detect if write protect is enabled.
void | Chip_SDIF_Init (LPC_SDMMC_T *pSDMMC)
| Initializes the SD/MMC card controller.
void | Chip_SDIF_DeInit (LPC_SDMMC_T *pSDMMC)
| Shutdown the SD/MMC card controller.
STATIC INLINE void | Chip_SDIF_PowerOff (LPC_SDMMC_T *pSDMMC)
| Disable slot power.
STATIC INLINE void | Chip_SDIF_PowerOn (LPC_SDMMC_T *pSDMMC)
| Enable slot power.
STATIC INLINE void | Chip_SDIF_SetIntMask (LPC_SDMMC_T *pSDMMC, uint32_t iVal)
| Sets the SD interface interrupt mask.
uint32_t | Chip_SDIF_GetIntStatus (LPC_SDMMC_T *pSDMMC)
| Returns the current SD status, clears pending ints, and disables all ints.

## Macro Definition Documentation

#define INIT_OP_RETRIES 50

initial OP_COND retries

Definition at line 48 of file sdif_18xx_43xx.h.

#define MMC_HIGH_BUS_MAX_CLOCK 52000000

Type 1 MMC card max clock rate

Definition at line 54 of file sdif_18xx_43xx.h.

#define MMC_LOW_BUS_MAX_CLOCK 26000000

Type 0 MMC card max clock rate

Definition at line 53 of file sdif_18xx_43xx.h.

#define MMC_MAX_CLOCK 20000000

Max MMC clock rate

Definition at line 52 of file sdif_18xx_43xx.h.

#define MS_ACQUIRE_DELAY (10)

inter-command acquire oper condition delay in msec

Definition at line 47 of file sdif_18xx_43xx.h.

#define SD_MAX_CLOCK 25000000

Max SD clock rate

Definition at line 55 of file sdif_18xx_43xx.h.

#define SD_MMC_ENUM_CLOCK 400000

Typical enumeration clock rate

Definition at line 51 of file sdif_18xx_43xx.h.

#define SDIO_BUS_WIDTH 4

Max bus width supported

Definition at line 50 of file sdif_18xx_43xx.h.

#define SET_OP_RETRIES 1000

set OP_COND retries

Definition at line 49 of file sdif_18xx_43xx.h.

#define US_TIMEOUT 1000000

Setup options for the SDIO driver.

give 1 atleast 1 sec for the card to respond

Definition at line 46 of file sdif_18xx_43xx.h.

## Function Documentation

STATIC INLINE int32_t Chip_SDIF_CardNDetect | ( | LPC_SDMMC_T * | pSDMMC | ) |

Detect if an SD card is inserted.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  Returns 0 if a card is detected, otherwise 1

Note
  Detect if an SD card is inserted (uses SD_CD pin, returns 0 on card detect)

Definition at line 64 of file sdif_18xx_43xx.h.

STATIC INLINE int32_t Chip_SDIF_CardWpOn | ( | LPC_SDMMC_T * | pSDMMC | ) |

Detect if write protect is enabled.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  Returns 1 if card is write protected, otherwise 0

Note
  Detect if write protect is enabled (uses SD_WP pin, returns 1 if card is write protected)

Definition at line 76 of file sdif_18xx_43xx.h.

void Chip_SDIF_DeInit | ( | LPC_SDMMC_T * | pSDMMC | ) |

Shutdown the SD/MMC card controller.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  None

Definition at line 59 of file sdif_18xx_43xx.c.

uint32_t Chip_SDIF_GetIntStatus | ( | LPC_SDMMC_T * | pSDMMC | ) |

Returns the current SD status, clears pending ints, and disables all ints.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  Current pending interrupt status of Or'ed values MCI_INT_*

Definition at line 66 of file sdif_18xx_43xx.c.

void Chip_SDIF_Init | ( | LPC_SDMMC_T * | pSDMMC | ) |

Initializes the SD/MMC card controller.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  None

Definition at line 52 of file sdif_18xx_43xx.c.

STATIC INLINE void Chip_SDIF_PowerOff | ( | LPC_SDMMC_T * | pSDMMC | ) |

Disable slot power.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  None

Note
  Uses SD_POW pin, set to low.

Definition at line 101 of file sdif_18xx_43xx.h.

STATIC INLINE void Chip_SDIF_PowerOn | ( | LPC_SDMMC_T * | pSDMMC | ) |

Enable slot power.

Parameters

  pSDMMC | : SDMMC peripheral selected

Returns
  None

Note
  Uses SD_POW pin, set to high.

Definition at line 112 of file sdif_18xx_43xx.h.

STATIC INLINE void Chip_SDIF_SetIntMask | ( | LPC_SDMMC_T * | pSDMMC,
|  | uint32_t | iVal
| ) |  |

Sets the SD interface interrupt mask.

Parameters

  pSDMMC | : SDMMC peripheral selected
  iVal | : Interrupts to enable, Or'ed values MCI_INT_*

Returns
  None

Definition at line 123 of file sdif_18xx_43xx.h.