Merge branch 'master' of git.shimatta.de:mhu/stm32f4-sdio

This commit is contained in:
Mario Hüttel 2020-02-22 19:32:43 +01:00
commit 6021c9e1e2
4 changed files with 592 additions and 603 deletions

View File

@ -33,7 +33,7 @@ DSTATUS disk_status (
switch (pdrv) {
case DEV_SD:
return SDIO_status();
return sdio_status();
}
return STA_NOINIT;
}
@ -53,7 +53,7 @@ DSTATUS disk_initialize (
switch (pdrv) {
case DEV_SD:
return SDIO_initialize();
return sdio_initialize();
}
return STA_NOINIT;
}
@ -76,7 +76,7 @@ DRESULT disk_read (
switch (pdrv) {
case DEV_SD:
return SDIO_disk_read(buff, sector, count);
return sdio_disk_read(buff, sector, count);
}
return RES_PARERR;
}
@ -125,7 +125,7 @@ DRESULT disk_ioctl (
switch (pdrv) {
case DEV_SD:
return SDIO_disk_ioctl(cmd, buff);
return sdio_disk_ioctl(cmd, buff);
}
return RES_PARERR;

File diff suppressed because it is too large Load Diff

View File

@ -12,11 +12,12 @@
#include <fatfs/ff.h>
#include <stdint.h>
DSTATUS SDIO_status();
DSTATUS SDIO_initialize();
DRESULT SDIO_disk_read(BYTE *buff, DWORD sector, UINT count);
DRESULT SDIO_disk_write(const BYTE *buff, DWORD sector, UINT count);
DRESULT SDIO_disk_ioctl(BYTE cmd, void* buff);
DSTATUS sdio_status();
DSTATUS sdio_initialize();
DRESULT sdio_disk_read(BYTE *buff, DWORD sector, UINT count);
DRESULT sdio_disk_write(const BYTE *buff, DWORD sector, UINT count);
DRESULT sdio_disk_ioctl(BYTE cmd, void* buff);
DWORD get_fattime();
@ -31,9 +32,7 @@ DWORD get_fattime();
#define CURRENT_STATE_PRG 7
#define CURRENT_STATE_DIS 8
typedef struct _CardStatus {
struct sd_card_status {
uint32_t reserved : 3;
uint32_t AKE_SEQ_ERROR : 1;
uint32_t reserved_2 : 1;
@ -60,21 +59,19 @@ typedef struct _CardStatus {
uint32_t BLOCK_LEN_ERROR : 1;
uint32_t ADDRESS_ERROR : 1;
uint32_t OUT_OF_RANGE : 1;
}CardStatus_t;
};
typedef enum {CARD_NONE = 0, MMC, SD_V1, SD_V2_SC, SD_V2_HC} card_type_t;
enum sdio_card_type {CARD_NONE = 0, MMC, SD_V1, SD_V2_SC, SD_V2_HC};
// MMC not supported
typedef struct _SDInfo {
struct sd_info {
uint16_t rca;
card_type_t type;
enum sdio_card_type type;
uint32_t sector_count;
}SDInfo_t;
};
typedef union _StatusConv {
CardStatus_t statusstruct;
union sdio_status_conv {
struct sd_card_status statusstruct;
uint32_t value;
}StatusConv_t;
};
#endif /* FATFS_SHIMATTA_SDIO_DRIVER_SHIMATTA_SDIO_DRIVER_H_ */

2
main.c
View File

@ -92,7 +92,7 @@ void SysTick_Handler()
sdio_wait++;
}
void SDIO_wait_ms(unsigned int i) {
void sdio_wait_ms(unsigned int i) {
sdio_wait = 0;
while(sdio_wait<i);