blob: 17bb1ff6462de7a6a3b801834746a7aa04ba5712 [file] [log] [blame]
Rob Purchase47ea0302008-01-14 22:04:48 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Rob Purchase
11 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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.
Rob Purchase47ea0302008-01-14 22:04:48 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
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 "sprintf.h"
30#include "font.h"
Christian Gmeinerb650bc52008-02-15 12:37:36 +000031#include "debug-target.h"
Rob Purchase2fee08a2008-04-08 20:43:04 +000032#include "adc.h"
33
34/* IRQ status registers of debug interest only */
35#define STS (*(volatile unsigned long *)0xF3001008)
36#define SRC (*(volatile unsigned long *)0xF3001010)
Rob Purchase47ea0302008-01-14 22:04:48 +000037
Rob Purchase47ea0302008-01-14 22:04:48 +000038bool __dbg_ports(void)
39{
40 return false;
41}
42
Rob Purchase47ea0302008-01-14 22:04:48 +000043bool __dbg_hw_info(void)
44{
Rob Purchase2fee08a2008-04-08 20:43:04 +000045 int line = 0, i, button, oldline;
Rob Purchase47ea0302008-01-14 22:04:48 +000046 bool done=false;
47 char buf[100];
48
Rob Purchase47ea0302008-01-14 22:04:48 +000049 lcd_setfont(FONT_SYSFIXED);
50 lcd_clear_display();
51
52 /* Put all the static text before the while loop */
53 lcd_puts(0, line++, "[Hardware info]");
54
Rob Purchase47ea0302008-01-14 22:04:48 +000055 line++;
56 oldline=line;
57 while(!done)
58 {
59 line = oldline;
60 button = button_get(false);
61
62 button &= ~BUTTON_REPEAT;
63
Rob Purchase2fee08a2008-04-08 20:43:04 +000064 if (button == BUTTON_POWER)
Rob Purchase47ea0302008-01-14 22:04:48 +000065 done=true;
Rob Purchase47ea0302008-01-14 22:04:48 +000066
Rob Purchase47ea0302008-01-14 22:04:48 +000067 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
68 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
Rob Purchase2fee08a2008-04-08 20:43:04 +000069
70 snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x",
71 (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf);
72 snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x",
73 (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf);
74 snprintf(buf, sizeof(buf), "GPIOE: 0x%08x",
75 (unsigned int)GPIOE); lcd_puts(0, line++, buf);
Rob Purchase47ea0302008-01-14 22:04:48 +000076
Rob Purchase2fee08a2008-04-08 20:43:04 +000077 for (i = 0; i<4; i++)
78 {
79 snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i));
80 lcd_puts(0, line++, buf);
81 }
82
83 snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x",
84 (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf);
85
Rob Purchase47ea0302008-01-14 22:04:48 +000086 lcd_update();
87 }
88 return false;
89}