From: Stefan E. <se...@us...> - 2002-05-08 20:08:16
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv13843 Modified Files: cf.c Log Message: - IDE_BLOCK_SIZE now in ide.h - calculate CF card size for io driver. The docs of my CF card says I've to use words 6+7 of the ID struct. Hope this is for other CF cards too ... Index: cf.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/cf.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cf.c 8 May 2002 14:01:18 -0000 1.3 +++ cf.c 8 May 2002 19:18:40 -0000 1.4 @@ -54,8 +54,6 @@ # define DBG( x, args... ) #endif -#define IDE_BLOCK_SIZE 512 - /********************************************************************** * module globals */ @@ -182,8 +180,6 @@ if ( ret ) return -EINVAL; - - ret = 0; DONE: if ( ret != 0 ) { @@ -234,6 +230,8 @@ int cf_io_conf( io_driver_t *io, void *conf ) { + int ret; + DBG( 5, "%s: io=%p, conf=%p\n", __FUNCTION__, io, conf ); @@ -243,9 +241,17 @@ cf_slot = (int)conf; DBG( 5, "%s: cf_slot=%d\n", __FUNCTION__, cf_slot ); + ret = cf_init( cf_slot ); + if ( ret ) + return -EINVAL; + io->private_data = (void *)cf_slot; - return cf_init( cf_slot ); + /* FIXME: is this ok? How to calculate the correct size? */ + io->io_size = (drive.driveid.vendor0 | (drive.driveid.vendor1 << 16)) * IDE_BLOCK_SIZE; + DBG( 1, "%s: io_size=%d\n", __FUNCTION__, io_get_size( io ) ); + + return 0; } static int cf_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) |