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

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

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
sdmmc_17xx_40xx.c File Reference
`#include "chip.h"`

Go to the source code of this file.

## Macros
#define | CMD_TIMEOUT (0x10000)
#define | DATA_TIMEOUT (0x1000000)
#define | DATA_TIMER_VALUE_R (SDC_TRAN_CLOCK_RATE / 4)
#define | DATA_TIMER_VALUE_W (SDC_TRAN_CLOCK_RATE)
#define | MS_ACQUIRE_DELAY (100)

## Functions
STATIC int32_t | sendCmd (LPC_SDC_T *pSDC, uint32_t Command, uint32_t Arg, uint32_t timeout)
STATIC int32_t | executeCmd (LPC_SDC_T *pSDC, uint32_t Command, uint32_t Arg, IP_SDC_001_RESP_T *pResp)
STATIC int32_t | checkR1Response (uint32_t resp, int32_t *pCheckResult)
STATIC int32_t | sendAppCmd (LPC_SDC_T *pSDC, uint16_t rca)
STATIC INLINE int32_t | cardReset (LPC_SDC_T *pSDC)
STATIC int32_t | sendIfCond (LPC_SDC_T *pSDC)
STATIC int32_t | sendOpCond (LPC_SDC_T *pSDC, uint32_t *pOCR)
STATIC int32_t | sendAppOpCond (LPC_SDC_T *pSDC, uint16_t rca, bool hcs, uint32_t *pOcr, bool *pCCS)
STATIC int32_t | getCID (LPC_SDC_T *pSDC, uint32_t *pCID)
STATIC int32_t | setAddr (LPC_SDC_T *pSDC, uint16_t addr)
STATIC int32_t | getAddr (LPC_SDC_T *pSDC, uint16_t *pRCA)
STATIC int32_t | getCSD (LPC_SDC_T *pSDC, uint16_t rca, uint32_t *pCSD)
STATIC int32_t | selectCard (LPC_SDC_T *pSDC, uint16_t addr)
STATIC int32_t | getStatus (LPC_SDC_T *pSDC, uint16_t rca, uint32_t *pStatus)
STATIC int32_t | getAppStatus (LPC_SDC_T *pSDC, uint16_t rca, uint32_t *pStatus)
STATIC uint32_t | getBits (LPC_SDC_T *pSDC, int32_t start, int32_t end, uint32_t *data)
STATIC void | processCSD (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo)
STATIC int32_t | setBusWidth (LPC_SDC_T *pSDC, uint16_t rca, uint8_t width)
STATIC int32_t | setTranState (LPC_SDC_T *pSDC, uint16_t rca)
STATIC int32_t | setblock_length (LPC_SDC_T *pSDC, uint32_t rca, uint32_t block_len)
STATIC int32_t | setCardParams (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo)
STATIC int32_t | readBlocks (LPC_SDC_T *pSDC, uint32_t card_type, uint32_t startBlock, uint32_t blockNum)
STATIC int32_t | writeBlocks (LPC_SDC_T *pSDC, uint32_t card_type, uint32_t startBlock, uint32_t blockNum)
STATIC int32_t | stopTranmission (LPC_SDC_T *pSDC, uint32_t rca)
STATIC int32_t | Chip_SDMMC_FIFOIRQHandler (LPC_SDC_T *pSDC, uint8_t *txBuf, uint32_t *txCnt, uint8_t *rxBuf, uint32_t *rxCnt)
int32_t | Chip_SDMMC_IRQHandler (LPC_SDC_T *pSDC, uint8_t *txBuf, uint32_t *txCnt, uint8_t *rxBuf, uint32_t *rxCnt)
| SD card interrupt service routine.
SDMMC_STATE_T | Chip_SDMMC_GetCardState (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo)
| Get card's current state (idle, transfer, program, etc.)
uint32_t | Chip_SDMMC_GetCardStatus (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo)
| Get 'card status' of SD Memory card.
int32_t | Chip_SDMMC_GetSDStatus (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo, uint32_t *pStatus)
| Get 'sd status' of SD Memory card.
int32_t | Chip_SDMMC_Acquire (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo)
| Function to enumerate the SD/MMC/SDHC/MMC+ cards.
int32_t | Chip_SDMMC_ReadBlocks (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo, void *buffer, int32_t startBlock, int32_t blockNum)
| Performs the read of data from the SD/MMC card.
int32_t | Chip_SDMMC_WriteBlocks (LPC_SDC_T *pSDC, SDMMC_CARD_T *pCardInfo, void *buffer, int32_t startBlock, int32_t blockNum)
| Performs write of data to the SD/MMC card.

## Macro Definition Documentation

#define CMD_TIMEOUT (0x10000)

Definition at line 39 of file sdmmc_17xx_40xx.c.

#define DATA_TIMEOUT (0x1000000)

Definition at line 40 of file sdmmc_17xx_40xx.c.

#define DATA_TIMER_VALUE_R (SDC_TRAN_CLOCK_RATE / 4)

Definition at line 41 of file sdmmc_17xx_40xx.c.

#define DATA_TIMER_VALUE_W (SDC_TRAN_CLOCK_RATE)

