summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
commit2f8a0081c64534da23fc0fa9cc685eb7454fd9c9 (patch)
tree84dbdbd5326cb48f43d2ebd5a4c86e992c1d5288 /apps/debug_menu.c
parent646cac0bde7b11fa7bcb670d1d76eec78e360485 (diff)
downloadrockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.tar.gz
rockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.zip
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
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 26534cc101..b6038e7c89 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -59,13 +59,16 @@
59#include "power.h" 59#include "power.h"
60#include "usb.h" 60#include "usb.h"
61#include "rtc.h" 61#include "rtc.h"
62#include "ata.h" 62#include "storage.h"
63#include "fat.h" 63#include "fat.h"
64#include "mas.h" 64#include "mas.h"
65#include "eeprom_24cxx.h" 65#include "eeprom_24cxx.h"
66#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 66#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
67#include "hotswap.h" 67#include "hotswap.h"
68#endif 68#endif
69#if (CONFIG_STORAGE & STORAGE_ATA)
70#include "ata.h"
71#endif
69#if CONFIG_TUNER 72#if CONFIG_TUNER
70#include "tuner.h" 73#include "tuner.h"
71#include "radio.h" 74#include "radio.h"
@@ -1731,11 +1734,13 @@ static bool view_battery(void)
1731 1734
1732#ifndef SIMULATOR 1735#ifndef SIMULATOR
1733#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) 1736#if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD)
1737
1734#if (CONFIG_STORAGE & STORAGE_MMC) 1738#if (CONFIG_STORAGE & STORAGE_MMC)
1735#define CARDTYPE "MMC" 1739#define CARDTYPE "MMC"
1736#else 1740#elif (CONFIG_STORAGE & STORAGE_SD)
1737#define CARDTYPE "microSD" 1741#define CARDTYPE "microSD"
1738#endif 1742#endif
1743
1739static int disk_callback(int btn, struct gui_synclist *lists) 1744static int disk_callback(int btn, struct gui_synclist *lists)
1740{ 1745{
1741 tCardInfo *card; 1746 tCardInfo *card;
@@ -1826,7 +1831,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1826 } 1831 }
1827 return btn; 1832 return btn;
1828} 1833}
1829#else /* !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) */ 1834#elif (CONFIG_STORAGE & STORAGE_ATA)
1830static int disk_callback(int btn, struct gui_synclist *lists) 1835static int disk_callback(int btn, struct gui_synclist *lists)
1831{ 1836{
1832 (void)lists; 1837 (void)lists;
@@ -1860,7 +1865,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1860 simplelist_addline(SIMPLELIST_ADD_LINE, 1865 simplelist_addline(SIMPLELIST_ADD_LINE,
1861 "Free: %ld MB", free / 1024); 1866 "Free: %ld MB", free / 1024);
1862 simplelist_addline(SIMPLELIST_ADD_LINE, 1867 simplelist_addline(SIMPLELIST_ADD_LINE,
1863 "Spinup time: %d ms", ata_spinup_time * (1000/HZ)); 1868 "Spinup time: %d ms", storage_spinup_time() * (1000/HZ));
1864 i = identify_info[83] & (1<<3); 1869 i = identify_info[83] & (1<<3);
1865 simplelist_addline(SIMPLELIST_ADD_LINE, 1870 simplelist_addline(SIMPLELIST_ADD_LINE,
1866 "Power mgmt: %s", i ? "enabled" : "unsupported"); 1871 "Power mgmt: %s", i ? "enabled" : "unsupported");
@@ -1945,7 +1950,29 @@ static int disk_callback(int btn, struct gui_synclist *lists)
1945 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0))); 1950 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
1946 return btn; 1951 return btn;
1947} 1952}
1953#else /* No SD, MMC or ATA */
1954static int disk_callback(int btn, struct gui_synclist *lists)
1955{
1956 (void)btn;
1957 (void)lists;
1958 struct storage_info info;
1959 storage_get_info(IF_MV2(0,)&info);
1960 simplelist_addline(SIMPLELIST_ADD_LINE, "Vendor: %s", info.vendor);
1961 simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", info.product);
1962 simplelist_addline(SIMPLELIST_ADD_LINE, "Firmware: %s", info.revision);
1963 simplelist_addline(SIMPLELIST_ADD_LINE,
1964 "Size: %ld MB", info.num_sectors*(info.sector_size/512)/2024);
1965 unsigned long free;
1966 fat_size( IF_MV2(0,) NULL, &free );
1967 simplelist_addline(SIMPLELIST_ADD_LINE,
1968 "Free: %ld MB", free / 1024);
1969 simplelist_addline(SIMPLELIST_ADD_LINE,
1970 "Cluster size: %d bytes", fat_get_cluster_size(IF_MV(0)));
1971 return btn;
1972}
1973#endif
1948 1974
1975#if (CONFIG_STORAGE & STORAGE_ATA)
1949static bool dbg_identify_info(void) 1976static bool dbg_identify_info(void)
1950{ 1977{
1951 int fd = creat("/identify_info.bin"); 1978 int fd = creat("/identify_info.bin");
@@ -1960,7 +1987,7 @@ static bool dbg_identify_info(void)
1960 } 1987 }
1961 return false; 1988 return false;
1962} 1989}
1963#endif /* !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) */ 1990#endif
1964 1991
1965static bool dbg_disk_info(void) 1992static bool dbg_disk_info(void)
1966{ 1993{
@@ -2504,7 +2531,7 @@ static const struct the_menu_item menuitems[] = {
2504#endif 2531#endif
2505#ifndef SIMULATOR 2532#ifndef SIMULATOR
2506 { "View disk info", dbg_disk_info }, 2533 { "View disk info", dbg_disk_info },
2507#if !(CONFIG_STORAGE & STORAGE_MMC) && !(CONFIG_STORAGE & STORAGE_SD) 2534#if (CONFIG_STORAGE & STORAGE_ATA)
2508 { "Dump ATA identify info", dbg_identify_info}, 2535 { "Dump ATA identify info", dbg_identify_info},
2509#endif 2536#endif
2510#endif 2537#endif