diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 26b9f18824..4620adaaec 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -370,26 +370,6 @@ bool dbg_audio_thread(void) | |||
370 | #endif /* HAVE_LCD_BITMAP */ | 370 | #endif /* HAVE_LCD_BITMAP */ |
371 | 371 | ||
372 | 372 | ||
373 | #if CONFIG_CPU == TCC730 | ||
374 | static unsigned flash_word_temp IDATA_ATTR; | ||
375 | |||
376 | static void flash_write_word(unsigned addr, unsigned value) ICODE_ATTR; | ||
377 | static void flash_write_word(unsigned addr, unsigned value) { | ||
378 | flash_word_temp = value; | ||
379 | |||
380 | long extAddr = (long)addr << 1; | ||
381 | ddma_transfer(1, 1, &flash_word_temp, extAddr, 2); | ||
382 | } | ||
383 | |||
384 | static unsigned flash_read_word(unsigned addr) ICODE_ATTR; | ||
385 | static unsigned flash_read_word(unsigned addr) { | ||
386 | long extAddr = (long)addr << 1; | ||
387 | ddma_transfer(1, 1, &flash_word_temp, extAddr, 2); | ||
388 | return flash_word_temp; | ||
389 | } | ||
390 | |||
391 | #endif | ||
392 | |||
393 | #ifndef SIMULATOR | 373 | #ifndef SIMULATOR |
394 | /* Tool function to read the flash manufacturer and type, if available. | 374 | /* Tool function to read the flash manufacturer and type, if available. |
395 | Only chips which could be reprogrammed in system will return values. | 375 | Only chips which could be reprogrammed in system will return values. |
@@ -423,37 +403,30 @@ bool dbg_flash_id(unsigned* p_manufacturer, unsigned* p_device, | |||
423 | #else | 403 | #else |
424 | unsigned not_manu, not_id; /* read values before switching to ID mode */ | 404 | unsigned not_manu, not_id; /* read values before switching to ID mode */ |
425 | unsigned manu, id; /* read values when in ID mode */ | 405 | unsigned manu, id; /* read values when in ID mode */ |
426 | #if CONFIG_CPU == TCC730 | ||
427 | #define FLASH(addr) (flash_read_word(addr)) | ||
428 | #define SET_FLASH(addr, val) (flash_write_word((addr), (val))) | ||
429 | 406 | ||
430 | #else /* memory mapped */ | ||
431 | #if CONFIG_CPU == SH7034 | 407 | #if CONFIG_CPU == SH7034 |
432 | volatile unsigned char* flash = (unsigned char*)0x2000000; /* flash mapping */ | 408 | volatile unsigned char* flash = (unsigned char*)0x2000000; /* flash mapping */ |
433 | #elif defined(CPU_COLDFIRE) | 409 | #elif defined(CPU_COLDFIRE) |
434 | volatile unsigned short* flash = (unsigned short*)0; /* flash mapping */ | 410 | volatile unsigned short* flash = (unsigned short*)0; /* flash mapping */ |
435 | #endif | 411 | #endif |
436 | #define FLASH(addr) (flash[addr]) | ||
437 | #define SET_FLASH(addr, val) (flash[addr] = val) | ||
438 | #endif | ||
439 | int old_level; /* saved interrupt level */ | 412 | int old_level; /* saved interrupt level */ |
440 | 413 | ||
441 | not_manu = FLASH(0); /* read the normal content */ | 414 | not_manu = flash[0]; /* read the normal content */ |
442 | not_id = FLASH(1); /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */ | 415 | not_id = flash[1]; /* should be 'A' (0x41) and 'R' (0x52) from the "ARCH" marker */ |
443 | 416 | ||
444 | /* disable interrupts, prevent any stray flash access */ | 417 | /* disable interrupts, prevent any stray flash access */ |
445 | old_level = set_irq_level(HIGHEST_IRQ_LEVEL); | 418 | old_level = set_irq_level(HIGHEST_IRQ_LEVEL); |
446 | 419 | ||
447 | SET_FLASH(addr1, 0xAA); /* enter command mode */ | 420 | flash[addr1] = 0xAA; /* enter command mode */ |
448 | SET_FLASH(addr2, 0x55); | 421 | flash[addr2] = 0x55; |
449 | SET_FLASH(addr1, 0x90); /* ID command */ | 422 | flash[addr1] = 0x90; /* ID command */ |
450 | /* Atmel wants 20ms pause here */ | 423 | /* Atmel wants 20ms pause here */ |
451 | /* sleep(HZ/50); no sleeping possible while interrupts are disabled */ | 424 | /* sleep(HZ/50); no sleeping possible while interrupts are disabled */ |
452 | 425 | ||
453 | manu = FLASH(0); /* read the IDs */ | 426 | manu = flash[0]; /* read the IDs */ |
454 | id = FLASH(1); | 427 | id = flash[1]; |
455 | 428 | ||
456 | SET_FLASH(0, 0xF0); /* reset flash (back to normal read mode) */ | 429 | flash[0] = 0xF0; /* reset flash (back to normal read mode) */ |
457 | /* Atmel wants 20ms pause here */ | 430 | /* Atmel wants 20ms pause here */ |
458 | /* sleep(HZ/50); no sleeping possible while interrupts are disabled */ | 431 | /* sleep(HZ/50); no sleeping possible while interrupts are disabled */ |
459 | 432 | ||