fix indicators, add emmc_mount, various fixes

This commit is contained in:
Christoph Baumann
2025-04-29 12:36:32 +02:00
parent 31c8ad0d88
commit 28796b417b
6 changed files with 792 additions and 423 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,7 @@
static u32 sd_rsvd_sectors = 0;
static u32 ramdisk_sectors = 0;
static u32 emummc_sectors = 0;
static u32 sfd_sectors = 0;
static bool ensure_partition(BYTE pdrv){
u8 part;
@@ -99,7 +100,7 @@ DRESULT disk_read (
case DRIVE_BOOT1:
return sdmmc_storage_read(&emmc_storage, sector, count, buff) ? RES_OK : RES_ERROR;
case DRIVE_SFD:
return sfd_read(sector, count ,buff) ? RES_OK : RES_ERROR;
return sfd_read(sector, count, buff) ? RES_OK : RES_ERROR;
}
return RES_ERROR;
@@ -187,8 +188,16 @@ DRESULT disk_ioctl (
*buf = 32768; // Align to 16MB.
break;
}
}
else // Catch all for unknown devices.
}else if(pdrv == DRIVE_SFD){
switch(cmd){
case GET_SECTOR_COUNT:
*buf = sfd_sectors;
break;
case GET_BLOCK_SIZE:
*buf = 32768;
break;
}
}else // Catch all for unknown devices.
{
switch (cmd)
{
@@ -225,6 +234,9 @@ DRESULT disk_set_info (
case DRIVE_EMU:
emummc_sectors = *buf;
break;
case DRIVE_SFD:
sfd_sectors = *buf;
break;
}
}

View File

@@ -1,6 +1,7 @@
#include "sfd.h"
#include <storage/emmc.h>
#include <storage/sdmmc.h>
#include <libs/fatfs/diskio.h>
static sdmmc_storage_t *_storage;
static u32 _offset;
@@ -13,7 +14,7 @@ static void ensure_partition(){
}
int sfd_read(u32 sector, u32 count, void *buff){
if(sector + _offset + count > _offset + _size){
if(sector + count > _size){
return 0;
}
ensure_partition();
@@ -21,7 +22,7 @@ int sfd_read(u32 sector, u32 count, void *buff){
}
int sfd_write(u32 sector, u32 count, void *buff){
if(sector + _offset + count > _offset + _size){
if(sector + count > _size){
return 0;
}
ensure_partition();
@@ -32,6 +33,7 @@ bool sfd_init(sdmmc_storage_t *storage, u32 offset, u32 size){
_storage = storage;
_offset = offset;
_size = size;
disk_set_info(DRIVE_SFD, SET_SECTOR_COUNT, &size);
return true;
}
@@ -39,4 +41,6 @@ void sfd_end(){
_storage = NULL;
_offset = 0;
_size = 0;
u32 size = 0;
disk_set_info(DRIVE_SFD, SET_SECTOR_COUNT, &size);
}