summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-01-27 11:05:38 +0000
committerThomas Martitz <kugel@rockbox.org>2009-01-27 11:05:38 +0000
commita43b0db3d10aeb04e78494074f90b553b1a8ae59 (patch)
tree5c9e5850a3516496308ca248f4640e0bbd0b32cc
parent9d10f112994ddd3470e219175b92ab201769ba87 (diff)
downloadrockbox-a43b0db3d10aeb04e78494074f90b553b1a8ae59.tar.gz
rockbox-a43b0db3d10aeb04e78494074f90b553b1a8ae59.zip
Sansa AMS: Debug screen, shows GPIO and (on the fuze) DBOP input for now, to be extended
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19866 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c4
-rw-r--r--firmware/SOURCES1
-rw-r--r--firmware/target/arm/as3525/debug-as3525.c49
-rw-r--r--firmware/target/arm/as3525/sansa-c200v2/debug-target.h (renamed from firmware/target/arm/as3525/debug-target.h)1
-rw-r--r--firmware/target/arm/as3525/sansa-clip/debug-target.h26
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/debug-target.h26
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/button-fuze.c12
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/debug-target.h28
-rw-r--r--firmware/target/arm/as3525/sansa-m200v4/debug-target.h26
9 files changed, 163 insertions, 10 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index f613c0a18a..60f4761e94 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2651,10 +2651,10 @@ static const struct the_menu_item menuitems[] = {
{ "Dump ROM contents", dbg_save_roms },
#endif
#if CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) || defined(CPU_PP) \
- || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L
+ || CONFIG_CPU == S3C2440 || CONFIG_CPU == IMX31L || CONFIG_CPU == AS3525
{ "View I/O ports", dbg_ports },
#endif
- #if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
+#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR)
{ "View PCF registers", dbg_pcf },
#endif
#if defined(HAVE_TSC2100) && !defined(SIMULATOR)
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 46c46c2ce2..614b0e3bca 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -344,6 +344,7 @@ target/arm/pnx0101/system-pnx0101.c
#endif
#if CONFIG_CPU == AS3525
+target/arm/as3525/debug-as3525.c
target/arm/as3525/system-as3525.c
target/arm/as3525/kernel-as3525.c
target/arm/as3525/ata_sd_as3525.c
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c
index 8a2f8838d6..a08d33e3da 100644
--- a/firmware/target/arm/as3525/debug-as3525.c
+++ b/firmware/target/arm/as3525/debug-as3525.c
@@ -21,15 +21,60 @@
#include <stdbool.h>
#include "debug-target.h"
+#include "button.h"
+#include "lcd.h"
+#include "font.h"
+#include "system.h"
+#include "sprintf.h"
+
+
+#define _DEBUG_PRINTF(a,varargs...) \
+ snprintf(buf, sizeof(buf), (a), ##varargs); lcd_puts(0,line++,buf)
/* TODO */
-bool __dbg_ports(void)
+bool __dbg_hw_info(void)
{
return false;
}
-bool __dbg_hw_info(void)
+bool __dbg_ports(void)
{
+ char buf[50];
+ int line, i;
+ char counter = 0;
+
+ lcd_clear_display();
+ lcd_setfont(FONT_SYSFIXED);
+ char gpio_data[4] = {0,0,0,0};
+
+ while(1)
+ {
+ line = 0;
+ for (i = 0; i < 8; i++)
+ {
+ gpio_data[0] |= GPIOA_PIN(i) & (1<<i);
+ gpio_data[1] |= GPIOB_PIN(i) & (1<<i);
+ gpio_data[2] |= GPIOC_PIN(i) & (1<<i);
+ gpio_data[3] |= GPIOD_PIN(i) & (1<<i);
+ }
+
+ line++;
+ _DEBUG_PRINTF("[GPIO Values and Directions]");
+ _DEBUG_PRINTF("GPIOA: %2x DIR: %2x", gpio_data[0], GPIOA_DIR);
+ _DEBUG_PRINTF("GPIOB: %2x DIR: %2x", gpio_data[1], GPIOB_DIR);
+ _DEBUG_PRINTF("GPIOC: %2x DIR: %2x", gpio_data[2], GPIOC_DIR);
+ _DEBUG_PRINTF("GPIOD: %2x DIR: %2x", gpio_data[3], GPIOD_DIR);
+ line++;
+#ifdef TRACK_DBOP_DIN
+ _DEBUG_PRINTF("[DBOP_DIN]");
+ _DEBUG_PRINTF("DBOP_DIN: %4x", _dbop_din);
+#endif
+ memset(gpio_data, 0, sizeof(gpio_data));
+ lcd_update();
+ if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL))
+ break;
+ }
+ lcd_setfont(FONT_UI);
return false;
}
diff --git a/firmware/target/arm/as3525/debug-target.h b/firmware/target/arm/as3525/sansa-c200v2/debug-target.h
index d3b7a28aee..0769a2f11d 100644
--- a/firmware/target/arm/as3525/debug-target.h
+++ b/firmware/target/arm/as3525/sansa-c200v2/debug-target.h
@@ -21,5 +21,6 @@
#include <stdbool.h>
+#define DEBUG_CANCEL BUTTON_LEFT
bool __dbg_hw_info(void);
bool __dbg_ports(void);
diff --git a/firmware/target/arm/as3525/sansa-clip/debug-target.h b/firmware/target/arm/as3525/sansa-clip/debug-target.h
new file mode 100644
index 0000000000..0769a2f11d
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-clip/debug-target.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Karl Kurbjun
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdbool.h>
+
+#define DEBUG_CANCEL BUTTON_LEFT
+bool __dbg_hw_info(void);
+bool __dbg_ports(void);
diff --git a/firmware/target/arm/as3525/sansa-e200v2/debug-target.h b/firmware/target/arm/as3525/sansa-e200v2/debug-target.h
new file mode 100644
index 0000000000..0769a2f11d
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-e200v2/debug-target.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Karl Kurbjun
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdbool.h>
+
+#define DEBUG_CANCEL BUTTON_LEFT
+bool __dbg_hw_info(void);
+bool __dbg_ports(void);
diff --git a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
index ff07965f90..e52a1d37d8 100644
--- a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c
@@ -42,8 +42,8 @@ static bool hold_button_old = false;
#else
#define hold_button false
#endif /* !BOOTLOADER */
-static int int_btn = BUTTON_NONE;
-static short dbop_din = BUTTON_NONE;
+static int int_btn = BUTTON_NONE;
+short _dbop_din = BUTTON_NONE;
void button_init_device(void)
{
@@ -76,7 +76,7 @@ static void get_wheel(void)
{ 2, 0, 3, 1 }, /* Clockwise rotation */
{ 1, 3, 0, 2 }, /* Counter-clockwise */
};
- wheel_value = dbop_din & (1<<13|1<<14);
+ wheel_value = _dbop_din & (1<<13|1<<14);
wheel_value >>= 13;
/* did the wheel value change? */
if (!hold_button)
@@ -130,7 +130,7 @@ static void get_wheel(void)
/* get hold button state */
static void get_hold(void)
{
- hold_button = dbop_din & (1<<12);
+ hold_button = _dbop_din & (1<<12);
}
#endif
@@ -141,7 +141,7 @@ bool button_hold(void)
static void get_power(void)
{
- if (dbop_din & (1<<8))
+ if (_dbop_din & (1<<8))
int_btn |= BUTTON_POWER;
}
@@ -172,7 +172,7 @@ static void get_button_from_dbob(void)
temp = DBOP_STAT;
} while ((temp & (1<<16)) == 0); /* wait for valid data */
- dbop_din = DBOP_DIN; /* now read */
+ _dbop_din = DBOP_DIN; /* now read */
DBOP_TIMPOL_01 = 0x6e167;
DBOP_TIMPOL_23 = 0xa167e06f;
diff --git a/firmware/target/arm/as3525/sansa-fuze/debug-target.h b/firmware/target/arm/as3525/sansa-fuze/debug-target.h
new file mode 100644
index 0000000000..7ba5b2e4db
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-fuze/debug-target.h
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Karl Kurbjun
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdbool.h>
+
+#define DEBUG_CANCEL BUTTON_LEFT
+#define TRACK_DBOP_DIN
+extern short _dbop_din;
+bool __dbg_hw_info(void);
+bool __dbg_ports(void);
diff --git a/firmware/target/arm/as3525/sansa-m200v4/debug-target.h b/firmware/target/arm/as3525/sansa-m200v4/debug-target.h
new file mode 100644
index 0000000000..0769a2f11d
--- /dev/null
+++ b/firmware/target/arm/as3525/sansa-m200v4/debug-target.h
@@ -0,0 +1,26 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Karl Kurbjun
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdbool.h>
+
+#define DEBUG_CANCEL BUTTON_LEFT
+bool __dbg_hw_info(void);
+bool __dbg_ports(void);