Definition at line 42 of file sdmmc_17xx_40xx.c.

#define MS_ACQUIRE_DELAY (100)

inter-command acquire oper condition delay in msec

Definition at line 43 of file sdmmc_17xx_40xx.c.

## Function Documentation

STATIC INLINE int32_t cardReset | ( | LPC_SDC_T * | pSDC | ) |

Definition at line 178 of file sdmmc_17xx_40xx.c.

STATIC int32_t checkR1Response | ( | uint32_t | resp,
|  | int32_t * | pCheckResult
| ) |  |

Definition at line 132 of file sdmmc_17xx_40xx.c.

STATIC int32_t Chip_SDMMC_FIFOIRQHandler | ( | LPC_SDC_T * | pSDC,
|  | uint8_t * | txBuf,
|  | uint32_t * | txCnt,
|  | uint8_t * | rxBuf,
|  | uint32_t * | rxCnt
| ) |  |

Definition at line 680 of file sdmmc_17xx_40xx.c.

STATIC int32_t executeCmd | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | Command,
|  | uint32_t | Arg,
|  | IP_SDC_001_RESP_T * | pResp
| ) |  |

Definition at line 99 of file sdmmc_17xx_40xx.c.

STATIC int32_t getAddr | ( | LPC_SDC_T * | pSDC,
|  | uint16_t * | pRCA
| ) |  |

Definition at line 309 of file sdmmc_17xx_40xx.c.

STATIC int32_t getAppStatus | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca,
|  | uint32_t * | pStatus
| ) |  |

Definition at line 395 of file sdmmc_17xx_40xx.c.

STATIC uint32_t getBits | ( | LPC_SDC_T * | pSDC,
|  | int32_t | start,
|  | int32_t | end,
|  | uint32_t * | data
| ) |  |

Definition at line 418 of file sdmmc_17xx_40xx.c.

STATIC int32_t getCID | ( | LPC_SDC_T * | pSDC,
|  | uint32_t * | pCID
| ) |  |

Definition at line 270 of file sdmmc_17xx_40xx.c.

STATIC int32_t getCSD | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca,
|  | uint32_t * | pCSD
| ) |  |

Definition at line 335 of file sdmmc_17xx_40xx.c.

STATIC int32_t getStatus | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca,
|  | uint32_t * | pStatus
| ) |  |

Definition at line 375 of file sdmmc_17xx_40xx.c.

STATIC void processCSD | ( | LPC_SDC_T * | pSDC,
|  | SDMMC_CARD_T * | pCardInfo
| ) |  |

Definition at line 435 of file sdmmc_17xx_40xx.c.

STATIC int32_t readBlocks | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | card_type,
|  | uint32_t | startBlock,
|  | uint32_t | blockNum
| ) |  |

Definition at line 570 of file sdmmc_17xx_40xx.c.

STATIC int32_t selectCard | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | addr
| ) |  |

Definition at line 356 of file sdmmc_17xx_40xx.c.

STATIC int32_t sendAppCmd | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca
| ) |  |

Definition at line 150 of file sdmmc_17xx_40xx.c.

STATIC int32_t sendAppOpCond | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca,
|  | bool | hcs,
|  | uint32_t * | pOcr,
|  | bool * | pCCS
| ) |  |

Definition at line 230 of file sdmmc_17xx_40xx.c.

STATIC int32_t sendCmd | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | Command,
|  | uint32_t | Arg,
|  | uint32_t | timeout
| ) |  |

Definition at line 53 of file sdmmc_17xx_40xx.c.

STATIC int32_t sendIfCond | ( | LPC_SDC_T * | pSDC | ) |

Definition at line 184 of file sdmmc_17xx_40xx.c.

STATIC int32_t sendOpCond | ( | LPC_SDC_T * | pSDC,
|  | uint32_t * | pOCR
| ) |  |

Definition at line 206 of file sdmmc_17xx_40xx.c.

STATIC int32_t setAddr | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | addr
| ) |  |

Definition at line 291 of file sdmmc_17xx_40xx.c.

STATIC int32_t setblock_length | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | rca,
|  | uint32_t | block_len
| ) |  |

Definition at line 530 of file sdmmc_17xx_40xx.c.

STATIC int32_t setBusWidth | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca,
|  | uint8_t | width
| ) |  |

Definition at line 466 of file sdmmc_17xx_40xx.c.

STATIC int32_t setCardParams | ( | LPC_SDC_T * | pSDC,
|  | SDMMC_CARD_T * | pCardInfo
| ) |  |

Definition at line 549 of file sdmmc_17xx_40xx.c.

STATIC int32_t setTranState | ( | LPC_SDC_T * | pSDC,
|  | uint16_t | rca
| ) |  |

Definition at line 488 of file sdmmc_17xx_40xx.c.

STATIC int32_t stopTranmission | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | rca
| ) |  |

Definition at line 640 of file sdmmc_17xx_40xx.c.

STATIC int32_t writeBlocks | ( | LPC_SDC_T * | pSDC,
|  | uint32_t | card_type,
|  | uint32_t | startBlock,
|  | uint32_t | blockNum
| ) |  |

Definition at line 605 of file sdmmc_17xx_40xx.c.