summaryrefslogtreecommitdiff
path: root/apps/debug_menu.c
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2003-10-29 22:10:13 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2003-10-29 22:10:13 +0000
commitd8b31814c710324b554d445b610ea26cd5d12fa4 (patch)
tree3560e150e24629a91615e8543e729e00b5c88851 /apps/debug_menu.c
parentbfe9c5b60845ab3de7fab0234fc3bdea50ec1cc4 (diff)
downloadrockbox-d8b31814c710324b554d445b610ea26cd5d12fa4.tar.gz
rockbox-d8b31814c710324b554d445b610ea26cd5d12fa4.zip
HW info: removed the V2 boot ROM crap, now gives boot ROM CRC or says no boot ROM in case of flash mirror
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3995 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r--apps/debug_menu.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index a2cda985d4..c56d4cc2c0 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -274,7 +274,8 @@ bool dbg_hw_info(void)
274 int rom_version = *(unsigned short*)0x20000fe; 274 int rom_version = *(unsigned short*)0x20000fe;
275 unsigned manu, id; /* flash IDs */ 275 unsigned manu, id; /* flash IDs */
276 bool got_id; /* flag if we managed to get the flash IDs */ 276 bool got_id; /* flag if we managed to get the flash IDs */
277 unsigned rom_crc; /* CRC16 of the boot ROM */ 277 unsigned rom_crc = 0xFFFF; /* CRC16 of the boot ROM */
278 bool has_bootrom; /* flag for boot ROM present */
278 279
279 if(PADR & 0x400) 280 if(PADR & 0x400)
280 usb_polarity = 0; /* Negative */ 281 usb_polarity = 0; /* Negative */
@@ -291,8 +292,13 @@ bool dbg_hw_info(void)
291 if (!got_id) 292 if (!got_id)
292 got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */ 293 got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */
293 294
294 /* calculate CRC16 checksum of boot ROM */ 295 /* check if the boot ROM area is a flash mirror */
295 rom_crc = crc_16((unsigned char*)0x0000, 64*1024); 296 has_bootrom = (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
297 if (has_bootrom) /* if ROM and Flash different */
298 {
299 /* calculate CRC16 checksum of boot ROM */
300 rom_crc = crc_16((unsigned char*)0x0000, 64*1024);
301 }
296 302
297 lcd_setmargins(0, 0); 303 lcd_setmargins(0, 0);
298 lcd_setfont(FONT_SYSFIXED); 304 lcd_setfont(FONT_SYSFIXED);
@@ -322,11 +328,16 @@ bool dbg_hw_info(void)
322 snprintf(buf, 32, "Flash: M=?? D=??"); /* unknown, sorry */ 328 snprintf(buf, 32, "Flash: M=?? D=??"); /* unknown, sorry */
323 lcd_puts(0, 6, buf); 329 lcd_puts(0, 6, buf);
324 330
325 snprintf(buf, 32-3, "ROM CRC: 0x%04x", rom_crc); 331 if (has_bootrom)
326 if (rom_crc == 0x222F) /* Version 1 */ 332 {
327 strcat(buf, " V1"); 333 snprintf(buf, 32-3, "ROM CRC: 0x%04x", rom_crc);
328 else if (rom_crc == 0x8C1E) /* Version 2 */ 334 if (rom_crc == 0x222F) /* known Version 1 */
329 strcat(buf, " V2"); 335 strcat(buf, " V1");
336 }
337 else
338 {
339 snprintf(buf, 32, "Boot ROM: none");
340 }
330 lcd_puts(0, 7, buf); 341 lcd_puts(0, 7, buf);
331 342
332 lcd_update(); 343 lcd_update();
@@ -351,7 +362,8 @@ bool dbg_hw_info(void)
351 int rom_version = *(unsigned short*)0x20000fe; 362 int rom_version = *(unsigned short*)0x20000fe;
352 unsigned manu, id; /* flash IDs */ 363 unsigned manu, id; /* flash IDs */
353 bool got_id; /* flag if we managed to get the flash IDs */ 364 bool got_id; /* flag if we managed to get the flash IDs */
354 unsigned rom_crc; /* CRC16 of the boot ROM */ 365 unsigned rom_crc = 0xFFFF; /* CRC16 of the boot ROM */
366 bool has_bootrom; /* flag for boot ROM present */
355 367
356 if(PADR & 0x400) 368 if(PADR & 0x400)
357 usb_polarity = 0; /* Negative */ 369 usb_polarity = 0; /* Negative */
@@ -363,8 +375,13 @@ bool dbg_hw_info(void)
363 if (!got_id) 375 if (!got_id)
364 got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */ 376 got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */
365 377
366 /* calculate CRC16 checksum of boot ROM */ 378 /* check if the boot ROM area is a flash mirror */
367 rom_crc = crc_16((unsigned char*)0x0000, 64*1024); 379 has_bootrom = (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0);
380 if (has_bootrom) /* if ROM and Flash different */
381 {
382 /* calculate CRC16 checksum of boot ROM */
383 rom_crc = crc_16((unsigned char*)0x0000, 64*1024);
384 }
368 385
369 lcd_clear_display(); 386 lcd_clear_display();
370 387
@@ -395,7 +412,10 @@ bool dbg_hw_info(void)
395 snprintf(buf, 32, "Flash:??,??"); /* unknown, sorry */ 412 snprintf(buf, 32, "Flash:??,??"); /* unknown, sorry */
396 break; 413 break;
397 case 5: 414 case 5:
398 snprintf(buf, 32, "ROM CRC:%04x", rom_crc); 415 if (has_bootrom)
416 snprintf(buf, 32, "RomCRC:%04x", rom_crc);
417 else
418 snprintf(buf, 32, "BootROM: no");
399 } 419 }
400 420
401 lcd_puts(0, 1, buf); 421 lcd_puts(0, 1, buf);