fix yellow and red from r28522
[maemo-rb.git] / firmware / target / coldfire / debug-coldfire.c
blob7e447beefc4a8e0b30e393dd1da9304d37e0fc26
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Linus Nielsen Feltzing
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 "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 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
32 #include "lcd-remote.h"
33 #endif
35 bool dbg_ports(void)
37 unsigned int gpio_out;
38 unsigned int gpio1_out;
39 unsigned int gpio_read;
40 unsigned int gpio1_read;
41 unsigned int gpio_function;
42 unsigned int gpio1_function;
43 unsigned int gpio_enable;
44 unsigned int gpio1_enable;
45 int adc_battery_voltage, adc_battery_level;
46 int adc_buttons, adc_remote;
47 int line;
49 lcd_clear_display();
50 lcd_setfont(FONT_SYSFIXED);
52 while(1)
54 line = 0;
55 gpio_read = GPIO_READ;
56 gpio1_read = GPIO1_READ;
57 gpio_out = GPIO_OUT;
58 gpio1_out = GPIO1_OUT;
59 gpio_function = GPIO_FUNCTION;
60 gpio1_function = GPIO1_FUNCTION;
61 gpio_enable = GPIO_ENABLE;
62 gpio1_enable = GPIO1_ENABLE;
64 lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read);
65 lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out);
66 lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function);
67 lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable);
68 lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read);
69 lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out);
70 lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function);
71 lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable);
73 adc_buttons = adc_read(ADC_BUTTONS);
74 adc_remote = adc_read(ADC_REMOTE);
75 battery_read_info(&adc_battery_voltage, &adc_battery_level);
76 #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES)
77 lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x",
78 button_scan_enabled() ? '+' : '-', adc_buttons);
79 #else
80 lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons);
81 #endif
82 #if defined(IAUDIO_X5) || defined(IAUDIO_M5)
83 lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x",
84 remote_detect() ? '+' : '-', adc_remote);
85 #else
86 lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote);
87 #endif
88 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
89 lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x",
90 adc_read(ADC_REMOTEDETECT));
91 #endif
93 battery_read_info(&adc_battery_voltage, &adc_battery_level);
94 lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
95 adc_battery_voltage % 1000, adc_battery_level);
97 #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
98 lcd_putsf(0, line++, "remotetype: %d", remote_type());
99 #endif
101 lcd_update();
102 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
104 lcd_setfont(FONT_UI);
105 return false;
108 return false;