D2: Implement power-off by putting the PCF50606 to sleep (and reduce timeout to 10...
[kugel-rb.git] / firmware / target / arm / tcc780x / debug-tcc780x.c
blob14aa8c1c106ccd4c118e3e7dc92d7aa8c84857f8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Rob Purchase
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 ****************************************************************************/
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 #include "adc.h"
32 /* IRQ status registers of debug interest only */
33 #define STS (*(volatile unsigned long *)0xF3001008)
34 #define SRC (*(volatile unsigned long *)0xF3001010)
36 bool __dbg_ports(void)
38 return false;
41 bool __dbg_hw_info(void)
43 int line = 0, i, button, oldline;
44 bool done=false;
45 char buf[100];
47 lcd_setmargins(0, 0);
48 lcd_setfont(FONT_SYSFIXED);
49 lcd_clear_display();
51 /* Put all the static text before the while loop */
52 lcd_puts(0, line++, "[Hardware info]");
54 line++;
55 oldline=line;
56 while(!done)
58 line = oldline;
59 button = button_get(false);
61 button &= ~BUTTON_REPEAT;
63 if (button == BUTTON_POWER)
64 done=true;
66 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
67 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
69 snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x",
70 (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf);
71 snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x",
72 (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf);
73 snprintf(buf, sizeof(buf), "GPIOE: 0x%08x",
74 (unsigned int)GPIOE); lcd_puts(0, line++, buf);
76 for (i = 0; i<4; i++)
78 snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i));
79 lcd_puts(0, line++, buf);
82 snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x",
83 (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf);
85 lcd_update();
87 return false;