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

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);
}