Move c/h files implementing/defining standard library stuff into a new libc directory...
[kugel-rb.git] / firmware / target / arm / tcc77x / debug-tcc77x.c
blobbf322f567541315b2a705d9ab0c03c6110903ec9
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 bool __dbg_ports(void)
35 return false;
38 bool __dbg_hw_info(void)
40 int line = 0, i, button, oldline;
41 bool done=false;
42 char buf[100];
44 lcd_setfont(FONT_SYSFIXED);
45 lcd_clear_display();
47 /* Put all the static text before the while loop */
48 lcd_puts(0, line++, "[Hardware info]");
50 line++;
51 oldline=line;
52 while(!done)
54 line = oldline;
55 button = button_get(false);
57 button &= ~BUTTON_REPEAT;
58 #ifdef BUTTON_SELECT
59 if (button == BUTTON_SELECT)
60 #else
61 if (button == BUTTON_STOP)
62 #endif
63 done=true;
65 snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d",
66 (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf);
68 snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x",
69 (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf);
70 snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x",
71 (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf);
72 snprintf(buf, sizeof(buf), "GPIOE: 0x%08x",
73 (unsigned int)GPIOE); lcd_puts(0, line++, buf);
75 for (i = 0; i<4; i++)
77 snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i));
78 lcd_puts(0, line++, buf);
81 lcd_update();
83 return false;