diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 86 |
1 files changed, 80 insertions, 6 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 65c3a7d6fe..bb9e7ec117 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -136,36 +136,110 @@ bool dbg_hw_info(void) | |||
136 | char buf[32]; | 136 | char buf[32]; |
137 | int button; | 137 | int button; |
138 | int usb_polarity; | 138 | int usb_polarity; |
139 | int pr_polarity; | ||
139 | int bitmask = *(unsigned short*)0x20000fc; | 140 | int bitmask = *(unsigned short*)0x20000fc; |
140 | int rom_version = *(unsigned short*)0x20000fe; | 141 | int rom_version = *(unsigned short*)0x20000fe; |
141 | 142 | ||
142 | if(PADR & 0x400) | 143 | if(PADR & 0x400) |
143 | usb_polarity = 1; | 144 | usb_polarity = 0; /* Negative */ |
144 | else | 145 | else |
145 | usb_polarity = 0; | 146 | usb_polarity = 1; /* Positive */ |
146 | 147 | ||
148 | if(PADR & 0x800) | ||
149 | pr_polarity = 0; /* Negative */ | ||
150 | else | ||
151 | pr_polarity = 1; /* Positive */ | ||
152 | |||
147 | lcd_setmargins(0, 0); | 153 | lcd_setmargins(0, 0); |
148 | lcd_setfont(FONT_SYSFIXED); | 154 | lcd_setfont(FONT_SYSFIXED); |
149 | lcd_clear_display(); | 155 | lcd_clear_display(); |
150 | 156 | ||
157 | lcd_puts(0, 0, "[Hardware info]"); | ||
158 | |||
151 | snprintf(buf, 32, "ROM: %d.%02d", rom_version/100, rom_version%100); | 159 | snprintf(buf, 32, "ROM: %d.%02d", rom_version/100, rom_version%100); |
152 | lcd_puts(0, 1, buf); | 160 | lcd_puts(0, 1, buf); |
153 | 161 | ||
154 | snprintf(buf, 32, "USB: %s", usb_polarity?"positive":"negative"); | 162 | snprintf(buf, 32, "Mask: 0x%04x", bitmask); |
155 | lcd_puts(0, 2, buf); | 163 | lcd_puts(0, 2, buf); |
156 | 164 | ||
157 | snprintf(buf, 32, "ATA: 0x%x", ata_io_address); | 165 | snprintf(buf, 32, "USB: %s", usb_polarity?"positive":"negative"); |
158 | lcd_puts(0, 3, buf); | 166 | lcd_puts(0, 3, buf); |
159 | 167 | ||
160 | snprintf(buf, 32, "Mask: 0x%04x", bitmask); | 168 | snprintf(buf, 32, "ATA: 0x%x", ata_io_address); |
161 | lcd_puts(0, 4, buf); | 169 | lcd_puts(0, 4, buf); |
162 | 170 | ||
171 | snprintf(buf, 32, "PR: %s", pr_polarity?"positive":"negative"); | ||
172 | lcd_puts(0, 5, buf); | ||
173 | |||
163 | lcd_update(); | 174 | lcd_update(); |
164 | 175 | ||
165 | button = button_get(true); | 176 | button = button_get(true); |
166 | 177 | ||
167 | return false; | 178 | return false; |
168 | } | 179 | } |
180 | #else | ||
181 | bool dbg_hw_info(void) | ||
182 | { | ||
183 | char buf[32]; | ||
184 | int button; | ||
185 | int currval = 0; | ||
186 | int usb_polarity; | ||
187 | int bitmask = *(unsigned short*)0x20000fc; | ||
188 | int rom_version = *(unsigned short*)0x20000fe; | ||
189 | |||
190 | if(PADR & 0x400) | ||
191 | usb_polarity = 0; /* Negative */ | ||
192 | else | ||
193 | usb_polarity = 1; /* Positive */ | ||
194 | |||
195 | lcd_clear_display(); | ||
196 | |||
197 | lcd_puts(0, 0, "[HW Info]"); | ||
198 | while(1) | ||
199 | { | ||
200 | switch(currval) | ||
201 | { | ||
202 | case 0: | ||
203 | snprintf(buf, 32, "ROM: %d.%02d", | ||
204 | rom_version/100, rom_version%100); | ||
205 | break; | ||
206 | case 1: | ||
207 | snprintf(buf, 32, "USB: %s", | ||
208 | usb_polarity?"pos":"neg"); | ||
209 | break; | ||
210 | case 2: | ||
211 | snprintf(buf, 32, "ATA: 0x%x", ata_io_address); | ||
212 | break; | ||
213 | case 3: | ||
214 | snprintf(buf, 32, "Mask: %04x", bitmask); | ||
215 | break; | ||
216 | } | ||
217 | |||
218 | lcd_puts(0, 0, buf); | ||
219 | lcd_update(); | ||
220 | |||
221 | button = button_get(true); | ||
222 | |||
223 | switch(button) | ||
224 | { | ||
225 | case BUTTON_STOP: | ||
226 | return false; | ||
227 | |||
228 | case BUTTON_LEFT: | ||
229 | currval--; | ||
230 | if(currval < 0) | ||
231 | currval = 3; | ||
232 | break; | ||
233 | |||
234 | case BUTTON_RIGHT: | ||
235 | currval++; | ||
236 | if(currval > 3) | ||
237 | currval = 0; | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | return false; | ||
242 | } | ||
169 | #endif | 243 | #endif |
170 | 244 | ||
171 | #ifdef HAVE_LCD_BITMAP | 245 | #ifdef HAVE_LCD_BITMAP |
@@ -815,8 +889,8 @@ bool debug_menu(void) | |||
815 | #endif | 889 | #endif |
816 | #ifdef HAVE_LCD_BITMAP | 890 | #ifdef HAVE_LCD_BITMAP |
817 | { "View battery", view_battery }, | 891 | { "View battery", view_battery }, |
818 | { "View HW info", dbg_hw_info }, | ||
819 | #endif | 892 | #endif |
893 | { "View HW info", dbg_hw_info }, | ||
820 | }; | 894 | }; |
821 | 895 | ||
822 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); | 896 | m=menu_init( items, sizeof items / sizeof(struct menu_items) ); |