Improve style of sdio driver
This commit is contained in:
parent
4b07178f3d
commit
d0c488645c
@ -33,7 +33,7 @@ DSTATUS disk_status (
|
|||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return SDIO_status();
|
return sdio_status();
|
||||||
}
|
}
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ DSTATUS disk_initialize (
|
|||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return SDIO_initialize();
|
return sdio_initialize();
|
||||||
}
|
}
|
||||||
return STA_NOINIT;
|
return STA_NOINIT;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ DRESULT disk_read (
|
|||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return SDIO_disk_read(buff, sector, count);
|
return sdio_disk_read(buff, sector, count);
|
||||||
}
|
}
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ DRESULT disk_ioctl (
|
|||||||
|
|
||||||
switch (pdrv) {
|
switch (pdrv) {
|
||||||
case DEV_SD:
|
case DEV_SD:
|
||||||
return SDIO_disk_ioctl(cmd, buff);
|
return sdio_disk_ioctl(cmd, buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RES_PARERR;
|
return RES_PARERR;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -12,12 +12,13 @@
|
|||||||
#include <fatfs/ff.h>
|
#include <fatfs/ff.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
DSTATUS SDIO_status();
|
DSTATUS sdio_status();
|
||||||
DSTATUS SDIO_initialize();
|
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_read(BYTE *buff, DWORD sector, UINT count);
|
||||||
DRESULT SDIO_disk_ioctl(BYTE cmd, void* buff);
|
DRESULT sdio_disk_write(const BYTE *buff, DWORD sector, UINT count);
|
||||||
DWORD get_fattime();
|
DRESULT sdio_disk_ioctl(BYTE cmd, void* buff);
|
||||||
|
DWORD get_fattime();
|
||||||
|
|
||||||
|
|
||||||
//Defines for Card Status in struct _CardStatus
|
//Defines for Card Status in struct _CardStatus
|
||||||
@ -31,9 +32,7 @@ DWORD get_fattime();
|
|||||||
#define CURRENT_STATE_PRG 7
|
#define CURRENT_STATE_PRG 7
|
||||||
#define CURRENT_STATE_DIS 8
|
#define CURRENT_STATE_DIS 8
|
||||||
|
|
||||||
|
struct sd_card_status {
|
||||||
|
|
||||||
typedef struct _CardStatus {
|
|
||||||
uint32_t reserved : 3;
|
uint32_t reserved : 3;
|
||||||
uint32_t AKE_SEQ_ERROR : 1;
|
uint32_t AKE_SEQ_ERROR : 1;
|
||||||
uint32_t reserved_2 : 1;
|
uint32_t reserved_2 : 1;
|
||||||
@ -60,21 +59,19 @@ typedef struct _CardStatus {
|
|||||||
uint32_t BLOCK_LEN_ERROR : 1;
|
uint32_t BLOCK_LEN_ERROR : 1;
|
||||||
uint32_t ADDRESS_ERROR : 1;
|
uint32_t ADDRESS_ERROR : 1;
|
||||||
uint32_t OUT_OF_RANGE : 1;
|
uint32_t OUT_OF_RANGE : 1;
|
||||||
}CardStatus_t;
|
};
|
||||||
|
|
||||||
|
enum sdio_card_type {CARD_NONE = 0, MMC, SD_V1, SD_V2_SC, SD_V2_HC};
|
||||||
|
|
||||||
typedef enum {CARD_NONE = 0, MMC, SD_V1, SD_V2_SC, SD_V2_HC} card_type_t;
|
|
||||||
// MMC not supported
|
// MMC not supported
|
||||||
typedef struct _SDInfo {
|
struct sd_info {
|
||||||
uint16_t rca;
|
uint16_t rca;
|
||||||
card_type_t type;
|
enum sdio_card_type type;
|
||||||
uint32_t sector_count;
|
uint32_t sector_count;
|
||||||
}SDInfo_t;
|
};
|
||||||
|
|
||||||
typedef union _StatusConv {
|
union sdio_status_conv {
|
||||||
CardStatus_t statusstruct;
|
struct sd_card_status statusstruct;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
}StatusConv_t;
|
};
|
||||||
|
|
||||||
#endif /* FATFS_SHIMATTA_SDIO_DRIVER_SHIMATTA_SDIO_DRIVER_H_ */
|
#endif /* FATFS_SHIMATTA_SDIO_DRIVER_SHIMATTA_SDIO_DRIVER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user