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...> - 2002-04-26 18:24:59
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv26183 Added Files: tar.c Log Message: - first revision of minimal tar archive support. - this module will be used to get a blob/ramdisk/kernel update mechanism from e.g. CF cards using raw tar archives. For ex. do a "tar -c --posix -f /def/hda zImage blob initrd.gz cramfs.img" with /dev/hda a mounted CF card, ship the CF card to your customer and off you go. - Missing so far: * only posix tar format * no zlib support (do we need this?) * only "t" and "x" are supported, i.e. no creation of tar archives so far. - This is WIP .... --- NEW FILE: tar.c --- /********************************************************************** * tar archive framework * * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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 * * $Id: tar.c,v 1.1 2002/04/26 18:24:54 seletz Exp $ * * $Log: tar.c,v $ * Revision 1.1 2002/04/26 18:24:54 seletz * - first revision of minimal tar archive support. * - this module will be used to get a blob/ramdisk/kernel * update mechanism from e.g. CF cards using raw tar archives. * For ex. do a "tar -c --posix -f /def/hda zImage blob initrd.gz cramfs.img" * with /dev/hda a mounted CF card, ship the CF card to your customer * and off you go. * - Missing so far: * * only posix tar format * * no zlib support (do we need this?) * * only "t" and "x" are supported, i.e. no creation of tar * archives so far. * - This is WIP .... * * Revision 1.2 2002/04/24 14:27:08 seletz * - first round of bugfixing. Now at last one can read 512 byte sectors * of a CF in true-ide mode. See system3.c::pcmciatest(). * * Still WIP. YMMV, and so on.... * * Revision 1.1 2002/04/18 19:52:49 seletz * - Added PCMCIA and IDE framework. Based on Brad Parker's code. * NOTE NOTE NOTE: * This is all Work-In-Progress (you have been warned) * */ /********************************************************************** * Includes */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/types.h> #include <blob/errno.h> #include <blob/util.h> #include <blob/command.h> #include <blob/tar.h> /********************************************************************** * defines */ #define TAR_DEBUG 0 #if TAR_DEBUG # define DBG( x, args... ) if ( tar_dbg>x ) printf( args ); #else # define DBG( x, args... ) #endif /********************************************************************** * module globals */ #if TAR_DEBUG static int tar_dbg = 1; #else static int tar_dbg = 0; #endif static char module_version[] = "$Id: tar.c,v 1.1 2002/04/26 18:24:54 seletz Exp $"; /********************************************************************** * static functions */ static int tar_skip_file( tar_arch_t *arch ); static int tar_file_search( tar_arch_t *arch, char *file ); static int tar_xtract_blocks( tar_arch_t *arch, char *dest ); static int tar_fileinfo_get( tar_arch_t *arch ); static int tar_hdr_chk( tar_hdr_posix_t *hdr ); static int tar_hdr_fname_get( tar_hdr_posix_t *hdr, char **fname ); static int tar_hdr_fsize_get( tar_hdr_posix_t *hdr, unsigned long *size ); static int tar_from_oct( unsigned char *start, size_t digits, unsigned long *value ); /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ /* simple memory block getter */ int mem_block_get( unsigned char *buffer, void *priv ) { struct mem *mp= (struct mem *)priv; DBG( 15, "%s: priv=%p\n", __FUNCTION__, priv ); if ( !mp ) return -EINVAL; if ( !mp->curr ) mp->curr=mp->start; DBG( 15, "%s: start=%p, curr=%p\n", __FUNCTION__, mp->start, mp->curr ); memcpy( buffer, mp->curr, 512 ); mp->curr += 512; return 0; } /* memory block reset */ int mem_block_reset( void *priv ) { struct mem *mp= (struct mem *)priv; DBG( 15, "%s: priv=%p\n", __FUNCTION__, priv ); if ( !mp ) return -EINVAL; DBG( 15, "%s: start=%p, curr=%p\n", __FUNCTION__, mp->start, mp->curr ); mp->curr=mp->start; return 0; } /* set debug level */ void tar_dbg_set( int lvl ) { tar_dbg = lvl; } /* init archive struct */ int tar_init( tar_arch_t *arch, block_get_fn get, block_reset_fn reset, void *priv ) { DBG( 1, "%s: arch=%p, get=%p, reset=%p, priv=%p\n", __FUNCTION__, arch, get, reset, priv ); DBG( 1, "tar: version %s\n", module_version ); if ( !arch ) { return -EINVAL; } arch->block_get = get; arch->block_reset=reset; arch->block_get_priv = priv; arch->size=0l; arch->blocks=0l; arch->filename[0]=0; return 0; } /* do a "tar tv" */ int tar_tell( tar_arch_t *arch ) { int ret = 0; int fini = 0; int files = 0; DBG( 1, "%s: arch=%p\n", __FUNCTION__, arch ); if ( !arch ) return -EINVAL; /* reset to block 0 */ ret = arch->block_reset( arch->block_get_priv ); if ( ret ) { printf( "tar: cant reset to block 0: %d\n", ret ); return ret; } while ( !fini ) { ret = tar_fileinfo_get( arch ); if ( ret ) { fini = 1; continue; } files++; printf( "%s %ld bytes, %d blocks\n", arch->filename, arch->size, arch->blocks ); /* skip file */ ret = tar_skip_file( arch ); if ( ret ) { printf( "tar: tar_skip_file: %d\n", ret ); return -EINVAL; } } printf( "tar: %d files.\n", files ); return 0; } /* do a "tar xv" */ int tar_xtract( tar_arch_t *arch, char *filename, char *dest ) { int ret = 0; DBG( 1, "%s: arch=%p, filename=%p, dest=%p\n", __FUNCTION__, arch, filename, dest ); if ( !arch || !filename ) return -EINVAL; /* reset to block 0 */ ret = arch->block_reset( arch->block_get_priv ); if ( ret ) { printf( "tar: cant reset to block 0: %d\n", ret ); return ret; } ret = tar_file_search( arch, filename ); if ( ret ) { printf( "tar: cant find file '%s' in archive (%d).\n", filename, ret ); return -EINVAL; } ret = tar_xtract_blocks( arch, dest ); if ( ret ) { printf( "tar: cant extract file '%s' from archive (%d).\n", filename, ret ); return -EINVAL; } printf( "tar: extracted file '%s', %ld bytes (%d blocks).\n", arch->filename, arch->size, arch->blocks ); return 0; } /********************************************************************** * Static functions */ static int tar_file_search( tar_arch_t *arch, char *file ) { int ret = 0; int fini = 0; int found = 0; DBG( 1, "%s: arch=%p, file=%p\n", __FUNCTION__, arch, file ); if ( !arch || !file ) return -EINVAL; while ( !fini ) { ret = tar_fileinfo_get( arch ); if ( ret ) { fini = 1; continue; } DBG( 5, "%s %ld bytes, %d blocks\n", arch->filename, arch->size, arch->blocks ); if ( strncmp( arch->filename, file, 255 ) == 0 ) { found = 1; fini = 1; continue; } /* skip file */ ret = tar_skip_file( arch ); if ( ret ) { printf( "tar: tar_skip_file: %d\n", ret ); return -EINVAL; } } return found?0:1; } /* skip to next file, if any */ static int tar_skip_file( tar_arch_t *arch ) { int ret = 0; int block; DBG( 1, "%s: arch=%p\n", __FUNCTION__, arch ); if ( !arch ) return -EINVAL; /* skip data */ for ( block=0; block<arch->blocks; block++ ) { ret = arch->block_get( arch->buffer, arch->block_get_priv ); if ( ret ) { printf( "tar: cant get block %d: %d\n", block, ret ); return ret; } } return 0; } /* extract current file to memory. */ static int tar_xtract_blocks( tar_arch_t *arch, char *dest ) { int ret = 0; int block; unsigned long size; DBG( 1, "%s: arch=%p, dest=%p\n", __FUNCTION__, arch, dest ); if ( !arch || !dest ) return -EINVAL; size = arch->size; if ( !size ) return -EINVAL; /* extract data */ for ( block=0; block<arch->blocks; block++ ) { ret = arch->block_get( arch->buffer, arch->block_get_priv ); if ( ret ) { printf( "tar: cant get block %d: %d\n", block, ret ); return ret; } DBG( 5, "%s: %ld bytes to go\n", __FUNCTION__, size ); if ( size>512 ) { memcpy( dest, arch->buffer, 512 ); size -= 512; dest += 512; } else { memcpy( dest, arch->buffer, size ); dest += size; } } return 0; } /* get current file infos out of tar header */ static int tar_fileinfo_get( tar_arch_t *arch ) { int ret = 0; tar_hdr_posix_t *phdr = NULL; if ( !arch ) return -EINVAL; /* get header */ ret = arch->block_get( arch->buffer, arch->block_get_priv ); if ( ret ) { printf( "tar: cant get block: %d\n", ret ); goto DONE; } /* and decode infos */ phdr = (tar_hdr_posix_t*)arch->buffer; ret = tar_hdr_chk( phdr ); if ( ret ) { printf( "tar: no posix tar header: %d\n", ret ); ret = -EINVAL; goto DONE; } ret = tar_hdr_fsize_get( phdr, &arch->size ); if ( ret ) { printf( "tar: cant decode file size: %d\n", ret ); ret = ret; goto DONE; } arch->blocks = (arch->size/512) + (arch->size%512?1:0); printf( "tar: %s %ld bytes, %d blocks\n", phdr->name, arch->size, arch->blocks ); strncpy( arch->filename, phdr->name, 100 ); arch->filename[100] = 0; ret = 0; DONE: /* reset fileinfos on error */ if ( ret ) { arch->size=0; arch->blocks=0; arch->filename[0]=0; } return ret; } /* check wether or not we have a posix tar header */ static int tar_hdr_chk( tar_hdr_posix_t *hdr ) { int ret = 0; if ( !hdr ) return -EINVAL; /* check magic */ ret = strncmp( hdr->magic, TMAGIC, TMAGLEN ); if ( ret != 0 ) return -EINVAL; return 0; } /* get file size from header */ static int tar_hdr_fsize_get( tar_hdr_posix_t *hdr, unsigned long *size ) { return tar_from_oct( hdr->size, 11, size ); } /* get filename from header */ static int tar_hdr_fname_get( tar_hdr_posix_t *hdr, char **fname ) { if ( !hdr || !fname ) return -EINVAL; *fname = hdr->name; return 0; } /* decode octal BCD data from header */ static int tar_from_oct( unsigned char *start, size_t digits, unsigned long *value ) { unsigned long val = 0l; DBG( 5, "%s: start=%p, digits=%d, value=%p\n", __FUNCTION__, start, digits, value ); if ( !start || !value ) return -EINVAL; while ( digits ) { if ( (*start > '7') || (*start < '0') ) return -EINVAL; DBG( 5, "%s: %c, val=%ld\n", __FUNCTION__, *start, val ); val = ( val << 3 ) | (*start - '0'); --digits; ++start; } *value = val; return 0; } |
From: Stefan E. <se...@us...> - 2002-04-26 18:14:04
|
Update of /cvsroot/blob/blob/src/commands In directory usw-pr-cvs1:/tmp/cvs-serv24395 Modified Files: dump.c Log Message: - modified so that repeated dumps w/o args are possible. Index: dump.c =================================================================== RCS file: /cvsroot/blob/blob/src/commands/dump.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dump.c 17 Feb 2002 20:01:31 -0000 1.2 +++ dump.c 26 Apr 2002 18:14:01 -0000 1.3 @@ -54,14 +54,17 @@ int dump_cmd( int argc, char *argv[] ) { int ret = 0; - u32 address, endaddress, tmpaddress, value; + static u32 address = 0L; + u32 endaddress, tmpaddress, value; - if ( argc < 2 ) + if ( argc < 1 ) ERR( -EINVAL ); - ret = strtou32(argv[1], &address); - if ( ret < 0 ) - ERR( -EINVAL ); + if ( argc > 1 ) { + ret = strtou32(argv[1], &address); + if ( ret < 0 ) + ERR( -EINVAL ); + } if ( argc == 3 ) { ret = strtou32(argv[2], &endaddress); @@ -98,4 +101,4 @@ return ret; } -char dump_help[] = "dump address [endAddress]\n"; +char dump_help[] = "dump [address [endAddress]]\n"; |
From: Stefan E. <se...@us...> - 2002-04-26 09:23:06
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv2139 Modified Files: ide.h pcmcia.h Log Message: - Added copyright stuff Index: ide.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/ide.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ide.h 24 Apr 2002 14:29:03 -0000 1.2 +++ ide.h 26 Apr 2002 09:23:03 -0000 1.3 @@ -1,3 +1,23 @@ +/* + * ide.h + * + * Copyright (C) 2001, Brad Parker (br...@he...) + * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> + * + * 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 + */ #ifndef BLOB_IDE_H #define BLOB_IDE_H 1 Index: pcmcia.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/pcmcia.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- pcmcia.h 26 Apr 2002 04:45:26 -0000 1.3 +++ pcmcia.h 26 Apr 2002 09:23:03 -0000 1.4 @@ -1,3 +1,23 @@ +/* + * pcmcia.h + * + * Copyright (C) 2001, Brad Parker (br...@he...) + * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> + * + * 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 + */ #ifndef BLOB_PCMCIA_H #define BLOB_PCMCIA_H 1 |
From: Stefan E. <se...@us...> - 2002-04-26 09:22:09
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv1588 Modified Files: ide.c pcmcia.c Log Message: - added original copyright from Brad Parker - corrected EMAIL addr Index: ide.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/ide.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ide.c 24 Apr 2002 14:27:08 -0000 1.2 +++ ide.c 26 Apr 2002 09:22:05 -0000 1.3 @@ -3,7 +3,8 @@ * * Basic ide drive framework. Based on Brad Parkers work. * - * Copyright (C) 2001 Stefan Eletzhofer <ste...@ww...> + * Copyright (C) 2001, Brad Parker (br...@he...) + * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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 @@ -22,6 +23,10 @@ * $Id$ * * $Log$ + * Revision 1.3 2002/04/26 09:22:05 seletz + * - added original copyright from Brad Parker + * - corrected EMAIL addr + * * Revision 1.2 2002/04/24 14:27:08 seletz * - first round of bugfixing. Now at last one can read 512 byte sectors * of a CF in true-ide mode. See system3.c::pcmciatest(). Index: pcmcia.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/pcmcia.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pcmcia.c 24 Apr 2002 14:27:08 -0000 1.2 +++ pcmcia.c 26 Apr 2002 09:22:05 -0000 1.3 @@ -4,7 +4,8 @@ * Provides an raw pcmcia/cf framework for blob. Based on original * work from Brad Parker. * - * Copyright (C) 2001 Stefan Eletzhofer <ste...@ww...> + * Copyright (C) 2001, Brad Parker (br...@he...) + * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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 @@ -23,6 +24,10 @@ * $Id$ * * $Log$ + * Revision 1.3 2002/04/26 09:22:05 seletz + * - added original copyright from Brad Parker + * - corrected EMAIL addr + * * Revision 1.2 2002/04/24 14:27:08 seletz * - first round of bugfixing. Now at last one can read 512 byte sectors * of a CF in true-ide mode. See system3.c::pcmciatest(). |
From: Tim R. <tim...@us...> - 2002-04-26 07:12:41
|
Update of /cvsroot/blob/blob/utils In directory usw-pr-cvs1:/tmp/cvs-serv26620/utils Modified Files: Makefile.am Log Message: build test apps, should probably happen only on debug Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/utils/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 4 Feb 2002 16:49:11 -0000 1.4 +++ Makefile.am 26 Apr 2002 07:12:38 -0000 1.5 @@ -5,6 +5,7 @@ SUBDIRS = \ build \ + test \ mkparamblock CLEANFILES = *~ |
From: Tim R. <tim...@us...> - 2002-04-26 07:12:41
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv26620/utils/test Added Files: Makefile.am Removed Files: Makefile Log Message: build test apps, should probably happen only on debug --- NEW FILE: Makefile.am --- # -*- makefile -*- # # $Id: Makefile.am,v 1.1 2002/04/26 07:12:38 timriker Exp $ # load_kernel_test_OBJECTS = \ load_kernel_test.o \ load_kernel.o \ mini_inflate.o \ error.o \ util.o \ jffs2.o \ compr_rtime.o \ compr_rubin.o \ cramfs.o \ zImage.o \ crc32.o EXTRA_load_kernel_test_SOURCES = \ load_kernel.c \ mini_inflate.c \ error.c \ util.c \ jffs2.c \ compr_rtime.c \ compr_rubin.c \ cramfs.c \ zImage.c \ crc32.c bin_PROGRAMS = \ load_kernel_test CFLAGS = -g -Wall -DHAVE_CONFIG_H -I${top_builddir}/include \ -I${top_srcdir}/include -I@LINUX_INCLUDE@ CC = gcc LDFLAGS = LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ load_kernel_test_SOURCES = \ load_kernel_test.c \ $(load_kernel_test_extra_SOURCES) load_kernel_test: $(load_kernel_test_OBJECTS) #gcc $(CFLAGS) -o $@ $(load_kernel_test_OBJECTS) gcc $(CFLAGS) -o $@ $< $(load_kernel_test_extra_SOURCES): ln -s ../../src/*/$@ CLEANFILE = load_kernel_test *~ --- Makefile DELETED --- |
From: Tim R. <tim...@us...> - 2002-04-26 07:12:41
|
Update of /cvsroot/blob/blob In directory usw-pr-cvs1:/tmp/cvs-serv26620 Modified Files: configure.in Log Message: build test apps, should probably happen only on debug Index: configure.in =================================================================== RCS file: /cvsroot/blob/blob/configure.in,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- configure.in 23 Apr 2002 13:48:16 -0000 1.50 +++ configure.in 26 Apr 2002 07:12:38 -0000 1.51 @@ -315,7 +315,9 @@ exit -1 fi AC_MSG_RESULT([yes]) -CFLAGS=`echo $CFLAGS -I${linux_prefix}/include` +LINUX_INCLUDE=${linux_prefix}/include +AC_SUBST(LINUX_INCLUDE) +CFLAGS=`echo $CFLAGS -I$LINUX_INCLUDE` @@ -585,7 +587,8 @@ tools/Makefile utils/Makefile utils/build/Makefile -utils/mkparamblock/Makefile) +utils/mkparamblock/Makefile +utils/test/Makefile) dnl Tell the user about the configuration |
From: Russ D. <ru...@us...> - 2002-04-26 07:01:11
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv23468 Modified Files: mini_inflate.c Log Message: its not *exactly* memset (quite different actually) Index: mini_inflate.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/mini_inflate.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mini_inflate.c 17 Feb 2002 15:41:54 -0000 1.1 +++ mini_inflate.c 26 Apr 2002 07:01:05 -0000 1.2 @@ -93,6 +93,14 @@ 11, 4, 12, 3, 13, 2, 14, 1, 15}; +static void int_memset(int *s, const int c, long n) +{ + n--; + for (;n > 0; n--) s[n] = c; + s[0] = c; +} + + /* associate a stream with a block of data and reset the stream */ static void init_stream(struct bitstream *stream, unsigned char *data) { @@ -270,9 +278,9 @@ static void init_code_tables(struct huffman_set *set) { - memset(set->lengths, 0, set->num_symbols); - memset(set->count, 0, set->bits); - memset(set->first, 0, set->bits); + int_memset(set->lengths, 0, set->num_symbols); + int_memset(set->count, 0, set->bits); + int_memset(set->first, 0, set->bits); } /* read in the huffman codes for dynamic decoding (section 3.2.7) */ @@ -388,19 +396,19 @@ struct huffman_set *lengths = &(stream->lengths); struct huffman_set *distance = &(stream->distance); - memset(lengths->count, 0, 16); - memset(lengths->first, 0, 16); - memset(lengths->lengths, 8, 144); - memset(lengths->lengths + 144, 9, 112); - memset(lengths->lengths + 256, 7, 24); - memset(lengths->lengths + 280, 8, 8); + int_memset(lengths->count, 0, 16); + int_memset(lengths->first, 0, 16); + int_memset(lengths->lengths, 8, 144); + int_memset(lengths->lengths + 144, 9, 112); + int_memset(lengths->lengths + 256, 7, 24); + int_memset(lengths->lengths + 280, 8, 8); lengths->count[7] = 24; lengths->count[8] = 152; lengths->count[9] = 112; - memset(distance->count, 0, 16); - memset(distance->first, 0, 16); - memset(distance->lengths, 5, 32); + int_memset(distance->count, 0, 16); + int_memset(distance->first, 0, 16); + int_memset(distance->lengths, 5, 32); distance->count[5] = 32; |
From: Russ D. <ru...@us...> - 2002-04-26 06:13:17
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv12443 Modified Files: load_kernel_test.c Log Message: increase the fodder buffer a bit Index: load_kernel_test.c =================================================================== RCS file: /cvsroot/blob/blob/utils/test/load_kernel_test.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- load_kernel_test.c 26 Apr 2002 04:50:49 -0000 1.2 +++ load_kernel_test.c 26 Apr 2002 06:13:14 -0000 1.3 @@ -18,7 +18,7 @@ unsigned long size = 0; part.erasesize = 0x20000; - fodder_ram_base = malloc(0x1000); + fodder_ram_base = malloc(0x10000); out = malloc(0xe00000); if (argc < 2) { |
From: Tim R. <tim...@us...> - 2002-04-26 04:51:13
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv30742/utils/test Modified Files: Makefile Log Message: cleanup for debug Index: Makefile =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile 26 Apr 2002 04:46:15 -0000 1.2 +++ Makefile 26 Apr 2002 04:51:09 -0000 1.3 @@ -1,8 +1,8 @@ DEFS = -DHAVE_CONFIG_H -I../../include -I/usr/include -I. -I/home/timr/work/shannon/buildroot-tux/build/linux/include load_kernel_test_OBJECTS = \ -load_kernel.o \ load_kernel_test.o \ +load_kernel.o \ mini_inflate.o \ error.o \ util.o \ @@ -14,6 +14,7 @@ crc32.o load_kernel_test_extra_SOURCES = \ +load_kernel.c \ mini_inflate.c \ error.c \ util.c \ |
From: Tim R. <tim...@us...> - 2002-04-26 04:50:52
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv30679/utils/test Modified Files: load_kernel_test.c Log Message: cleanup for debug Index: load_kernel_test.c =================================================================== RCS file: /cvsroot/blob/blob/utils/test/load_kernel_test.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- load_kernel_test.c 14 Feb 2002 09:59:34 -0000 1.1 +++ load_kernel_test.c 26 Apr 2002 04:50:49 -0000 1.2 @@ -1,6 +1,6 @@ -typedef unsigned long u32; -typedef unsigned short u16; -typedef unsigned char u8; +#ifdef HAVE_CONFIG_H +# include <blob/config.h> +#endif #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> @@ -45,7 +45,9 @@ printf("flash emulation region is 0x%lx bytes\n", part.size); - for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++); + for (i = 0; loader[i]; i++) + if (loader[i]->check_magic(&part)) + break; if (!loader[i]) { printf("unable to find magic\n"); } else { |
From: Tim R. <tim...@us...> - 2002-04-26 04:47:57
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv30140/utils/test Removed Files: load_kernel.c Log Message: remove dupe --- load_kernel.c DELETED --- |
From: Tim R. <tim...@us...> - 2002-04-26 04:47:02
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv29979/src/lib Modified Files: Makefile.am Added Files: disk.c Log Message: get ready for reading vfat --- NEW FILE: disk.c --- /* * disk.c * * read extfs file system root dir, locate image and load it into memory * * this is a very large hack which assumes: * - ms-dos partion table * - linux partition is #1 partition * - bootable image is at /zImage or /boot/zImage * - ramdisk image is at /ramdisk.gz or /boot/ramdisk.gz * * Copyright (C) 2001, Brad Parker (br...@he...) * * 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 */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/serial.h> #include <blob/util.h> #include <blob/serial.h> #define _SIZE_T /* don't use the one in the kernel's types.h */ #include <linux/ext2_fs.h> char buf1[512], buf2[512]; char sb_block_buf[EXT2_MAX_BLOCK_SIZE]; char inode_block_buf[EXT2_MAX_BLOCK_SIZE]; char dir_block_buf[EXT2_MAX_BLOCK_SIZE]; char ind_block_buf[EXT2_MAX_BLOCK_SIZE]; char ind2_block_buf[EXT2_MAX_BLOCK_SIZE]; char block1[EXT2_MAX_BLOCK_SIZE]; char block2[EXT2_MAX_BLOCK_SIZE]; extern int verbose; extern int hd_read_mapped(int sector_num, char *buffer); char tohex(char b) { b = b & 0xf; if (b < 10) return '0' + b; return 'a' + (b - 10); } void dumpmem(char *ptr, int len) { char line[80], chars[80], *p, b, *c, *end; int j; end = ptr + len; while (ptr < end) { SerialOutputHex((int)ptr); p = line; c = chars; *p++ = ' '; for (j = 0; j < 16; j++) { b = *ptr++; *p++ = tohex(b >> 4); *p++ = tohex(b); *p++ = ' '; *c++ = ' ' <= b && b <= '~' ? b : '.'; } *p = 0; SerialOutputString(line); *c = 0; SerialOutputString(chars); serial_write('\n'); } } #ifdef TEST char disk[1024*1024*8]; int read_buffer(int sectornum, char *buf) { char *ptr = disk + sectornum * 512; if (ptr > disk+sizeof(disk)) { printf("read past eod!\n"); while (1); return -1; } memcpy(buf, ptr, 512); return 0; } #else int read_buffer(int sectornum, char *buf) { return hd_read_mapped(sectornum, buf); } #endif void debug(char *msg) { printf("%s\n", msg); } int le32_p(u8 *p) { int n; n = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; return n; } /* ms-dos disk partition structure */ struct part_ent { u8 p_boot; u8 p_start[3]; u8 p_type; u8 p_end[3]; u8 p_start_sector[4]; u8 p_size_sectors[4]; }; static unsigned int start, size; static unsigned int base; struct ext2_group_desc group_desc[32]; unsigned int boot_inode_num=0; unsigned int our_inode_num=0; unsigned int e2fs_block_size; unsigned int e2fs_sectors_per_block; void set_ext2fs_block_size(int bytes) { e2fs_block_size = bytes; e2fs_sectors_per_block = bytes / 512; if (verbose > 1) { printf("set_ext2fs_block_size(bytes=%d) sectors_per_block %d\n", bytes, e2fs_sectors_per_block); } } /* read ext2fs 4k block */ int read_block(int blocknum, char *buf) { unsigned int abs_blocknum = base + blocknum*e2fs_sectors_per_block; int i; if (verbose > 2) printf("read_block(%d) base %d, abs %d\n", blocknum, base, abs_blocknum); for (i = 0; i < e2fs_sectors_per_block; i++) { if (read_buffer(abs_blocknum, buf) != 0) { return -1; } abs_blocknum++; buf += 512; } return 0; } /* check master boot record; locate parition info */ int check_mbr() { struct part_ent *p; int h, s, c; if( verbose > 0) printf("check MBR...\n"); if (read_buffer(0, buf1)) { debug("mbr read error"); return -1; } if ((u8)buf1[510] != 0x55 || (u8)buf1[511] != 0xaa) { debug("bad mbr signature"); if (verbose > 1) dumpmem(buf1, sizeof(buf1)); return -1; } /* XXX 1st partition must be linux */ p = (struct part_ent *)&buf1[0x1be]; if (p->p_type != 0x83) { debug("part #1 not linux"); return -1; } h = p->p_start[0]; s = p->p_start[1] & 0x3f; c = ((p->p_start[1] & 0xc0) << 2) + p->p_start[2]; if( verbose > 0) printf("found linux partition\n"); start = le32_p(p->p_start_sector); size = le32_p(p->p_size_sectors); if (verbose > 1) { printf("partition @ h=%d,s=%d,c=%d\n", h, s, c); printf("start %d, size %d\n", start, size); } return 0; } /* * read ext2fs inode * require group descriptors to be in memory */ int read_inode(struct ext2_super_block *sb, int ino, struct ext2_inode *ibuf) { unsigned long group, offset, block, block_nr; group = (ino - 1) / EXT2_INODES_PER_GROUP(sb); offset = ((ino - 1) % EXT2_INODES_PER_GROUP(sb)) * EXT2_INODE_SIZE(sb); block = offset >> EXT2_BLOCK_SIZE_BITS(sb); if (!group_desc[(unsigned)group].bg_inode_table) { if( verbose > 0) { printf("inode %d; group %d, offset %d, block %d; no group descriptor\n", ino, group, offset, block); } return -1; } block_nr = group_desc[(unsigned)group].bg_inode_table + block; offset &= (EXT2_BLOCK_SIZE(sb) - 1); if (verbose > 1) { printf("inode %d; group %d, offset %d, block %d, block_nr %d\n", ino, group, offset, block, block_nr); printf("inodes/group %d, inode size %d\n", EXT2_INODES_PER_GROUP(sb), EXT2_INODE_SIZE(sb)); } /* read entire block and copy inode out */ if (read_block(block_nr, inode_block_buf)) return -1; memcpy((char *)ibuf, inode_block_buf + offset, 128); return 0; } int load_indirect_block(int iblock_num, char **pptr, unsigned long *poffset) { int i; u8 *p; unsigned long bn; char *ptr; unsigned long offset; ptr = *pptr; offset = *poffset; if (verbose > 1) printf("indirect block %d\n", iblock_num); if (read_block(iblock_num, ind_block_buf)) { debug("read indirect block error"); return -1; } p = ind_block_buf; for (i = 0; i < e2fs_block_size/4; i++) { bn = le32_p(p); p += 4; if (bn == 0) break; #if 0 // FIXME if (verbose > 2) printf("file block # %d (0x%x)\n", bn, bn); else if( verbose > 0) printf("%d \r", offset); #endif // 0 FIXME switch( verbose) { case 0: if( bn % 100 == 0) serial_write( '.'); break; case 1: printf("%d \r", offset); break; default: printf("file block # %d (0x%x)\n", bn, bn); break; } if (read_block(bn, ptr)) { debug("read file block error"); return -1; } ptr += e2fs_sectors_per_block*512; offset += e2fs_sectors_per_block*512; } *pptr = ptr; *poffset = offset; return 0; } int load_file_inode(struct ext2_super_block *sb, unsigned int inode_num, char *ptr) { struct ext2_inode file_inode, *inode; unsigned long offset; int i; if (read_inode(sb, inode_num, &file_inode)) { debug("read file inode error"); return -1; } inode = &file_inode; offset = 0; if (verbose > 1) { printf("file inode:\n"); printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x (max %d)\n", inode->i_blocks, EXT2_N_BLOCKS); } for (i = 0; i < EXT2_NDIR_BLOCKS; i++) { if (verbose > 1) printf("block[%d] %d (0%x)\n", i, inode->i_block[i], inode->i_block[i]); else if( verbose > 0) printf("%d \r", offset); else if( inode->i_block[i] % 100 == 0) serial_write( '.'); if (inode->i_block[i] == 0) break; if (read_block(inode->i_block[i], ptr)) { debug("read file block error"); return -1; } ptr += e2fs_sectors_per_block*512; offset += e2fs_sectors_per_block*512; } if (inode->i_block[EXT2_NDIR_BLOCKS]) { if (verbose > 2) printf("1 indirect block %d\n", inode->i_block[EXT2_NDIR_BLOCKS]); if (load_indirect_block(inode->i_block[EXT2_NDIR_BLOCKS], &ptr, &offset)) return -1; } if (inode->i_block[EXT2_NDIR_BLOCKS+1]) { int i; u8 *p; unsigned long bn; if (verbose > 2) printf("2 indirect block %d\n", inode->i_block[EXT2_NDIR_BLOCKS+1]); if (read_block(inode->i_block[EXT2_NDIR_BLOCKS+1], ind2_block_buf)) { debug("read 2nd indirect block error"); return -1; } p = ind2_block_buf; for (i = 0; i < e2fs_block_size/4; i++) { bn = le32_p(p); p += 4; if (bn == 0) break; if (verbose > 2) printf("ind block # %d (0x%x)\n", bn, bn); if (load_indirect_block(bn, &ptr, &offset)) return -1; } } #if 0 if (inode->i_block[EXT2_NDIR_BLOCKS+2]) { printf("3 indirect inode %d\n", inode->i_block[EXT2_NDIR_BLOCKS+2]); if(read_block(inode->i_block[EXT2_NDIR_BLOCKS+2], &ind_block_buf)) { debug("read 3rd indirect block error"); return -1; } } #endif if( verbose > 0) printf("done! offset %d (0x%x)\n", offset, offset); else serial_write( '\n'); return inode->i_size; // success: return file size } /* * read file "fileName" into RAM location ramBase */ int load_root_image(char *fileName, void *ramBase) { struct ext2_super_block *sb; struct ext2_inode root_inode, boot_inode, *inode; struct ext2_group_desc *bg; struct ext2_dir_entry_2 *de; int sb_block, group_block, group_desc_count, desc_blocks; int i; unsigned long offset; int retval=0; /* read super block */ base = start; sb_block = 1; group_block = sb_block + 1; if( verbose > 0) printf("reading super block...\n"); set_ext2fs_block_size(1024); #if 0 { int abn; abn = base; for (i = 0; i < 8; i++) { printf("abn %d\n", abn); if (read_buffer(abn, sb_block_buf) != 0) break; dumpmem(sb_block_buf, 64); abn++; } } #endif if (read_block(sb_block, sb_block_buf)) { debug("find_root read error"); return -1; } sb = (struct ext2_super_block *)sb_block_buf; if (verbose > 1) printf("sb magic %x\n", sb->s_magic); if (sb->s_magic != EXT2_SUPER_MAGIC) { debug("sb magic number wrong"); return -1; } if (verbose > 1) { printf("block size %d\n", EXT2_BLOCK_SIZE(sb)); printf("blocks per group %d\n", sb->s_blocks_per_group); printf("block # of sb %d\n", sb->s_block_group_nr); printf("first data block %d\n", sb->s_first_data_block); printf("inodes / group %d\n", EXT2_INODES_PER_GROUP(sb)); } group_desc_count = (sb->s_blocks_count - sb->s_first_data_block + EXT2_BLOCKS_PER_GROUP(sb) - 1) / EXT2_BLOCKS_PER_GROUP(sb); desc_blocks = (group_desc_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); if (verbose > 1) printf("group_block %d, group_desc_count %d, desc_blocks %d\n", group_block, group_desc_count, desc_blocks); /* set block size */ set_ext2fs_block_size(EXT2_BLOCK_SIZE(sb)); //this is wrong and a hack; why? if (EXT2_BLOCK_SIZE(sb) == 4096) group_block = 1; /* read group descriptors */ if (read_block(group_block, block2)) { debug("read group desc error"); return -1; } if (verbose > 4) { dumpmem(block2, sizeof(block2)); } bg = (struct ext2_group_desc *)block2; for (i = 0; i < group_desc_count; i++) { group_desc[i] = bg[i]; if (verbose > 1) { printf("block group %d\n", i); printf("dirs %d\n", bg[i].bg_used_dirs_count); } } // set_ext2fs_block_size(EXT2_BLOCK_SIZE(sb)); /* read root inode */ if (read_inode(sb, EXT2_ROOT_INO, &root_inode)) { debug("read initial inode error"); return -1; } inode = &root_inode; if (verbose > 1) { printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x (max %d)\n", inode->i_blocks, EXT2_N_BLOCKS); printf("block[0] %x\n", inode->i_block[0]); printf("block[1] %x\n", inode->i_block[1]); printf("\n"); } if (read_block(inode->i_block[0], dir_block_buf)) { debug("read root inode dir block error"); return -1; } if (verbose > 1) printf("scanning root dir\n"); offset = 0; while (offset < 4096) { char name[256]; de = (struct ext2_dir_entry_2 *)(dir_block_buf + offset); if (verbose > 1) printf("offset 0x%x, len 0x%x\n", offset, de->rec_len); strncpy(name, de->name, de->name_len); name[de->name_len] = 0; offset += de->rec_len; if (verbose > 1) { printf("inode %d, type %d, name '%s'\n", de->inode, de->file_type, name); printf("rec_len %d (%x), b %d\n", de->rec_len, de->rec_len, offset); } if (/* FIXME de->file_type == 2 && */ strncmp(name, "boot", 5) == 0) { if( verbose > 0) printf("found /boot dir\n"); if (verbose > 1) printf("/boot dir inode %d\n", de->inode); boot_inode_num = de->inode; break; } // FIXME de->file_type == 0 for me 8-( if (/* FIXME de->file_type == 1 && */ strncmp(name, fileName, sizeof(name)) == 0) { if( verbose > 0) printf("found /%s\n", fileName); if (verbose > 1) printf("/%s inode %d\n", fileName, de->inode); our_inode_num = de->inode; break; } } if (boot_inode_num) { if (verbose > 1) printf("scanning /boot dir\n"); if (read_inode(sb, boot_inode_num, &boot_inode)) { debug("read boot inode error"); return -1; } inode = &boot_inode; if (verbose > 1) { printf("mode %o\n", inode->i_mode); printf("flags %x\n", inode->i_flags); printf("size %x\n", inode->i_size); printf("blocks %x\n", inode->i_blocks); printf("block[0] %x\n", inode->i_block[0]); printf("block[1] %x\n", inode->i_block[1]); } if (read_block(inode->i_block[0], dir_block_buf)) { debug("read boot inode dir block error"); return -1; } our_inode_num = 0; offset = 0; while (offset < 4096) { char name[256]; de = (struct ext2_dir_entry_2 *)(dir_block_buf + offset); strncpy(name, de->name, de->name_len); name[de->name_len] = 0; offset += de->rec_len; if (verbose > 1) { printf("inode %d, type %d, name '%s'\n", de->inode, de->file_type, name); printf("rec_len %d (%x), b %d\n", de->rec_len, de->rec_len, offset); } if (/* FIXME de->file_type == 1 && */ strncmp(name, fileName, sizeof(name)) == 0) { printf("found /boot/%s\n", fileName); our_inode_num = de->inode; } if (our_inode_num) break; } } if (our_inode_num) { if( verbose > 0) printf("reading %s:\n", fileName); if( (retval=load_file_inode(sb, our_inode_num, ramBase)) < 0) return -1; } return retval; // success: return file size } #ifdef TEST main() { int fd; fd = open("/tmp/disk", 0); read(fd, disk, sizeof(disk)); close(fd); check_mbr(); find_root(); } #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/blob/blob/src/lib/Makefile.am,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.am 19 Apr 2002 19:59:23 -0000 1.16 +++ Makefile.am 26 Apr 2002 04:46:59 -0000 1.17 @@ -25,14 +25,13 @@ libblob.a -# no headers, so these are broken -# ide.c \ -# pcmcia.c \ libblob_a_SOURCES = \ command.c \ crc32.c \ + disk.c \ error.c \ icache.c \ + ide.c \ init.c \ led.c \ md5.c \ @@ -40,6 +39,7 @@ memcpy.c \ memset.c \ mini_inflate.c \ + pcmcia.c \ printf.c \ reboot.c \ serial.c \ |
From: Tim R. <tim...@us...> - 2002-04-26 04:46:18
|
Update of /cvsroot/blob/blob/utils/test In directory usw-pr-cvs1:/tmp/cvs-serv29848/utils/test Modified Files: Makefile Log Message: try to get user space working again Index: Makefile =================================================================== RCS file: /cvsroot/blob/blob/utils/test/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 14 Feb 2002 09:59:34 -0000 1.1 +++ Makefile 26 Apr 2002 04:46:15 -0000 1.2 @@ -1,22 +1,28 @@ -DEFS = -DHAVE_CONFIG_H -I/usr/include -I. -I../../include +DEFS = -DHAVE_CONFIG_H -I../../include -I/usr/include -I. -I/home/timr/work/shannon/buildroot-tux/build/linux/include load_kernel_test_OBJECTS = \ load_kernel.o \ load_kernel_test.o \ mini_inflate.o \ +error.o \ +util.o \ jffs2.o \ compr_rtime.o \ compr_rubin.o \ -compr_zlib.o \ -cramfs.o zImage.o crc32.o +cramfs.o \ +zImage.o \ +crc32.o load_kernel_test_extra_SOURCES = \ mini_inflate.c \ +error.c \ +util.c \ jffs2.c \ compr_rtime.c \ compr_rubin.c \ -compr_zlib.c \ -cramfs.c zImage.c crc32.c +cramfs.c \ +zImage.c \ +crc32.c CC=gcc |
From: Tim R. <tim...@us...> - 2002-04-26 04:45:29
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv29696/include/blob Modified Files: pcmcia.h Log Message: try pcmcia on idr Index: pcmcia.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/pcmcia.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- pcmcia.h 24 Apr 2002 14:29:03 -0000 1.2 +++ pcmcia.h 26 Apr 2002 04:45:26 -0000 1.3 @@ -56,7 +56,7 @@ */ #define PCMCIA_MAX_SLOTS 2 -#if defined(PT_SYSTEM3) +#if defined(PT_SYSTEM3) || defined(IDR) # define PCMCIA_S0_BASE 0x20000000 # define PCMCIA_S0_ATTR_BASE 0x28000000 # define PCMCIA_S1_BASE 0x30000000 |
From: Tim R. <tim...@us...> - 2002-04-26 04:44:43
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv29505/include/blob Modified Files: load_kernel.h Log Message: load_kernel.c has fodder_ram_base as const Index: load_kernel.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/load_kernel.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- load_kernel.h 16 Feb 2002 00:43:59 -0000 1.3 +++ load_kernel.h 26 Apr 2002 04:44:41 -0000 1.4 @@ -65,7 +65,7 @@ extern const void *fodder_ram_base; #define UDEBUG(str, args...) #else -extern void *fodder_ram_base; +extern const void *fodder_ram_base; #define UDEBUG(str, args...) printf(str, ## args) #endif |
From: Tim R. <tim...@us...> - 2002-04-26 04:43:34
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv29346/src/lib Modified Files: util.c Log Message: use printf so user space works Index: util.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/util.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- util.c 12 Feb 2002 23:59:41 -0000 1.6 +++ util.c 26 Apr 2002 04:43:31 -0000 1.7 @@ -51,7 +51,7 @@ while(numWords--) { if((numWords & 0xffff) == 0x0) - serial_write('.'); + printf("."); *dest++ = *src++; } |
From: Christopher H. <ch...@us...> - 2002-04-25 23:29:45
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv9315/src/lib Modified Files: i2c.c Log Message: fix -Wall warnings Index: i2c.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/i2c.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- i2c.c 25 Apr 2002 22:46:11 -0000 1.1 +++ i2c.c 25 Apr 2002 23:29:42 -0000 1.2 @@ -240,7 +240,6 @@ int i2c_read_device_byte(struct i2c_bus *bus, u8 devAddr) { - int rc; u8 val; i2c_start(bus); @@ -254,8 +253,6 @@ int i2c_read_device_byte_at(struct i2c_bus *bus, u8 devAddr, u8 startAddr) { - int rc; - i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); @@ -269,8 +266,6 @@ u8 devAddr, u8 startAddr, u8 *buf, unsigned long n) { - int rc; - i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); @@ -295,8 +290,6 @@ int i2c_write_device_byte_at(struct i2c_bus *bus, u8 devAddr, u8 val, u8 startAddr) { - int rc; - i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); @@ -313,8 +306,6 @@ u8 devAddr, u8 startAddr, const u8 *buf, unsigned long n) { - int rc; - i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); |
From: Christopher H. <ch...@us...> - 2002-04-25 22:46:19
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv23553/include/blob Added Files: i2c.h i2c-gpio.h Log Message: simple i2c implementation -- useful for reading DRAM size and timing info out of SPD roms on SIMMs --- NEW FILE: i2c.h --- #ifndef _I2C_H_ #define _I2C_H_ #include <blob/types.h> struct i2c_bus { int (*init_bus)(struct i2c_bus *); int (*set_scl)(struct i2c_bus *, unsigned sense); int (*set_sda)(struct i2c_bus *, unsigned sense); int (*get_scl)(struct i2c_bus *); int (*get_sda)(struct i2c_bus *); void *private; }; //////////////////////////////////////////////////////////////////////// /* high-level operators */ extern int i2c_init(struct i2c_bus *); extern int i2c_read_device_byte(struct i2c_bus *, u8); extern int i2c_read_device_byte_at(struct i2c_bus *bus, u8, u8); extern int i2c_read_device_bytes(struct i2c_bus *, u8, u8, u8 *, unsigned long); extern int i2c_write_device_byte_at(struct i2c_bus *, u8, u8, u8); extern int i2c_write_device_bytes_at(struct i2c_bus *, u8, u8, const u8 *, unsigned long); extern int i2c_scan(struct i2c_bus *bus, u8 map[256]); /* low-level operators */ extern int i2c_start(struct i2c_bus *); extern int i2c_stop(struct i2c_bus *); extern int i2c_send_ack(struct i2c_bus *); extern int i2c_get_ack(struct i2c_bus *); extern int i2c_get_ack_quietly(struct i2c_bus *); extern int i2c_write_byte(struct i2c_bus *, u8); extern int i2c_read_byte(struct i2c_bus *); #endif --- NEW FILE: i2c-gpio.h --- #ifndef _I2C_GPIO_H_ #define _I2C_GPIO_H_ #include <blob/types.h> struct i2c_bus_gpio_private { unsigned sda_gpio; unsigned scl_gpio; unsigned delay; }; extern int init_bus_gpio(struct i2c_bus *); extern int set_sda_gpio(struct i2c_bus *, unsigned); extern int get_sda_gpio(struct i2c_bus *); extern int set_scl_gpio(struct i2c_bus *, unsigned); extern int get_scl_gpio(struct i2c_bus *); #endif |
From: Christopher H. <ch...@us...> - 2002-04-25 22:46:17
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv23553/src/lib Added Files: i2c.c i2c-gpio.c Log Message: simple i2c implementation -- useful for reading DRAM size and timing info out of SPD roms on SIMMs --- NEW FILE: i2c.c --- /* * i2c.c: generic i2c bus support * * Copyright (C) 2001 Hewlett-Packard Comapny * Written by Christopher Hoover <ch...@hp...> * * 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: i2c.c,v 1.1 2002/04/25 22:46:11 choover Exp $" #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/i2c.h> #include <blob/util.h> #include <blob/errno.h> #ifdef DEBUG #define DPRINTF(...) do { printf(__VA_ARGS__); } while (0) #else #define DPRINTF(...) do { } while (0) #endif //////////////////////////////////////////////////////////////////////// static inline int set_scl(struct i2c_bus *bus, unsigned sense) { return (bus->set_scl)(bus, sense); } static inline int set_sda(struct i2c_bus *bus, unsigned sense) { return (bus->set_sda)(bus, sense); } static inline int get_scl(struct i2c_bus *bus) { return (bus->get_scl)(bus); } static inline int get_sda(struct i2c_bus *bus) { return (bus->get_sda)(bus); } //////////////////////////////////////////////////////////////////////// int i2c_start(struct i2c_bus *bus) { /* high to low transition on SDA while SCL is high */ set_scl(bus, 1); set_sda(bus, 1); set_sda(bus, 0); set_scl(bus, 0); set_sda(bus, 1); return 0; } int i2c_stop(struct i2c_bus *bus) { /* low to high transition on SDA while SCL is high */ set_sda(bus, 0); set_scl(bus, 1); set_sda(bus, 1); return 0; } int i2c_init(struct i2c_bus *bus) { int rc, i; DPRINTF("initializing i2c driver\n"); rc = (bus->init_bus)(bus); if (rc < 0) return rc; DPRINTF("resetting i2c bus"); for (i = 0; i < 9; i++) (void) i2c_stop(bus); DPRINTF("testing i2c bus"); DPRINTF("[0] scl: %d, sda: %d\n", get_scl(bus), get_sda(bus)); if ((get_scl(bus) != 1) || (get_sda(bus) != 1)) { printf("bus seems to be busy\n"); goto fail; } set_sda(bus, 0); DPRINTF("[1] scl: %d, sda: %d\n", get_scl(bus), get_sda(bus)); if (get_sda(bus) != 0) { printf("sda stuck high\n"); goto fail; } if (get_scl(bus) == 0) { printf("scl unexpectedly low while pulling SDA low\n"); goto fail; } set_sda(bus, 1); DPRINTF("[2] scl: %d, sda: %d\n", get_scl(bus), get_sda(bus)); if (get_sda(bus) == 0) { printf("sda stuck low\n"); goto fail; } if (get_scl(bus) == 0) { printf("scl unexpectedly low while SDA high\n"); goto fail; } set_scl(bus, 0); DPRINTF("[3] scl: %d, sda: %d\n", get_scl(bus), get_sda(bus)); if (get_scl(bus) != 0) { printf("scl stuck high\n"); goto fail; } if (get_sda(bus) == 0) { printf("sda unexpected low while pulling scl low\n"); goto fail; } set_scl(bus, 1); DPRINTF("[4] scl: %d, sda: %d\n", get_scl(bus), get_sda(bus)); if (get_scl(bus) == 0) { printf("scl stuck low\n"); goto fail; } if (get_sda(bus) == 0) { printf("sda unexpected low while scl high\n"); goto fail; } DPRINTF("test passed\n"); return 0; fail: /* float the lines */ set_scl(bus, 1); set_sda(bus, 1); return -EINVAL; } int i2c_send_ack(struct i2c_bus *bus) { set_sda(bus, 0); set_scl(bus, 1); set_scl(bus, 0); set_sda(bus, 1); return 0; } int i2c_get_ack(struct i2c_bus *bus) { unsigned bit; set_sda(bus, 1); set_scl(bus, 1); bit = get_sda(bus); if (bit) printf(__FUNCTION__ ": did not get ack\n"); set_scl(bus, 0); /* zero is winning */ return bit; } int i2c_get_ack_quietly(struct i2c_bus *bus) { unsigned bit; set_sda(bus, 1); set_scl(bus, 1); bit = get_sda(bus); set_scl(bus, 0); /* zero is winning */ return bit; } int i2c_write_byte(struct i2c_bus *bus, u8 byte) { int i; for (i = 7; i >= 0; i--) { unsigned bit = byte & (1<<i); set_sda(bus, bit); set_scl(bus, 1); set_scl(bus, 0); } set_sda(bus, 1); return 0; } int i2c_read_byte(struct i2c_bus *bus) { int i; u8 value = 0; set_sda(bus, 1); for (i = 0; i < 8; i++) { unsigned bit; set_scl(bus, 1); bit = get_sda(bus); value = (value << 1) | bit; set_scl(bus, 0); } return value; } #define READ_ADDR(x) (((x) << 1) | 1) #define WRITE_ADDR(x) ((x) << 1) #define i2c_get_ack_or_bail(bus) \ do { \ int rc = i2c_get_ack(bus); \ if (rc != 0) { i2c_stop(bus); i2c_stop(bus); return rc; } \ } while (0) int i2c_read_device_byte(struct i2c_bus *bus, u8 devAddr) { int rc; u8 val; i2c_start(bus); i2c_write_byte(bus, READ_ADDR(devAddr)); i2c_get_ack_or_bail(bus); val = i2c_read_byte(bus); i2c_stop(bus); return val; } int i2c_read_device_byte_at(struct i2c_bus *bus, u8 devAddr, u8 startAddr) { int rc; i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); i2c_write_byte(bus, startAddr); i2c_get_ack_or_bail(bus); return i2c_read_device_byte(bus, devAddr); } int i2c_read_device_bytes(struct i2c_bus *bus, u8 devAddr, u8 startAddr, u8 *buf, unsigned long n) { int rc; i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); i2c_write_byte(bus, startAddr); i2c_get_ack_or_bail(bus); i2c_start(bus); i2c_write_byte(bus, READ_ADDR(devAddr)); i2c_get_ack_or_bail(bus); for (; n > 0; n--) { u8 val = i2c_read_byte(bus); *buf++ = val; if (n) i2c_send_ack(bus); } i2c_stop(bus); return 0; } int i2c_write_device_byte_at(struct i2c_bus *bus, u8 devAddr, u8 val, u8 startAddr) { int rc; i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); i2c_write_byte(bus, startAddr); i2c_get_ack_or_bail(bus); i2c_write_byte(bus, val); i2c_get_ack_or_bail(bus); i2c_stop(bus); return 0; } int i2c_write_device_bytes_at(struct i2c_bus *bus, u8 devAddr, u8 startAddr, const u8 *buf, unsigned long n) { int rc; i2c_start(bus); i2c_write_byte(bus, WRITE_ADDR(devAddr)); i2c_get_ack_or_bail(bus); i2c_write_byte(bus, startAddr); i2c_get_ack_or_bail(bus); for (; n > 0; n--) { u8 val = *buf++; i2c_write_byte(bus, val); i2c_get_ack_or_bail(bus); } i2c_stop(bus); return 0; } int i2c_scan(struct i2c_bus *bus, u8 map[256]) { int i; DPRINTF("scanning bus "); for (i = 0; i < 0xff; i += 1) { unsigned ack; i2c_start(bus); i2c_write_byte(bus, i); ack = i2c_get_ack_quietly(bus); i2c_stop(bus); if (ack == 0) { DPRINTF("(%02x)", i); map[i] = 1; } else { DPRINTF("."); map[i] = 0; } } DPRINTF("\ndone\n"); return 0; } --- NEW FILE: i2c-gpio.c --- /* * i2c-gpio.c: i2c on a pair of GPIO pins * * Copyright (C) 2001 Hewlett-Packard Comapny * Written by Christopher Hoover <ch...@hp...> * * 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: i2c-gpio.c,v 1.1 2002/04/25 22:46:11 choover Exp $" #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/i2c.h> #include <blob/i2c-gpio.h> #include <blob/sa1100.h> #include <blob/errno.h> #include <blob/util.h> #ifdef DEBUG #define DPRINTF(...) do { printf(__VA_ARGS__); } while (0) #else #define DPRINTF(...) do { } while (0) #endif //////////////////////////////////////////////////////////////////////// static inline int set_scl(struct i2c_bus *bus, unsigned sense) { return (bus->set_scl)(bus, sense); } static inline int set_sda(struct i2c_bus *bus, unsigned sense) { return (bus->set_sda)(bus, sense); } static inline int get_scl(struct i2c_bus *bus) { return (bus->get_scl)(bus); } static inline int get_sda(struct i2c_bus *bus) { return (bus->get_sda)(bus); } //////////////////////////////////////////////////////////////////////// static inline void delay(const struct i2c_bus *bus) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; /* ### use msleep? no, it may not be around early enough */ volatile int i; for (i = 0; i < private->delay; i++) ; } int init_bus_gpio(struct i2c_bus *bus) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; GPDR &= ~(private->sda_gpio | private->scl_gpio); GPCR = (private->sda_gpio | private->scl_gpio); set_sda_gpio(bus, 1); set_scl_gpio(bus, 1); delay(bus); delay(bus); return 0; } int set_sda_gpio(struct i2c_bus *bus, unsigned sense) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; if (sense) /* float high */ GPDR &= ~(private->sda_gpio); else /* pull low */ GPDR |= (private->sda_gpio); delay(bus); return 0; } int get_sda_gpio(struct i2c_bus *bus) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; return (GPLR & (private->sda_gpio)) ? 1 : 0; } int set_scl_gpio(struct i2c_bus *bus, unsigned sense) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; if (sense) { int i = 0; /* float high */ GPDR &= ~(private->scl_gpio); /* ### this should timeout and return -ETIMEOUT */ while (!get_scl(bus)) { if (i++ > 10) { DPRINTF(__FUNCTION__ ": scl did not go high\n"); return -ETIMEOUT; } delay(bus); } } else /* pull low */ GPDR |= (private->scl_gpio); delay(bus); return 0; } int get_scl_gpio(struct i2c_bus *bus) { struct i2c_bus_gpio_private *private = (struct i2c_bus_gpio_private *) bus->private; return (GPLR & (private->scl_gpio)) ? 1 : 0; } |
From: Erik M. <J.A...@it...> - 2002-04-25 22:38:08
|
On Thu, Apr 25, 2002 at 12:33:34PM +0200, Abraham vd Merwe wrote: > I'm beating my head against a stone here :P > > If I set the irq exception handler to any address in a > INIT_LEVEL_DRIVER_SELECTION hook and I check that address later on in a > INIT_LEVEL_OTHER_STUFF hook, the address differs, e.g. with > > static void frodo_set_irq() > { > u32 *irq_vector = (u32 *) 0x00000018; > *irq_vector = 0xdeadbeaf; You're trying to write to flash... > } > __initlist(frodo_set_irq,INIT_LEVEL_DRIVER_SELECTION); > > static void frodo_debug_irq() > { > u32 *irq_vector = (u32 *) 0x00000018; > printf ("*irq_vector == 0x%.8x\n",*irq_vector); > } > __initlist(frodo_debug_irq,INIT_LEVEL_OTHER_STUFF); > > I get *irq_vector == 0xea0000c1 when booting blob. > > I can't see anything in the second stage boot loader that modifies this > address, so what is happening here? Writing to flash doesn't work. Do it like I suggested before: "irq" in start-sa11x0.S has to become an indirect branch to an entry point in trampoline.S. The entry point in trampoline.S on its turn can push some registers on the stack and branch&link into the C irq handler. Erik -- J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty of Information Technology and Systems, Delft University of Technology, PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635 Fax: +31-15-2781843 Email: J.A...@it... WWW: http://www-ict.its.tudelft.nl/~erik/ |
From: Abraham vd M. <ab...@2d...> - 2002-04-25 11:27:57
|
Hi Russ! > didn't we already go over the whole thing about having a watchdog > running in the bootloader is bad? or are you trying to do something > else, its late, I'm confused easily It is still for the watchdog. I can change the watchdog in version 2, but for now I need an interrupt handler in blob --=20 Regards Abraham No one knows like a woman how to say things that are at once gentle and dee= p. -- Hugo __________________________________________________________ Abraham vd Merwe - 2d3D, Inc. Device Driver Development, Outsourcing, Embedded Systems Cell: +27 82 565 4451 Snailmail: Tel: +27 21 761 7549 Block C, Aintree Park Fax: +27 21 761 7648 Doncaster Road Email: ab...@2d... Kenilworth, 7700 Http: http://www.2d3d.com South Africa |
From: Russ D. <Rus...@as...> - 2002-04-25 11:26:09
|
didn't we already go over the whole thing about having a watchdog running in the bootloader is bad? or are you trying to do something else, its late, I'm confused easily |
From: Abraham vd M. <ab...@2d...> - 2002-04-25 10:33:41
|
Hi! I'm beating my head against a stone here :P If I set the irq exception handler to any address in a INIT_LEVEL_DRIVER_SELECTION hook and I check that address later on in a INIT_LEVEL_OTHER_STUFF hook, the address differs, e.g. with static void frodo_set_irq() { u32 *irq_vector =3D (u32 *) 0x00000018; *irq_vector =3D 0xdeadbeaf; =20 } __initlist(frodo_set_irq,INIT_LEVEL_DRIVER_SELECTION); static void frodo_debug_irq() { u32 *irq_vector =3D (u32 *) 0x00000018; printf ("*irq_vector =3D=3D 0x%.8x\n",*irq_vector); =20 } __initlist(frodo_debug_irq,INIT_LEVEL_OTHER_STUFF); I get *irq_vector =3D=3D 0xea0000c1 when booting blob. I can't see anything in the second stage boot loader that modifies this address, so what is happening here? --=20 Regards Abraham "Kill the Wabbit, Kill the Wabbit, Kill the Wabbit!" -- Looney Tunes, "What's Opera Doc?" (1957, Chuck Jones) __________________________________________________________ Abraham vd Merwe - 2d3D, Inc. Device Driver Development, Outsourcing, Embedded Systems Cell: +27 82 565 4451 Snailmail: Tel: +27 21 761 7549 Block C, Aintree Park Fax: +27 21 761 7648 Doncaster Road Email: ab...@2d... Kenilworth, 7700 Http: http://www.2d3d.com South Africa |
From: Stefan E. <se...@us...> - 2002-04-24 14:34:31
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv20791 Modified Files: system3.c Log Message: - pcmcia test funtion. reads first 10 sectors of an CF card. Yeah! - sysver command prints out system3 build id string - manually reference ferase/fwrite/dlfile commands - changed sa1111_init() to match recent kernels. - removed silly bug in MEM(). Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- system3.c 18 Apr 2002 19:55:34 -0000 1.11 +++ system3.c 24 Apr 2002 14:34:26 -0000 1.12 @@ -58,23 +58,15 @@ #define ERR( x ) { ret = x; goto DONE; } /* more readable IMHO */ -#define MEM( x ) (*((u32 *)x)) +#define MEM( x ) (*((u32 *)(x))) #define SET(reg,bit) ((reg) |= (1<<(bit))) #define RST(reg,bit) ((reg) &= ~(1<<(bit))) -#define mem_b(adr) ( ((volatile unsigned char*)0)[adr] ) -#define mem_w(adr) ( ((volatile unsigned short int*)0)[(adr)/2] ) -#define mem_dw(adr) ( ((volatile unsigned long*)(0)) [(adr)/4] ) - -#if 0 -#define GPDR (0x90040004) -#define GPSR (0x90040008) -#define GPCR (0x9004000c) -#define GAFR (0x9004001c) -#define TUCR (0x90030008) /* Test Unit Control Reg. */ -#endif - -#define CF_REG_CFG (0x200) +/***************************************************************** + * CF Flash register definitions + */ +/* config register - offset 0 */ +#define CF_REG_CFG (0x00) #define CF_CFG_SRST (0x80) #define CF_CFG_LVLREQ (0x40) #define CF_CFG_MMAP (0x00) @@ -82,7 +74,8 @@ #define CF_CFG_IO_IDE0 (0x02) #define CF_CFG_IO_IDE1 (0x03) -#define CF_REG_CFGSTAT (0x202) +/* config status register - offset 2 */ +#define CF_REG_CFGSTAT (0x02) #define SYSTEM3_DEBUG 1 @@ -96,7 +89,6 @@ */ extern blob_status_t blob_status; -static void sa1111_init(); /********************************************************************** * module globals @@ -119,15 +111,13 @@ /********************************************************************** * static functions */ +static char module_version[] = "$Id$"; +static void dumpmem(char *ptr, int len); +static char tohex(char b); +static void sa1111_init(); /********************************************************************* - * init_system3_flash - * - * AUTOR: SELETZ - * REVISED: - * - * inits system 3 flash driver - * + * init_system3_flash - inits system 3 flash driver */ static void init_system3_flash_driver(void) { @@ -136,6 +126,9 @@ } __initlist(init_system3_flash_driver, INIT_LEVEL_DRIVER_SELECTION); +/********************************************************************* + * system3_init_hardware - inits system 3 LL hardware stuff + */ static void system3_init_hardware(void) { /* init on-board CPLD */ @@ -143,18 +136,15 @@ MEM(SYSTEM3_CTRL_1) = 0x00; MEM(SYSTEM3_CTRL_2) = 0x00; -#if 0 /* activate SYSCLCK for keyboard controller */ - SET( MEM(GAFR), 27 ); - SET( MEM(GPDR), 27 ); + RST( MEM(TUCR), 31 ); + GAFR |= GPIO_32_768kHz; + GPDR |= GPIO_32_768kHz; /* 3.6864 MHz SYSCLK */ - SET( MEM(TUCR), 29 ); - RST( MEM(TUCR), 30 ); - RST( MEM(TUCR), 31 ); + TUCR = TUCR_3_6864MHz; msleep( 1 ); -#endif //sa1111_init(); @@ -170,72 +160,103 @@ } __initlist(system3_init_hardware, INIT_LEVEL_DRIVER_SELECTION); +/***************************************************************** + * sysver - print system version + */ +static int sysver_cmd( int argc, char *argv[] ) +{ + printf( "version: '%s'\n", module_version ); + return 0; +} +static char sysver_help[] = "print BLOB and system3 version number\n"; +__commandlist(sysver_cmd, "sysver", sysver_help); + +/***************************************************************** + * sa1111_init - initialize companion chip + */ static void sa1111_init() { _DBG( "%s", "START\n" ); - _DBG( "%s", "Switch on SYSCLCK 3.6864 MHz\n" ); - /* switch on clock for sa1111 */ + /* + * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: + * (SA-1110 Developer's Manual, section 9.1.2.1) + */ GAFR |= GPIO_32_768kHz; GPDR |= GPIO_32_768kHz; TUCR = TUCR_3_6864MHz; - /* Now, set up the PLL and RCLK in the SA-1111: */ - SBI_SKCR = SKCR_PLL_BYPASS | SKCR_RDYEN | SKCR_OE_EN; - msleep(100); - SBI_SKCR = SKCR_PLL_BYPASS | SKCR_RCLKEN | SKCR_RDYEN | SKCR_OE_EN; + /* + * Turn VCO on, and disable PLL Bypass. + */ + SBI_SKCR &= ~SKCR_VCO_OFF; + SBI_SKCR |= SKCR_PLL_BYPASS | SKCR_OE_EN; - printf( "SA1111 ID: %08x\n", SBI_SKID ); + /* + * Wait lock time. SA1111 manual _doesn't_ + * specify a figure for this! We choose 100us. + */ + msleep(1); /* - * SA-1111 Register Access Bus should now be available. Clocks for - * any other SA-1111 functional blocks must be enabled separately - * using the SKPCR. + * Enable RCLK. We also ensure that RDYEN is set. */ - SKPCR |= SKPCR_DCLKEN | SKPCR_PWMCLKEN; + SBI_SKCR |= SKCR_RCLKEN | SKCR_RDYEN; /* - * If the system is going to use the SA-1111 DMA engines, set up - * the memory bus request/grant pins. Also configure the shared - * memory controller on the SA-1111 (SA-1111 Developer's Manual, - * section 3.2.3) and power up the DMA bus clock: + * Wait 14 RCLK cycles for the chip to finish coming out + * of reset. (RCLK=24MHz). This is 590ns. */ - GAFR |= (GPIO_MBGNT | GPIO_MBREQ); - GPDR |= GPIO_MBGNT; - GPDR &= ~GPIO_MBREQ; - TUCR |= TUCR_MR; + msleep(1); + + /* + * Ensure all clocks are initially off. + */ + SKPCR = 0; + + printf( "SA1111 ID: %08x\n", SBI_SKID ); - SBI_SMCR = (SMCR_DTIM | SMCR_MBGE | - FInsrt(FExtr(MDCNFG, MDCNFG_SA1110_DRAC0), SMCR_DRAC) | - ((FExtr(MDCNFG, MDCNFG_SA1110_TDL0)==3) ? SMCR_CLAT : 0)); _DBG( "%s", "DONE\n" ); } #if defined(CONFIG_PCMCIA_SUPPORT) +/***************************************************************** + * pcmcia_init - initialize PCMCIA + */ int pcmcia_init() { printf( "PT Digital Board PCMCIA init\n" ); - /* nothing to do ATM */ sa1111_init(); +#if SYSTEM3_DEBUG printf( "MECR=0x%08x\n", MECR ); printf( "MSC0=0x%08x\n", MSC0 ); printf( "MSC1=0x%08x\n", MSC1 ); printf( "MSC2=0x%08x\n", MSC2 ); + printf( "SA1111_BASE=0x%08x\n", SA1111_VBASE ); + printf( "SBI_SMCR=0x%08x\n", SBI_SMCR ); + printf( "SBI_SKID=0x%08x\n", SBI_SKID ); +#endif return 0; } + +/***************************************************************** + * pcmcia_test - test PCMCIA, CF and IDE + */ static int pcmcia_test( int argc, char *argv[] ) { int ret = 0; - int slot = 0; - u32 *slot_base; - u32 *slot_attr; + int slot = 1; /* default CF */ + u32 slot_base; + 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" }; @@ -259,7 +280,7 @@ } pcmcia_dbg_set( 5 ); - //ide_dbg_set( 5 ); + ide_dbg_set( 5 ); ret = pcmcia_slot_detect( slot ); if ( !ret ) ERR( -EINVAL ); @@ -275,18 +296,39 @@ ret = pcmcia_slot_reset( slot ); if ( ret != 0 ) ERR( -EINVAL ); - mem_b( (u32)slot_attr + CF_REG_CFG ) = ( mem_b( (u32)slot_attr + CF_REG_CFG ) & 0xC0 ) | CF_CFG_IO_IDE0; - - printf( "CF CFG REG = 0x%x\n", mem_b( (u32)slot_attr + CF_REG_CFG ) ); - - printf( "slot %d enabled\n", slot ); - ret = pcmcia_cis_parse( slot ); if ( ret != 0 ) ERR( -EINVAL ); -#if 0 ret = pcmcia_slot_cfg_reg_get( slot, &cfg_reg ); if ( ret != 0 ) ERR( -EINVAL ); + printf( "slot %d config register: 0x%03x\n", slot, cfg_reg ); + + pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); + printf( "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); + + pcmcia_slot_attr_read( slot, CF_REG_CFGSTAT, &value ); + printf( "slot %d config status register: 0x%02x = 0x%02x\n", slot, CF_REG_CFGSTAT, value ); + + /* reset CF card */ + pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue | CF_CFG_SRST ); + msleep(1); + pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue & (~CF_CFG_SRST) ); + pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); + printf( "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); + + + /* configure for true ide mode */ + pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue | CF_CFG_IO_IDE0 ); + pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); + printf( "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); + + pcmcia_slot_attr_read( slot, CF_REG_CFGSTAT, &value ); + printf( "slot %d config status register: 0x%02x = 0x%02x\n", slot, CF_REG_CFGSTAT, value ); + + printf( "slot %d enabled\n", slot ); + + //ret = pcmcia_slot_cfg_reg_get( slot, &cfg_reg ); + //if ( ret != 0 ) ERR( -EINVAL ); ret = ide_init( &drive, (u32)slot_base ); if ( ret != 0 ) ERR( -EINVAL ); @@ -299,6 +341,7 @@ ret = ide_status_dump( &drive ); if ( ret != 0 ) ERR( -EINVAL ); +#if 1 for ( sec=0; sec<10; sec++ ) { ret = hd_read_mapped( &drive, sec, buffer ); if ( ret != 0 ) ERR( -EINVAL ); @@ -356,153 +399,55 @@ __commandlist(pcmcia_test, "pcmciatest", pcmciahelp); #endif - -#if 0 -/********************************************************************* - * cmd_download_file - * - * AUTOR: SELETZ - * REVISED: - * - * Download a file to arbitary memory location - * +/***************************************************************** + * misc utility funcs */ -int cmd_download_file( int argc, char *argv[] ) +static char tohex(char b) { - int ret = 0; - u32 dest = 0L; - u32 len = 0L; - - if ( argc < 3 ) ERR( -EINVAL ); - - ret = strtou32( argv[1], &dest ); - if ( ret < 0 ) ERR( -EINVAL ); - - ret = strtou32( argv[2], &len ); - if ( ret < 0 ) ERR( -EINVAL ); - -#if defined(CONFIG_XMODEM_SUPPORT) - printf( "XMODEM download\n" ); -#else - printf( "UUENCODE download\n" ); -#endif - - if (blob_status.terminalSpeed != blob_status.downloadSpeed) { - SerialOutputString("Switching to download speed\n"); - SerialOutputString("You have 60 seconds to switch your terminal emulator to the same speed and\n"); - SerialOutputString("start downloading. After that " PACKAGE " will switch back to term speed.\n"); - - serial_init(blob_status.downloadSpeed); - } else { - SerialOutputString("You have 60 seconds to start downloading.\n"); - } -#if defined(CONFIG_XMODEM_SUPPORT) - ret = XModemReceive( (char *)dest, len ); -#else - ret = UUDecode((char *)dest, len); -#endif - if ( ret == len ) { - SerialOutputString("Received "); - SerialOutputDec(ret); - SerialOutputString(" (0x"); - SerialOutputHex(ret); - SerialOutputString(") bytes.\n"); - ret = 0; - } else { - SerialOutputString("error during download\n"); - } - - if (blob_status.terminalSpeed != blob_status.downloadSpeed) { - SerialOutputString("\n(Please switch your terminal emulator back to terminal speed\n"); - serial_init(blob_status.terminalSpeed); - } - -DONE: - return ret; + b = b & 0xf; + if (b < 10) return '0' + b; + return 'a' + (b - 10); } -static char downloadhelp[] = "dlfile destadr filelength\n" -"download file to memory\n"; -__commandlist( cmd_download_file, "dlfile", downloadhelp ); -/********************************************************************* - * cmd_flash_write - * - * AUTOR: SELETZ - * REVISED: - * - * Command wrapper for low-level flash write access - * - */ -static int cmd_flash_write( int argc, char *argv[] ) +static void dumpmem(char *ptr, int len) { - int ret = 0; - u32 src = 0L; - u32 dest = 0L; - u32 len = 0L; - - if ( argc < 4 ) ERR( -EINVAL ); - - ret = strtou32( argv[1], &src ); - if ( ret < 0 ) ERR( -EINVAL ); - - ret = strtou32( argv[2], &dest ); - if ( ret < 0 ) ERR( -EINVAL ); + char line[80], chars[80], *p, b, *c, *end; + int i, j; - ret = strtou32( argv[3], &len ); - if ( ret < 0 ) ERR( -EINVAL ); + end = ptr + len; + while (ptr < end) { + SerialOutputHex((int)ptr); + p = line; + c = chars; - if ( len & (0x3) ) { - len = (len>>2) + 1; - } else { - len = len>>2; + *p++ = ' '; + for (j = 0; j < 16; j++) { + b = *ptr++; + *p++ = tohex(b >> 4); + *p++ = tohex(b); + *p++ = ' '; + *c++ = ' ' <= b && b <= '~' ? b : '.'; } - - _DBGU32( src ); - _DBGU32( dest ); - _DBGU32( len ); - - ret = flash_write_region( (u32 *)dest, (u32*)src, len ); -DONE: - return ret; + *p = 0; + SerialOutputString(line); + *c = 0; + SerialOutputString(chars); + serial_write('\n'); + } } -static char flashwritehelp[] = "fwrite srcadr destadr size(bytes)\n" -"flash a memory region\n"; -__commandlist( cmd_flash_write, "fwrite", flashwritehelp ); -/********************************************************************* - * cmd_flash_erase - * - * AUTOR: SELETZ - * REVISED: - * - * Command wrapper for low-level flash erasing - * +/***************************************************************** + * manually reference flash and download commands until they + * are in libblob. */ -static int cmd_flash_erase( int argc, char *argv[] ) -{ - int ret = 0; - u32 dest = 0L; - u32 len = 0L; - - if ( argc < 3 ) ERR( -EINVAL ); - - ret = strtou32( argv[1], &dest ); - if ( ret < 0 ) ERR( -EINVAL ); - - ret = strtou32( argv[2], &len ); - if ( ret < 0 ) ERR( -EINVAL ); +extern int fwrite_cmd(int argc, char *argv[]); +extern char fwrite_help[]; +__commandlist(fwrite_cmd, "fwrite", fwrite_help); - if ( len & (0x3) ) { - len = (len>>2) + 1; - } else { - len = len>>2; - } +extern int ferase_cmd(int argc, char *argv[]); +extern char ferase_help[]; +__commandlist(ferase_cmd, "ferase", ferase_help); - ret = flash_erase_region( (u32 *)dest, len ); -DONE: - return ret; -} -static char flasherasehelp[] = "ferase adr size(bytes)\n" -"erase a flash region\n"; -__commandlist( cmd_flash_erase, "ferase", flasherasehelp ); -#endif +extern int dlfile_cmd(int argc, char *argv[]); +extern char dlfile_help[]; +__commandlist(dlfile_cmd, "dlfile", dlfile_help); |