Hi Folks Time for a discussion about block devices and there interface.
The cyg_io_bread() and cyg_io_block() functions are not very well documented. None of the source code documents the exact meaning of the paramters. // Write data to a block device Cyg_ErrNo cyg_io_bwrite(cyg_io_handle_t handle, const void *buf, cyg_uint32 *len, cyg_uint32 pos); // Read data from a block device Cyg_ErrNo cyg_io_bread(cyg_io_handle_t handle, void *buf, cyg_uint32 *len, cyg_uint32 pos); Is len in bytes or blocks? is pos in bytes or blocks? Currently we have two block devices, disk and flash. disk uses blocks for both. Flash uses bytes for both. The blib code assumes blocks for both. eCosCentric's documentation about the disks, which is not part of anonymous CVS, says the len is in bytes. My proposal is that we define the block device API to use blocks for both len and pos. If this is agreed i will add comments to the code to make this clear. If eCosCentric will contribute there Disk IO Package documentation i will fix it and add it to anoncvs. The harder question is what to do about the flash code. JFFS2 needs to be able to write and read in less than blocks. In fact it really wants a character interface. So we could in fact modify the current code and turn it into a character device. A block device is possible, with one block equaling one flash page, but is it useful? Could you put a fatfs on top of this, when the block size could be anything from 128bytes to 64K? For the moment i suggest we just put in comments that the flash block device does not correctly implement the block interface and leave it alone. Comments please. Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss