summaryrefslogtreecommitdiff
path: root/firmware/target/sh
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh')
-rw-r--r--firmware/target/sh/debug-sh.c103
-rw-r--r--firmware/target/sh/debug-target.h27
2 files changed, 130 insertions, 0 deletions
diff --git a/firmware/target/sh/debug-sh.c b/firmware/target/sh/debug-sh.c
new file mode 100644
index 0000000000..3502cfade0
--- /dev/null
+++ b/firmware/target/sh/debug-sh.c
@@ -0,0 +1,103 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Heikki Hannikainen
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 int adc_battery_voltage;
35#ifndef HAVE_LCD_BITMAP
36 int currval = 0;
37 int button;
38#else
39 int adc_battery_level;
40
41 lcd_setfont(FONT_SYSFIXED);
42#endif
43 lcd_clear_display();
44
45 while(1)
46 {
47#ifdef HAVE_LCD_BITMAP
48 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
49 lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR);
50
51 lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4));
52 lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5));
53 lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6));
54 lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7));
55
56 battery_read_info(&adc_battery_voltage, &adc_battery_level);
57 lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000,
58 adc_battery_voltage % 1000, adc_battery_level);
59
60 lcd_update();
61 if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
62 {
63 lcd_setfont(FONT_UI);
64 return false;
65 }
66#else /* !HAVE_LCD_BITMAP */
67
68 if (currval == 0) {
69 lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR);
70 } else if (currval == 1) {
71 lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR);
72 } else {
73 int idx = currval - 2; /* idx < 7 */
74 lcd_putsf(0, 0, "AN%d: %03x", idx, adc_read(idx));
75 }
76
77 battery_read_info(&adc_battery_voltage, NULL);
78 lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000,
79 adc_battery_voltage % 1000);
80 lcd_update();
81
82 button = button_get_w_tmo(HZ/5);
83 switch(button)
84 {
85 case BUTTON_STOP:
86 return false;
87
88 case BUTTON_LEFT:
89 currval--;
90 if(currval < 0)
91 currval = 9;
92 break;
93
94 case BUTTON_RIGHT:
95 currval++;
96 if(currval > 9)
97 currval = 0;
98 break;
99 }
100#endif
101 }
102 return false;
103}
diff --git a/firmware/target/sh/debug-target.h b/firmware/target/sh/debug-target.h
new file mode 100644
index 0000000000..4e25b81948
--- /dev/null
+++ b/firmware/target/sh/debug-target.h
@@ -0,0 +1,27 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2010 by Marcin Bukat
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#if CONFIG_KEYPAD == RECORDER_PAD
22# define DEBUG_CANCEL BUTTON_OFF
23
24#elif CONFIG_KEYPAD == ONDIO_PAD
25# define DEBUG_CANCEL BUTTON_MENU
26#endif
27bool dbg_ports(void);