From f0a96580ae84cdfbb09db568f296491c699b6a4b Mon Sep 17 00:00:00 2001 From: Michael Sparmann Date: Fri, 9 Oct 2009 20:36:09 +0000 Subject: Core changes to allow storage drivers to do cleanup on shutdown, and iPod Nano 2G shutdown code rework (FS#10668) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23057 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-ipodnano2g.h | 7 +++++++ firmware/export/nand.h | 3 +++ firmware/export/storage.h | 16 ++++++++++++++++ 3 files changed, 26 insertions(+) (limited to 'firmware/export') diff --git a/firmware/export/config-ipodnano2g.h b/firmware/export/config-ipodnano2g.h index 9d36a37046..641e88860b 100644 --- a/firmware/export/config-ipodnano2g.h +++ b/firmware/export/config-ipodnano2g.h @@ -39,6 +39,9 @@ /* define this to enable JPEG decoding */ #define HAVE_JPEG +/* define this if the LCD can shut down */ +#define HAVE_LCD_SHUTDOWN + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT @@ -58,6 +61,10 @@ #define CONFIG_NAND NAND_SAMSUNG +/* define this if at least one storage driver + needs to do cleanup on shutdown */ +#define HAVE_STORAGE_FLUSH + /* The NAND flash has 2048-byte sectors, and is our only storage */ #define SECTOR_SIZE 2048 diff --git a/firmware/export/nand.h b/firmware/export/nand.h index 67ebe73ddf..60b986dc2f 100644 --- a/firmware/export/nand.h +++ b/firmware/export/nand.h @@ -37,6 +37,9 @@ int nand_init(void); void nand_close(void); int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); +#ifdef HAVE_STORAGE_FLUSH +int nand_flush(void); +#endif void nand_spin(void); int nand_spinup_time(void); /* ticks */ diff --git a/firmware/export/storage.h b/firmware/export/storage.h index fc49d0ce31..cb4ad7fc3a 100644 --- a/firmware/export/storage.h +++ b/firmware/export/storage.h @@ -69,6 +69,9 @@ struct storage_info #define storage_close() ata_close() #define storage_read_sectors(drive, start, count, buf) ata_read_sectors(IF_MD2(drive,) start, count, buf) #define storage_write_sectors(drive, start, count, buf) ata_write_sectors(IF_MD2(drive,) start, count, buf) + #ifdef HAVE_STORAGE_FLUSH + #define storage_flush() (void)0 + #endif #define storage_last_disk_activity() ata_last_disk_activity() #define storage_spinup_time() ata_spinup_time() #define storage_get_identify() ata_get_identify() @@ -92,6 +95,9 @@ struct storage_info #define storage_init() sd_init() #define storage_read_sectors(drive, start, count, buf) sd_read_sectors(IF_MD2(drive,) start, count, buf) #define storage_write_sectors(drive, start, count, buf) sd_write_sectors(IF_MD2(drive,) start, count, buf) + #ifdef HAVE_STORAGE_FLUSH + #define storage_flush() (void)0 + #endif #define storage_last_disk_activity() sd_last_disk_activity() #define storage_spinup_time() 0 #define storage_get_identify() sd_get_identify() @@ -115,6 +121,9 @@ struct storage_info #define storage_init() mmc_init() #define storage_read_sectors(drive, start, count, buf) mmc_read_sectors(IF_MD2(drive,) start, count, buf) #define storage_write_sectors(drive, start, count, buf) mmc_write_sectors(IF_MD2(drive,) start, count, buf) + #ifdef HAVE_STORAGE_FLUSH + #define storage_flush() (void)0 + #endif #define storage_last_disk_activity() mmc_last_disk_activity() #define storage_spinup_time() 0 #define storage_get_identify() mmc_get_identify() @@ -138,6 +147,9 @@ struct storage_info #define storage_init() nand_init() #define storage_read_sectors(drive, start, count, buf) nand_read_sectors(IF_MD2(drive,) start, count, buf) #define storage_write_sectors(drive, start, count, buf) nand_write_sectors(IF_MD2(drive,) start, count, buf) + #ifdef HAVE_STORAGE_FLUSH + #define storage_flush() nand_flush() + #endif #define storage_last_disk_activity() nand_last_disk_activity() #define storage_spinup_time() 0 #define storage_get_identify() nand_get_identify() @@ -161,6 +173,9 @@ struct storage_info #define storage_init() ramdisk_init() #define storage_read_sectors(drive, start, count, buf) ramdisk_read_sectors(IF_MD2(drive,) start, count, buf) #define storage_write_sectors(drive, start, count, buf) ramdisk_write_sectors(IF_MD2(drive,) start, count, buf) + #ifdef HAVE_STORAGE_FLUSH + #define storage_flush() (void)0 + #endif #define storage_last_disk_activity() ramdisk_last_disk_activity() #define storage_spinup_time() 0 #define storage_get_identify() ramdisk_get_identify() @@ -187,6 +202,7 @@ int storage_soft_reset(void); int storage_init(void); int storage_read_sectors(int drive, unsigned long start, int count, void* buf); int storage_write_sectors(int drive, unsigned long start, int count, const void* buf); +int storage_flush(void); void storage_spin(void); void storage_spindown(int seconds); long storage_last_disk_activity(void); -- cgit v1.2.3