diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 26 |
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 */ |
194 | unsigned short crc_16(unsigned char* buf, unsigned len) | 194 | unsigned 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 */ | ||
1330 | extern union /* defined in main.c */ | ||
1331 | { | ||
1332 | unsigned char port8 [512]; | ||
1333 | unsigned short port16[256]; | ||
1334 | unsigned port32[128]; | ||
1335 | } startup_io; | ||
1336 | |||
1337 | bool 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 | |||
1327 | bool debug_menu(void) | 1352 | bool 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 |