ipod5g/6g: support DEFAULT_VIRT_SECTOR_SIZE

This way if there's no valid partition/filesystem we still report the
"correct" sector size out via USB.

Update the ipod5g/6g bootloaders so they do the right thing too.

Change-Id: I0d93ae7e6664f1591d8edf1c0252c586e329cd4b
This commit is contained in:
Solomon Peachy 2024-11-09 16:43:11 -05:00
parent 1516c48a37
commit c8e1da8e90
4 changed files with 35 additions and 16 deletions

View file

@ -202,6 +202,13 @@ void fatal_error(void)
#endif #endif
lcd_update(); lcd_update();
#if defined(MAX_VIRT_SECTOR_SIZE) && defined(DEFAULT_VIRT_SECTOR_SIZE)
#ifdef HAVE_MULTIDRIVE
for (int i = 0 ; i < NUM_DRIVES ; i++)
#endif
disk_set_sector_multiplier(IF_MD(i,) DEFAULT_VIRT_SECTOR_SIZE);
#endif
usb_init(); usb_init();
while (1) { while (1) {
if (button_hold() != holdstatus) { if (button_hold() != holdstatus) {

View file

@ -424,8 +424,15 @@ void main(void)
#ifdef HAVE_BOOTLOADER_USB_MODE #ifdef HAVE_BOOTLOADER_USB_MODE
/* Enter USB mode if SELECT+RIGHT are pressed */ /* Enter USB mode if SELECT+RIGHT are pressed */
if (button_read_device() == (BUTTON_SELECT|BUTTON_RIGHT)) if (button_read_device() == (BUTTON_SELECT|BUTTON_RIGHT)) {
#if defined(MAX_VIRT_SECTOR_SIZE) && defined(DEFAULT_VIRT_SECTOR_SIZE)
#ifdef HAVE_MULTIDRIVE
for (int i = 0 ; i < NUM_DRIVES ; i++)
#endif
disk_set_sector_multiplier(IF_MD(i,) DEFAULT_VIRT_SECTOR_SIZE);
#endif
usb_mode(); usb_mode();
}
#endif #endif
rc = disk_mount_all(); rc = disk_mount_all();

View file

@ -194,6 +194,9 @@
/* define this if the device has larger sectors when accessed via USB */ /* define this if the device has larger sectors when accessed via USB */
#define MAX_VIRT_SECTOR_SIZE 4096 #define MAX_VIRT_SECTOR_SIZE 4096
/* If we have no valid paritions, advertise this as our sector size */
#define DEFAULT_VIRT_SECTOR_SIZE 4096
/* This is the minimum access size for the device, even if it's larger than the logical sector size */ /* This is the minimum access size for the device, even if it's larger than the logical sector size */
#define MAX_PHYS_SECTOR_SIZE 4096 #define MAX_PHYS_SECTOR_SIZE 4096

View file

@ -214,9 +214,11 @@
#define HAVE_HARDWARE_CLICK #define HAVE_HARDWARE_CLICK
/* define this if the device has larger sectors when accessed via USB */ /* define this if the device has larger sectors when accessed via USB */
/* (only relevant in disk.c, fat.c now always supports large virtual sectors) */
#define MAX_VIRT_SECTOR_SIZE 2048 #define MAX_VIRT_SECTOR_SIZE 2048
/* If we have no valid paritions, advertise this as our sector size */
#define DEFAULT_VIRT_SECTOR_SIZE 2048
/* define this if the hard drive uses large physical sectors (ATA-7 feature) */ /* define this if the hard drive uses large physical sectors (ATA-7 feature) */
/* and doesn't handle them in the drive firmware */ /* and doesn't handle them in the drive firmware */
#define MAX_PHYS_SECTOR_SIZE 1024 #define MAX_PHYS_SECTOR_SIZE 1024