summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-09-12 20:12:41 +0800
committersakumisu <[email protected]>2022-09-12 20:41:51 +0800
commit1df32997eddb5b50c5a804cf7bfbd63866a402e2 (patch)
treea334083653cc53dff16bdd566f7bb3d21c657ebd /third_party
parentf630da75831b2238988a430a6d35d2770d6ffd50 (diff)
update fatfs demo and port
Diffstat (limited to 'third_party')
-rw-r--r--third_party/fatfs-0.14/source/diskio.c30
-rw-r--r--third_party/fatfs-0.14/source/ffconf.h4
-rw-r--r--third_party/fatfs-0.14/source/port/fatfs_usbh.c5
3 files changed, 19 insertions, 20 deletions
diff --git a/third_party/fatfs-0.14/source/diskio.c b/third_party/fatfs-0.14/source/diskio.c
index 0d0b28fa..a73dabb3 100644
--- a/third_party/fatfs-0.14/source/diskio.c
+++ b/third_party/fatfs-0.14/source/diskio.c
@@ -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;
}
diff --git a/third_party/fatfs-0.14/source/ffconf.h b/third_party/fatfs-0.14/source/ffconf.h
index 16c12748..b150ce6d 100644
--- a/third_party/fatfs-0.14/source/ffconf.h
+++ b/third_party/fatfs-0.14/source/ffconf.h
@@ -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
diff --git a/third_party/fatfs-0.14/source/port/fatfs_usbh.c b/third_party/fatfs-0.14/source/port/fatfs_usbh.c
index f8d521ae..feab07e4 100644
--- a/third_party/fatfs-0.14/source/port/fatfs_usbh.c
+++ b/third_party/fatfs-0.14/source/port/fatfs_usbh.c
@@ -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;