summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/debug-coldfire.c
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-11-06 14:24:25 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-11-06 14:24:25 +0000
commitb8a7f5137b38cbfd301715bb69034467a033eccb (patch)
tree5bef733ca715d7706801587137c1db40f173b6c1 /firmware/target/coldfire/debug-coldfire.c
parent97a783a79ab53cc772545980ff4bad6a6d3b8bad (diff)
downloadrockbox-b8a7f5137b38cbfd301715bb69034467a033eccb.tar.gz
rockbox-b8a7f5137b38cbfd301715bb69034467a033eccb.zip
move dbg_ports() from apps/menu_debug.c to target tree. FS#11712 by me.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28522 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/debug-coldfire.c')
-rw-r--r--firmware/target/coldfire/debug-coldfire.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/firmware/target/coldfire/debug-coldfire.c b/firmware/target/coldfire/debug-coldfire.c
new file mode 100644
index 0000000000..0676ed0b07
--- /dev/null
+++ b/firmware/target/coldfire/debug-coldfire.c
@@ -0,0 +1,106 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
11 *
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.
16 *
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 "system.h"
24#include <stdbool.h>
25#include "font.h"
26#include "lcd.h"
27#include "button.h"
28#include "powermgmt.h"
29#include "adc.h"
30#include "debug-target.h"
31
32bool dbg_ports(void)
33{
34 unsigned int gpio_out;
35 unsigned int gpio1_out;
36 unsigned int gpio_read;
37 unsigned int gpio1_read;
38 unsigned int gpio_function;
39 unsigned int gpio1_function;
40 unsigned int gpio_enable;
41 unsigned int gpio1_enable;
42 int adc_battery_voltage, adc_battery_level;
43 int adc_buttons, adc_remote;
44 int line;
45
46 lcd_clear_display();
47 lcd_setfont(FONT_SYSFIXED);
48
49 while(1)
50 {
51 line = 0;
52 gpio_read = GPIO_READ;
53 gpio1_read = GPIO1_READ;
54 gpio_out = GPIO_OUT;
55 gpio1_out = GPIO1_OUT;
56 gpio_function = GPIO_FUNCTION;
57 gpio1_function = GPIO1_FUNCTION;
58 gpio_enable = GPIO_ENABLE;
59 gpio1_enable = GPIO1_ENABLE;
60
61 lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
62 lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
63 lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
64 lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
65 lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
66 lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
67 lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
68 lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
69
70 adc_buttons = adc_read(ADC_BUTTONS);
71 adc_remote = adc_read(ADC_REMOTE);
72 battery_read_info(&adc_battery_voltage, &adc_battery_level);
73#if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
74 lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
75 button_scan_enabled() ? '+' : '-', adc_buttons);
76#else
77 lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
78#endif
79#if defined(IAUDIO_X5) || defined(IAUDIO_M5)
80 lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
81 remote_detect() ? '+' : '-', adc_remote);
82#else
83 lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
84#endif
85#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
86 lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
87 adc_read(ADC_REMOTEDETECT));
88#endif
89
90 battery_read_info(&adc_battery_voltage, &adc_battery_level);
91 lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
92 adc_battery_voltage % 1000, adc_battery_level);
93
94#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
95 lcd_putsf(0, line++, "remotetype: %d", remote_type());
96#endif
97
98 lcd_update();
99 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
100 {
101 lcd_setfont(FONT_UI);
102 return false;
103 }
104 }
105 return false;
106}