34 #define DBG_PRINTF(...) 35 //#define DBG_PRINTF printf 37 #define PHYSICAL_BLOCK_SIZE 512 39 // Command table value definitions 56 // Start and stop data tokens for single and multiple 58 #define START_SBR 0xFE 59 #define START_MBR 0xFE 60 #define START_SBW 0xFE 61 #define START_MBW 0xFC 64 // Mask for data response Token after an MMC write 65 #define DATA_RESP_MASK 0x11 67 // Mask for busy Token in R1b response 70 #define BACK_FROM_ERROR { SingleWrite(0xFF); SPI_SET_SS0_HIGH(SPI1); return FALSE;} 72 typedef union // byte-addressable unsigned long 83 #define SD_SUCCESS (0) 86 // Command Table Index Constants: 95 #define GO_IDLE_STATE 0 96 #define SEND_OP_COND 1 97 #define SEND_IF_COND 2 100 #define STOP_TRANSMISSION 5 101 #define SEND_STATUS 6 102 #define SET_BLOCKLEN 7 103 #define READ_SINGLE_BLOCK 8 104 #define READ_MULTIPLE_BLOCK 9 105 #define SET_BLOCK_COUNT 10 106 #define WRITE_BLOCK 11 107 #define WRITE_MULTIPLE_BLOCK 12 108 #define PROGRAM_CSD 13 109 #define SET_WRITE_PROT 14 110 #define CLR_WRITE_PROT 15 111 #define SEND_WRITE_PROT 16 112 #define TAG_SECTOR_START 17 113 #define TAG_SECTOR_END 18 114 #define UNTAG_SECTOR 19 115 #define TAG_ERASE_GROUP_START 20 116 #define TAG_ERASE_GROUP_END 21 117 #define UNTAG_ERASE_GROUP 22 119 #define LOCK_UNLOCK 24 122 #define CRC_ON_OFF 27 123 #define SD_SEND_STATUS 28 124 #define SD_SET_WR_BLK_ERASE_COUNT 29 125 #define SD_SEND_OP_COND 30 149 uint32_t
MMC_Command_Exec (uint8_t cmd_loc, uint32_t argument,uint8_t *pchar, uint32_t* response);
152 void SpiRead(uint32_t addr, uint32_t size, uint8_t* buffer);
153 void SpiWrite(uint32_t addr, uint32_t size, uint8_t* buffer);
void SDCARD_Close(void)
This function is used to close SDCARD.
uint32_t SDCARD_Open(void)
This function is used to Open GPIO function and initial SDCARD.
void SpiRead(uint32_t addr, uint32_t size, uint8_t *buffer)
This function is used to Get data from SD card.
Nano100 series peripheral access layer header file. This file contains all the peripheral register's ...
uint32_t SDCARD_GetCardSize(uint32_t *pu32TotSecCnt)
This function is used to get card total sector after SDCARD is opened.
void SpiWrite(uint32_t addr, uint32_t size, uint8_t *buffer)
This function is used to store data into SD card.
uint32_t SDCARD_GetVersion(void)
uint32_t GetLogicSector(void)
This function is used to get logic sector size.
uint32_t MMC_Command_Exec(uint8_t nCmd, uint32_t nArg, uint8_t *pchar, uint32_t *response)
This function is used to Send SDCARD CMD and Receive Response.