Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Configuration storage and RTC RAM
From: Heikki Hannikainen (hessu_at_hes.iki.fi)
Date: 2002-07-11


On Wed, 10 Jul 2002, Björn Stenberg wrote:

> Heikki Hannikainen wrote:

> > - Should I post the (rather simple) patch for the RTC RAM viewer?
>
> Sure, do so. Maybe we won't add it just yet, but it's better to have it
> here in the archive than just sitting on your disk.

  Here's 20020710-rtc-ram-viewer.diff, it adds a debug submenu with the
I/O port viewer and the RTC ram viewer.

  - Hessu

diff -urN orig/apps/debug_menu.c apps/debug_menu.c
--- orig/apps/debug_menu.c Thu Jan 1 02:00:00 1970
+++ apps/debug_menu.c Thu Jul 11 00:55:56 2002
@@ -0,0 +1,50 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Robert Hak
+ *
+ * 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"
+#ifdef HAVE_LCD_BITMAP
+#include <stdio.h>
+#include <stdbool.h>
+#include "lcd.h"
+#include "menu.h"
+#include "debug_menu.h"
+#include "button.h"
+#include "kernel.h"
+#include "sprintf.h"
+#include "debug.h"
+
+void debug_menu(void)
+{
+ int m;
+
+ struct menu_items items[] = {
+#ifndef SIMULATOR
+ { "Debug ports", dbg_ports },
+ { "Debug RTC", dbg_rtc },
+#endif
+ };
+
+ m=menu_init( items, sizeof items / sizeof(struct menu_items) );
+ menu_run(m);
+ menu_exit(m);
+}
+
+#endif
+
+
diff -urN orig/apps/debug_menu.h apps/debug_menu.h
--- orig/apps/debug_menu.h Thu Jan 1 02:00:00 1970
+++ apps/debug_menu.h Thu Jul 11 00:55:56 2002
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 Robert Hak
+ *
+ * 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.
+ *
+ ****************************************************************************/
+#ifndef _DEBUG_MENU_H
+#define _DEBUG_MENU_H
+
+void debug_menu(void);
+
+#endif
diff -urN orig/apps/main_menu.c apps/main_menu.c
--- orig/apps/main_menu.c Thu Jul 4 16:38:49 2002
+++ apps/main_menu.c Thu Jul 11 00:56:05 2002
@@ -25,7 +25,7 @@
 #include "kernel.h"
 #include "main_menu.h"
 #include "version.h"
-#include "debug.h"
+#include "debug_menu.h"
 #include "sprintf.h"
 #include <string.h>
 #include "playlist.h"
@@ -135,7 +135,7 @@
 #endif
         { "Version", show_credits },
 #ifndef SIMULATOR
- { "Debug (keep out!)", dbg_ports },
+ { "Debug (keep out!)", debug_menu },
 #endif
     };
 
diff -urN orig/firmware/debug.c firmware/debug.c
--- orig/firmware/debug.c Thu Jul 4 19:09:53 2002
+++ firmware/debug.c Thu Jul 11 01:07:37 2002
@@ -36,6 +36,8 @@
 #include "mas.h"
 #include "power.h"
 
+#include "rtc.h"
+
 void debug_init(void)
 {
     /* Clear it all! */
@@ -386,6 +388,59 @@
                 break;
         }
     }
+}
+#endif
+
+#ifdef HAVE_RTC
+/* Read RTC RAM contents and display them */
+void dbg_rtc(void)
+{
+ char buf[32];
+ unsigned char addr = 0, r, c;
+ int i;
+ int button;
+
+ lcd_clear_display();
+ lcd_puts(0, 0, "RTC read:");
+
+ while(1)
+ {
+ for (r = 0; r <= 3; r++) {
+ snprintf(buf, 10, "0x%02x: ", addr + r*4);
+ for (c = 0; c <= 3; c++) {
+ i = rtc_read(addr + r*4 + c);
+ snprintf(buf + 6 + c*2, 3, "%02x", i);
+ }
+ lcd_puts(1, r+1, buf);
+ }
+
+ lcd_update();
+ sleep(HZ/2);
+
+ button = button_get(false);
+
+ switch(button)
+ {
+ case BUTTON_RIGHT:
+ if (addr < 63-16) { addr += 16; }
+ break;
+ case BUTTON_LEFT:
+ if (addr) { addr -= 16; }
+ break;
+ case BUTTON_F2:
+ /* clear the user RAM space */
+ for (c = 0; c <= 43; c++)
+ rtc_write(0x18 + c, 0);
+ break;
+ case BUTTON_OFF:
+ return;
+ }
+ }
+}
+#else
+void dbg_rtc(void)
+{
+ return;
 }
 #endif
 
diff -urN orig/firmware/debug.h firmware/debug.h
--- orig/firmware/debug.h Tue Jul 2 18:59:15 2002
+++ firmware/debug.h Thu Jul 11 00:56:18 2002
@@ -23,6 +23,9 @@
 extern void debugf(char* fmt,...);
 #ifndef SIMULATOR
 extern void dbg_ports(void);
+#ifdef HAVE_RTC
+extern void dbg_rtc(void);
+#endif
 #endif
 
 #ifdef __GNUC__



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa