From 2f8a0081c64534da23fc0fa9cc685eb7454fd9c9 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Sat, 1 Nov 2008 16:14:28 +0000 Subject: Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do that, it also introduces sd_*, nand_*, and mmc_*. This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657 --- bootloader/creativezvm.c | 4 ++-- bootloader/gigabeat-s.c | 8 ++++---- bootloader/gigabeat.c | 6 +++--- bootloader/iaudio_coldfire.c | 8 ++++---- bootloader/iriver_h1x0.c | 12 ++++++------ bootloader/iriver_h300.c | 12 ++++++------ bootloader/main-c240wipe.c | 14 +++++++------- bootloader/main-c250wipe.c | 16 ++++++++-------- bootloader/main-e200r-installer.c | 8 ++++---- bootloader/main-pp.c | 16 ++++++++-------- bootloader/meizu_m3.c | 2 +- bootloader/meizu_m6sl.c | 2 +- bootloader/meizu_m6sp.c | 2 +- bootloader/mrobe500.c | 8 ++++---- bootloader/ondavx747.c | 2 +- bootloader/sansa_as3525.c | 4 ++-- bootloader/telechips.c | 4 ++-- bootloader/tpj1022.c | 4 ++-- 18 files changed, 66 insertions(+), 66 deletions(-) (limited to 'bootloader') diff --git a/bootloader/creativezvm.c b/bootloader/creativezvm.c index bd8050b22a..403a8bbdc4 100644 --- a/bootloader/creativezvm.c +++ b/bootloader/creativezvm.c @@ -21,7 +21,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "ata-target.h" #include "disk.h" #include "font.h" @@ -64,7 +64,7 @@ void main(void) printf("Rockbox boot loader"); printf("Version %s", APPSVERSION); - ret = ata_init(); + ret = storage_init(); if(ret) printf("ATA error: %d", ret); diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index 089d0f7890..e1e293fb55 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c @@ -25,7 +25,7 @@ #include "string.h" #include "adc.h" #include "powermgmt.h" -#include "ata.h" +#include "storage.h" #include "dir.h" #include "disk.h" #include "common.h" @@ -81,7 +81,7 @@ static bool pause_if_button_pressed(bool pre_usb) sleep(HZ/5); /* If the disk powers off, the firmware will lock at startup */ - ata_spin(); + storage_spin(); } } @@ -310,7 +310,7 @@ static void __attribute__((noreturn)) handle_firmware_load(void) /* Put drivers into a known state */ button_close_device(); - ata_close(); + storage_close(); system_prepare_fw_start(); if (rc == EOK) @@ -353,7 +353,7 @@ void main(void) check_battery(); - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/gigabeat.c b/bootloader/gigabeat.c index 117dacc2b2..6b3a68be6e 100644 --- a/bootloader/gigabeat.c +++ b/bootloader/gigabeat.c @@ -29,7 +29,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" @@ -75,7 +75,7 @@ void main(void) (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); lcd_update(); - ata_enable(false); + storage_enable(false); sleep(HZ/20); usb_enable(true); @@ -101,7 +101,7 @@ void main(void) sleep(50); /* ATA seems to error without this pause */ - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/iaudio_coldfire.c b/bootloader/iaudio_coldfire.c index 8e85dc9deb..0af2f25256 100644 --- a/bootloader/iaudio_coldfire.c +++ b/bootloader/iaudio_coldfire.c @@ -30,7 +30,7 @@ #include "lcd-remote.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "usb.h" #include "disk.h" #include "font.h" @@ -87,10 +87,10 @@ void shutdown(void) if (ide_powered()) { /* Make sure ATA has been initialized. */ - ata_init(); + storage_init(); /* And put the disk into sleep immediately. */ - ata_sleepnow(); + storage_sleepnow(); } sleep(HZ*2); @@ -192,7 +192,7 @@ void main(void) check_battery(); - rc = ata_init(); + rc = storage_init(); if(rc) { printf("ATA error: %d", rc); diff --git a/bootloader/iriver_h1x0.c b/bootloader/iriver_h1x0.c index 7f051bccb5..83e545540b 100644 --- a/bootloader/iriver_h1x0.c +++ b/bootloader/iriver_h1x0.c @@ -31,7 +31,7 @@ #include "scroll_engine.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "usb.h" #include "disk.h" #include "font.h" @@ -148,10 +148,10 @@ void shutdown(void) if (ide_powered()) { /* Make sure ATA has been initialized. */ - ata_init(); + storage_init(); /* And put the disk into sleep immediately. */ - ata_sleepnow(); + storage_sleepnow(); } sleep(HZ*2); @@ -560,7 +560,7 @@ void main(void) } #endif ide_power_enable(true); - ata_enable(false); + storage_enable(false); sleep(HZ/20); usb_enable(true); cpu_idle_mode(true); @@ -571,7 +571,7 @@ void main(void) remote_line = 0; check_battery(); - ata_spin(); /* Prevent the drive from spinning down */ + storage_spin(); /* Prevent the drive from spinning down */ sleep(HZ); /* Backlight OFF */ @@ -585,7 +585,7 @@ void main(void) lcd_update(); } - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/iriver_h300.c b/bootloader/iriver_h300.c index 9d839aed29..d15efb9b72 100644 --- a/bootloader/iriver_h300.c +++ b/bootloader/iriver_h300.c @@ -31,7 +31,7 @@ #include "scroll_engine.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "usb.h" #include "disk.h" #include "font.h" @@ -93,10 +93,10 @@ void shutdown(void) if (ide_powered()) { /* Make sure ATA has been initialized. */ - ata_init(); + storage_init(); /* And put the disk into sleep immediately. */ - ata_sleepnow(); + storage_sleepnow(); } sleep(HZ*2); @@ -317,7 +317,7 @@ void main(void) lcd_remote_update(); ide_power_enable(true); - ata_enable(false); + storage_enable(false); sleep(HZ/20); usb_enable(true); cpu_idle_mode(true); @@ -328,7 +328,7 @@ void main(void) remote_line = 0; check_battery(); - ata_spin(); /* Prevent the drive from spinning down */ + storage_spin(); /* Prevent the drive from spinning down */ sleep(HZ); } @@ -339,7 +339,7 @@ void main(void) lcd_update(); } - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/main-c240wipe.c b/bootloader/main-c240wipe.c index 1bf3ac21a3..952382eb5b 100644 --- a/bootloader/main-c240wipe.c +++ b/bootloader/main-c240wipe.c @@ -29,7 +29,7 @@ #include "kernel.h" #include "lcd.h" #include "font.h" -#include "ata.h" +#include "storage.h" #include "button.h" #include "disk.h" #include "crc32-mi4.h" @@ -185,14 +185,14 @@ void* main(void) printf(""); - i=ata_init(); + i=storage_init(); disk_init(IF_MV(0)); memset(zero,0,16*1024); printf("Zeroing flash"); for(i=0;i<250816;i++) { - ata_write_sectors(IF_MV2(0,) i*32,32,zero); + storage_write_sectors(IF_MV2(0,) i*32,32,zero); if(i%64 == 0) { printf("%d kB left",(250816-i)/2); @@ -200,13 +200,13 @@ void* main(void) } printf("Writing MBR"); - ata_write_sectors(IF_MV2(0,) 0,1,mbr); + storage_write_sectors(IF_MV2(0,) 0,1,mbr); printf("Writing FAT bootsector"); - ata_write_sectors(IF_MV2(0,) 1023,1,fat); + storage_write_sectors(IF_MV2(0,) 1023,1,fat); printf("Writing more FAT"); - ata_write_sectors(IF_MV2(0,) 1024,1,backupfat); + storage_write_sectors(IF_MV2(0,) 1024,1,backupfat); printf("Writing more FAT"); - ata_write_sectors(IF_MV2(0,) 1264,1,backupfat); + storage_write_sectors(IF_MV2(0,) 1264,1,backupfat); if (button_hold()) printf("Release Hold and"); diff --git a/bootloader/main-c250wipe.c b/bootloader/main-c250wipe.c index fedabb7275..06a0a5b2b5 100644 --- a/bootloader/main-c250wipe.c +++ b/bootloader/main-c250wipe.c @@ -29,7 +29,7 @@ #include "kernel.h" #include "lcd.h" #include "font.h" -#include "ata.h" +#include "storage.h" #include "button.h" #include "disk.h" #include "crc32-mi4.h" @@ -250,14 +250,14 @@ void* main(void) printf(""); - i=ata_init(); + i=storage_init(); disk_init(IF_MV(0)); memset(zero,0,16*1024); printf("Zeroing flash"); for(i=0;i<250816;i++) { - ata_write_sectors(IF_MV2(0,) i*32,32,zero); + storage_write_sectors(IF_MV2(0,) i*32,32,zero); if(i%64 == 0) { printf("%d kB left",(250816-i)/2); @@ -265,15 +265,15 @@ void* main(void) } printf("Writing MBR"); - ata_write_sectors(IF_MV2(0,) 0,1,mbr); + storage_write_sectors(IF_MV2(0,) 0,1,mbr); printf("Writing FAT bootsector"); - ata_write_sectors(IF_MV2(0,) 1017,2,bootsector); + storage_write_sectors(IF_MV2(0,) 1017,2,bootsector); printf("Writing more FAT"); - ata_write_sectors(IF_MV2(0,) 1023,1,fat); + storage_write_sectors(IF_MV2(0,) 1023,1,fat); printf("Writing more FAT"); - ata_write_sectors(IF_MV2(0,) 1049,1,backupfat); + storage_write_sectors(IF_MV2(0,) 1049,1,backupfat); printf("Writing more FAT"); - ata_write_sectors(IF_MV2(0,) 4920,1,backupfat); + storage_write_sectors(IF_MV2(0,) 4920,1,backupfat); if (button_hold()) printf("Release Hold and"); diff --git a/bootloader/main-e200r-installer.c b/bootloader/main-e200r-installer.c index b1209e1692..3ac57432a3 100644 --- a/bootloader/main-e200r-installer.c +++ b/bootloader/main-e200r-installer.c @@ -31,7 +31,7 @@ #include "kernel.h" #include "lcd.h" #include "font.h" -#include "ata.h" +#include "storage.h" #include "button.h" #include "disk.h" #include "crc32-mi4.h" @@ -120,7 +120,7 @@ void* main(void) printf(MODEL_NAME); printf(""); - i=ata_init(); + i=storage_init(); disk_init(IF_MV(0)); num_partitions = disk_mount_all(); @@ -139,7 +139,7 @@ void* main(void) printf("reading: %x", (START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK)*512); #endif - ata_read_sectors(IF_MV2(0,) + storage_read_sectors(IF_MV2(0,) pinfo->start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK, 1 , sector); crc32 = chksum_crc32 (sector, 512); @@ -161,7 +161,7 @@ void* main(void) /* E200R bootloader detected - patch it */ memcpy(§or[HACK_OFFSET], changedBytes, sizeof(changedBytes)/sizeof(*changedBytes)); - ata_write_sectors(IF_MV2(0,) + storage_write_sectors(IF_MV2(0,) pinfo->start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK, 1 , sector); printf("Firmware unlocked"); diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index c1aad5ce11..09e1c23ed8 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c @@ -30,7 +30,7 @@ #include "kernel.h" #include "lcd.h" #include "font.h" -#include "ata.h" +#include "storage.h" #include "adc.h" #include "button.h" #include "disk.h" @@ -371,7 +371,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, unsigned long sum; /* Read header to find out how long the mi4 file is. */ - ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET, + storage_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET, PPMI_SECTORS, &ppmi_header); /* The first four characters at 0x80000 (sector 1024) should be PPMI*/ @@ -381,7 +381,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, printf("BL mi4 size: %x", ppmi_header.length); /* Read mi4 header of the OF */ - ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS + storage_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS + (ppmi_header.length/512), MI4_HEADER_SECTORS, &mi4header); /* We don't support encrypted mi4 files yet */ @@ -404,7 +404,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, printf("Binary type: %.4s", mi4header.type); /* Load firmware */ - ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS + storage_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS + (ppmi_header.length/512) + MI4_HEADER_SECTORS, (mi4header.mi4size-MI4_HEADER_SIZE)/512, buf); @@ -423,9 +423,9 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, printf("Disabling database rebuild"); - ata_read_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); + storage_read_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); block[0xe1] = 0; - ata_write_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); + storage_write_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); } #else (void) disable_rebuild; @@ -505,7 +505,7 @@ void* main(void) printf("Version: %s", version); printf(MODEL_NAME); - i=ata_init(); + i=storage_init(); #if !(CONFIG_STORAGE & STORAGE_SD) if (i==0) { identify_info=ata_get_identify(); @@ -601,7 +601,7 @@ void* main(void) { printf("dumping sector %d", i); } - ata_read_sectors(IF_MV2(0,) pinfo->start + i, 1, sector); + storage_read_sectors(IF_MV2(0,) pinfo->start + i, 1, sector); write(fd,sector,512); } close(fd); diff --git a/bootloader/meizu_m3.c b/bootloader/meizu_m3.c index acd07d7c66..940e7ea876 100644 --- a/bootloader/meizu_m3.c +++ b/bootloader/meizu_m3.c @@ -29,7 +29,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" diff --git a/bootloader/meizu_m6sl.c b/bootloader/meizu_m6sl.c index 86c4c5731e..0b335bec8a 100644 --- a/bootloader/meizu_m6sl.c +++ b/bootloader/meizu_m6sl.c @@ -29,7 +29,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" diff --git a/bootloader/meizu_m6sp.c b/bootloader/meizu_m6sp.c index 7608c9bd30..63ade2dbe8 100644 --- a/bootloader/meizu_m6sp.c +++ b/bootloader/meizu_m6sp.c @@ -29,7 +29,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index 8389d11b4b..f92ff4bf84 100644 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c @@ -26,7 +26,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" @@ -229,13 +229,13 @@ void main(void) lcd_update(); ide_power_enable(true); - ata_enable(false); + storage_enable(false); sleep(HZ/20); usb_enable(true); while (usb_detect() == USB_INSERTED) { - ata_spin(); /* Prevent the drive from spinning down */ + storage_spin(); /* Prevent the drive from spinning down */ sleep(HZ); } @@ -248,7 +248,7 @@ void main(void) mrdebug(); #endif printf("ATA"); - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/ondavx747.c b/bootloader/ondavx747.c index d8fefd4f48..13c537b9be 100644 --- a/bootloader/ondavx747.c +++ b/bootloader/ondavx747.c @@ -54,7 +54,7 @@ int main(void) backlight_init(); - ata_init(); + storage_init(); int touch, btn; char datetime[30]; diff --git a/bootloader/sansa_as3525.c b/bootloader/sansa_as3525.c index df6f789135..aa4d6a9057 100644 --- a/bootloader/sansa_as3525.c +++ b/bootloader/sansa_as3525.c @@ -30,7 +30,7 @@ #include "backlight-target.h" #include "as3525-codec.h" #include "common.h" -#include "ata.h" +#include "storage.h" int show_logo(void); void main(void) @@ -54,7 +54,7 @@ void main(void) } printf("ID: %02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); - ata_init(); + storage_init(); #ifdef SANSA_CLIP /* Use hardware scrolling */ diff --git a/bootloader/telechips.c b/bootloader/telechips.c index 7e00e52142..4d64532449 100644 --- a/bootloader/telechips.c +++ b/bootloader/telechips.c @@ -30,7 +30,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" @@ -206,7 +206,7 @@ void* main(void) printf("Version %s", version); printf("ATA"); - rc = ata_init(); + rc = storage_init(); if(rc) { reset_screen(); diff --git a/bootloader/tpj1022.c b/bootloader/tpj1022.c index 62929cf1aa..aaf6e9fcfd 100644 --- a/bootloader/tpj1022.c +++ b/bootloader/tpj1022.c @@ -30,7 +30,7 @@ #include "lcd.h" #include "kernel.h" #include "thread.h" -#include "ata.h" +#include "storage.h" #include "fat.h" #include "disk.h" #include "font.h" @@ -58,7 +58,7 @@ void* main(void) printf("Hello World!"); #endif - i=ata_init(); + i=storage_init(); disk_init(); rc = disk_mount_all(); -- cgit v1.2.3