FS#8961 - Anti-Aliased Fonts.
[kugel-rb.git] / firmware / target / arm / tms320dm320 / debug-dm320.c
blob53acd3f655f4739ff3cb4b6e84d1e359974ee4cf
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Karl Kurbjun
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "cpu.h"
24 #include "system.h"
25 #include "string.h"
26 #include <stdbool.h>
27 #include "button.h"
28 #include "lcd.h"
29 #include "debug.h"
30 #include "sprintf.h"
31 #include "font.h"
32 #include "lcd-target.h"
34 #ifndef CREATIVE_ZVx
35 #include "tsc2100.h"
36 #endif
38 bool __dbg_ports(void)
40 return false;
43 bool __dbg_hw_info(void)
45 int line = 0, oldline;
46 int button;
47 #ifndef CREATIVE_ZVx
48 int *address=0x0;
49 #endif
50 bool done=false;
51 char buf[100];
53 lcd_setfont(FONT_SYSFIXED);
54 lcd_clear_display();
56 /* Put all the static text befor the while loop */
57 lcd_puts(0, line++, "[Hardware info]");
59 lcd_puts(0, line++, "Clock info:");
60 #if LCD_WIDTH > 320
61 snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
62 IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf);
63 snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
64 IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf);
65 snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
66 IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf);
67 snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
68 IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf);
69 #else
70 snprintf(buf, sizeof(buf), " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB);
71 lcd_puts(0, line++, buf);
72 snprintf(buf, sizeof(buf), " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1);
73 lcd_puts(0, line++, buf);
74 snprintf(buf, sizeof(buf), " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0);
75 lcd_puts(0, line++, buf);
76 snprintf(buf, sizeof(buf), " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2);
77 lcd_puts(0, line++, buf);
78 snprintf(buf, sizeof(buf), " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4);
79 lcd_puts(0, line++, buf);
80 snprintf(buf, sizeof(buf), " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV);
81 lcd_puts(0, line++, buf);
82 snprintf(buf, sizeof(buf), " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1);
83 lcd_puts(0, line++, buf);
84 snprintf(buf, sizeof(buf), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0);
85 lcd_puts(0, line++, buf);
86 lcd_puts(0, line++, "Interrupt info:");
87 snprintf(buf, sizeof(buf), " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1);
88 lcd_puts(0, line++, buf);
89 snprintf(buf, sizeof(buf), " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0);
90 lcd_puts(0, line++, buf);
91 snprintf(buf, sizeof(buf), " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2);
92 lcd_puts(0, line++, buf);
93 #endif
95 lcd_puts(0, line++, "Board revision:");
96 switch (IO_BUSC_REVR) {
97 case 0x0010:
98 lcd_puts(0, line++, " DM320 Rev. A");
99 break;
100 case 0x0011:
101 lcd_puts(0, line++, " DM320 Rev. B/C");
102 break;
103 default:
104 lcd_puts(0, line++, " Unknown DM320 Chip ID");
107 #ifndef CREATIVE_ZVx
108 line++;
109 #endif
110 oldline=line;
111 while(!done)
113 line = oldline;
114 #ifndef CREATIVE_ZVx
115 button = button_get(false);
116 button&=~BUTTON_REPEAT;
117 if (button == BUTTON_POWER)
118 done=true;
119 if(button==BUTTON_RC_PLAY)
120 address+=0x01;
121 else if (button==BUTTON_RC_DOWN)
122 address-=0x01;
123 else if (button==BUTTON_RC_FF)
124 address+=0x800;
125 else if (button==BUTTON_RC_REW)
126 address-=0x800;
127 #else
128 button = button_get(false);
129 if(button & BUTTON_POWER)
130 done = true;
131 else if(button & BUTTON_LEFT)
132 lcd_set_direct_fb(false);
133 else if(button & BUTTON_RIGHT)
134 lcd_set_direct_fb(true);
136 lcd_puts(0, line++, "LCD info:");
137 snprintf(buf, sizeof(buf), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
138 lcd_puts(0, line++, buf);
139 line++;
140 #endif
141 lcd_puts(0, line++, "[Rockbox info]");
142 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
143 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
144 #ifndef CREATIVE_ZVx
145 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
146 (unsigned int)address, *address); lcd_puts(0, line++, buf);
147 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
148 (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf);
149 snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x",
150 (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf);
151 #endif
153 lcd_update();
155 return false;