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.zip rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.tar.gz rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.tar.bz2 rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.tar.xz | |
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 0141c77..1527e8a 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1891,13 +1891,22 @@ bool dbg_save_roms(void) fd = creat("/internal_eeprom.bin", O_WRONLY); if (fd >= 0) { + int old_irq_level; char buf[EEPROM_SIZE]; - - if (eeprom_24cxx_read(0, buf, sizeof buf)) - gui_syncsplash(HZ*3, true, "Eeprom read failure!"); + int err; + + old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); + + err = eeprom_24cxx_read(0, buf, sizeof buf); + if (err) + gui_syncsplash(HZ*3, true, "Eeprom read failure (%d)",err); else + { write(fd, buf, sizeof buf); - + } + + set_irq_level(old_irq_level); + close(fd); } #endif @@ -1976,6 +1985,46 @@ bool dbg_set_memory_guard(void) } #endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ +#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) +bool dbg_write_eeprom(void) +{ + int fd; + int rc; + int old_irq_level; + char buf[EEPROM_SIZE]; + int err; + + fd = open("/internal_eeprom.bin", O_RDONLY); + + if (fd >= 0) + { + rc = read(fd, buf, EEPROM_SIZE); + + if(rc == EEPROM_SIZE) + { + old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL); + + err = eeprom_24cxx_write(0, buf, sizeof buf); + if (err) + gui_syncsplash(HZ*3, true, "Eeprom write failure (%d)",err); + + set_irq_level(old_irq_level); + } + else + { + gui_syncsplash(HZ*3, true, "File read error (%d)",rc); + } + close(fd); + } + else + { + gui_syncsplash(HZ*3, true, "Failed to open 'internal_eeprom.bin'"); + } + + return false; +} +#endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */ + bool debug_menu(void) { int m; @@ -2023,6 +2072,9 @@ bool debug_menu(void) #ifdef CONFIG_TUNER { "FM Radio", dbg_fm_radio }, #endif +#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) + { "Write back EEPROM", dbg_write_eeprom }, +#endif #ifdef ROCKBOX_HAS_LOGF {"logf", logfdisplay }, {"logfdump", logfdump }, |