You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(79) |
Aug
(27) |
Sep
(64) |
Oct
(202) |
Nov
(31) |
Dec
(59) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(125) |
Feb
(173) |
Mar
(13) |
Apr
(140) |
May
(75) |
Jun
(1) |
Jul
(37) |
Aug
(14) |
Sep
|
Oct
(20) |
Nov
(9) |
Dec
(2) |
| 2003 |
Jan
(51) |
Feb
(12) |
Mar
(18) |
Apr
(24) |
May
(1) |
Jun
|
Jul
|
Aug
(72) |
Sep
(12) |
Oct
(18) |
Nov
(60) |
Dec
(26) |
| 2004 |
Jan
(1) |
Feb
(40) |
Mar
(3) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(5) |
| 2006 |
Jan
(13) |
Feb
(5) |
Mar
(8) |
Apr
(13) |
May
(7) |
Jun
(6) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(35) |
Nov
(20) |
Dec
(10) |
| 2007 |
Jan
(13) |
Feb
(9) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(1) |
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(54) |
Jun
(78) |
Jul
(35) |
Aug
(21) |
Sep
(21) |
Oct
(29) |
Nov
(10) |
Dec
(5) |
| 2010 |
Jan
|
Feb
|
Mar
(26) |
Apr
(55) |
May
(73) |
Jun
(63) |
Jul
(38) |
Aug
(39) |
Sep
(19) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
| 2011 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: Stefan E. <se...@us...> - 2001-10-04 16:33:43
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv27788
Modified Files:
chkmem.c
Log Message:
- moved peek and poke to debug.c
Index: chkmem.c
===================================================================
RCS file: /cvsroot/blob/blob/src/chkmem.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- chkmem.c 2001/10/01 12:40:18 1.4
+++ chkmem.c 2001/10/04 16:33:41 1.5
@@ -234,92 +234,6 @@
__commandlist(ChkMem, "chkmem", chkmemhelp);
-/*********************************************************************
- * Poke
- *
- * AUTOR: Stefan Eletzhofer
- * REVISED:
- *
- * Poke values to memory
- *
- */
-int Poke( int argc, char *argv[] )
-{
- u32 address;
- u32 value;
-
- if ( argc < 3 ) {
- SerialOutputString("*** not enough arguments\n");
- return CHKMEM_ERR;
- }
-
- if(strtoval(argv[1], &address) < 0) {
- SerialOutputString("*** not an address\n");
- return CHKMEM_ERR;
- }
-
- if(strtoval(argv[2], &value) < 0) {
- SerialOutputString("*** not a value\n");
- return CHKMEM_ERR;
- }
-
-
-#if CHKMEM_DEBUG
- SerialOutputString("adr=0x");
- SerialOutputHex(address);
- SerialOutputString(" val=0x");
- SerialOutputHex(value);
- SerialOutputString("\n");
-#endif
-
- MEM( address ) = value;
-
- return CHKMEM_OK;
-}
-static char pokehelp[] = "poke address value\n";
-__commandlist(Poke, "poke", pokehelp );
-
-/*********************************************************************
- * Peek
- *
- * AUTOR: Stefan Eletzhofer
- * REVISED:
- *
- * Poke values to memory
- *
- */
-int Peek( int argc, char *argv[] )
-{
- u32 address;
- u32 value;
-
- if ( argc < 2 ) {
- SerialOutputString("*** not enough arguments\n");
- return CHKMEM_ERR;
- }
-
- if(strtoval(argv[1], &address) < 0) {
- SerialOutputString("*** not an address\n");
- return CHKMEM_ERR;
- }
-
-#if CHKMEM_DEBUG
- SerialOutputString("adr=0x");
- SerialOutputHex(address);
- SerialOutputString("\n");
-#endif
-
- value = MEM( address );
-
- SerialOutputHex(value);
- SerialOutputString("\n");
-
- return CHKMEM_OK;
-}
-static char peekhelp[] = "peek address\n";
-__commandlist(Peek, "peek", peekhelp );
-
-
/*********************************************************************/
/** STATIC FUNCTIONS ************************************************/
/*********************************************************************/
|
|
From: Erik M. <er...@us...> - 2001-10-04 16:28:47
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv25664 Modified Files: Makefile.am Log Message: add memsetup.h to the list of header files Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/include/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Makefile.am 2001/10/03 16:02:43 1.6 +++ Makefile.am 2001/10/04 16:28:40 1.7 @@ -21,6 +21,7 @@ linux.h \ main.h \ memory.h \ + memsetup.h \ param_block.h \ registers.h \ sa1100.h \ |
|
From: Erik M. <er...@us...> - 2001-10-04 16:26:52
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv24785 Modified Files: start.S memsetup-sa1110.S Log Message: - move led init before memory init - cleanup sa1110 memory setup. creditlart is the same as assabet for the time being Index: start.S =================================================================== RCS file: /cvsroot/blob/blob/src/start.S,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- start.S 2001/10/04 12:16:37 1.4 +++ start.S 2001/10/04 16:26:50 1.5 @@ -103,11 +103,11 @@ str r1, [r0, #PPCR] - /* setup memory */ - bl memsetup - /* init LED */ bl ledinit + + /* setup memory */ + bl memsetup /* check if this is a wake-up from sleep */ Index: memsetup-sa1110.S =================================================================== RCS file: /cvsroot/blob/blob/src/memsetup-sa1110.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- memsetup-sa1110.S 2001/10/04 12:23:08 1.3 +++ memsetup-sa1110.S 2001/10/04 16:26:50 1.4 @@ -45,10 +45,9 @@ .text MEM_REG_BASE: .long 0xa0000000 -MEM_START: .long 0xc0000000 +MEM_START: .long 0xc0000000 -#ifdef ASSABET - .align 4 +#if (defined ASSABET) || (defined CLART) MEMORY_CONFIG: .long 0x72547254 /* 0x0 MDCNFG */ .long 0xAAAAAA7F /* 0x04 MDCAS00 */ @@ -63,11 +62,9 @@ .long 0xAAAAAAAA /* 0x28 MDCAS22 */ .long 0x42196669 /* 0x2C MCS2 */ .long 0xafccafcc /* 0x30 SMCNFG */ -MEMORY_CONFIG_END: - .long 0x0 +#endif -#elif defined PT_SYSTEM3 - .align 4 +#if defined PT_SYSTEM3 MEMORY_CONFIG: .long 0x72547254 /* 0x0 MDCNFG */ .long 0xAAAAAA7F /* 0x04 MDCAS00 */ @@ -82,21 +79,16 @@ .long 0xAAAAAAAA /* 0x28 MDCAS22 */ .long 0x00002249 /* 0x2C MCS2 */ .long 0xafccafcc /* 0x30 SMCNFG */ -MEMORY_CONFIG_END: - .long 0x0 -#else -# error "add memory config for your board!" #endif + .globl memsetup memsetup: mov r5, lr - bl ledinit - bl led_on /* Set up the SDRAM */ ldr r0, MEM_REG_BASE - adr r1, MEMORY_CONFIG + adr r1, MEMORY_CONFIG ldr r2, [r1, #MDCNFG ] str r2, [r0, #MDCNFG ] @@ -119,25 +111,21 @@ ldr r2, [r1, #MDCAS22 ] str r2, [r0, #MDCAS22 ] -#if 1 /* clear K1DB2 K2DB2 */ ldr r2, [ r0, #MDREFR ] - bic r2, r2, #MDREFR_K1DB2 - //bic r2, r2, #MDREFR_K2DB2 + bic r2, r2, #(MDREFR_K1DB2 | MDREFR_K2DB2) str r2, [ r0, #MDREFR ] /* set TRASR and DRI, K1DB2 K2DB2 */ ldr r2, [ r0, #MDREFR ] orr r2, r2, #MDREFR_TRASR(7) orr r2, r2, #MDREFR_DRI(12) - orr r2, r2, #MDREFR_K1DB2 - orr r2, r2, #MDREFR_K2DB2 + orr r2, r2, #(MDREFR_K1DB2 | MDREFR_K2DB2) str r2, [ r0, #MDREFR ] /* set K1RUN K2RUN */ ldr r2, [ r0, #MDREFR ] - orr r2, r2, #MDREFR_K1RUN - orr r2, r2, #MDREFR_K2RUN + orr r2, r2, #(MDREFR_K1RUN | MDREFR_K2RUN) str r2, [ r0, #MDREFR ] /* clear SLFRSH */ @@ -149,14 +137,6 @@ ldr r2, [ r0, #MDREFR ] orr r2, r2, #MDREFR_E1PIN str r2, [ r0, #MDREFR ] -#else - ldr r2, [ r1, #MDREFR ] - orr r2, r2, #MDREFR_K1DB2 - orr r2, r2, #MDREFR_K2DB2 - //orr r2, r2, #MDREFR_EAPD - //orr r2, r2, #MDREFR_KAPD - str r2, [ r0, #MDREFR ] -#endif /* Issue read requests to disabled bank to start refresh */ ldr r1, =0xC0000000 @@ -169,19 +149,8 @@ /* ENABLE SDRAM BANKS */ ldr r2, [r0, #MDCNFG ] -#if defined ASSABET - orr r2, r2, #0x00000001 /* BANK 0 */ - // orr r2, r2, #0x00000002 /* BANK 1 */ - // orr r2, r2, #0x00010000 /* BANK 2 */ - // orr r2, r2, #0x00020000 /* BANK 3 */ -#elif defined PT_SYSTEM3 - orr r2, r2, #0x00000001 /* BANK 0 */ - // orr r2, r2, #0x00000002 /* BANK 1 */ - orr r2, r2, #0x00010000 /* BANK 2 */ - // orr r2, r2, #0x00020000 /* BANK 3 */ -#else -# error "Enable SDRAM Banks on your board!" -#endif + orr r2, r2, #0x00000003 + orr r2, r2, #0x00030000 str r2, [r0, #MDCNFG] /* OPTIONALLY enable Autopowerup/down */ |
|
From: Stefan E. <se...@us...> - 2001-10-04 14:49:11
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv28533/src Modified Files: Makefile.am Log Message: - added misc debugging functions module Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Makefile.am 2001/10/03 19:55:34 1.10 +++ Makefile.am 2001/10/04 14:49:08 1.11 @@ -79,10 +79,12 @@ # conditionally compiled sources EXTRA_blob_rest_elf32_SOURCES = \ chkmem.c \ + debug.c \ clock.c blob_rest_elf32_DEPENDENCIES = \ @CHKMEM@ \ + @DEBUG@ \ @CLOCK@ blob_rest_elf32_LDFLAGS += \ @@ -91,6 +93,7 @@ blob_rest_elf32_LDADD += \ @CHKMEM@ \ + @DEBUG@ \ @CLOCK@ \ -lgcc |
|
From: Stefan E. <se...@us...> - 2001-10-04 14:47:36
|
Update of /cvsroot/blob/blob
In directory usw-pr-cvs1:/tmp/cvs-serv27890
Modified Files:
configure.in
Log Message:
- added debugging functions compile time option
Index: configure.in
===================================================================
RCS file: /cvsroot/blob/blob/configure.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- configure.in 2001/10/04 12:42:12 1.12
+++ configure.in 2001/10/04 14:47:34 1.13
@@ -176,7 +176,12 @@
[chkmem_flag=$enable_memtest],
[chkmem_flag=no])
+AC_ARG_ENABLE(debug,
+[ --enable-debug Enable support for misc debugging functions ],
+[debug_flag=$enable_debug],
+[debug_flag=no])
+
dnl Check if the user wants *all* features
AC_ARG_ENABLE(all-features,
[ --enable-all-features Enable all features],
@@ -186,6 +191,7 @@
if test "x$all_features_flag" = "xyes" ; then
clock_scaling_flag=yes
chkmem_flag=yes
+ debug_flag=yes
fi
@@ -213,6 +219,13 @@
AC_SUBST(CHKMEM)
+dnl Check wether or not debug code is wanted
+if test "x$debug_flag" = "xyes" ; then
+ DEBUG="debug.o"
+fi
+
+AC_SUBST(DEBUG)
+
@@ -291,5 +304,6 @@
echo "Objcopy flags ${OCFLAGS}"
echo "Clock scaling support ${clock_scaling_flag}"
echo "Memory test support ${chkmem_flag}"
+echo "Debugging commands support ${debug_flag}"
echo "Run-time debug information ${blob_debug_flag}"
echo ""
|
|
From: Stefan E. <se...@us...> - 2001-10-04 14:46:11
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv27518
Modified Files:
debug.c
Log Message:
- moved peek and pore from chkmem.c over here
- added memcpy command
- added bitchg command
Index: debug.c
===================================================================
RCS file: /cvsroot/blob/blob/src/debug.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- debug.c 2001/10/04 12:38:59 1.1
+++ debug.c 2001/10/04 14:46:08 1.2
@@ -0,0 +1,285 @@
+/*
+ * debug.c: Debugging command functions
+ *
+ * Copyright (C) 2001 Stefan Eletzhofer <ste...@ww...>
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+/**********************************************************************
+ * Includes
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "errno.h"
+#include "error.h"
+#include "types.h"
+#include "util.h"
+#include "serial.h"
+#include "command.h"
+
+/**********************************************************************
+ * defines
+ */
+
+/* this will send a cold shiver through erik's spine ... */
+#define ERR( x ) { ret = x; goto DONE; }
+
+/* more readable IMHO */
+#define MEM( x ) (*((u32 *)x))
+
+/**********************************************************************
+ * program globals
+ */
+
+/**********************************************************************
+ * module globals
+ */
+
+/**********************************************************************
+ * prototypes
+ */
+
+void perror( int errno, char *func )
+{
+ printerrprefix();
+
+ if ( errno < 0 )
+ errno = -errno;
+
+ if ( func != NULL) {
+ SerialOutputString(func);
+ SerialOutputString(": ");
+ }
+ SerialOutputString(strerror(errno));
+
+ SerialOutputByte('\n');
+}
+
+/**********************************************************************
+ * exported functions
+ */
+
+/**********************************************************************
+ * static functions
+ */
+
+/*********************************************************************
+ * CmdMemcpy
+ *
+ * AUTOR: SELETZ
+ * REVISED:
+ *
+ * Command wrapper for memcpy utility function.
+ *
+ */
+static int CmdMemcpy( int argc, char *argv[] )
+{
+ int ret = 0;
+ u32 src = 0L;
+ u32 dest = 0L;
+ u32 len = 0L;
+
+ if ( argc < 4 ) ERR( -EINVAL );
+
+ ret = strtoval( argv[1], &src );
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ ret = strtoval( argv[2], &dest );
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ ret = strtoval( argv[3], &len );
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ /* counted in words */
+ if ( len & 0x00000003 ) {
+ len = ( len >> 2 ) + 1;
+ } else {
+ len = len >> 2;
+ }
+
+ SerialOutputString("\n### Now copying 0x");
+ SerialOutputHex(len);
+ SerialOutputString(" words from 0x");
+ SerialOutputHex((int)src);
+ SerialOutputString(" to 0x");
+ SerialOutputHex((int)dest);
+ SerialOutputByte('\n');
+
+ MyMemCpy( (u32 *)dest, (const u32 *)src, len);
+
+ SerialOutputString(" done\n");
+
+ ret = 0;
+DONE:
+ if ( ret != 0 ) {
+ perror( ret, __FUNCTION__ );
+ }
+ return ret;
+}
+
+static char memcpyhelp[] = "memcpy [source] [dest] [len]\n"
+"copy memory blocks\n";
+__commandlist(CmdMemcpy, "memcpy", memcpyhelp);
+
+/*********************************************************************
+ * Poke
+ *
+ * AUTOR: Stefan Eletzhofer
+ * REVISED:
+ *
+ * Poke values to memory
+ *
+ */
+int Poke( int argc, char *argv[] )
+{
+ int ret = 0;
+ u32 address;
+ u32 value;
+
+ if ( argc < 3 ) ERR( -EINVAL );
+
+ ret = strtoval(argv[1], &address);
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ ret = strtoval(argv[2], &value);
+ if ( ret < 0 ) ERR( -EINVAL );
+
+#if CHKMEM_DEBUG
+ SerialOutputString("adr=0x");
+ SerialOutputHex(address);
+ SerialOutputString(" val=0x");
+ SerialOutputHex(value);
+ SerialOutputString("\n");
+#endif
+
+ MEM( address ) = value;
+
+ ret = 0;
+DONE:
+ if ( ret != 0 ) {
+ perror( ret, __FUNCTION__ );
+ }
+ return ret;
+}
+static char pokehelp[] = "poke address value\n";
+__commandlist(Poke, "poke", pokehelp );
+
+/*********************************************************************
+ * Peek
+ *
+ * AUTOR: Stefan Eletzhofer
+ * REVISED:
+ *
+ * Poke values to memory
+ *
+ */
+int Peek( int argc, char *argv[] )
+{
+ int ret = 0;
+ u32 address;
+ u32 value;
+
+ if ( argc < 2 ) ERR( -EINVAL );
+
+ ret = strtoval(argv[1], &address);
+ if ( ret < 0 ) ERR( -EINVAL );
+
+#if CHKMEM_DEBUG
+ SerialOutputString("adr=0x");
+ SerialOutputHex(address);
+ SerialOutputString("\n");
+#endif
+
+ value = MEM( address );
+
+ SerialOutputHex(value);
+ SerialOutputString("\n");
+
+ ret = 0;
+DONE:
+ if ( ret != 0 ) {
+ perror( ret, __FUNCTION__ );
+ }
+ return ret;
+}
+static char peekhelp[] = "peek address\n";
+__commandlist(Peek, "peek", peekhelp );
+
+
+/*********************************************************************
+ * BitChange
+ *
+ * AUTOR: SELETZ
+ * REVISED:
+ *
+ * Modifies bits of an given memory location
+ *
+ */
+int BitChange( int argc, char *argv[] )
+{
+ int ret = 0;
+ u32 adr = 0L;
+ u32 value = 0L;
+
+ if ( argc < 4 ) ERR( -EINVAL );
+
+ ret = strtoval( argv[1], &adr );
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ ret = strtoval( argv[2], &value );
+ if ( ret < 0 ) ERR( -EINVAL );
+
+ SerialOutputHex( MEM( adr ) );
+
+ switch ( argv[3][0] & (~0x20) ) {
+ case 'A':
+ MEM( adr ) &= value;
+ break;
+ case 'S':
+ case 'O':
+ MEM( adr ) |= value;
+ break;
+ case 'X':
+ MEM( adr ) ^= value;
+ break;
+ case 'C':
+ MEM( adr ) &= ~value;
+ break;
+ default:
+ ERR( -EINVAL );
+ break;
+ }
+
+ SerialOutputString( "->" );
+ SerialOutputHex( MEM( adr ) );
+ SerialOutputString( "\n" );
+
+ ret = 0;
+DONE:
+ if ( ret != 0 ) {
+ perror( ret, __FUNCTION__ );
+ }
+ return ret;
+}
+static char bitchghelp[] = "bitchg address value {and|or|xor|set|clear}\n";
+__commandlist(BitChange, "bitchg", bitchghelp );
+
|
|
From: Erik M. <er...@us...> - 2001-10-04 12:42:15
|
Update of /cvsroot/blob/blob In directory usw-pr-cvs1:/tmp/cvs-serv27817 Modified Files: configure.in Log Message: Add --enable-all-features to enable all features with a single switch Index: configure.in =================================================================== RCS file: /cvsroot/blob/blob/configure.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- configure.in 2001/09/27 23:27:51 1.11 +++ configure.in 2001/10/04 12:42:12 1.12 @@ -165,13 +165,32 @@ - -dnl Check wether or not clock scaling code is wanted +dnl Check for individual features AC_ARG_ENABLE(clock-scaling, [ --enable-clock-scaling Enable support for clock scaling (SA1100 only)], [clock_scaling_flag=$enable_clock_scaling], [clock_scaling_flag=no]) +AC_ARG_ENABLE(memtest, +[ --enable-memtest Enable support for memory tests ], +[chkmem_flag=$enable_memtest], +[chkmem_flag=no]) + + +dnl Check if the user wants *all* features +AC_ARG_ENABLE(all-features, +[ --enable-all-features Enable all features], +[all_features_flag=$enable_all_features], +[all_features_flag=no]) + +if test "x$all_features_flag" = "xyes" ; then + clock_scaling_flag=yes + chkmem_flag=yes +fi + + + +dnl Check wether or not clock scaling code is wanted if test "x$clock_scaling_flag" = "xyes" ; then if test "x$use_cpu" = "xsa1100"; then CLOCK="clock.o" @@ -188,11 +207,6 @@ dnl Check wether or not memtest code is wanted -AC_ARG_ENABLE(memtest, -[ --enable-memtest Enable support for memory tests ], -[chkmem_flag=$enable_memtest], -[chkmem_flag=no]) - if test "x$chkmem_flag" = "xyes" ; then CHKMEM="chkmem.o" fi |
|
From: Stefan E. <se...@us...> - 2001-10-04 12:39:16
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv27012 Added Files: debug.c Log Message: - new file. will contain all debugging commands --- NEW FILE debug.c --- |
|
From: Stefan E. <se...@us...> - 2001-10-04 12:23:15
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv23106 Modified Files: memsetup-sa1110.S Log Message: - largely reworked for multiple board support - perform SA1110 Hardware Reset Procedure Index: memsetup-sa1110.S =================================================================== RCS file: /cvsroot/blob/blob/src/memsetup-sa1110.S,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- memsetup-sa1110.S 2001/09/23 15:01:18 1.2 +++ memsetup-sa1110.S 2001/10/04 12:23:08 1.3 @@ -29,6 +29,10 @@ * appears to be true, but it might be possible that somebody designs a * board with mixed EDODRAM/SDRAM memory. -- Erik * + * 04-10-2001: SELETZ + * - separated memory config for multiple platform support + * - perform SA1110 Hardware Reset Procedure + * */ .ident "$Id$" @@ -37,95 +41,170 @@ # include <config.h> #endif +#include <memsetup.h> - - .text - - - - -MEM_BASE: .long 0xa0000000 -MEM_START: .long 0xc0000000 -#define MDCNFG 0x0 -#define MDCAS0 0x04 -#define MDCAS1 0x08 -#define MDCAS2 0x0c -#define MCS0 0x10 +MEM_REG_BASE: .long 0xa0000000 +MEM_START: .long 0xc0000000 - - +#ifdef ASSABET + .align 4 +MEMORY_CONFIG: + .long 0x72547254 /* 0x0 MDCNFG */ + .long 0xAAAAAA7F /* 0x04 MDCAS00 */ + .long 0xAAAAAAAA /* 0x08 MDCAS01 */ + .long 0xAAAAAAAA /* 0x0c MDCAS02 */ + .long 0x4b904b90 /* 0x10 MCS0 */ + .long 0x22212419 /* 0x14 MCS1 */ + .long 0x994a994a /* 0x18 MECR */ + .long 0x4dbc0317 /* 0x1C MDREFR */ + .long 0xAAAAAA7F /* 0x20 MDCAS20 */ + .long 0xAAAAAAAA /* 0x24 MDCAS21 */ + .long 0xAAAAAAAA /* 0x28 MDCAS22 */ + .long 0x42196669 /* 0x2C MCS2 */ + .long 0xafccafcc /* 0x30 SMCNFG */ +MEMORY_CONFIG_END: + .long 0x0 + +#elif defined PT_SYSTEM3 + .align 4 +MEMORY_CONFIG: + .long 0x72547254 /* 0x0 MDCNFG */ + .long 0xAAAAAA7F /* 0x04 MDCAS00 */ + .long 0xAAAAAAAA /* 0x08 MDCAS01 */ + .long 0xAAAAAAAA /* 0x0c MDCAS02 */ + .long 0x00004380 /* 0x10 MCS0 */ + .long 0xfef5212c /* 0x14 MCS1 */ + .long 0x994a994a /* 0x18 MECR */ + .long 0x023600c1 /* 0x1C MDREFR */ + .long 0xAAAAAA7F /* 0x20 MDCAS20 */ + .long 0xAAAAAAAA /* 0x24 MDCAS21 */ + .long 0xAAAAAAAA /* 0x28 MDCAS22 */ + .long 0x00002249 /* 0x2C MCS2 */ + .long 0xafccafcc /* 0x30 SMCNFG */ +MEMORY_CONFIG_END: + .long 0x0 +#else +# error "add memory config for your board!" +#endif .globl memsetup memsetup: - /* This part is actually for the Assabet only. If your board - * uses other settings, you'll have to ifdef them here. - */ - /* Set up the SDRAM */ - mov r1, #0xA0000000 /* MDCNFG base address */ - - ldr r2, =0xAAAAAA7F - str r2, [r1, #0x04] /* MDCAS00 */ - str r2, [r1, #0x20] /* MDCAS20 */ + mov r5, lr + bl ledinit + bl led_on - ldr r2, =0xAAAAAAAA - str r2, [r1, #0x08] /* MDCAS01 */ - str r2, [r1, #0x24] /* MDCAS21 */ + /* Set up the SDRAM */ + ldr r0, MEM_REG_BASE + adr r1, MEMORY_CONFIG - ldr r2, =0xAAAAAAAA - str r2, [r1, #0x0C] /* MDCAS02 */ - str r2, [r1, #0x28] /* MDCAS22 */ + ldr r2, [r1, #MDCNFG ] + str r2, [r0, #MDCNFG ] - ldr r2, =0x4dbc0327 /* MDREFR */ - str r2, [r1, #0x1C] + ldr r2, [r1, #MDCAS00 ] + str r2, [r0, #MDCAS00 ] - ldr r2, =0x72547254 /* MDCNFG */ - str r2, [r1, #0x00] + ldr r2, [r1, #MDCAS01 ] + str r2, [r0, #MDCAS01 ] + + ldr r2, [r1, #MDCAS02 ] + str r2, [r0, #MDCAS02 ] + + ldr r2, [r1, #MDCAS20 ] + str r2, [r0, #MDCAS20 ] + + ldr r2, [r1, #MDCAS21 ] + str r2, [r0, #MDCAS21 ] + + ldr r2, [r1, #MDCAS22 ] + str r2, [r0, #MDCAS22 ] + +#if 1 + /* clear K1DB2 K2DB2 */ + ldr r2, [ r0, #MDREFR ] + bic r2, r2, #MDREFR_K1DB2 + //bic r2, r2, #MDREFR_K2DB2 + str r2, [ r0, #MDREFR ] + + /* set TRASR and DRI, K1DB2 K2DB2 */ + ldr r2, [ r0, #MDREFR ] + orr r2, r2, #MDREFR_TRASR(7) + orr r2, r2, #MDREFR_DRI(12) + orr r2, r2, #MDREFR_K1DB2 + orr r2, r2, #MDREFR_K2DB2 + str r2, [ r0, #MDREFR ] + + /* set K1RUN K2RUN */ + ldr r2, [ r0, #MDREFR ] + orr r2, r2, #MDREFR_K1RUN + orr r2, r2, #MDREFR_K2RUN + str r2, [ r0, #MDREFR ] + + /* clear SLFRSH */ + ldr r2, [ r0, #MDREFR ] + bic r2, r2, #MDREFR_SLFRSH + str r2, [ r0, #MDREFR ] + + /* toggle E1PIN (set -> clear ) */ + ldr r2, [ r0, #MDREFR ] + orr r2, r2, #MDREFR_E1PIN + str r2, [ r0, #MDREFR ] +#else + ldr r2, [ r1, #MDREFR ] + orr r2, r2, #MDREFR_K1DB2 + orr r2, r2, #MDREFR_K2DB2 + //orr r2, r2, #MDREFR_EAPD + //orr r2, r2, #MDREFR_KAPD + str r2, [ r0, #MDREFR ] +#endif /* Issue read requests to disabled bank to start refresh */ - ldr r1, =0xC0000000 - .rept 8 ldr r0, [r1] .endr - mov r1, #0xA0000000 /* MDCNFG base address */ + ldr r0, MEM_REG_BASE + adr r1, MEMORY_CONFIG - ldr r2, =0x72547255 /* Enable the banks */ - str r2, [r1, #0x00] /* MDCNFG */ - -/* Static memory chip selects on Assabet: */ - - ldr r2, =0x4b90 /* MCS0 */ - orr r2,r2,r2,lsl #16 - str r2, [r1, #0x10] - - ldr r2, =0x22212419 /* MCS1 */ - str r2, [r1, #0x14] - - ldr r2, =0x42196669 /* MCS2 */ - str r2, [r1, #0x2C] - - ldr r2, =0xafccafcc /* SMCNFG */ - str r2, [r1, #0x30] + /* ENABLE SDRAM BANKS */ + ldr r2, [r0, #MDCNFG ] +#if defined ASSABET + orr r2, r2, #0x00000001 /* BANK 0 */ + // orr r2, r2, #0x00000002 /* BANK 1 */ + // orr r2, r2, #0x00010000 /* BANK 2 */ + // orr r2, r2, #0x00020000 /* BANK 3 */ +#elif defined PT_SYSTEM3 + orr r2, r2, #0x00000001 /* BANK 0 */ + // orr r2, r2, #0x00000002 /* BANK 1 */ + orr r2, r2, #0x00010000 /* BANK 2 */ + // orr r2, r2, #0x00020000 /* BANK 3 */ +#else +# error "Enable SDRAM Banks on your board!" +#endif + str r2, [r0, #MDCNFG] -/* Set up PCMCIA space */ + /* OPTIONALLY enable Autopowerup/down */ +#if defined PT_SYSTEM3 + ldr r2, [ r0, #MDREFR ] + orr r2, r2, #MDREFR_EAPD + orr r2, r2, #MDREFR_KAPD + str r2, [ r0, #MDREFR ] +#endif - ldr r2, =0x994a994a - str r2, [r1, #0x18] + ldr r2, [r1, #MCS0 ] + str r2, [r0, #MCS0 ] -/* All SDRAM memory settings should be ready to go... */ -/* For best performance, should fill out remaining memory config regs: */ + ldr r2, [r1, #MCS1 ] + str r2, [r0, #MCS1 ] + ldr r2, [r1, #MECR ] + str r2, [r0, #MECR ] - /* Testing ,Chester */ - mov r3,#0x12000000 - mov r2,#0x5000 /* D9_LED on and D8_LED off */ - str r2,[r3] - mov r4, #0x20000 -gogogo2: - subs r4, r4, #1 - bne gogogo2 + ldr r2, [r1, #MCS2 ] + str r2, [r0, #MCS2 ] + + mov r2, #3 + bl led_blink - mov pc, lr + mov pc, r5 |
|
From: Stefan E. <se...@us...> - 2001-10-04 12:17:40
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv22290 Modified Files: ledasm.S Log Message: - added led_blink Index: ledasm.S =================================================================== RCS file: /cvsroot/blob/blob/src/ledasm.S,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ledasm.S 2001/08/06 22:44:52 1.2 +++ ledasm.S 2001/10/04 12:17:37 1.3 @@ -80,3 +80,33 @@ ldr r1, LED str r1, [r0, #GPCR] mov pc, lr + +.globl led_blink + /* blinks LED r2 times. clobbers r0 and r1, changes r2 */ + +led_blink: +loop0: + /* led off */ + ldr r0, GPIO_BASE + ldr r1, LED + str r1, [r0, #GPSR] + + mov r0, #0x20000 +wloop1: + subs r0, r0, #1 + bne wloop1 + + /* led on */ + ldr r0, GPIO_BASE + ldr r1, LED + str r1, [r0, #GPCR] + + mov r0, #0x20000 +wloop2: + subs r0, r0, #1 + bne wloop2 + + subs r2, r2, #1 + bne loop0 + + mov pc, lr |
|
From: Erik M. <er...@us...> - 2001-10-04 12:16:41
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv22024 Modified Files: memsetup-sa1100.S start.S Log Message: From Adam Wiggins: fix PLEB memory setup code Index: memsetup-sa1100.S =================================================================== RCS file: /cvsroot/blob/blob/src/memsetup-sa1100.S,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- memsetup-sa1100.S 2001/09/23 15:01:18 1.2 +++ memsetup-sa1100.S 2001/10/04 12:16:37 1.3 @@ -77,10 +77,10 @@ #endif #if defined PLEB -mdcas0: .long 0x1c71c01f -mdcas1: .long 0xff1c71c7 +mdcas0: .long 0x8e38e01f +mdcas1: .long 0xff8e38e3 mdcas2: .long 0xffffffff -mdcnfg: .long 0x0c7f3ca3 +mdcnfg: .long 0x0bb2bcbf mcs0: .long 0xfff8fff8 #endif Index: start.S =================================================================== RCS file: /cvsroot/blob/blob/src/start.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- start.S 2001/10/03 17:18:13 1.3 +++ start.S 2001/10/04 12:16:37 1.4 @@ -75,9 +75,10 @@ /* The initial CPU speed. Note that the SA11x0 CPUs can be safely overclocked: * 190 MHz CPUs are able to run at 221 MHz, 133 MHz CPUs can do 206 Mhz. */ -#if (defined ASSABET) || (defined CLART) || (defined LART) \ - || (defined NESA) || (defined NESA) +#if (defined ASSABET) || (defined CLART) || (defined LART) || (defined NESA) cpuspeed: .long 0x0b /* 221 MHz */ +#elif defined PLEB +cpuspeed: .long 0x0a /* 206.4 MHz */ #elif defined SHANNON cpuspeed: .long 0x09 /* 191.7 MHz */ #else |
|
From: Stefan E. <se...@us...> - 2001-10-04 11:50:57
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv15960 Modified Files: memsetup.h Log Message: - provides some defines and macros for memory config registers Index: memsetup.h =================================================================== RCS file: /cvsroot/blob/blob/include/memsetup.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- memsetup.h 2001/10/04 11:45:50 1.1 +++ memsetup.h 2001/10/04 11:50:54 1.2 @@ -0,0 +1,69 @@ +/* + * memsetup.h: include file for memory setup + * + * $Id$ + * + * Copyright (C) 2001 Stefan Eletzhofer + * <ste...@ww...> + * + * 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +/* + * Documentation: + * Intel Corporation, "Intel StrongARM SA-1110 Microprocessor + * Developer's Manual", April 1999 + */ + +#ident "$Id$" + +/********************************************************************** + * Memory Config Register Indices + * based on 0xA0000000 + */ +#define MDCNFG 0x0 +#define MDCAS00 0x04 +#define MDCAS01 0x08 +#define MDCAS02 0x0c +#define MCS0 0x10 +#define MCS1 0x14 +#define MECR 0x18 +#define MDREFR 0x1C +#define MDCAS20 0x20 +#define MDCAS21 0x24 +#define MDCAS22 0x28 +#define MCS2 0x2C +#define SMCNFG 0x30 + +/********************************************************************** + * MDCNFG masks + */ + +/********************************************************************** + * MDREFR masks + */ +#define MDREFR_TRASR(X) (X & (0x0000000f)) +#define MDREFR_DRI(X) ((X & (0x00000fff)) << 4 ) +#define MDREFR_E0PIN (1 << 16) +#define MDREFR_K0RUN (1 << 17) +#define MDREFR_K0DB2 (1 << 18) +#define MDREFR_E1PIN (1 << 20) +#define MDREFR_K1RUN (1 << 21) +#define MDREFR_K1DB2 (1 << 22) +#define MDREFR_K2RUN (1 << 25) +#define MDREFR_K2DB2 (1 << 26) +#define MDREFR_EAPD (1 << 28) +#define MDREFR_KAPD (1 << 29) +#define MDREFR_SLFRSH (1 << 31) |
|
From: Stefan E. <se...@us...> - 2001-10-04 11:46:01
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv14779 Added Files: memsetup.h Log Message: - empty file first --- NEW FILE memsetup.h --- |
|
From: Erik M. <er...@us...> - 2001-10-03 19:55:37
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv14750
Modified Files:
Makefile.am help.c main.c reboot.c terminal.c
Log Message:
Cleanups: move a couple of commands to separate files so main.c becomes
shorter and hence cleaner.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/blob/blob/src/Makefile.am,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Makefile.am 2001/10/03 17:17:15 1.9
+++ Makefile.am 2001/10/03 19:55:34 1.10
@@ -61,6 +61,7 @@
command.c \
error.c \
flash.c \
+ help.c \
icache.c \
init.c \
led.c \
@@ -68,7 +69,9 @@
main.c \
memory.c \
param_block.c \
+ reboot.c \
serial.c \
+ terminal.c \
time.c \
util.c \
uucodec.c
Index: help.c
===================================================================
RCS file: /cvsroot/blob/blob/src/help.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- help.c 2001/10/03 19:26:10 1.1
+++ help.c 2001/10/03 19:55:34 1.2
@@ -0,0 +1,76 @@
+/*
+ * help.c: Help for commands
+ *
+ * Copyright (C) 2001 Erik Mouw (J.A...@it...)
+ *
+ * $Id$
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "command.h"
+#include "errno.h"
+#include "error.h"
+#include "serial.h"
+#include "util.h"
+
+
+
+
+static int help(int argc, char *argv[])
+{
+ commandlist_t *cmd;
+
+ /* help on a command? */
+ if(argc >= 2) {
+ for(cmd = commands; cmd != NULL; cmd = cmd->next) {
+ if(strcmp(cmd->name, argv[1]) == 0) {
+ SerialOutputString("Help for '");
+ SerialOutputString(argv[1]);
+ SerialOutputString("':\n\nUsage: ");
+ SerialOutputString(cmd->help);
+ return 0;
+ }
+ }
+
+ printerror(EINVAL, argv[1]);
+ return 0;
+ }
+
+ /* generic help */
+ SerialOutputString("Help for " PACKAGE " " VERSION ", the bootloader\n");
+ SerialOutputString("The following commands are supported:");
+
+ for(cmd = commands; cmd != NULL; cmd = cmd->next) {
+ SerialOutputString("\n* ");
+ SerialOutputString(cmd->name);
+ }
+
+ SerialOutputString("\nUse \"help command\" to get help on a specific command\n");
+
+ return 0;
+}
+
+static char helphelp[] = "help\n"
+"Get this help\n";
+
+__commandlist(help, "help", helphelp);
Index: main.c
===================================================================
RCS file: /cvsroot/blob/blob/src/main.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- main.c 2001/10/03 17:19:25 1.17
+++ main.c 2001/10/03 19:55:34 1.18
@@ -348,48 +348,6 @@
-static int PrintHelp(int argc, char *argv[])
-{
- commandlist_t *cmd;
-
- /* help on a command? */
- if(argc >= 2) {
- for(cmd = commands; cmd != NULL; cmd = cmd->next) {
- if(strcmp(cmd->name, argv[1]) == 0) {
- SerialOutputString("Help for '");
- SerialOutputString(argv[1]);
- SerialOutputString("':\n\nUsage: ");
- SerialOutputString(cmd->help);
- return 0;
- }
- }
-
- printerror(EINVAL, argv[1]);
- return 0;
- }
-
- /* generic help */
- SerialOutputString("Help for " PACKAGE " " VERSION ", the LART bootloader\n");
- SerialOutputString("The following commands are supported:");
-
- for(cmd = commands; cmd != NULL; cmd = cmd->next) {
- SerialOutputString("\n* ");
- SerialOutputString(cmd->name);
- }
-
- SerialOutputString("\nUse \"help command\" to get help on a specific command\n");
-
- return 0;
-}
-
-static char helphelp[] = "help\n"
-"Get this help\n";
-
-__commandlist(PrintHelp, "help", helphelp);
-
-
-
-
static int SetDownloadSpeed(int argc, char *argv[])
{
if(argc < 2)
@@ -517,28 +475,6 @@
-static int ResetTerminal(int argc, char *argv[])
-{
- int i;
-
- SerialInit(blob_status.terminalSpeed);
- SerialOutputString(" c");
- for(i = 0; i < 100; i++)
- SerialOutputByte('\n');
-
- SerialOutputString("c");
-
- return 0;
-}
-
-static char resethelp[] = "reset\n"
-"Reset terminal\n";
-
-__commandlist(ResetTerminal, "reset", resethelp);
-
-
-
-
static int do_reload(char *what)
{
u32 *dst = 0;
@@ -641,46 +577,3 @@
break;
}
}
-
-
-
-
-static int Reboot(int argc, char *argv[])
-{
- SerialOutputString("Rebooting...\n\n");
-
- msleep(500);
-
- RCSR = 0;
- RSRR = 1;
-
- /* never reached, but anyway... */
- return 0;
-}
-
-static char reboothelp[] = "reboot\n"
-"Reboot system\n";
-
-__commandlist(Reboot, "reboot", reboothelp);
-
-
-
-
-int Reblob(int argc, char *argv[])
-{
- void (*blob)(void) = (void (*)(void))BLOB_RAM_BASE;
-
- SerialOutputString("Restarting blob from RAM...\n\n");
-
- msleep(500);
-
- blob();
-
- /* never reached, but anyway... */
- return 0;
-}
-
-static char reblobhelp[] = "reblob\n"
-"Restart blob from RAM\n";
-
-__commandlist(Reblob, "reblob", reblobhelp);
Index: reboot.c
===================================================================
RCS file: /cvsroot/blob/blob/src/reboot.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- reboot.c 2001/10/03 19:26:10 1.1
+++ reboot.c 2001/10/03 19:55:34 1.2
@@ -0,0 +1,77 @@
+/*
+ * reboot.c: Reboot board
+ *
+ * Copyright (C) 2001 Erik Mouw (J.A...@it...)
+ *
+ * $Id$
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "command.h"
+#include "main.h"
+#include "serial.h"
+#include "sa1100.h"
+#include "time.h"
+
+
+
+
+static int reboot(int argc, char *argv[])
+{
+ SerialOutputString("Rebooting...\n\n");
+
+ msleep(500);
+
+ RCSR = 0;
+ RSRR = 1;
+
+ /* never reached, but anyway... */
+ return 0;
+}
+
+static char reboothelp[] = "reboot\n"
+"Reboot system\n";
+
+__commandlist(reboot, "reboot", reboothelp);
+
+
+
+
+static int reblob(int argc, char *argv[])
+{
+ void (*blob)(void) = (void (*)(void))BLOB_RAM_BASE;
+
+ SerialOutputString("Restarting blob from RAM...\n\n");
+
+ msleep(500);
+
+ blob();
+
+ /* never reached, but anyway... */
+ return 0;
+}
+
+static char reblobhelp[] = "reblob\n"
+"Restart blob from RAM\n";
+
+__commandlist(reblob, "reblob", reblobhelp);
Index: terminal.c
===================================================================
RCS file: /cvsroot/blob/blob/src/terminal.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- terminal.c 2001/10/03 19:53:55 1.1
+++ terminal.c 2001/10/03 19:55:34 1.2
@@ -0,0 +1,54 @@
+/*
+ * terminal.c: terminal reset functions
+ *
+ * Copyright (C) 1999 2000 2001 Erik Mouw (J.A...@it...)
+ *
+ * $Id$
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "command.h"
+#include "main.h"
+#include "serial.h"
+
+
+
+
+static int reset_terminal(int argc, char *argv[])
+{
+ int i;
+
+ SerialInit(blob_status.terminalSpeed);
+ SerialOutputString(" c");
+ for(i = 0; i < 100; i++)
+ SerialOutputByte('\n');
+
+ SerialOutputString("c");
+
+ return 0;
+}
+
+static char resethelp[] = "reset\n"
+"Reset terminal\n";
+
+__commandlist(reset_terminal, "reset", resethelp);
|
|
From: Erik M. <er...@us...> - 2001-10-03 19:53:57
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv14173 Added Files: terminal.c Log Message: commit empty file --- NEW FILE terminal.c --- |
|
From: Erik M. <er...@us...> - 2001-10-03 19:26:14
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv30317 Added Files: help.c reboot.c Log Message: commit empty files --- NEW FILE help.c --- --- NEW FILE reboot.c --- |
|
From: Erik M. <er...@us...> - 2001-10-03 17:20:27
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv22130/src Modified Files: error.c Log Message: fix typo Index: error.c =================================================================== RCS file: /cvsroot/blob/blob/src/error.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- error.c 2001/10/03 16:02:43 1.2 +++ error.c 2001/10/03 17:20:24 1.3 @@ -1,5 +1,5 @@ /* - * errno.c: error handling functions + * error.c: error handling functions * * Copyright (C) 2001 Erik Mouw (J.A...@it...) * |
|
From: Erik M. <er...@us...> - 2001-10-03 17:19:28
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv20842/include Modified Files: linux.h Log Message: boot_kernel() is no longer an exported function, so we just call it through the command line parser. Index: linux.h =================================================================== RCS file: /cvsroot/blob/blob/include/linux.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- linux.h 2001/10/01 12:43:49 1.4 +++ linux.h 2001/10/03 17:19:25 1.5 @@ -54,7 +54,6 @@ #endif -int boot_linux(int argc, char *argv[]); #endif |
|
From: Erik M. <er...@us...> - 2001-10-03 17:19:28
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv20842/src
Modified Files:
main.c
Log Message:
boot_kernel() is no longer an exported function, so we just call it through
the command line parser.
Index: main.c
===================================================================
RCS file: /cvsroot/blob/blob/src/main.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- main.c 2001/10/03 16:09:09 1.16
+++ main.c 2001/10/03 17:19:25 1.17
@@ -44,7 +44,6 @@
#include "flash.h"
#include "init.h"
#include "led.h"
-#include "linux.h"
#include "main.h"
#include "memory.h"
#include "param_block.h"
@@ -155,7 +154,7 @@
/* no key was pressed, so proceed booting the kernel */
if(retval == 0) {
commandline[0] = '\0';
- boot_linux(0, NULL);
+ parse_command("boot");
}
SerialOutputString("\nAutoboot aborted\n");
|
|
From: Erik M. <er...@us...> - 2001-10-03 17:18:15
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv20214/src
Modified Files:
start.S linux.c
Log Message:
Now that the i-cache code is in a separate file, we can get rid of it over
here.
Index: start.S
===================================================================
RCS file: /cvsroot/blob/blob/src/start.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- start.S 2001/08/06 22:44:52 1.2
+++ start.S 2001/10/03 17:18:13 1.3
@@ -127,12 +127,6 @@
normal_boot:
- /* enable I-cache */
- mrc p15, 0, r1, c1, c0, 0 @ read control reg
- orr r1, r1, #0x1000 @ set Icache
- mcr p15, 0, r1, c1, c0, 0 @ write it back
-
-
/* check the first 1MB in increments of 4k */
mov r7, #0x1000
mov r6, r7, lsl #8 /* 4k << 2^8 = 1MB */
Index: linux.c
===================================================================
RCS file: /cvsroot/blob/blob/src/linux.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- linux.c 2001/10/02 21:54:48 1.7
+++ linux.c 2001/10/03 17:18:13 1.8
@@ -48,7 +48,7 @@
static struct tag *params;
-int boot_linux(int argc, char *argv[])
+static int boot_linux(int argc, char *argv[])
{
register u32 i;
void (*theKernel)(int zero, int arch) = (void (*)(int, int))KERNEL_RAM_BASE;
@@ -66,14 +66,7 @@
/* disable subsystems that want to be disabled before kernel boot */
exit_subsystems();
- /* turn off I-cache */
- asm ("mrc p15, 0, %0, c1, c0, 0": "=r" (i));
- i &= ~0x1000;
- asm ("mcr p15, 0, %0, c1, c0, 0": : "r" (i));
-
- /* flush I-cache */
- asm ("mcr p15, 0, %0, c7, c5, 0": : "r" (i));
-
+ /* start kernel */
theKernel(0, ARCH_NUMBER);
SerialOutputString("Hey, the kernel returned! This should not happen.\n");
|
|
From: Erik M. <er...@us...> - 2001-10-03 17:17:18
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv19599/src
Modified Files:
Makefile.am icache.c
Log Message:
i-cache code can also be called from init and exit lists
Index: Makefile.am
===================================================================
RCS file: /cvsroot/blob/blob/src/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.am 2001/10/03 16:02:43 1.8
+++ Makefile.am 2001/10/03 17:17:15 1.9
@@ -61,6 +61,7 @@
command.c \
error.c \
flash.c \
+ icache.c \
init.c \
led.c \
linux.c \
Index: icache.c
===================================================================
RCS file: /cvsroot/blob/blob/src/icache.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- icache.c 2001/10/03 17:15:24 1.1
+++ icache.c 2001/10/03 17:17:15 1.2
@@ -0,0 +1,74 @@
+/*
+ * icache.c: i-cache handling
+ *
+ * Copyright (C) 2001 Russ Dill <Rus...@as...>
+ *
+ * $Id$
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "init.h"
+#include "types.h"
+
+
+
+static void enable_icache(void)
+{
+ register u32 i;
+
+ /* read control register */
+ asm ("mrc p15, 0, %0, c1, c0, 0": "=r" (i));
+
+ /* set i-cache */
+ i |= 0x1000;
+
+ /* write back to control register */
+ asm ("mcr p15, 0, %0, c1, c0, 0": : "r" (i));
+}
+
+
+
+
+static void disable_icache(void)
+{
+ register u32 i;
+
+ /* read control register */
+ asm ("mrc p15, 0, %0, c1, c0, 0": "=r" (i));
+
+ /* clear i-cache */
+ i &= ~0x1000;
+
+ /* write back to control register */
+ asm ("mcr p15, 0, %0, c1, c0, 0": : "r" (i));
+
+ /* flush i-cache */
+ asm ("mcr p15, 0, %0, c7, c5, 0": : "r" (i));
+}
+
+
+
+
+/* init and exit calls */
+__initlist(enable_icache, INIT_LEVEL_INITIAL_HARDWARE);
+__exitlist(disable_icache, INIT_LEVEL_INITIAL_HARDWARE);
|
|
From: Erik M. <er...@us...> - 2001-10-03 17:15:26
|
Update of /cvsroot/blob/blob/src In directory usw-pr-cvs1:/tmp/cvs-serv18530 Added Files: icache.c Log Message: Commit empty file --- NEW FILE icache.c --- |
|
From: Erik M. <er...@us...> - 2001-10-03 16:09:12
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv8731
Modified Files:
clock.c command.c flash.c init.c main.c uucodec.c
Log Message:
And now for the cleanup: use the new error functions. Note that I didn't touch
chkmem.c because I know Stefan is working on it.
Index: clock.c
===================================================================
RCS file: /cvsroot/blob/blob/src/clock.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- clock.c 2001/09/27 21:30:58 1.6
+++ clock.c 2001/10/03 16:09:09 1.7
@@ -36,6 +36,8 @@
#endif
#include "command.h"
+#include "errno.h"
+#include "error.h"
#include "types.h"
#include "sa1100.h"
#include "serial.h"
@@ -61,17 +63,12 @@
u32 regs[5];
u32 startTime, currentTime;
- if(argc < 6) {
- /* FIXME: command loop should print error messages */
- SerialOutputString("*** not enough arguments\n");
- return 0;
- }
+ if(argc < 6)
+ return -ENOPARAMS;
for(i = 0; i < 5; i++) {
if(strtoval(argv[i + 1], ®s[i]) < 0) {
- SerialOutputString("*** not a number: ");
- SerialOutputString(argv[i + 1]);
- SerialOutputByte('\n');
+ printerror(ENAN, argv[i + 1]);
return 0;
}
}
Index: command.c
===================================================================
RCS file: /cvsroot/blob/blob/src/command.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- command.c 2001/10/02 21:54:48 1.8
+++ command.c 2001/10/03 16:09:09 1.9
@@ -36,6 +36,7 @@
#endif
#include "command.h"
+#include "errno.h"
#include "init.h"
#include "serial.h"
#include "time.h"
@@ -122,7 +123,8 @@
#ifdef BLOB_DEBUG
for(i = 0; i < *argc; i++) {
- SerialOutputString("*** argv[");
+ printerrprefix();
+ SerialOutputString("argv[");
SerialOutputDec(i);
SerialOutputString("] = ");
SerialOutputString(argv[i]);
@@ -148,12 +150,14 @@
for(cmd = commands; cmd != NULL; cmd = cmd->next) {
if(cmd->magic != COMMAND_MAGIC) {
- SerialOutputString("*** Command magic failed for 0x");
+#ifdef BLOB_DEBUG
+ printerrprefix();
+ SerialOutputString("Address = 0x");
SerialOutputHex((u32)cmd);
SerialOutputString("!\n");
+#endif
- /* FIXME: should return a proper return value */
- return 0;
+ return -EMAGIC;
}
if(strcmp(cmd->name, cmdline) == 0) {
@@ -162,7 +166,7 @@
}
}
- return -1;
+ return -ECOMMAND;
}
Index: flash.c
===================================================================
RCS file: /cvsroot/blob/blob/src/flash.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- flash.c 2001/08/31 06:26:59 1.3
+++ flash.c 2001/10/03 16:09:09 1.4
@@ -35,6 +35,8 @@
# include "config.h"
#endif
+#include "errno.h"
+#include "error.h"
#include "led.h"
#include "main.h"
#include "util.h"
@@ -180,7 +182,8 @@
SerialOutputByte('.');
led_toggle();
if((EraseOne(thisBlock) & STATUS_ERASE_ERR) != 0) {
- SerialOutputString("\n*** Erase error at address 0x");
+ printerrprefix();
+ SerialOutputString("erase error at address 0x");
SerialOutputHex((u32)thisBlock);
SerialOutputByte('\n');
return;
@@ -203,9 +206,13 @@
#endif
if((u32)source & 0x03) {
- SerialOutputString("*** Source is not on a word boundary: 0x");
+ printerror(EALIGN, NULL);
+#ifdef BLOB_DEBUG
+ printerrprefix();
+ SerialOutputString("Address = 0x");
SerialOutputHex((u32)source);
SerialOutputByte('\n');
+#endif
return;
}
@@ -307,7 +314,8 @@
if((result & STATUS_PGM_ERR) != 0 || *flashBase != *source) {
#endif
- SerialOutputString("\n*** Write error at address 0x");
+ printerrprefix();
+ SerialOutputString("Write error at address 0x");
SerialOutputHex((u32)flashBase);
SerialOutputByte('\n');
return;
Index: init.c
===================================================================
RCS file: /cvsroot/blob/blob/src/init.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- init.c 2001/10/02 21:39:54 1.2
+++ init.c 2001/10/03 16:09:09 1.3
@@ -27,8 +27,11 @@
# include "config.h"
#endif
+#include "errno.h"
+#include "error.h"
#include "init.h"
#include "serial.h"
+#include "types.h"
/* int and exit list start and end. filled in by the linker */
@@ -45,10 +48,13 @@
for(item = start; item != end; item++) {
if(item->magic != magic) {
- SerialOutputString("*** Init magic failed for 0x");
+ printerror(EMAGIC, NULL);
+#ifdef BLOB_DEBUG
+ printerrprefix();
+ SerialOutputString("Address = 0x");
SerialOutputHex((u32)item);
- SerialOutputString("!\n");
-
+ SerialOutputByte('\n');
+#endif
return;
}
Index: main.c
===================================================================
RCS file: /cvsroot/blob/blob/src/main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- main.c 2001/10/02 21:54:48 1.15
+++ main.c 2001/10/03 16:09:09 1.16
@@ -39,6 +39,8 @@
#endif
#include "command.h"
+#include "errno.h"
+#include "error.h"
#include "flash.h"
#include "init.h"
#include "led.h"
@@ -167,11 +169,8 @@
numRead = GetCommand(commandline, MAX_COMMANDLINE_LENGTH, 600);
if(numRead > 0) {
- if(parse_command(commandline) != 0 ) {
- SerialOutputString("*** Unknown command: ");
- SerialOutputString(commandline);
- SerialOutputByte('\n');
- }
+ if((retval = parse_command(commandline)) < 0 )
+ printerror(retval, NULL);
}
}
@@ -186,13 +185,10 @@
u32 startAddress = 0;
int bufLen;
int *numRead = 0;
+ int retval;
- if(argc < 2) {
- SerialOutputString("*** not enough parameters\n");
- /* FIXME: let the command line parser print the error
- message */
- return 0;
- }
+ if(argc < 2)
+ return -ENOPARAMS;
if(strncmp(argv[1], "blob", 4) == 0) {
/* download blob */
@@ -221,9 +217,7 @@
numRead = &blob_status.ramdiskSize;
blob_status.ramdiskType = fromDownload;
} else {
- SerialOutputString("*** Don't know how to download \"");
- SerialOutputString(argv[1]);
- SerialOutputString("\"\n");
+ printerror(EINVAL, argv[1]);
return 0;
}
@@ -247,13 +241,13 @@
if(*numRead < 0) {
/* something went wrong */
- SerialOutputString("*** Uudecode receive failed\n");
+ retval = *numRead;
/* reload the correct memory */
do_reload(argv[1]);
SerialInit(blob_status.terminalSpeed);
- return 0;
+ return retval;
}
SerialOutputString("Received ");
SerialOutputDec(*numRead);
@@ -281,82 +275,64 @@
tBlockType block;
int numBytes = 0;
int maxSize = 0;
+ block_source_t type = fromFlash;
- if(argc < 2) {
- SerialOutputString("*** not enough parameters\n");
- /* FIXME: let the command line parser print the error
- message */
- return 0;
- }
+ if(argc < 2)
+ return -ENOPARAMS;
if(strncmp(argv[1], "blob", 4) == 0) {
startAddress = BLOB_RAM_BASE;
block = blBlob;
numBytes = blob_status.blobSize;
maxSize = BLOB_LEN;
-
- if(blob_status.blobType == fromFlash) {
- SerialOutputString("*** No blob downloaded\n");
- return 0;
- }
-
- SerialOutputString("Saving blob to flash ");
+ type = blob_status.blobType;
#ifdef PARAM_START
} else if(strncmp(argv[1], "param", 5) == 0) {
startAddress = PARAM_RAM_BASE;
block = blParam;
numBytes = blob_status.paramSize;
maxSize = PARAM_LEN;
-
- if(blob_status.paramType == fromFlash) {
- SerialOutputString("*** No paramater block downloaded\n");
- return 0;
- }
-
- SerialOutputString("Saving paramater block to flash ");
+ type = blob_status.paramType;
#endif
} else if(strncmp(argv[1], "kernel", 6) == 0) {
startAddress = KERNEL_RAM_BASE;
block = blKernel;
numBytes = blob_status.kernelSize;
maxSize = KERNEL_LEN;
-
- if(blob_status.kernelType == fromFlash) {
- SerialOutputString("*** No kernel downloaded\n");
- return 0;
- }
-
- SerialOutputString("Saving kernel to flash ");
+ type = blob_status.kernelType;
} else if(strncmp(argv[1], "ramdisk", 7) == 0) {
startAddress = RAMDISK_RAM_BASE;
block = blRamdisk;
numBytes = blob_status.ramdiskSize;
maxSize = INITRD_LEN;
-
- if(blob_status.ramdiskType == fromFlash) {
- SerialOutputString("*** No ramdisk downloaded\n");
- return 0;
- }
-
- SerialOutputString("Saving ramdisk to flash ");
+ type = blob_status.ramdiskType;
} else {
- SerialOutputString("*** Don't know how to flash \"");
- SerialOutputString(argv[1]);
- SerialOutputString("\"\n");
+ printerror(EINVAL, argv[1]);
return 0;
}
+ if(type == fromFlash) {
+ /* error */
+ printerrprefix();
+ SerialOutputString(argv[1]);
+ SerialOutputString(" not downloaded\n");
+ return -EINVAL;
+ }
+
if(numBytes > maxSize) {
- SerialOutputString("*** Downloaded image too large for flash area\n");
- SerialOutputString("*** (0x");
+ printerrprefix();
+ SerialOutputString("image too large for flash: 0x");
SerialOutputHex(numBytes);
- SerialOutputString(" downloaded, maximum size is 0x");
+ SerialOutputString(" > 0x");
SerialOutputHex(maxSize);
- SerialOutputString(" bytes)\n");
+ SerialOutputByte('\n');
- return 0;
+ return -ETOOLONG;
}
+ SerialOutputString("Saving ");
+ SerialOutputString(argv[1]);
+ SerialOutputString(" to flash ");
EraseBlocks(block);
SerialOutputByte(' ');
WriteBlocksFromMem(block, (u32 *)startAddress, numBytes);
@@ -388,10 +364,8 @@
return 0;
}
}
-
- SerialOutputString("*** Can't find help for '");
- SerialOutputString(argv[1]);
- SerialOutputString("'\n");
+
+ printerror(EINVAL, argv[1]);
return 0;
}
@@ -419,12 +393,8 @@
static int SetDownloadSpeed(int argc, char *argv[])
{
- if(argc < 2) {
- /* FIXME: return -EINVAL and let the command line
- stuff print the error */
- SerialOutputString("*** not enough parameters\n");
- return 0;
- }
+ if(argc < 2)
+ return -ENOPARAMS;
if(strcmp(argv[1], "1200") == 0) {
blob_status.downloadSpeed = baud1k2;
@@ -455,11 +425,7 @@
} else if(strcmp(argv[1], "230k4") == 0) {
blob_status.downloadSpeed = baud230k4;
} else {
- SerialOutputString("*** Invalid download speed value \"");
- SerialOutputString(argv[1]);
- SerialOutputString("\"\n*** Valid values are:\n");
- SerialOutputString("*** 1200, 9600, 19200, 38400, 57600, 115200, 230400\n");
- SerialOutputString("*** 1k2, 9k6, 19k2, 38k4, 57k6, 115k2, and 230k4\n");
+ return -EINVAL;
}
SerialOutputString("Download speed set to ");
@@ -469,8 +435,10 @@
return 0;
}
-static char speedhelp[] = "speed\n"
-"Set download speed\n";
+static char speedhelp[] = "speed [baudrate]\n"
+"Set download speed. Valid baudrates are:\n"
+"1200, 9600, 19200, 38400, 57600, 115200, 230400,\n"
+" 1k2, 9k6, 19k2, 38k4, 57k6, 115k2, 230k4\n";
__commandlist(SetDownloadSpeed, "speed", speedhelp);
@@ -609,9 +577,7 @@
blob_status.ramdiskType = fromFlash;
SerialOutputString("Loading ramdisk from flash ");
} else {
- SerialOutputString("*** Don't know how to reload \"");
- SerialOutputString(what);
- SerialOutputString("\"\n");
+ printerror(EINVAL, what);
return 0;
}
@@ -626,13 +592,9 @@
static int Reload(int argc, char *argv[])
{
- if(argc < 2) {
- /* FIXME: return -EINVAL and let the command line
- stuff print the error */
- SerialOutputString("*** not enough parameters\n");
- return 0;
- }
-
+ if(argc < 2)
+ return -ENOPARAMS;
+
return do_reload(argv[1]);
}
Index: uucodec.c
===================================================================
RCS file: /cvsroot/blob/blob/src/uucodec.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- uucodec.c 2001/09/16 15:44:00 1.3
+++ uucodec.c 2001/10/03 16:09:09 1.4
@@ -37,6 +37,7 @@
# include "config.h"
#endif
+#include "errno.h"
#include "serial.h"
#include "util.h"
@@ -48,8 +49,7 @@
#define TEST_MAX_RETRIES do { \
if(retries++ > MAX_RETRIES) { \
- SerialOutputString("\n*** Timeout exceeded. Aborting.\n"); \
- return -1; \
+ return -ETIMEOUT; \
} \
} while(0)
@@ -60,8 +60,8 @@
#define OUT_OF_RANGE do { \
SerialOutputByte('\n'); \
SerialOutputString(buf); \
- SerialOutputString("\n*** Received character out of range. Aborting.\n"); \
- return -1; \
+ SerialOutputByte('\n'); \
+ return -ERANGE; \
} while(0)
#define PUT_CHAR(x) do { \
@@ -94,8 +94,7 @@
/* for each input line */
for (;;) {
if (SerialInputString(p = buf, sizeof(buf), 2) == 0) {
- SerialOutputString("\n*** Short file. Aborting\n");
- return -1;
+ return -ETOOSHORT;
}
/* Status print to show where we are at right now */
if((linesReceived++ & 0x007F) == 0) {
@@ -147,8 +146,8 @@
}
SerialOutputByte('\n');
if (SerialInputString(p = buf, sizeof(buf), 2) == 0 || (strncmp(buf, "end", 3))) {
- SerialOutputString("*** No \"end\" line. Aborting.\n");
- return(-1);
+ /* no "end" line */
+ return -ETOOSHORT;
}
return(bytesWritten);
} /* UUDecode */
|
|
From: Erik M. <er...@us...> - 2001-10-03 16:02:46
|
Update of /cvsroot/blob/blob/src
In directory usw-pr-cvs1:/tmp/cvs-serv4842/src
Modified Files:
error.c Makefile.am
Log Message:
Generalised error handling functions
Index: error.c
===================================================================
RCS file: /cvsroot/blob/blob/src/error.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- error.c 2001/10/03 16:01:25 1.1
+++ error.c 2001/10/03 16:02:43 1.2
@@ -0,0 +1,95 @@
+/*
+ * errno.c: error handling functions
+ *
+ * Copyright (C) 2001 Erik Mouw (J.A...@it...)
+ *
+ * $Id$
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ident "$Id$"
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "errno.h"
+#include "error.h"
+#include "serial.h"
+#include "types.h"
+
+
+typedef struct {
+ int errno;
+ char *string;
+} error_t;
+
+
+static error_t errors[] = {
+ { ENOERROR, "no error" },
+ { EINVAL, "invalid argument" },
+ { ENOPARAMS, "not enough parameters" },
+ { EMAGIC, "magic value failed" },
+ { ECOMMAND, "invalid command" },
+ { ENAN, "not a number" },
+ { EALIGN, "alignment error" },
+ { ERANGE, "out of range" },
+ { ETIMEOUT, "timeout exceeded" },
+ { ETOOSHORT, "short file" },
+ { ETOOLONG, "long file" },
+};
+
+
+static char *unknown = "unknown error";
+static char *errprefix = "*** ";
+
+
+char *strerror(int errnum)
+{
+ int i;
+ int num = sizeof(errors) / sizeof(error_t);
+
+ /* make positive if it is negative */
+ if(errnum < 0)
+ errnum = -errnum;
+
+ for(i = 0; i < num; i++)
+ if(errors[i].errno == errnum)
+ return errors[i].string;
+
+ return unknown;
+}
+
+
+void printerrprefix(void)
+{
+ SerialOutputString(errprefix);
+}
+
+
+void printerror(int errnum, char *s)
+{
+ printerrprefix();
+ SerialOutputString(strerror(errnum));
+
+ if(s != NULL) {
+ SerialOutputString(": ");
+ SerialOutputString(s);
+ }
+
+ SerialOutputByte('\n');
+}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/blob/blob/src/Makefile.am,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Makefile.am 2001/10/02 21:39:54 1.7
+++ Makefile.am 2001/10/03 16:02:43 1.8
@@ -59,6 +59,7 @@
flashasm.S \
testmem2.S \
command.c \
+ error.c \
flash.c \
init.c \
led.c \
|
|
From: Erik M. <er...@us...> - 2001-10-03 16:02:46
|
Update of /cvsroot/blob/blob/include In directory usw-pr-cvs1:/tmp/cvs-serv4842/include Modified Files: errno.h error.h Makefile.am Log Message: Generalised error handling functions Index: errno.h =================================================================== RCS file: /cvsroot/blob/blob/include/errno.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- errno.h 2001/10/03 16:01:25 1.1 +++ errno.h 2001/10/03 16:02:43 1.2 @@ -0,0 +1,42 @@ +/* + * errno.h: error numbers for blob + * + * Copyright (C) 2001 Erik Mouw (J.A...@it...) + * + * $Id$ + * + * 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ident "$Id$" + +#ifndef BLOB_ERRNO_H +#define BLOB_ERRNO_H + + +#define ENOERROR 0 /* no error at all */ +#define EINVAL 1 /* invalid argument */ +#define ENOPARAMS 2 /* not enough parameters */ +#define EMAGIC 3 /* magic value failed */ +#define ECOMMAND 4 /* invalid command */ +#define ENAN 5 /* not a number */ +#define EALIGN 6 /* addres not aligned */ +#define ERANGE 7 /* out of range */ +#define ETIMEOUT 8 /* timeout exceeded */ +#define ETOOSHORT 9 /* short file */ +#define ETOOLONG 10 /* long file */ + +#endif Index: error.h =================================================================== RCS file: /cvsroot/blob/blob/include/error.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- error.h 2001/10/03 16:01:25 1.1 +++ error.h 2001/10/03 16:02:43 1.2 @@ -0,0 +1,35 @@ +/* + * error.h: error handling functions + * + * Copyright (C) 2001 Erik Mouw (J.A...@it...) + * + * $Id$ + * + * 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 program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ident "$Id$" + +#ifndef BLOB_ERROR_H +#define BLOB_ERROR_H + + +char *strerror(int errnum); +void printerrprefix(void); +void printerror(int errnum, char *s); + + +#endif Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/include/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile.am 2001/10/02 21:39:54 1.5 +++ Makefile.am 2001/10/03 16:02:43 1.6 @@ -13,6 +13,8 @@ noinst_HEADERS = \ command.h \ + errno.h \ + error.h \ flash.h \ init.h \ led.h \ |