1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Karl Kurbjun
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
29 #include "debug-target.h"
30 #include "lcd-target.h"
32 bool __dbg_ports(void)
38 extern char r_buffer
[5];
41 bool __dbg_hw_info(void)
43 int line
= 0, oldline
;
52 lcd_setfont(FONT_SYSFIXED
);
55 /* Put all the static text befor the while loop */
56 lcd_puts(0, line
++, "[Hardware info]");
58 lcd_puts(0, line
++, "Clock info:");
60 snprintf(buf
, sizeof(buf
), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x",
61 IO_CLK_PLLA
, IO_CLK_PLLB
, IO_CLK_SEL0
, IO_CLK_SEL1
); lcd_puts(0, line
++, buf
);
62 snprintf(buf
, sizeof(buf
), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x",
63 IO_CLK_SEL2
, IO_CLK_DIV0
, IO_CLK_DIV1
, IO_CLK_DIV2
); lcd_puts(0, line
++, buf
);
64 snprintf(buf
, sizeof(buf
), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x",
65 IO_CLK_DIV3
, IO_CLK_DIV4
, IO_CLK_BYP
, IO_CLK_INV
); lcd_puts(0, line
++, buf
);
66 snprintf(buf
, sizeof(buf
), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x",
67 IO_CLK_MOD0
, IO_CLK_MOD1
, IO_CLK_MOD2
, IO_CLK_LPCTL0
); lcd_puts(0, line
++, buf
);
69 snprintf(buf
, sizeof(buf
), " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA
, IO_CLK_PLLB
);
70 lcd_puts(0, line
++, buf
);
71 snprintf(buf
, sizeof(buf
), " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0
, IO_CLK_SEL1
);
72 lcd_puts(0, line
++, buf
);
73 snprintf(buf
, sizeof(buf
), " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2
, IO_CLK_DIV0
);
74 lcd_puts(0, line
++, buf
);
75 snprintf(buf
, sizeof(buf
), " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1
, IO_CLK_DIV2
);
76 lcd_puts(0, line
++, buf
);
77 snprintf(buf
, sizeof(buf
), " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3
, IO_CLK_DIV4
);
78 lcd_puts(0, line
++, buf
);
79 snprintf(buf
, sizeof(buf
), " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP
, IO_CLK_INV
);
80 lcd_puts(0, line
++, buf
);
81 snprintf(buf
, sizeof(buf
), " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0
, IO_CLK_MOD1
);
82 lcd_puts(0, line
++, buf
);
83 snprintf(buf
, sizeof(buf
), " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2
, IO_CLK_LPCTL0
);
84 lcd_puts(0, line
++, buf
);
87 lcd_puts(0, line
++, "Board revision:");
88 switch (IO_BUSC_REVR
) {
90 lcd_puts(0, line
++, " DM320 Rev. A");
93 lcd_puts(0, line
++, " DM320 Rev. B/C");
96 lcd_puts(0, line
++, " Unknown DM320 Chip ID");
107 button
= button_get(false);
108 button
&=~BUTTON_REPEAT
;
109 if (button
== BUTTON_POWER
)
111 if(button
==BUTTON_RC_PLAY
)
113 else if (button
==BUTTON_RC_DOWN
)
115 else if (button
==BUTTON_RC_FF
)
117 else if (button
==BUTTON_RC_REW
)
120 snprintf(buf
, sizeof(buf
), "Buffer: 0x%02x%02x%02x%02x%02x",
121 r_buffer
[0], r_buffer
[1], r_buffer
[2], r_buffer
[3],r_buffer
[4] ); lcd_puts(0, line
++, buf
);
122 snprintf(buf
, sizeof(buf
), "Button: 0x%08x, HWread: 0x%08x",
123 (unsigned int)button
, r_button
); lcd_puts(0, line
++, buf
);
125 button
= button_get(false);
126 if(button
& BUTTON_POWER
)
128 else if(button
& BUTTON_LEFT
)
129 lcd_set_direct_fb(false);
130 else if(button
& BUTTON_RIGHT
)
131 lcd_set_direct_fb(true);
133 lcd_puts(0, line
++, "PIC info:");
134 snprintf(buf
, sizeof(buf
), " Init value 1: 0x%04x", get_debug_info(1));
135 lcd_puts(0, line
++, buf
);
136 snprintf(buf
, sizeof(buf
), " Init value 2: 0x%04x", get_debug_info(2));
137 lcd_puts(0, line
++, buf
);
138 snprintf(buf
, sizeof(buf
), " Last button value: 0x%04x Raw value: 0x%04x", get_debug_info(3), button_read_device());
139 lcd_puts(0, line
++, buf
);
140 snprintf(buf
, sizeof(buf
), " Last button at: 0x%04x", get_debug_info(5));
141 lcd_puts(0, line
++, buf
);
142 snprintf(buf
, sizeof(buf
), " Dock values: 0x%04x", get_debug_info(4));
143 lcd_puts(0, line
++, buf
);
144 lcd_puts(0, line
++, "LCD info:");
145 snprintf(buf
, sizeof(buf
), " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no"));
146 lcd_puts(0, line
++, buf
);
149 lcd_puts(0, line
++, "[Rockbox info]");
150 snprintf(buf
, sizeof(buf
), "current tick: %08x Seconds running: %08d",
151 (unsigned int)current_tick
, (unsigned int)current_tick
/100); lcd_puts(0, line
++, buf
);
153 snprintf(buf
, sizeof(buf
), "Address: 0x%08x Data: 0x%08x",
154 (unsigned int)address
, *address
); lcd_puts(0, line
++, buf
);
155 snprintf(buf
, sizeof(buf
), "Address: 0x%08x Data: 0x%08x",
156 (unsigned int)(address
+1), *(address
+1)); lcd_puts(0, line
++, buf
);
157 snprintf(buf
, sizeof(buf
), "Address: 0x%08x Data: 0x%08x",
158 (unsigned int)(address
+2), *(address
+2)); lcd_puts(0, line
++, buf
);