This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MMC Driver? (was Re: blib_get_block() uses blocks instead of bytes...)


Dear Andrew and ecos-discuss,

Thanks for the comments and warnings, that was helpful.

My immediate goal was read-only fatfs in FLASH as a test case for setting up a fatfs via a SD/MMC
card SPI mode driver.  I have not yet found an eCos MMC driver, although it seems there is one in
eCosPro.   Do you know of any open ones available?

I have found several open sources I could try adapting for my needs; the protocol doesn't look too
hard.  But a working one would save me some work.

   Thanks,

   Garth Zeglin

--- Andrew Lunn <andrew@lunn.ch> wrote:
> It is a bug, but a different bug to what you have found.
> 
> You are the first to try to put a fatfs on top of flash. Hence you
> found the bug. Normally fatfs is put on top of a disk. The disk
> bread/bwrite functions do work in blocks. The length is the number of
> blocks and the pos is in units of blocks.
> 
> The flash block driver however is using bytes!
> 
> As you said, it is not well documented and the documentation you
> pointed at also is not consistent with the disk implementation. It
> says len is in bytes, but disk_bread() uses len in blocks.
> 
> In my opinion, the pos should be in blocks. If it was in bytes we are
> going to have problems with big disks, since pos is only 32bits
> long. len could be either, but it is easier to fix the documentation
> than change the code and do lots of tests.
> 
> This however does not solve your problem. First off, i hope you
> realise your fatfs can only be read only! 
> 
> The flash bwrite function does not erase the page before writting, so
> writes are going to fail if the flash contains something. Also, fatfs
> assumes blocks are 512 bytes in size. If you flash device has bigger
> than 512 byte pages, doing a page erase is going to corrupt your
> filesystem. In order to make a fatfs writable on flash you will need
> to insert another layer. This would have to handle the erases and
> differences between block sizes and page sizes. blib actually already
> allows this. If you call cyg_blib_create() instead of
> cyg_blib_io_create() you can specify the read and write functions.
> 
> The eCos maintainers need to have a discussion about what a block read
> and write should do and if we want to modify the flash code to
> implement it.
> 
>         Andrew
> 



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]