From 57742e0ef7736cbc5c568baf0f3adb0719e3ff7b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 11 Apr 2008 15:49:48 +0000 Subject: Add a "View I/O Ports" screen for imx31. Show all GPIO contents. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17072 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/imx31/debug-imx31.c | 91 ++++++++++++++++++++++ firmware/target/arm/imx31/debug-target.h | 24 ++++++ .../target/arm/imx31/gigabeat-s/system-target.h | 3 - 3 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 firmware/target/arm/imx31/debug-imx31.c create mode 100644 firmware/target/arm/imx31/debug-target.h (limited to 'firmware/target') diff --git a/firmware/target/arm/imx31/debug-imx31.c b/firmware/target/arm/imx31/debug-imx31.c new file mode 100644 index 0000000000..ab8db78063 --- /dev/null +++ b/firmware/target/arm/imx31/debug-imx31.c @@ -0,0 +1,91 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2008 by Michael Sevakis + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "config.h" +#include "system.h" +#include "string.h" +#include "button.h" +#include "lcd.h" +#include "sprintf.h" +#include "font.h" +#include "debug-target.h" + +bool __dbg_hw_info(void) +{ + return false; +} + +bool __dbg_ports(void) +{ + char buf[50]; + int line; + + lcd_setmargins(0, 0); + lcd_clear_display(); + lcd_setfont(FONT_SYSFIXED); + + while(1) + { + line = 0; + snprintf(buf, sizeof(buf), "[Ports and Registers]"); + lcd_puts(0, line++, buf); line++; + + /* GPIO1 */ + snprintf(buf, sizeof(buf), "GPIO1: DR: %08lx GDIR: %08lx", GPIO1_DR, GPIO1_GDIR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO1_PSR, GPIO1_ICR1); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO1_ICR2, GPIO1_IMR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO1_ISR); + lcd_puts(0, line++, buf); line++; + + /* GPIO2 */ + snprintf(buf, sizeof(buf), "GPIO2: DR: %08lx GDIR: %08lx", GPIO2_DR, GPIO2_GDIR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO2_PSR, GPIO2_ICR1); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO2_ICR2, GPIO2_IMR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO2_ISR); + lcd_puts(0, line++, buf); line++; + + /* GPIO3 */ + snprintf(buf, sizeof(buf), "GPIO3: DR: %08lx GDIR: %08lx", GPIO3_DR, GPIO3_GDIR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " PSR: %08lx ICR1: %08lx", GPIO3_PSR, GPIO3_ICR1); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ICR2: %08lx IMR: %08lx", GPIO3_ICR2, GPIO3_IMR); + lcd_puts(0, line++, buf); + + snprintf(buf, sizeof(buf), " ISR: %08lx", GPIO3_ISR); + lcd_puts(0, line++, buf); line++; + + lcd_update(); + if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) + return false; + } +} diff --git a/firmware/target/arm/imx31/debug-target.h b/firmware/target/arm/imx31/debug-target.h new file mode 100644 index 0000000000..5928e0c64b --- /dev/null +++ b/firmware/target/arm/imx31/debug-target.h @@ -0,0 +1,24 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Karl Kurbjun + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#define DEBUG_CANCEL BUTTON_BACK +bool __dbg_hw_info(void); +bool __dbg_ports(void); + + diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h index 8db0c78eb7..17f1593f62 100644 --- a/firmware/target/arm/imx31/gigabeat-s/system-target.h +++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h @@ -30,9 +30,6 @@ static inline void udelay(unsigned int usecs) while ((signed int)EPITCNT1 > stop); } -#define __dbg_hw_info(...) 0 -#define __dbg_ports(...) 0 - void system_prepare_fw_start(void); void tick_stop(void); void kernel_device_init(void); -- cgit