From 57742e0ef7736cbc5c568baf0f3adb0719e3ff7b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 11 Apr 2008 15:49:48 +0000 Subject: [PATCH] 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 --- apps/debug_menu.c | 6 +- firmware/SOURCES | 1 + firmware/target/arm/imx31/debug-imx31.c | 91 +++++++++++++++++++ firmware/target/arm/imx31/debug-target.h | 24 +++++ .../arm/imx31/gigabeat-s/system-target.h | 3 - 5 files changed, 120 insertions(+), 5 deletions(-) create mode 100644 firmware/target/arm/imx31/debug-imx31.c create mode 100644 firmware/target/arm/imx31/debug-target.h diff --git a/apps/debug_menu.c b/apps/debug_menu.c index d2d30ab675..e167b1f329 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -94,7 +94,8 @@ #include "pcf50605.h" #endif -#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 +#if CONFIG_CPU == DM320 || CONFIG_CPU == S3C2440 || CONFIG_CPU == TCC7801 \ + || CONFIG_CPU == IMX31L #include "debug-target.h" #endif @@ -2407,7 +2408,8 @@ static const struct the_menu_item menuitems[] = { (defined(CPU_PP) && !(defined(SANSA_E200) || defined(SANSA_C200))) { "Dump ROM contents", dbg_save_roms }, #endif -#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) || CONFIG_CPU == S3C2440 +#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \ + || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L { "View I/O ports", dbg_ports }, #endif #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) diff --git a/firmware/SOURCES b/firmware/SOURCES index 6d32e63be5..8229fecca0 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -642,6 +642,7 @@ target/arm/s3c2440/gigabeat-fx/wmcodec-meg-fx.c #ifndef SIMULATOR target/arm/lcd-as-memframe.S target/arm/mmu-arm.c +target/arm/imx31/debug-imx31.c target/arm/imx31/gigabeat-s/adc-imx31.c target/arm/imx31/gigabeat-s/ata-imx31.c target/arm/imx31/gigabeat-s/avic-imx31.c 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);