Move c/h files implementing/defining standard library stuff into a new libc directory...
[kugel-rb.git] / firmware / target / arm / tcc780x / debug-tcc780x.c
blob11d6d2acab0edd695e94aae7243e0fd04983d787
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Rob Purchase
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 "font.h"
30 #include "debug-target.h"
31 #include "adc.h"
33 /* IRQ status registers of debug interest only */
34 #define STS (*(volatile unsigned long *)0xF3001008)
35 #define SRC (*(volatile unsigned long *)0xF3001010)
37 bool __dbg_ports(void)
39 return false;
42 bool __dbg_hw_info(void)
44 int line = 0, i, oldline;
45 char buf[100];
47 lcd_setfont(FONT_SYSFIXED);
48 lcd_clear_display();
50 /* Put all the static text before the while loop */
51 lcd_puts(0, line++, "[Hardware info]");
53 line++;
54 oldline=line;
56 while (1)
58 line = oldline;
60 if (button_get_w_tmo(HZ/20) == (BUTTON_POWER|BUTTON_REL))
61 break;
63 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
64 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
66 snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x",
67 (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf);
68 snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x",
69 (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf);
70 snprintf(buf, sizeof(buf), "GPIOE: 0x%08x",
71 (unsigned int)GPIOE); lcd_puts(0, line++, buf);
73 for (i = 0; i<4; i++)
75 snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i));
76 lcd_puts(0, line++, buf);
79 snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x",
80 (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf);
82 lcd_update();
84 return false;