2009-02-09 10:02:38 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009 by Maurus Cuelenaere
|
|
|
|
*
|
|
|
|
* 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 "config.h"
|
2012-01-04 05:21:52 +00:00
|
|
|
#include "system.h"
|
2009-02-09 10:02:38 +00:00
|
|
|
#include "jz4740.h"
|
2009-02-13 00:45:49 +00:00
|
|
|
#include "debug-target.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "button.h"
|
2009-02-16 22:49:58 +00:00
|
|
|
#include "timefuncs.h"
|
2009-02-13 00:45:49 +00:00
|
|
|
|
|
|
|
static int line = 0;
|
2009-02-09 10:02:38 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clock Generation Module
|
|
|
|
*/
|
|
|
|
#define TO_MHZ(x) ((x)/1000000), ((x)%1000000)/10000
|
|
|
|
#define TO_KHZ(x) ((x)/1000), ((x)%1000)/10
|
|
|
|
|
|
|
|
static void display_clocks(void)
|
|
|
|
{
|
2009-05-21 12:29:51 +00:00
|
|
|
unsigned int cppcr = REG_CPM_CPPCR; /* PLL Control Register */
|
|
|
|
unsigned int cpccr = REG_CPM_CPCCR; /* Clock Control Register */
|
|
|
|
unsigned int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
|
|
|
|
unsigned int od[4] = {1, 2, 2, 4};
|
2009-02-09 10:02:38 +00:00
|
|
|
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "CPPCR : 0x%08x", cppcr);
|
|
|
|
lcd_putsf(0, line++, "CPCCR : 0x%08x", cpccr);
|
|
|
|
lcd_putsf(0, line++, "PLL : %s", (cppcr & CPM_CPPCR_PLLEN) ? "ON" : "OFF");
|
|
|
|
lcd_putsf(0, line++, "m:n:o : %d:%d:%d",
|
2009-05-21 12:29:51 +00:00
|
|
|
__cpm_get_pllm() + 2,
|
|
|
|
__cpm_get_plln() + 2,
|
|
|
|
od[__cpm_get_pllod()]
|
|
|
|
);
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "C:H:M:P : %d:%d:%d:%d",
|
2009-05-21 12:29:51 +00:00
|
|
|
div[__cpm_get_cdiv()],
|
|
|
|
div[__cpm_get_hdiv()],
|
|
|
|
div[__cpm_get_mdiv()],
|
|
|
|
div[__cpm_get_pdiv()]
|
|
|
|
);
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "U:L:I:P:M : %d:%d:%d:%d:%d",
|
2009-05-21 12:29:51 +00:00
|
|
|
__cpm_get_udiv() + 1,
|
|
|
|
__cpm_get_ldiv() + 1,
|
|
|
|
__cpm_get_i2sdiv()+1,
|
|
|
|
__cpm_get_pixdiv()+1,
|
|
|
|
__cpm_get_mscdiv()+1
|
2009-02-09 10:02:38 +00:00
|
|
|
);
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "PLL Freq: %3d.%02d MHz", TO_MHZ(__cpm_get_pllout()));
|
|
|
|
lcd_putsf(0, line++, "CCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_cclk()));
|
|
|
|
lcd_putsf(0, line++, "HCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_hclk()));
|
|
|
|
lcd_putsf(0, line++, "MCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_mclk()));
|
|
|
|
lcd_putsf(0, line++, "PCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_pclk()));
|
|
|
|
lcd_putsf(0, line++, "LCDCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_lcdclk()));
|
|
|
|
lcd_putsf(0, line++, "PIXCLK : %6d.%02d KHz", TO_KHZ(__cpm_get_pixclk()));
|
|
|
|
lcd_putsf(0, line++, "I2SCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_i2sclk()));
|
|
|
|
lcd_putsf(0, line++, "USBCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_usbclk()));
|
|
|
|
lcd_putsf(0, line++, "MSCCLK : %3d.%02d MHz", TO_MHZ(__cpm_get_mscclk()));
|
|
|
|
lcd_putsf(0, line++, "EXTALCLK: %3d.%02d MHz", TO_MHZ(__cpm_get_extalclk()));
|
|
|
|
lcd_putsf(0, line++, "RTCCLK : %3d.%02d KHz", TO_KHZ(__cpm_get_rtcclk()));
|
2009-02-09 10:02:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void display_enabled_clocks(void)
|
|
|
|
{
|
2009-05-21 12:29:51 +00:00
|
|
|
unsigned long lcr = REG_CPM_LCR;
|
|
|
|
unsigned long clkgr = REG_CPM_CLKGR;
|
2009-02-09 10:02:38 +00:00
|
|
|
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "Low Power Mode : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
((lcr & CPM_LCR_LPM_MASK) == CPM_LCR_LPM_IDLE) ?
|
|
|
|
"IDLE" : (((lcr & CPM_LCR_LPM_MASK) == CPM_LCR_LPM_SLEEP) ? "SLEEP" : "HIBERNATE")
|
2009-02-09 10:02:38 +00:00
|
|
|
);
|
2009-05-21 12:29:51 +00:00
|
|
|
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "Doze Mode : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(lcr & CPM_LCR_DOZE_ON) ? "ON" : "OFF");
|
|
|
|
if (lcr & CPM_LCR_DOZE_ON)
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, " duty : %d", (int)((lcr & CPM_LCR_DOZE_DUTY_MASK) >> CPM_LCR_DOZE_DUTY_BIT));
|
2009-05-21 12:29:51 +00:00
|
|
|
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "IPU : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_IPU) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "DMAC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_DMAC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "UHC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_UHC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "UDC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_UDC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "LCD : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_LCD) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "CIM : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_CIM) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "SADC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_SADC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "MSC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_MSC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "AIC1 : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_AIC1) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "AIC2 : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_AIC2) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "SSI : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_SSI) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "I2C : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_I2C) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "RTC : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_RTC) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "TCU : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_TCU) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "UART1 : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_UART1) ? "stopped" : "running");
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "UART0 : %s",
|
2009-05-21 12:29:51 +00:00
|
|
|
(clkgr & CPM_CLKGR_UART0) ? "stopped" : "running");
|
2009-02-09 10:02:38 +00:00
|
|
|
}
|
|
|
|
|
2010-11-06 14:24:25 +00:00
|
|
|
bool dbg_ports(void)
|
2009-02-09 10:02:38 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-06-05 10:26:06 +00:00
|
|
|
bool dbg_hw_info(void)
|
2009-02-09 10:02:38 +00:00
|
|
|
{
|
2009-03-09 21:26:39 +00:00
|
|
|
int btn = 0;
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
int touch;
|
|
|
|
#endif
|
2009-02-16 22:49:58 +00:00
|
|
|
struct tm *cur_time;
|
2009-05-21 12:29:51 +00:00
|
|
|
|
2009-02-13 00:45:49 +00:00
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
while(btn ^ BUTTON_POWER)
|
|
|
|
{
|
|
|
|
lcd_clear_display();
|
|
|
|
line = 0;
|
|
|
|
display_clocks();
|
|
|
|
display_enabled_clocks();
|
2009-03-09 21:26:39 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2009-02-13 00:45:49 +00:00
|
|
|
btn = button_read_device(&touch);
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "X: %d Y: %d BTN: 0x%X", touch>>16, touch&0xFFFF, btn);
|
2009-03-09 21:26:39 +00:00
|
|
|
#else
|
|
|
|
btn = button_read_device();
|
|
|
|
#endif
|
|
|
|
cur_time = get_time();
|
2010-08-28 23:12:04 +00:00
|
|
|
lcd_putsf(0, line++, "%02d/%02d/%04d %02d:%02d:%02d", cur_time->tm_mday,
|
2009-02-16 22:49:58 +00:00
|
|
|
cur_time->tm_mon, cur_time->tm_year, cur_time->tm_hour,
|
|
|
|
cur_time->tm_min, cur_time->tm_sec);
|
2009-02-13 00:45:49 +00:00
|
|
|
lcd_update();
|
|
|
|
sleep(HZ/16);
|
|
|
|
}
|
|
|
|
return true;
|
2009-02-09 10:02:38 +00:00
|
|
|
}
|
|
|
|
|