2008-11-10 11:04:43 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright © 2008 Rafaël Carré
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "debug-target.h"
|
2009-01-27 11:05:38 +00:00
|
|
|
#include "button.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "sprintf.h"
|
2009-01-27 19:45:00 +00:00
|
|
|
#include "cpu.h"
|
2009-05-19 14:43:37 +00:00
|
|
|
#include "pl180.h"
|
2009-06-30 17:56:21 +00:00
|
|
|
#include "ascodec-target.h"
|
2009-07-12 14:12:45 +00:00
|
|
|
#include "adc.h"
|
2009-12-01 20:12:25 +00:00
|
|
|
#include "storage.h"
|
2009-01-27 11:05:38 +00:00
|
|
|
|
2009-03-14 17:17:27 +00:00
|
|
|
#define ON "Enabled"
|
2009-05-19 14:43:37 +00:00
|
|
|
#define OFF "Disabled"
|
2009-03-14 17:17:27 +00:00
|
|
|
|
|
|
|
#define CP15_MMU (1<<0) /* mmu off/on */
|
|
|
|
#define CP15_DC (1<<2) /* dcache off/on */
|
|
|
|
#define CP15_IC (1<<12) /* icache off/on */
|
|
|
|
|
2009-05-19 14:43:37 +00:00
|
|
|
#define CLK_MAIN 24000000 /* 24 MHz */
|
|
|
|
|
|
|
|
#define CLK_PLLA 0
|
|
|
|
#define CLK_PLLB 1
|
2010-03-11 19:01:49 +00:00
|
|
|
#define CLK_PROC 2
|
2009-05-19 14:43:37 +00:00
|
|
|
#define CLK_FCLK 3
|
|
|
|
#define CLK_EXTMEM 4
|
|
|
|
#define CLK_PCLK 5
|
|
|
|
#define CLK_IDE 6
|
|
|
|
#define CLK_I2C 7
|
|
|
|
#define CLK_I2SI 8
|
|
|
|
#define CLK_I2SO 9
|
|
|
|
#define CLK_DBOP 10
|
2009-12-01 20:12:25 +00:00
|
|
|
#define CLK_SD_MCLK_NAND 11
|
|
|
|
#define CLK_SD_MCLK_MSD 12
|
2009-05-19 14:43:37 +00:00
|
|
|
#define CLK_USB 13
|
|
|
|
|
|
|
|
#define I2C2_CPSR0 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x1C))
|
|
|
|
#define I2C2_CPSR1 *((volatile unsigned int *)(I2C_AUDIO_BASE + 0x20))
|
|
|
|
#define MCI_NAND *((volatile unsigned long *)(NAND_FLASH_BASE + 0x04))
|
|
|
|
#define MCI_SD *((volatile unsigned long *)(SD_MCI_BASE + 0x04))
|
|
|
|
|
2009-12-01 21:23:11 +00:00
|
|
|
extern bool sd_enabled;
|
2009-05-19 14:43:37 +00:00
|
|
|
|
2009-02-17 02:36:48 +00:00
|
|
|
/* FIXME: target tree is including ./debug-target.h rather than the one in
|
|
|
|
* sansa-fuze/, even though deps contains the correct one
|
|
|
|
* if I put the below into a sansa-fuze/debug-target.h, it doesn't work*/
|
2009-06-18 15:05:59 +00:00
|
|
|
#if defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_C200V2)
|
2009-02-17 02:36:48 +00:00
|
|
|
#define DEBUG_DBOP
|
2010-01-06 23:41:36 +00:00
|
|
|
#include "dbop-as3525.h"
|
2009-02-17 02:36:48 +00:00
|
|
|
#endif
|
|
|
|
|
2009-06-23 13:54:05 +00:00
|
|
|
static inline unsigned read_cp15 (void)
|
2009-03-14 17:17:27 +00:00
|
|
|
{
|
2009-06-23 13:54:05 +00:00
|
|
|
unsigned cp15_value;
|
2009-03-14 17:17:27 +00:00
|
|
|
asm volatile (
|
2009-06-23 13:54:05 +00:00
|
|
|
"mrc p15, 0, %0, c1, c0, 0 @ read control reg\n" : "=r"(cp15_value));
|
|
|
|
return (cp15_value);
|
2009-03-14 17:17:27 +00:00
|
|
|
}
|
2008-11-10 11:04:43 +00:00
|
|
|
|
2009-12-20 16:28:15 +00:00
|
|
|
static int calc_freq(int clk)
|
2009-05-19 14:43:37 +00:00
|
|
|
{
|
2009-05-29 06:43:37 +00:00
|
|
|
unsigned int prediv = ((unsigned int)CGU_PROC>>2) & 0x3;
|
|
|
|
unsigned int postdiv = ((unsigned int)CGU_PROC>>4) & 0xf;
|
2010-03-11 19:01:49 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
|
|
|
int out_div;
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
switch(clk) {
|
|
|
|
/* clk_main = clk_int = 24MHz oscillator */
|
|
|
|
case CLK_PLLA:
|
|
|
|
if(CGU_PLLASUP & (1<<3))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*assume 24MHz oscillator only input available */
|
2009-09-12 20:50:11 +00:00
|
|
|
out_div = ((CGU_PLLA>>13) & 0x3); /* bits 13:14 */
|
|
|
|
if (out_div == 3) /* for 11 NO=4 */
|
2009-05-19 14:43:37 +00:00
|
|
|
out_div=4;
|
2009-09-12 20:50:11 +00:00
|
|
|
if(out_div) /* NO = 0 not allowed */
|
2009-05-19 14:43:37 +00:00
|
|
|
return ((2 * (CGU_PLLA & 0xff))*CLK_MAIN)/
|
2009-09-12 20:50:11 +00:00
|
|
|
(((CGU_PLLA>>8) & 0x1f)*out_div);
|
2009-05-19 14:43:37 +00:00
|
|
|
return 0;
|
|
|
|
case CLK_PLLB:
|
|
|
|
if(CGU_PLLBSUP & (1<<3))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/*assume 24MHz oscillator only input available */
|
2009-09-12 20:50:11 +00:00
|
|
|
out_div = ((CGU_PLLB>>13) & 0x3); /* bits 13:14 */
|
|
|
|
if (out_div == 3) /* for 11 NO=4 */
|
2009-05-19 14:43:37 +00:00
|
|
|
out_div=4;
|
2009-09-12 20:50:11 +00:00
|
|
|
if(out_div) /* NO = 0 not allowed */
|
2009-05-19 14:43:37 +00:00
|
|
|
return ((2 * (CGU_PLLB & 0xff))*CLK_MAIN)/
|
2009-09-12 20:50:11 +00:00
|
|
|
(((CGU_PLLB>>8) & 0x1f)*out_div);
|
2009-05-19 14:43:37 +00:00
|
|
|
return 0;
|
2010-03-11 19:01:49 +00:00
|
|
|
#else
|
|
|
|
/* AS3525v2 */
|
|
|
|
switch(clk) {
|
|
|
|
/* we're using a known setting for PLLA = 240 MHz and PLLB inop */
|
|
|
|
case CLK_PLLA:
|
|
|
|
return 240000000;
|
|
|
|
|
|
|
|
case CLK_PLLB:
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
case CLK_PROC:
|
2010-04-01 04:37:17 +00:00
|
|
|
#if CONFIG_CPU == AS3525 /* not in arm926-ejs */
|
2009-05-19 14:43:37 +00:00
|
|
|
if (!(read_cp15()>>30)) /* fastbus */
|
|
|
|
return calc_freq(CLK_PCLK);
|
|
|
|
else /* Synch or Asynch bus*/
|
2010-04-01 04:37:17 +00:00
|
|
|
#endif /* CONFIG_CPU == AS3525 */
|
2009-05-19 14:43:37 +00:00
|
|
|
return calc_freq(CLK_FCLK);
|
|
|
|
case CLK_FCLK:
|
|
|
|
switch(CGU_PROC & 3) {
|
|
|
|
case 0:
|
2009-09-12 20:50:11 +00:00
|
|
|
return (CLK_MAIN * (8 - prediv)) / (8 * (postdiv + 1));
|
2009-05-19 14:43:37 +00:00
|
|
|
case 1:
|
2009-09-12 20:50:11 +00:00
|
|
|
return (calc_freq(CLK_PLLA) * (8 - prediv)) /
|
|
|
|
(8 * (postdiv + 1));
|
2009-05-19 14:43:37 +00:00
|
|
|
case 2:
|
2009-09-12 20:50:11 +00:00
|
|
|
return (calc_freq(CLK_PLLB) * (8 - prediv)) /
|
|
|
|
(8 * (postdiv + 1));
|
2009-05-19 14:43:37 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
case CLK_EXTMEM:
|
2010-04-01 06:05:24 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
2009-05-19 14:43:37 +00:00
|
|
|
switch(CGU_PERI & 3) {
|
2010-04-01 06:05:24 +00:00
|
|
|
#else
|
2010-04-05 15:22:36 +00:00
|
|
|
/* bits 1:0 of CGU_PERI always read as 0 and source = FCLK */
|
|
|
|
switch(3) {
|
2010-04-01 06:05:24 +00:00
|
|
|
#endif
|
2009-05-19 14:43:37 +00:00
|
|
|
case 0:
|
2009-05-26 18:44:02 +00:00
|
|
|
return CLK_MAIN/(((CGU_PERI>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case 1:
|
2009-05-26 18:44:02 +00:00
|
|
|
return calc_freq(CLK_PLLA)/(((CGU_PERI>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case 2:
|
2009-05-26 18:44:02 +00:00
|
|
|
return calc_freq(CLK_PLLB)/(((CGU_PERI>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case 3:
|
|
|
|
default:
|
2010-04-01 06:05:24 +00:00
|
|
|
return calc_freq(CLK_FCLK)/(((CGU_PERI>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
}
|
|
|
|
case CLK_PCLK:
|
2009-05-26 18:44:02 +00:00
|
|
|
return calc_freq(CLK_EXTMEM)/(((CGU_PERI>>6)& 0x1)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case CLK_IDE:
|
|
|
|
switch(CGU_IDE & 3) {
|
|
|
|
case 0:
|
2009-05-26 18:44:02 +00:00
|
|
|
return CLK_MAIN/(((CGU_IDE>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case 1:
|
2009-05-26 18:44:02 +00:00
|
|
|
return calc_freq(CLK_PLLA)/(((CGU_IDE>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
case 2:
|
2009-05-26 18:44:02 +00:00
|
|
|
return calc_freq(CLK_PLLB)/(((CGU_IDE>>2)& 0xf)+1);
|
2009-05-19 14:43:37 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
case CLK_I2C:
|
2010-03-23 09:22:03 +00:00
|
|
|
return calc_freq(CLK_PCLK)/AS3525_I2C_PRESCALER;
|
2009-05-19 14:43:37 +00:00
|
|
|
case CLK_I2SI:
|
|
|
|
switch((CGU_AUDIO>>12) & 3) {
|
|
|
|
case 0:
|
|
|
|
return CLK_MAIN/(((CGU_AUDIO>>14) & 0x1ff)+1);
|
|
|
|
case 1:
|
|
|
|
return calc_freq(CLK_PLLA)/(((CGU_AUDIO>>14) & 0x1ff)+1);
|
|
|
|
case 2:
|
|
|
|
return calc_freq(CLK_PLLB)/(((CGU_AUDIO>>14) & 0x1ff)+1);
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
case CLK_I2SO:
|
|
|
|
switch(CGU_AUDIO & 3) {
|
|
|
|
case 0:
|
|
|
|
return CLK_MAIN/(((CGU_AUDIO>>2) & 0x1ff)+1);
|
|
|
|
case 1:
|
|
|
|
return calc_freq(CLK_PLLA)/(((CGU_AUDIO>>2) & 0x1ff)+1);
|
|
|
|
case 2:
|
|
|
|
return calc_freq(CLK_PLLB)/(((CGU_AUDIO>>2) & 0x1ff)+1);
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
case CLK_DBOP:
|
|
|
|
return calc_freq(CLK_PCLK)/((CGU_DBOP & 7)+1);
|
2010-03-11 19:01:49 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
2009-09-12 20:50:11 +00:00
|
|
|
case CLK_SD_MCLK_NAND:
|
2009-05-21 17:35:56 +00:00
|
|
|
if(!(MCI_NAND & (1<<8)))
|
|
|
|
return 0;
|
|
|
|
else if(MCI_NAND & (1<<10))
|
2009-12-11 04:53:22 +00:00
|
|
|
return calc_freq(CLK_IDE);
|
2009-05-21 17:35:56 +00:00
|
|
|
else
|
2009-12-11 04:53:22 +00:00
|
|
|
return calc_freq(CLK_IDE)/(((MCI_NAND & 0xff)+1)*2);
|
2009-09-12 20:50:11 +00:00
|
|
|
case CLK_SD_MCLK_MSD:
|
2009-05-21 17:35:56 +00:00
|
|
|
if(!(MCI_SD & (1<<8)))
|
|
|
|
return 0;
|
|
|
|
else if(MCI_SD & (1<<10))
|
|
|
|
return calc_freq(CLK_PCLK);
|
|
|
|
else
|
2009-09-12 20:50:11 +00:00
|
|
|
return calc_freq(CLK_PCLK)/(((MCI_SD & 0xff)+1)*2);
|
2010-03-11 19:01:49 +00:00
|
|
|
#endif
|
2009-05-19 14:43:37 +00:00
|
|
|
case CLK_USB:
|
|
|
|
switch(CGU_USB & 3) { /* 0-> div=1 other->div=1/(2*n) */
|
|
|
|
case 0:
|
2010-03-29 17:12:16 +00:00
|
|
|
if (!((CGU_USB>>2) & 0x7))
|
2009-05-19 14:43:37 +00:00
|
|
|
return CLK_MAIN;
|
|
|
|
else
|
2010-03-29 17:12:16 +00:00
|
|
|
return CLK_MAIN/(2*((CGU_USB>>2) & 0x7));
|
2009-05-19 14:43:37 +00:00
|
|
|
case 1:
|
2010-03-29 17:12:16 +00:00
|
|
|
if (!((CGU_USB>>2) & 0x7))
|
2009-05-19 14:43:37 +00:00
|
|
|
return calc_freq(CLK_PLLA);
|
|
|
|
else
|
2010-03-29 17:12:16 +00:00
|
|
|
return calc_freq(CLK_PLLA)/(2*((CGU_USB>>2) & 0x7));
|
2009-05-19 14:43:37 +00:00
|
|
|
case 2:
|
2010-03-29 17:12:16 +00:00
|
|
|
if (!((CGU_USB>>2) & 0x7))
|
2009-05-19 14:43:37 +00:00
|
|
|
return calc_freq(CLK_PLLB);
|
|
|
|
else
|
2010-03-29 17:12:16 +00:00
|
|
|
return calc_freq(CLK_PLLB)/(2*((CGU_USB>>2) & 0x7));
|
2009-05-19 14:43:37 +00:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-27 11:05:38 +00:00
|
|
|
bool __dbg_hw_info(void)
|
2008-11-10 11:04:43 +00:00
|
|
|
{
|
2009-05-19 14:43:37 +00:00
|
|
|
int line;
|
2010-03-11 19:01:49 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
2009-09-12 20:50:11 +00:00
|
|
|
int last_nand = 0;
|
2009-10-26 17:22:05 +00:00
|
|
|
#ifdef HAVE_MULTIDRIVE
|
2009-09-12 20:50:11 +00:00
|
|
|
int last_sd = 0;
|
|
|
|
#endif
|
2010-03-11 19:01:49 +00:00
|
|
|
#endif /* CONFIG_CPU == AS3525 */
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
2009-05-20 11:22:31 +00:00
|
|
|
while(1)
|
|
|
|
{
|
2010-04-06 18:32:47 +00:00
|
|
|
#ifdef SANSA_C200V2
|
2010-04-16 06:01:24 +00:00
|
|
|
extern int dbop_denoise_accept;
|
|
|
|
extern int dbop_denoise_reject;
|
|
|
|
|
2010-04-06 18:32:47 +00:00
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
lcd_puts(0, line++, "[Submodel:]");
|
|
|
|
lcd_putsf(0, line++, "C200v2 variant %d", c200v2_variant);
|
2010-04-16 06:01:24 +00:00
|
|
|
if (dbop_denoise_accept) {
|
|
|
|
lcd_putsf(0, line++, "DBOP noise: %d%%",
|
|
|
|
(100*dbop_denoise_reject)/dbop_denoise_accept);
|
|
|
|
} else {
|
|
|
|
lcd_puts(0, line++, "DBOP noise: oo");
|
|
|
|
}
|
|
|
|
lcd_putsf(0, line++, "reject: %d", dbop_denoise_reject);
|
|
|
|
lcd_putsf(0, line++, "accept: %d", dbop_denoise_accept);
|
2010-04-06 18:32:47 +00:00
|
|
|
lcd_update();
|
2010-04-16 06:01:24 +00:00
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
2010-04-06 18:32:47 +00:00
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
#endif
|
2009-05-19 14:43:37 +00:00
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_puts(0, line++, "[Clock Frequencies:]");
|
2010-03-11 19:01:49 +00:00
|
|
|
lcd_puts(0, line++, " SET ACTUAL");
|
|
|
|
#if CONFIG_CPU == AS3525
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "922T:%s %3dMHz",
|
2009-09-12 20:50:11 +00:00
|
|
|
(!(read_cp15()>>30)) ? "FAST " :
|
|
|
|
(read_cp15()>>31) ? "ASYNC" : "SYNC ",
|
2010-04-01 04:37:17 +00:00
|
|
|
#else
|
|
|
|
lcd_putsf(0, line++, "926ejs: %3dMHz",
|
|
|
|
#endif
|
2010-03-11 19:01:49 +00:00
|
|
|
calc_freq(CLK_PROC)/1000000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "PLLA:%3dMHz %3dMHz", AS3525_PLLA_FREQ/1000000,
|
2009-09-12 20:50:11 +00:00
|
|
|
calc_freq(CLK_PLLA)/1000000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "PLLB: %3dMHz", calc_freq(CLK_PLLB)/1000000);
|
|
|
|
lcd_putsf(0, line++, "FCLK: %3dMHz", calc_freq(CLK_FCLK)/1000000);
|
2010-03-11 19:01:49 +00:00
|
|
|
lcd_putsf(0, line++, "DRAM:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
|
|
|
|
calc_freq(CLK_EXTMEM)/1000000);
|
|
|
|
lcd_putsf(0, line++, "PCLK:%3dMHz %3dMHz", AS3525_PCLK_FREQ/1000000,
|
|
|
|
calc_freq(CLK_PCLK)/1000000);
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
#if LCD_HEIGHT < 176 /* clip */
|
|
|
|
lcd_update();
|
2009-05-20 11:22:31 +00:00
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
2009-05-19 14:43:37 +00:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
#endif /* LCD_HEIGHT < 176 */
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "IDE :%3dMHz %3dMHz", AS3525_IDE_FREQ/1000000,
|
2009-09-12 20:50:11 +00:00
|
|
|
calc_freq(CLK_IDE)/1000000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "DBOP:%3dMHz %3dMHz", AS3525_DBOP_FREQ/1000000,
|
2009-09-12 20:50:11 +00:00
|
|
|
calc_freq(CLK_DBOP)/1000000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "I2C :%3dkHz %3dkHz", AS3525_I2C_FREQ/1000,
|
2009-09-12 20:50:11 +00:00
|
|
|
calc_freq(CLK_I2C)/1000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "I2SI: %s %3dMHz", (CGU_AUDIO & (1<<23)) ?
|
2009-09-12 20:50:11 +00:00
|
|
|
"on " : "off" , calc_freq(CLK_I2SI)/1000000);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "I2SO: %s %3dMHz", (CGU_AUDIO & (1<<11)) ?
|
2009-09-12 20:50:11 +00:00
|
|
|
"on " : "off", calc_freq(CLK_I2SO)/1000000);
|
2010-03-11 19:01:49 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
2009-12-01 21:23:11 +00:00
|
|
|
/* If disabled, enable SD cards so we can read the registers */
|
|
|
|
if(sd_enabled == false)
|
|
|
|
{
|
|
|
|
sd_enable(true);
|
|
|
|
last_nand = MCI_NAND;
|
2009-12-01 20:12:25 +00:00
|
|
|
#ifdef HAVE_MULTIDRIVE
|
2009-12-01 21:23:11 +00:00
|
|
|
last_sd = MCI_SD;
|
2009-12-01 20:12:25 +00:00
|
|
|
#endif
|
2009-12-01 21:23:11 +00:00
|
|
|
sd_enable(false);
|
|
|
|
}
|
2009-12-01 20:12:25 +00:00
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "SD :%3dMHz %3dMHz",
|
2009-12-11 04:53:22 +00:00
|
|
|
((AS3525_IDE_FREQ/ 1000000) /
|
2009-09-12 20:50:11 +00:00
|
|
|
((last_nand & MCI_CLOCK_BYPASS)? 1:(((last_nand & 0xff)+1) * 2))),
|
|
|
|
calc_freq(CLK_SD_MCLK_NAND)/1000000);
|
2009-10-26 17:22:05 +00:00
|
|
|
#ifdef HAVE_MULTIDRIVE
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "uSD :%3dMHz %3dMHz",
|
2009-12-01 20:12:25 +00:00
|
|
|
((AS3525_PCLK_FREQ/ 1000000) /
|
2009-09-12 20:50:11 +00:00
|
|
|
((last_sd & MCI_CLOCK_BYPASS) ? 1: (((last_sd & 0xff) + 1) * 2))),
|
|
|
|
calc_freq(CLK_SD_MCLK_MSD)/1000000);
|
|
|
|
#endif
|
2010-03-11 19:01:49 +00:00
|
|
|
#endif /* CONFIG_CPU == AS3525 */
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "USB : %3dMHz", calc_freq(CLK_USB)/1000000);
|
2010-03-11 19:01:49 +00:00
|
|
|
|
|
|
|
#if LCD_HEIGHT < 176 /* clip */
|
|
|
|
lcd_update();
|
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
#endif /* LCD_HEIGHT < 176 */
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "MMU : %s CVDDP:%4d", (read_cp15() & CP15_MMU) ?
|
2009-09-12 20:50:11 +00:00
|
|
|
" on" : "off", adc_read(ADC_CVDD) * 25);
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "Icache:%s Dcache:%s",
|
2009-09-12 20:50:11 +00:00
|
|
|
(read_cp15() & CP15_IC) ? " on" : "off",
|
|
|
|
(read_cp15() & CP15_DC) ? " on" : "off");
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
lcd_update();
|
2009-05-20 11:22:31 +00:00
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
2009-05-19 14:43:37 +00:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "CGU_PLLA :%8x", (unsigned int)(CGU_PLLA));
|
|
|
|
lcd_putsf(0, line++, "CGU_PLLB :%8x", (unsigned int)(CGU_PLLB));
|
|
|
|
lcd_putsf(0, line++, "CGU_PROC :%8x", (unsigned int)(CGU_PROC));
|
|
|
|
lcd_putsf(0, line++, "CGU_PERI :%8x", (unsigned int)(CGU_PERI));
|
|
|
|
lcd_putsf(0, line++, "CGU_IDE :%8x", (unsigned int)(CGU_IDE));
|
|
|
|
lcd_putsf(0, line++, "CGU_DBOP :%8x", (unsigned int)(CGU_DBOP));
|
2010-03-11 19:01:49 +00:00
|
|
|
lcd_putsf(0, line++, "CGU_AUDIO :%8x", (unsigned int)(CGU_AUDIO));
|
|
|
|
lcd_putsf(0, line++, "CGU_USB :%8x", (unsigned int)(CGU_USB));
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
#if LCD_HEIGHT < 176 /* clip */
|
|
|
|
lcd_update();
|
2009-05-20 11:22:31 +00:00
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
2009-05-19 14:43:37 +00:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
#endif /* LCD_HEIGHT < 176 */
|
|
|
|
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "I2C2_CPSR :%8x", (unsigned int)(I2C2_CPSR1<<8 |
|
2009-09-12 20:50:11 +00:00
|
|
|
I2C2_CPSR0));
|
2010-03-11 19:01:49 +00:00
|
|
|
#if CONFIG_CPU == AS3525
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_putsf(0, line++, "MCI_NAND :%8x", (unsigned int)(MCI_NAND));
|
|
|
|
lcd_putsf(0, line++, "MCI_SD :%8x", (unsigned int)(MCI_SD));
|
2010-03-23 17:00:59 +00:00
|
|
|
#else
|
|
|
|
lcd_putsf(0, line++, "CGU_MEMSTK:%8x", (unsigned int)(CGU_MEMSTICK));
|
|
|
|
lcd_putsf(0, line++, "CGU_SDSLOT:%8x", (unsigned int)(CGU_SDSLOT));
|
2010-03-11 19:01:49 +00:00
|
|
|
#endif
|
2009-05-19 14:43:37 +00:00
|
|
|
|
|
|
|
lcd_update();
|
2009-05-20 11:22:31 +00:00
|
|
|
int btn = button_get_w_tmo(HZ/10);
|
|
|
|
if(btn == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
goto end;
|
|
|
|
else if(btn == (BUTTON_DOWN|BUTTON_REL))
|
|
|
|
break;
|
2009-05-19 14:43:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
lcd_setfont(FONT_UI);
|
2008-11-10 11:04:43 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-01-27 11:05:38 +00:00
|
|
|
bool __dbg_ports(void)
|
2008-11-10 11:04:43 +00:00
|
|
|
{
|
2009-01-27 19:45:00 +00:00
|
|
|
int line;
|
2009-01-27 11:05:38 +00:00
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
line = 0;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_puts(0, line++, "[GPIO Values and Directions]");
|
|
|
|
lcd_putsf(0, line++, "GPIOA: %2x DIR: %2x", GPIOA_DATA, GPIOA_DIR);
|
|
|
|
lcd_putsf(0, line++, "GPIOB: %2x DIR: %2x", GPIOB_DATA, GPIOB_DIR);
|
|
|
|
lcd_putsf(0, line++, "GPIOC: %2x DIR: %2x", GPIOC_DATA, GPIOC_DIR);
|
|
|
|
lcd_putsf(0, line++, "GPIOD: %2x DIR: %2x", GPIOD_DATA, GPIOD_DIR);
|
2009-02-17 02:36:48 +00:00
|
|
|
#ifdef DEBUG_DBOP
|
2009-01-27 19:45:00 +00:00
|
|
|
line++;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_puts(0, line++, "[DBOP_DIN]");
|
2010-01-06 23:41:36 +00:00
|
|
|
lcd_putsf(0, line++, "DBOP_DIN: %4x", dbop_debug());
|
2009-01-27 11:05:38 +00:00
|
|
|
#endif
|
2009-03-14 17:17:27 +00:00
|
|
|
line++;
|
2009-10-17 18:02:48 +00:00
|
|
|
lcd_puts(0, line++, "[CP15]");
|
|
|
|
lcd_putsf(0, line++, "CP15: 0x%8x", read_cp15());
|
2009-01-27 11:05:38 +00:00
|
|
|
lcd_update();
|
|
|
|
if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
lcd_setfont(FONT_UI);
|
2008-11-10 11:04:43 +00:00
|
|
|
return false;
|
|
|
|
}
|