Skip to content

Commit

Permalink
fix kernel usb sector size/count bug
Browse files Browse the repository at this point in the history
caused unconditional -3 boot error with file write on. introduced in aa5ea1f I must have neglected to test that commit on account of 3am at the time
  • Loading branch information
jmlee337 committed Oct 19, 2023
1 parent e6a5d01 commit 5936ee6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions kernel/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int _main( int argc, char *argv[] )
res = f_mount( devices[0], fatSdName, 1 );
if( res != FR_OK )
{
dbgprintf("ES:f_mount() failed:%d\r\n", res );
dbgprintf("SD ES:f_mount() failed:%d\r\n", res );
BootStatusError(-3, res);
mdelay(4000);
Shutdown();
Expand All @@ -255,7 +255,7 @@ int _main( int argc, char *argv[] )
res = f_mount( devices[1], fatUsbName, 1 );
if( res != FR_OK )
{
dbgprintf("ES:f_mount() failed:%d\r\n", res );
dbgprintf("USB ES:f_mount() failed:%d\r\n", res );
BootStatusError(-3, res);
mdelay(4000);
Shutdown();
Expand Down
8 changes: 5 additions & 3 deletions kernel/usbstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,8 @@ void USBStorage_Open()
sync_before_read((void*)0x132C1000, sizeof(important_storage_data));
important_storage_data *d = (important_storage_data*)0x132C1000;

usb_s_size = d->sector_size;
usb_s_cnt = d->sector_count;

__mounted_device.sector_size = d->sector_size;
__mounted_device.sector_count = d->sector_count;
__mounted_device.lun = d->lun;
__mounted_device.vid = d->vid;
__mounted_device.pid = d->pid;
Expand All @@ -319,6 +318,9 @@ void USBStorage_Open()
__mounted_device.ep_in = d->ep_in;
__mounted_device.ep_out = d->ep_out;

usb_s_size = __mounted_device.sector_size;
usb_s_cnt = __mounted_device.sector_count;

__mounted = true;

if(transferbuffer == NULL)
Expand Down

0 comments on commit 5936ee6

Please sign in to comment.