diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-08-15 22:54:06 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-08-15 22:54:06 +0000 |
commit | c4a59a290b81cae137f8b3c2b709c9c565701eb9 (patch) | |
tree | 9d54832f14b8fe365e427152011b62026f61e898 /apps/debug_menu.c | |
parent | 98c9f959e53536a0b63d0376fad198ef883c5c03 (diff) | |
download | rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.tar.gz rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.zip |
eeprom driver for the h3x0 series, cleaned up the h1x0 series driver a bit, added debug entry for h3x0 that allows to write to the eeprom
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10597 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 0141c77fbe..1527e8abe7 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1891,13 +1891,22 @@ bool dbg_save_roms(void) | |||
1891 | fd = creat("/internal_eeprom.bin", O_WRONLY); | 1891 | fd = creat("/internal_eeprom.bin", O_WRONLY); |
1892 | if (fd >= 0) | 1892 | if (fd >= 0) |
1893 | { | 1893 | { |
1894 | int old_irq_level; | ||
1894 | char buf[EEPROM_SIZE]; | 1895 | char buf[EEPROM_SIZE]; |
1895 | 1896 | int err; | |
1896 | if (eeprom_24cxx_read(0, buf, sizeof buf)) | 1897 | |
1897 | gui_syncsplash(HZ*3, true, "Eeprom read failure!"); | 1898 | old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); |
1899 | |||
1900 | err = eeprom_24cxx_read(0, buf, sizeof buf); | ||
1901 | if (err) | ||
1902 | gui_syncsplash(HZ*3, true, "Eeprom read failure (%d)",err); | ||
1898 | else | 1903 | else |
1904 | { | ||
1899 | write(fd, buf, sizeof buf); | 1905 | write(fd, buf, sizeof buf); |
1900 | 1906 | } | |
1907 | |||
1908 | set_irq_level(old_irq_level); | ||
1909 | |||
1901 | close(fd); | 1910 | close(fd); |
1902 | } | 1911 | } |
1903 | #endif | 1912 | #endif |
@@ -1976,6 +1985,46 @@ bool dbg_set_memory_guard(void) | |||
1976 | } | 1985 | } |
1977 | #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ | 1986 | #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ |
1978 | 1987 | ||
1988 | #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) | ||
1989 | bool dbg_write_eeprom(void) | ||
1990 | { | ||
1991 | int fd; | ||
1992 | int rc; | ||
1993 | int old_irq_level; | ||
1994 | char buf[EEPROM_SIZE]; | ||
1995 | int err; | ||
1996 | |||
1997 | fd = open("/internal_eeprom.bin", O_RDONLY); | ||
1998 | |||
1999 | if (fd >= 0) | ||
2000 | { | ||
2001 | rc = read(fd, buf, EEPROM_SIZE); | ||
2002 | |||
2003 | if(rc == EEPROM_SIZE) | ||
2004 | { | ||
2005 | old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
2006 | |||
2007 | err = eeprom_24cxx_write(0, buf, sizeof buf); | ||
2008 | if (err) | ||
2009 | gui_syncsplash(HZ*3, true, "Eeprom write failure (%d)",err); | ||
2010 | |||
2011 | set_irq_level(old_irq_level); | ||
2012 | } | ||
2013 | else | ||
2014 | { | ||
2015 | gui_syncsplash(HZ*3, true, "File read error (%d)",rc); | ||
2016 | } | ||
2017 | close(fd); | ||
2018 | } | ||
2019 | else | ||
2020 | { | ||
2021 | gui_syncsplash(HZ*3, true, "Failed to open 'internal_eeprom.bin'"); | ||
2022 | } | ||
2023 | |||
2024 | return false; | ||
2025 | } | ||
2026 | #endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */ | ||
2027 | |||
1979 | bool debug_menu(void) | 2028 | bool debug_menu(void) |
1980 | { | 2029 | { |
1981 | int m; | 2030 | int m; |
@@ -2023,6 +2072,9 @@ bool debug_menu(void) | |||
2023 | #ifdef CONFIG_TUNER | 2072 | #ifdef CONFIG_TUNER |
2024 | { "FM Radio", dbg_fm_radio }, | 2073 | { "FM Radio", dbg_fm_radio }, |
2025 | #endif | 2074 | #endif |
2075 | #if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) | ||
2076 | { "Write back EEPROM", dbg_write_eeprom }, | ||
2077 | #endif | ||
2026 | #ifdef ROCKBOX_HAS_LOGF | 2078 | #ifdef ROCKBOX_HAS_LOGF |
2027 | {"logf", logfdisplay }, | 2079 | {"logf", logfdisplay }, |
2028 | {"logfdump", logfdump }, | 2080 | {"logfdump", logfdump }, |