update fatfs demo and port

This commit is contained in:
sakumisu
2022-09-12 20:12:41 +08:00
parent f630da7583
commit 1df32997ed
4 changed files with 81 additions and 60 deletions

View File

@@ -29,25 +29,24 @@ DSTATUS disk_status (
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_RAM :
//result = RAM_disk_status();
//stat = RAM_disk_status();
// translate the reslut code here
return stat;
case DEV_MMC :
//result = MMC_disk_status();
//stat = MMC_disk_status();
// translate the reslut code here
return stat;
case DEV_USB :
result = USB_disk_status();
stat = USB_disk_status();
// translate the reslut code here
@@ -67,25 +66,24 @@ DSTATUS disk_initialize (
)
{
DSTATUS stat;
int result;
switch (pdrv) {
case DEV_RAM :
//result = RAM_disk_initialize();
//stat = RAM_disk_initialize();
// translate the reslut code here
return stat;
case DEV_MMC :
//result = MMC_disk_initialize();
//stat = MMC_disk_initialize();
// translate the reslut code here
return stat;
case DEV_USB :
result = USB_disk_initialize();
stat = USB_disk_initialize();
// translate the reslut code here
@@ -108,13 +106,12 @@ DRESULT disk_read (
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
//result = RAM_disk_read(buff, sector, count);
//res = RAM_disk_read(buff, sector, count);
// translate the reslut code here
@@ -123,7 +120,7 @@ DRESULT disk_read (
case DEV_MMC :
// translate the arguments here
//result = MMC_disk_read(buff, sector, count);
//res = MMC_disk_read(buff, sector, count);
// translate the reslut code here
@@ -132,7 +129,7 @@ DRESULT disk_read (
case DEV_USB :
// translate the arguments here
result = USB_disk_read(buff, sector, count);
res = USB_disk_read(buff, sector, count);
// translate the reslut code here
@@ -158,13 +155,12 @@ DRESULT disk_write (
)
{
DRESULT res;
int result;
switch (pdrv) {
case DEV_RAM :
// translate the arguments here
//result = RAM_disk_write(buff, sector, count);
//res = RAM_disk_write(buff, sector, count);
// translate the reslut code here
@@ -173,7 +169,7 @@ DRESULT disk_write (
case DEV_MMC :
// translate the arguments here
//result = MMC_disk_write(buff, sector, count);
//res = MMC_disk_write(buff, sector, count);
// translate the reslut code here
@@ -182,7 +178,7 @@ DRESULT disk_write (
case DEV_USB :
// translate the arguments here
result = USB_disk_write(buff, sector, count);
res = USB_disk_write(buff, sector, count);
// translate the reslut code here
@@ -224,7 +220,7 @@ DRESULT disk_ioctl (
case DEV_USB :
// Process of the command the USB drive
USB_disk_ioctl(cmd,buff);
res = USB_disk_ioctl(cmd,buff);
return res;
}

View File

@@ -166,12 +166,12 @@
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define FF_VOLUMES 1
#define FF_VOLUMES 3
/* Number of volumes (logical drives) to be used. (1-10) */
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
#define FF_VOLUME_STRS "RAM","SD","USB"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each

View File

@@ -14,18 +14,21 @@ int USB_disk_initialize(void)
active_msc_class = (struct usbh_msc *)usbh_find_class_instance("/dev/sda");
if (active_msc_class == NULL) {
printf("do not find /dev/sda\r\n");
return -1;
return RES_NOTRDY;
}
return RES_OK;
}
int USB_disk_read(BYTE *buff, LBA_t sector, UINT count)
{
return usbh_msc_scsi_read10(active_msc_class, sector, buff, count);
}
int USB_disk_write(const BYTE *buff, LBA_t sector, UINT count)
{
return usbh_msc_scsi_write10(active_msc_class, sector, buff, count);
}
int USB_disk_ioctl(BYTE cmd, void *buff)
{
int result = 0;