Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
| 10 | * Copyright (C) 2007 by Rob Purchase |
| 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame^] | 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. |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 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 "cpu.h" |
| 24 | #include "system.h" |
| 25 | #include "string.h" |
| 26 | #include <stdbool.h> |
| 27 | #include "button.h" |
| 28 | #include "lcd.h" |
| 29 | #include "sprintf.h" |
| 30 | #include "font.h" |
Christian Gmeiner | b650bc5 | 2008-02-15 12:37:36 +0000 | [diff] [blame] | 31 | #include "debug-target.h" |
Rob Purchase | 2fee08a | 2008-04-08 20:43:04 +0000 | [diff] [blame] | 32 | #include "adc.h" |
| 33 | |
| 34 | /* IRQ status registers of debug interest only */ |
| 35 | #define STS (*(volatile unsigned long *)0xF3001008) |
| 36 | #define SRC (*(volatile unsigned long *)0xF3001010) |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 37 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 38 | bool __dbg_ports(void) |
| 39 | { |
| 40 | return false; |
| 41 | } |
| 42 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 43 | bool __dbg_hw_info(void) |
| 44 | { |
Rob Purchase | 2fee08a | 2008-04-08 20:43:04 +0000 | [diff] [blame] | 45 | int line = 0, i, button, oldline; |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 46 | bool done=false; |
| 47 | char buf[100]; |
| 48 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 49 | lcd_setfont(FONT_SYSFIXED); |
| 50 | lcd_clear_display(); |
| 51 | |
| 52 | /* Put all the static text before the while loop */ |
| 53 | lcd_puts(0, line++, "[Hardware info]"); |
| 54 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 55 | line++; |
| 56 | oldline=line; |
| 57 | while(!done) |
| 58 | { |
| 59 | line = oldline; |
| 60 | button = button_get(false); |
| 61 | |
| 62 | button &= ~BUTTON_REPEAT; |
| 63 | |
Rob Purchase | 2fee08a | 2008-04-08 20:43:04 +0000 | [diff] [blame] | 64 | if (button == BUTTON_POWER) |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 65 | done=true; |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 66 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 67 | snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", |
| 68 | (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); |
Rob Purchase | 2fee08a | 2008-04-08 20:43:04 +0000 | [diff] [blame] | 69 | |
| 70 | snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", |
| 71 | (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); |
| 72 | snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", |
| 73 | (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); |
| 74 | snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", |
| 75 | (unsigned int)GPIOE); lcd_puts(0, line++, buf); |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 76 | |
Rob Purchase | 2fee08a | 2008-04-08 20:43:04 +0000 | [diff] [blame] | 77 | for (i = 0; i<4; i++) |
| 78 | { |
| 79 | snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); |
| 80 | lcd_puts(0, line++, buf); |
| 81 | } |
| 82 | |
| 83 | snprintf(buf, sizeof(buf), "STS: 0x%08x SRC: 0x%08x", |
| 84 | (unsigned int)STS, (unsigned int)SRC); lcd_puts(0, line++, buf); |
| 85 | |
Rob Purchase | 47ea030 | 2008-01-14 22:04:48 +0000 | [diff] [blame] | 86 | lcd_update(); |
| 87 | } |
| 88 | return false; |
| 89 | } |