Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2007 by Karl Kurbjun |
| 11 | * |
| 12 | * All files in this archive are subject to the GNU General Public License. |
| 13 | * See the file COPYING in the source tree root for full license agreement. |
| 14 | * |
| 15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 16 | * KIND, either express or implied. |
| 17 | * |
| 18 | ****************************************************************************/ |
| 19 | |
| 20 | #include "config.h" |
| 21 | #include "cpu.h" |
| 22 | #include "system.h" |
| 23 | #include "string.h" |
| 24 | #include <stdbool.h> |
| 25 | #include "button.h" |
| 26 | #include "lcd.h" |
| 27 | #include "sprintf.h" |
| 28 | #include "font.h" |
| 29 | #include "debug-target.h" |
| 30 | |
Karl Kurbjun | d185f9e | 2007-11-10 23:13:27 +0000 | [diff] [blame] | 31 | bool __dbg_ports(void) |
| 32 | { |
| 33 | return false; |
| 34 | } |
| 35 | |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 36 | bool __dbg_hw_info(void) |
| 37 | { |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 38 | int line = 0, button, oldline; |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 39 | int *address=0x0; |
| 40 | bool done=false; |
| 41 | char buf[100]; |
| 42 | |
| 43 | lcd_setmargins(0, 0); |
| 44 | lcd_setfont(FONT_SYSFIXED); |
| 45 | lcd_clear_display(); |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 46 | |
| 47 | /* Put all the static text befor the while loop */ |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 48 | lcd_puts(0, line++, "[Hardware info]"); |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 49 | |
| 50 | lcd_puts(0, line++, "Clock info:"); |
| 51 | snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", |
| 52 | IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf); |
| 53 | snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", |
| 54 | IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf); |
| 55 | snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", |
| 56 | IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf); |
| 57 | snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", |
| 58 | IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf); |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 59 | |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 60 | line++; |
| 61 | oldline=line; |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 62 | while(!done) |
| 63 | { |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 64 | line = oldline; |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 65 | button = button_get(false); |
| 66 | button&=~BUTTON_REPEAT; |
| 67 | if (button == BUTTON_POWER) |
| 68 | done=true; |
| 69 | if(button==BUTTON_RC_PLAY) |
| 70 | address+=0x01; |
| 71 | else if (button==BUTTON_RC_DOWN) |
| 72 | address-=0x01; |
| 73 | else if (button==BUTTON_RC_FF) |
| 74 | address+=0x800; |
| 75 | else if (button==BUTTON_RC_REW) |
| 76 | address-=0x800; |
| 77 | |
Karl Kurbjun | 59a2862 | 2007-11-11 03:31:24 +0000 | [diff] [blame^] | 78 | snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", |
| 79 | (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); |
| 80 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
| 81 | (unsigned int)address, *address); lcd_puts(0, line++, buf); |
| 82 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
| 83 | (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); |
| 84 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
| 85 | (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); |
Karl Kurbjun | 0082da7 | 2007-11-10 22:16:15 +0000 | [diff] [blame] | 86 | |
| 87 | lcd_update(); |
| 88 | } |
| 89 | return false; |
| 90 | } |