Update of /cvsroot/blob/blob/src/lib
In directory usw-pr-cvs1:/tmp/cvs-serv17359
Modified Files:
cf.c
Log Message:
- set CF to 8-bit-mode, PIO
- initialize CF card on socket 1 as "CF" by default.
- BUGFIX: src address NULL is ok for cf_io_read()
- This code now seems to work. Reads correct sectors, and works
together with the tar io driver. Correctly extracts files
from a raw tar archive on /dev/hda. Yeah!
Index: cf.c
===================================================================
RCS file: /cvsroot/blob/blob/src/lib/cf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cf.c 3 May 2002 16:02:22 -0000 1.2
+++ cf.c 8 May 2002 14:01:18 -0000 1.3
@@ -170,10 +170,20 @@
if ( ret )
return -EINVAL;
+ ret = ide_setfeature( &drive, IDE_FEAT_8BITON, 0 );
+ if ( ret )
+ return -EINVAL;
+
+ ret = ide_setfeature( &drive, IDE_FEAT_IOMODE, IDE_IOM_PIO );
+ if ( ret )
+ return -EINVAL;
+
ret = ide_status_dump( &drive );
if ( ret )
return -EINVAL;
+
+
ret = 0;
DONE:
if ( ret != 0 ) {
@@ -202,7 +212,7 @@
if ( ret ) return;
}
-//__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2);
+__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2);
int cf_io_init( io_driver_t *io )
{
@@ -246,7 +256,7 @@
u16 start_off;
int block, to_copy;
- if ( !dest || !src )
+ if ( !dest )
return -EINVAL;
/* starting block number */
@@ -265,6 +275,12 @@
if ( ret != 0 )
return -EINVAL;
+ if ( cf_dbg>5 ) {
+ ret = ide_status_dump( &drive );
+ if ( ret )
+ return -EINVAL;
+ }
+
if ( start_off ) {
to_copy = IDE_BLOCK_SIZE - start_off;
} else {
@@ -332,7 +348,7 @@
return ret;
}
- ret = io_read( buffer, 256, 512, &cf_def_io );
+ ret = io_read( buffer, (unsigned char *)256, 512, &cf_def_io );
if ( ret ) {
DBG( 1, "%s: io_read: %d\n", __FUNCTION__, ret );
return ret;
|