Update of /cvsroot/blob/blob/src/blob
In directory sc8-pr-cvs1:/tmp/cvs-serv7243
Modified Files:
system3.c
Log Message:
- sysver command now prints board revision and type
- setip command to set server/client ip for tftp
- tftp command reworked. Now download to unused RAM instead to KERNEL_RAM_BASE.
Index: system3.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/system3.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- system3.c 18 Mar 2003 16:24:18 -0000 1.26
+++ system3.c 1 Apr 2003 19:01:29 -0000 1.27
@@ -237,7 +237,7 @@
static void system3_init_hardware(void)
{
/* init on-board CPLD */
- MEM(SYSTEM3_CTRL_0) = 0x0b;
+ MEM(SYSTEM3_CTRL_0) = 0x03;
MEM(SYSTEM3_CTRL_1) = 0x00;
MEM(SYSTEM3_CTRL_2) = 0x00;
@@ -320,6 +320,22 @@
static int sysver_cmd( int argc, char *argv[] )
{
printf( "version: '%s'\n", module_version );
+ switch ( PT_ID_BOARDID ) {
+ case PT_BOARD_ALPHA:
+ printf( "ALPHA Board" );
+ break;
+ case PT_BOARD_SYS3:
+ printf( "SYSTEM 3 Board" );
+ break;
+ case PT_BOARD_DAFIT:
+ printf( "DAFIT Board" );
+ break;
+ default:
+ printf( "UNKNOWN Board (ID 0x%X)", PT_ID_BOARDID );
+ break;
+
+ }
+ printf( " revision 0x%02X.\n", PT_ID_REVISION );
return 0;
}
static char sysver_help[] = "print BLOB and system3 version number\n";
@@ -339,9 +355,8 @@
if ( ret < 0 ) return -EINVAL;
sys3_dbg = lvl;
- printf( "sys3dbg: debug level set to %d\n", sys3_dbg );
-#if 0
+#if defined(CONFIG_PCMCIA_SUPPORT)
if ( lvl>5 ) {
cf_dbg_set( 5 );
tar_dbg_set( 5 );
@@ -359,6 +374,7 @@
}
#endif
+ printf( "sys3dbg: debug level set to %d\n", sys3_dbg );
return 0;
}
static char sys3dbg_help[] = "sys3dbg level\n";
@@ -370,6 +386,9 @@
static void sa1111_init()
{
+ if ( PT_ID_BOARDID == PT_BOARD_DAFIT )
+ return;
+
/*
* First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111:
* (SA-1110 Developer's Manual, section 9.1.2.1)
@@ -879,7 +898,6 @@
{
int ret = 0;
extern int do_arp( u8 *, u8 *);
- extern u8 clientipaddress[4];
u8 serverip[4] = { 192, 168, 1, 11 };
u8 servereth[6];
@@ -889,11 +907,6 @@
return ret;
}
- clientipaddress[0]=192;
- clientipaddress[1]=168;
- clientipaddress[2]=1;
- clientipaddress[3]=191;
-
ret = do_arp( servereth, serverip );
printf( "%s: got eth addr %02x:%02x:%02x:%02x:%02x:%02x\n", __FUNCTION__,
@@ -906,17 +919,77 @@
__commandlist(arp_cmd, "arp", arp_help);
+int setip_cmd( int argc, char *argv[] )
+{
+ extern u8 clientipaddress[4];
+ extern u8 serveripaddress[4];
+ u8 *ip;
+ char *ptr, *num;
+ int i, fini;
+
+ if ( argc < 3 )
+ return -EINVAL;
+
+ switch ( argv[1][0] ) {
+ case 'c':
+ case 'C':
+ ip = clientipaddress;
+ break;
+ case 's':
+ case 'S':
+ ip = serveripaddress;
+ break;
+ default:
+ return -EINVAL;
+ break;
+ }
+
+ num = ptr = argv[2];
+ fini=0;
+ for ( i=0; i<4 || !fini; i++ ) {
+ u32 n;
+
+ while ( *ptr != '\0' && *ptr != '.' )
+ ptr++;
+
+ if ( *ptr == '\0' )
+ fini = 1;
+
+ *ptr = 0;
+
+ strtou32( num, &n );
+ ip[i]=n;
+
+ num = ++ptr;
+ }
+
+ if ( fini && i<4 ) {
+ printf( "error parsing ip.\n" );
+ return -EINVAL;
+ }
+
+ printf( "Set IP to %d.%d.%d.%d\n",
+ ip[0], ip[1], ip[2], ip[3] );
+
+ return 0;
+}
+char setip_help[] = "setip command. Set IP addresses for tftp.\n"
+"usage: setip {client|server} ip\n"
+"\tip in usual dotted-quad format please.\n";;
+__commandlist(setip_cmd, "setip", setip_help);
+
int tftp_cmd(int argc, char *argv[])
{
int ret = 0;
extern int do_tftp(char *file, unsigned long addr, unsigned long *size);
- extern u8 clientipaddress[4];
- extern u8 serveripaddress[4];
unsigned long size = 0;
- char *tftp_file = "zImage";
+ char *tftp_file = "update.tar";
if ( argc>1 ) {
tftp_file = argv[1];
+ } else {
+ printf( "No filename given, using '%s'\n",
+ tftp_file );
}
ret = smc_init( 0x18000000 );
@@ -925,24 +998,17 @@
return ret;
}
- clientipaddress[0]=192;
- clientipaddress[1]=168;
- clientipaddress[2]=1;
- clientipaddress[3]=191;
-
- serveripaddress[0]=192;
- serveripaddress[1]=168;
- serveripaddress[2]=1;
- serveripaddress[3]=2;
-
- ret = do_tftp( tftp_file, KERNEL_RAM_BASE, &size );
+ ret = do_tftp( tftp_file, RAM_START, &size );
if ( ret ) {
return -EINVAL;
}
printf( "%s: file '%s' loaded via tftp to address 0x%08x.\n",
- __FUNCTION__, tftp_file, KERNEL_RAM_BASE );
+ __FUNCTION__, tftp_file, RAM_START );
return 0;
}
-char tftp_help[] = "tftp test command. No args.\n";;
+char tftp_help[] = "tftp command.\n"
+"usage: tftp filename\n"
+"\tdownloads file over TFTP to RAM.\n"
+"\tUse setip to set client and server IP addresses\n";
__commandlist(tftp_cmd, "tftp", tftp_help);
|