49 #include "stm32f4xx.h"
53 #define BLOCK_SIZE 512
76 printf(
"disk_initialize %d\n", drv);
87 puts(
"Initialization Fail");
132 printf(
"disk_read %d %p %10d %d\n",drv,buff,sector,count);
139 if ((DWORD) buff & 3) {
144 res =
disk_read(drv, (
void *) scratch, sector++, 1);
160 if (Status == SD_OK) {
170 if ((State == SD_TRANSFER_ERROR) || (Status != SD_OK))
191 DRESULT disk_write(BYTE drv,
const BYTE *buff, DWORD sector, BYTE count) {
196 printf(
"disk_write %d %p %10d %d\n",drv,buff,sector,count);
203 if ((DWORD) buff & 3) {
210 res = disk_write(drv, (
void *) scratch, sector++, 1);
222 Status = SD_WriteMultiBlocksFIXED((uint8_t *) buff, sector,
BLOCK_SIZE,
225 if (Status == SD_OK) {
235 if ((State == SD_TRANSFER_ERROR) || (Status != SD_OK))
256 DRESULT disk_ioctl(BYTE pdrv, BYTE cmd,
void *buff) {
SD_Error SD_Init(void)
Initializes the SD Card and put it into StandBy State (Ready for data transfer).
SD_Error SD_WaitWriteOperation(void)
This function waits until the SDIO DMA data transfer is finished. This function should be called afte...
This file contains all the functions prototypes for the SD Card stm324xg_eval_sdio_sd driver firmware...
SD_Error SD_WaitReadOperation(void)
This function waits until the SDIO DMA data transfer is finished. This function should be called afte...
SD_Error SD_ReadMultiBlocksFIXED(uint8_t *readbuff, uint32_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks)
DRESULT disk_read(BYTE drv, BYTE *buff, DWORD sector, UINT count)
Read from the SD Card.
DRESULT
Results of Disk Functions.
SDTransferState SD_GetStatus(void)
Gets the cuurent sd card data transfer status.
BYTE DSTATUS
Status of Disk Functions.
#define SD_PRESENT
SD detection on its memory slot.
SDTransferState
SDIO Transfer state.
DSTATUS disk_status(BYTE drv)
Return disk status.
uint8_t SD_Detect(void)
Detect if SD card is correctly plugged in the memory slot.
DSTATUS disk_initialize(BYTE drv)
Initialize the SD Card Returns the disk status.