From f80505c9d0275ce56b9d03b01aa96a5ad2ac0b59 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sat, 2 Aug 2003 12:53:57 +0000 Subject: Diagnostic code added, to find init problems (charging, etc.) when flashed: the whole I/O space is saved on startup, can be dumped to a file via debug menu. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3912 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'apps/debug_menu.c') diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 6df8f2f534..91746d2e58 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -193,6 +193,7 @@ bool dbg_mpeg_thread(void) /* Tool function to calculate a CRC16 across some buffer */ unsigned short crc_16(unsigned char* buf, unsigned len) { + /* CCITT standard polynomial 0x1021 */ static const unsigned short crc16_lookup[16] = { /* lookup table for 4 bits at a time is affordable */ 0x0000, 0x1021, 0x2042, 0x3063, @@ -1324,6 +1325,30 @@ bool dbg_save_roms(void) return false; } + +/* test code, to be removed later */ +extern union /* defined in main.c */ +{ + unsigned char port8 [512]; + unsigned short port16[256]; + unsigned port32[128]; +} startup_io; + +bool dbg_save_io(void) /* dump the initial I/O space to disk */ +{ + int fd; + + fd = creat("/startup_io.bin", O_WRONLY); + if(fd >= 0) + { + write(fd, (void *)&startup_io, sizeof(startup_io)); + close(fd); + } + + return false; +} +/* end of test code */ + bool debug_menu(void) { int m; @@ -1331,6 +1356,7 @@ bool debug_menu(void) struct menu_items items[] = { { "Dump ROM contents", dbg_save_roms }, + { "Dump startup I/O", dbg_save_io }, { "View I/O ports", dbg_ports }, #ifdef HAVE_LCD_BITMAP #ifdef HAVE_RTC -- cgit v1.2.3