summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2003-08-02 12:53:57 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2003-08-02 12:53:57 +0000
commitf80505c9d0275ce56b9d03b01aa96a5ad2ac0b59 (patch)
tree8447074db140cce259e8effe7f65b4cfa7a26d34 /apps/debug_menu.c
parent9513236c9454ec363392c9160f533780f924b8e9 (diff)
downloadrockbox-f80505c9d0275ce56b9d03b01aa96a5ad2ac0b59.tar.gz
rockbox-f80505c9d0275ce56b9d03b01aa96a5ad2ac0b59.zip
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
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c26
1 files changed, 26 insertions, 0 deletions
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)
193/* Tool function to calculate a CRC16 across some buffer */ 193/* Tool function to calculate a CRC16 across some buffer */
194unsigned short crc_16(unsigned char* buf, unsigned len) 194unsigned short crc_16(unsigned char* buf, unsigned len)
195{ 195{
196 /* CCITT standard polynomial 0x1021 */
196 static const unsigned short crc16_lookup[16] = 197 static const unsigned short crc16_lookup[16] =
197 { /* lookup table for 4 bits at a time is affordable */ 198 { /* lookup table for 4 bits at a time is affordable */
198 0x0000, 0x1021, 0x2042, 0x3063, 199 0x0000, 0x1021, 0x2042, 0x3063,
@@ -1324,6 +1325,30 @@ bool dbg_save_roms(void)
1324 return false; 1325 return false;
1325} 1326}
1326 1327
1328
1329/* test code, to be removed later */
1330extern union /* defined in main.c */
1331{
1332 unsigned char port8 [512];
1333 unsigned short port16[256];
1334 unsigned port32[128];
1335} startup_io;
1336
1337bool dbg_save_io(void) /* dump the initial I/O space to disk */
1338{
1339 int fd;
1340
1341 fd = creat("/startup_io.bin", O_WRONLY);
1342 if(fd >= 0)
1343 {
1344 write(fd, (void *)&startup_io, sizeof(startup_io));
1345 close(fd);
1346 }
1347
1348 return false;
1349}
1350/* end of test code */
1351
1327bool debug_menu(void) 1352bool debug_menu(void)
1328{ 1353{
1329 int m; 1354 int m;
@@ -1331,6 +1356,7 @@ bool debug_menu(void)
1331 1356
1332 struct menu_items items[] = { 1357 struct menu_items items[] = {
1333 { "Dump ROM contents", dbg_save_roms }, 1358 { "Dump ROM contents", dbg_save_roms },
1359 { "Dump startup I/O", dbg_save_io },
1334 { "View I/O ports", dbg_ports }, 1360 { "View I/O ports", dbg_ports },
1335#ifdef HAVE_LCD_BITMAP 1361#ifdef HAVE_LCD_BITMAP
1336#ifdef HAVE_RTC 1362#ifdef HAVE_RTC