2007-11-10 22:16:15 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Karl Kurbjun
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2007-11-10 22:16:15 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "button.h"
|
|
|
|
#include "lcd.h"
|
2009-03-11 01:18:23 +00:00
|
|
|
#include "debug.h"
|
2007-11-10 22:16:15 +00:00
|
|
|
#include "sprintf.h"
|
|
|
|
#include "font.h"
|
2008-04-24 20:08:28 +00:00
|
|
|
#include "lcd-target.h"
|
2007-11-10 22:16:15 +00:00
|
|
|
|
2009-02-26 21:23:10 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
|
|
|
#include "tsc2100.h"
|
|
|
|
#endif
|
|
|
|
|
2009-03-24 16:40:31 +00:00
|
|
|
#if defined(PCM_TEST)
|
|
|
|
/* Leaving this in for potential debugging for other targets */
|
|
|
|
#include "pcm.h"
|
|
|
|
#include "debug-target.h"
|
|
|
|
#include "dsp-target.h"
|
|
|
|
#include "dsp/ipc.h"
|
2009-03-11 01:18:23 +00:00
|
|
|
#define ARM_BUFFER_SIZE (PCM_SIZE)
|
|
|
|
|
|
|
|
static signed short *the_rover = (signed short *)0x1900000;
|
|
|
|
static unsigned int index_rover = 0;
|
|
|
|
|
|
|
|
void pcmtest_get_more(unsigned char** start, size_t* size)
|
|
|
|
{
|
|
|
|
unsigned long sdem_addr;
|
|
|
|
sdem_addr = (unsigned long)the_rover + index_rover;
|
|
|
|
|
|
|
|
*start = (unsigned char*)(sdem_addr);
|
|
|
|
*size = ARM_BUFFER_SIZE;
|
|
|
|
|
|
|
|
index_rover += ARM_BUFFER_SIZE;
|
|
|
|
if (index_rover >= 4*1024*1024)
|
|
|
|
{
|
|
|
|
index_rover = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUGF("pcm_sdram at 0x%08lx, sdem_addr 0x%08lx",
|
|
|
|
(unsigned long)the_rover, (unsigned long)sdem_addr);
|
|
|
|
}
|
2009-03-24 16:40:31 +00:00
|
|
|
#endif
|
2009-03-11 01:18:23 +00:00
|
|
|
|
2007-11-10 23:13:27 +00:00
|
|
|
bool __dbg_ports(void)
|
|
|
|
{
|
2009-03-24 16:40:31 +00:00
|
|
|
#if defined(PCM_TEST)
|
2009-03-11 01:18:23 +00:00
|
|
|
int fd;
|
|
|
|
int bytes;
|
|
|
|
|
|
|
|
fd = open("/test.raw", O_RDONLY);
|
|
|
|
bytes = read(fd, the_rover, 4*1024*1024);
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
DEBUGF("read %d rover bytes", bytes);
|
|
|
|
|
|
|
|
pcm_play_data(&pcmtest_get_more,(unsigned char*)the_rover, ARM_BUFFER_SIZE);
|
2009-03-24 16:40:31 +00:00
|
|
|
#endif
|
2009-03-11 01:18:23 +00:00
|
|
|
|
2007-11-10 23:13:27 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-05-14 18:55:19 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
2007-11-15 06:44:35 +00:00
|
|
|
extern char r_buffer[5];
|
|
|
|
extern int r_button;
|
2008-04-24 20:08:28 +00:00
|
|
|
#endif
|
2007-11-10 22:16:15 +00:00
|
|
|
bool __dbg_hw_info(void)
|
|
|
|
{
|
2008-04-24 20:08:28 +00:00
|
|
|
int line = 0, oldline;
|
|
|
|
int button;
|
2008-05-14 18:55:19 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
2007-11-10 22:16:15 +00:00
|
|
|
int *address=0x0;
|
2008-04-24 20:08:28 +00:00
|
|
|
#endif
|
2007-11-10 22:16:15 +00:00
|
|
|
bool done=false;
|
|
|
|
char buf[100];
|
2007-11-15 06:44:35 +00:00
|
|
|
|
2007-11-10 22:16:15 +00:00
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
lcd_clear_display();
|
2007-11-15 06:44:35 +00:00
|
|
|
|
2007-11-11 03:31:24 +00:00
|
|
|
/* Put all the static text befor the while loop */
|
2007-11-10 22:16:15 +00:00
|
|
|
lcd_puts(0, line++, "[Hardware info]");
|
2007-11-15 06:44:35 +00:00
|
|
|
|
2007-11-11 03:31:24 +00:00
|
|
|
lcd_puts(0, line++, "Clock info:");
|
2008-04-24 20:08:28 +00:00
|
|
|
#if LCD_WIDTH > 320
|
2007-11-11 03:31:24 +00:00
|
|
|
snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
|
|
|
|
IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
|
|
|
|
IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
|
|
|
|
IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
|
|
|
|
IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf);
|
2008-04-24 20:08:28 +00:00
|
|
|
#else
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0);
|
|
|
|
lcd_puts(0, line++, buf);
|
2008-05-03 14:43:43 +00:00
|
|
|
lcd_puts(0, line++, "Interrupt info:");
|
|
|
|
snprintf(buf, sizeof(buf), " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0);
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2);
|
|
|
|
lcd_puts(0, line++, buf);
|
2008-04-24 20:08:28 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
lcd_puts(0, line++, "Board revision:");
|
|
|
|
switch (IO_BUSC_REVR) {
|
|
|
|
case 0x0010:
|
|
|
|
lcd_puts(0, line++, " DM320 Rev. A");
|
|
|
|
break;
|
|
|
|
case 0x0011:
|
|
|
|
lcd_puts(0, line++, " DM320 Rev. B/C");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
lcd_puts(0, line++, " Unknown DM320 Chip ID");
|
|
|
|
}
|
2007-11-10 22:16:15 +00:00
|
|
|
|
2008-05-14 18:55:19 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
2007-11-11 03:31:24 +00:00
|
|
|
line++;
|
2008-04-24 20:08:28 +00:00
|
|
|
#endif
|
2007-11-11 03:31:24 +00:00
|
|
|
oldline=line;
|
2007-11-10 22:16:15 +00:00
|
|
|
while(!done)
|
|
|
|
{
|
2007-11-11 03:31:24 +00:00
|
|
|
line = oldline;
|
2008-05-14 18:55:19 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
2007-11-10 22:16:15 +00:00
|
|
|
button = button_get(false);
|
|
|
|
button&=~BUTTON_REPEAT;
|
|
|
|
if (button == BUTTON_POWER)
|
|
|
|
done=true;
|
|
|
|
if(button==BUTTON_RC_PLAY)
|
|
|
|
address+=0x01;
|
|
|
|
else if (button==BUTTON_RC_DOWN)
|
|
|
|
address-=0x01;
|
|
|
|
else if (button==BUTTON_RC_FF)
|
|
|
|
address+=0x800;
|
|
|
|
else if (button==BUTTON_RC_REW)
|
|
|
|
address-=0x800;
|
|
|
|
|
2007-11-15 06:44:35 +00:00
|
|
|
snprintf(buf, sizeof(buf), "Buffer: 0x%02x%02x%02x%02x%02x",
|
|
|
|
r_buffer[0], r_buffer[1], r_buffer[2], r_buffer[3],r_buffer[4] ); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "Button: 0x%08x, HWread: 0x%08x",
|
|
|
|
(unsigned int)button, r_button); lcd_puts(0, line++, buf);
|
2008-04-24 20:08:28 +00:00
|
|
|
#else
|
|
|
|
button = button_get(false);
|
|
|
|
if(button & BUTTON_POWER)
|
|
|
|
done = true;
|
|
|
|
else if(button & BUTTON_LEFT)
|
|
|
|
lcd_set_direct_fb(false);
|
|
|
|
else if(button & BUTTON_RIGHT)
|
|
|
|
lcd_set_direct_fb(true);
|
|
|
|
|
|
|
|
lcd_puts(0, line++, "LCD info:");
|
|
|
|
snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
|
|
|
|
lcd_puts(0, line++, buf);
|
|
|
|
line++;
|
|
|
|
#endif
|
|
|
|
lcd_puts(0, line++, "[Rockbox info]");
|
2007-11-11 03:31:24 +00:00
|
|
|
snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
|
|
|
|
(unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
|
2008-05-14 18:55:19 +00:00
|
|
|
#ifndef CREATIVE_ZVx
|
2007-11-11 03:31:24 +00:00
|
|
|
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
|
|
|
|
(unsigned int)address, *address); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
|
|
|
|
(unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf);
|
|
|
|
snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
|
|
|
|
(unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf);
|
2008-04-24 20:08:28 +00:00
|
|
|
#endif
|
2007-11-10 22:16:15 +00:00
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|