diff options
Diffstat (limited to 'firmware/target/arm/s5l8702/debug-s5l8702.c')
-rw-r--r-- | firmware/target/arm/s5l8702/debug-s5l8702.c | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/debug-s5l8702.c b/firmware/target/arm/s5l8702/debug-s5l8702.c new file mode 100644 index 0000000000..30d97d9203 --- /dev/null +++ b/firmware/target/arm/s5l8702/debug-s5l8702.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: debug-s5l8700.c 28719 2010-12-01 18:35:01Z Buschel $ | ||
9 | * | ||
10 | * Copyright © 2008 Rafaël Carré | ||
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 <stdbool.h> | ||
23 | #include "config.h" | ||
24 | #include "kernel.h" | ||
25 | #include "debug-target.h" | ||
26 | #include "button.h" | ||
27 | #include "lcd.h" | ||
28 | #include "font.h" | ||
29 | #include "storage.h" | ||
30 | #include "power.h" | ||
31 | #include "pmu-target.h" | ||
32 | |||
33 | /* Skeleton for adding target specific debug info to the debug menu | ||
34 | */ | ||
35 | |||
36 | #define _DEBUG_PRINTF(a, varargs...) lcd_putsf(0, line++, (a), ##varargs); | ||
37 | |||
38 | bool __dbg_hw_info(void) | ||
39 | { | ||
40 | int line; | ||
41 | int i; | ||
42 | unsigned int state = 0; | ||
43 | const unsigned int max_states=2; | ||
44 | |||
45 | lcd_clear_display(); | ||
46 | lcd_setfont(FONT_SYSFIXED); | ||
47 | |||
48 | state=0; | ||
49 | while(1) | ||
50 | { | ||
51 | lcd_clear_display(); | ||
52 | line = 0; | ||
53 | |||
54 | if(state == 0) | ||
55 | { | ||
56 | _DEBUG_PRINTF("CPU:"); | ||
57 | _DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick); | ||
58 | line++; | ||
59 | } | ||
60 | else if(state==1) | ||
61 | { | ||
62 | _DEBUG_PRINTF("PMU:"); | ||
63 | for(i=0;i<7;i++) | ||
64 | { | ||
65 | char *device[] = {"(unknown)", | ||
66 | "(unknown)", | ||
67 | "(unknown)", | ||
68 | "(unknown)", | ||
69 | "(unknown)", | ||
70 | "(unknown)", | ||
71 | "(unknown)"}; | ||
72 | _DEBUG_PRINTF("ldo%d %s: %dmV %s",i, | ||
73 | pmu_read(0x2e + (i << 1))?" on":"off", | ||
74 | 900 + pmu_read(0x2d + (i << 1))*100, | ||
75 | device[i]); | ||
76 | } | ||
77 | _DEBUG_PRINTF("cpu voltage: %dmV",625 + pmu_read(0x1e)*25); | ||
78 | _DEBUG_PRINTF("memory voltage: %dmV",625 + pmu_read(0x22)*25); | ||
79 | line++; | ||
80 | _DEBUG_PRINTF("charging: %s", charging_state() ? "true" : "false"); | ||
81 | _DEBUG_PRINTF("backlight: %s", pmu_read(0x29) ? "on" : "off"); | ||
82 | _DEBUG_PRINTF("brightness value: %d", pmu_read(0x28)); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | state=0; | ||
87 | } | ||
88 | |||
89 | |||
90 | lcd_update(); | ||
91 | switch(button_get_w_tmo(HZ/20)) | ||
92 | { | ||
93 | case BUTTON_SCROLL_BACK: | ||
94 | if(state!=0) state--; | ||
95 | break; | ||
96 | |||
97 | case BUTTON_SCROLL_FWD: | ||
98 | if(state!=max_states-1) | ||
99 | { | ||
100 | state++; | ||
101 | } | ||
102 | break; | ||
103 | |||
104 | case DEBUG_CANCEL: | ||
105 | case BUTTON_REL: | ||
106 | lcd_setfont(FONT_UI); | ||
107 | return false; | ||
108 | } | ||
109 | } | ||
110 | |||
111 | lcd_setfont(FONT_UI); | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | bool dbg_ports(void) | ||
116 | { | ||
117 | int line; | ||
118 | |||
119 | lcd_setfont(FONT_SYSFIXED); | ||
120 | |||
121 | while(1) | ||
122 | { | ||
123 | lcd_clear_display(); | ||
124 | line = 0; | ||
125 | |||
126 | _DEBUG_PRINTF("GPIO 0: %08x",(unsigned int)PDAT(0)); | ||
127 | _DEBUG_PRINTF("GPIO 1: %08x",(unsigned int)PDAT(1)); | ||
128 | _DEBUG_PRINTF("GPIO 2: %08x",(unsigned int)PDAT(2)); | ||
129 | _DEBUG_PRINTF("GPIO 3: %08x",(unsigned int)PDAT(3)); | ||
130 | _DEBUG_PRINTF("GPIO 4: %08x",(unsigned int)PDAT(4)); | ||
131 | _DEBUG_PRINTF("GPIO 5: %08x",(unsigned int)PDAT(5)); | ||
132 | _DEBUG_PRINTF("GPIO 6: %08x",(unsigned int)PDAT(6)); | ||
133 | _DEBUG_PRINTF("GPIO 7: %08x",(unsigned int)PDAT(7)); | ||
134 | _DEBUG_PRINTF("GPIO 8: %08x",(unsigned int)PDAT(8)); | ||
135 | _DEBUG_PRINTF("GPIO 9: %08x",(unsigned int)PDAT(9)); | ||
136 | _DEBUG_PRINTF("GPIO 10: %08x",(unsigned int)PDAT(10)); | ||
137 | _DEBUG_PRINTF("GPIO 11: %08x",(unsigned int)PDAT(11)); | ||
138 | _DEBUG_PRINTF("GPIO 12: %08x",(unsigned int)PDAT(12)); | ||
139 | _DEBUG_PRINTF("GPIO 13: %08x",(unsigned int)PDAT(13)); | ||
140 | _DEBUG_PRINTF("GPIO 14: %08x",(unsigned int)PDAT(14)); | ||
141 | _DEBUG_PRINTF("GPIO 15: %08x",(unsigned int)PDAT(15)); | ||
142 | _DEBUG_PRINTF("USEC : %08x",(unsigned int)USEC_TIMER); | ||
143 | |||
144 | lcd_update(); | ||
145 | if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) | ||
146 | break; | ||
147 | } | ||
148 | lcd_setfont(FONT_UI); | ||
149 | return false; | ||
150 | } | ||
151 | |||