From: Stefan E. <se...@us...> - 2004-02-19 13:45:33
|
Update of /cvsroot/blob/blob/src/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26260 Modified Files: gio_flash.c Log Message: unlock flash region at write Index: gio_flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/gio_flash.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gio_flash.c 3 Apr 2003 14:32:50 -0000 1.1 +++ gio_flash.c 19 Feb 2004 13:35:05 -0000 1.2 @@ -77,6 +77,7 @@ if ( !io ) return -EINVAL; + io->flags = GIO_FLAG_R|GIO_FLAG_W; io->private_data = NULL; io->io_size = 0; io->conf = flash_io_conf; @@ -159,6 +160,11 @@ DBG( 5, "%s: adr=0x%08x, nwords=%d.\n", __FUNCTION__, adr, amount/4 + (amount%4?1:0)); + if ( flash_unlock_region( adr, amount>>2 ) ) { + printf( "%s: can't unlock flash at %p\n", __FUNCTION__, adr ); + return -1; + } + return flash_write_region( (u32 *)adr, (u32*)src, amount/4 + (amount%4?1:0)); } |