From: Stefan E. <se...@us...> - 2002-05-02 15:57:35
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv29677 Modified Files: system3.c Log Message: - io driver test command Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- system3.c 26 Apr 2002 18:26:38 -0000 1.13 +++ system3.c 2 May 2002 15:57:29 -0000 1.14 @@ -46,6 +46,9 @@ #include <blob/sa1100.h> #include <blob/sa1111.h> + +#include <blob/generic_io.h> + #include <blob/pcmcia.h> #include <blob/ide.h> #include <blob/tar.h> @@ -254,13 +257,10 @@ u32 slot_attr; u16 cfg_reg; ide_drive_t drive; - int numDev; int sec; u8 cfgvalue; u8 value; - unsigned char * devTypeStr[] - = { "no device found", "unknown type", "ATA", "ATAPI" }; char buffer[4096]; /* set ata debg level high */ @@ -413,7 +413,7 @@ static void dumpmem(char *ptr, int len) { char line[80], chars[80], *p, b, *c, *end; - int i, j; + int j; end = ptr + len; while (ptr < end) { @@ -439,11 +439,11 @@ int tar_cmd( int argc, char *argv[] ) { +#if 0 int ret = 0; u32 start = 0; u32 dest = 0; tar_arch_t my_arch; - struct mem arch_adr; tar_dbg_set( 100 ); @@ -483,15 +483,83 @@ printf( "tar_xtract: %d\n", ret ); goto DONE; } - dumpmem( dest, 0x200 ); + dumpmem( (unsigned char*)dest, 0x200 ); break; } DONE: return ret; +#else + /* FIXME: rewrite using io drivers */ + return -EINVAL; +#endif } static char tar_help[] = "tar [t|x] src [filename dest]\n"; __commandlist(tar_cmd, "tar", tar_help); + +extern int io_test(void); +int io_cmd( int argc, char *argv[] ) +{ + int ret; + io_driver_t *iotar, *ioram1; + + io_dbg_set( 100 ); + tar_dbg_set( 1 ); + + ret = io_test(); + if ( ret ) return -EINVAL; + + ioram1 = io_get_byname( "RAM1" ); + if ( !ioram1 ) return -EINVAL; + printf( "found 'RAM1': %p\n", ioram1 ); + + iotar = io_get_byname( "TAR" ); + if ( !iotar ) return -EINVAL; + printf( "found 'TAR': %p\n", iotar ); + + /* have tar io driver reading from RAM0 io driver */ + ret = io_chain_driver( "TAR", "RAM0" ); + if ( ret ) return -EINVAL; + printf( "chained RAM0->TAR\n" ); + + /* select a file */ + ret = io_configure( iotar, "system3.c" ); + if ( ret ) return -EINVAL; + printf( "selected file\n" ); + + /* copy a file */ + ret = io_copy( ioram1, iotar, io_get_size( iotar ) ); + if ( ret ) return -EINVAL; + + printf( "copied file\n" ); + +/* + Future uses/extensions: + + raw flash access: + iofl = io_get_byname( "FLASH" ); + ret = io_configure( iofl, 0x00300000 ); // base offset to r/w + + filesystem access: + iocramfs = io_get_byname( "CRAMFS" ); or + ioext2 = io_get_byname( "EXT2FS" ); or + iofat = io_get_byname( "FAT32" ); + + Partitioning: + iopart = io_get_byname( "BLOBPART" ); + io_configure( iopart, "kernel" ); + + Flash kernel coming from a cramfs file on CF: + io_chain_driver( "BLOB_PART", "FLASH" ); // write chain + io_chain_driver( "CRAMFS", "CF" ); // read chain + io_configure( iocramfs, "zImage" ); // select "zImage" file + io_configure( iopart, "kernel" ); // select "kernel" partition + io_copy( iopart, iocramfs, io_get_size( iocramfs ) ); + */ + return 0; +} +static char io_help[] = "io test function\n"; +__commandlist(io_cmd, "iotest", io_help); /***************************************************************** * manually reference flash and download commands until they |