This is the mail archive of the ecos-discuss@sources.redhat.com 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]

Re: Support for multiple flash types


On Tue, Nov 27, 2001 at 03:13:40PM -0600, Grant Edwards wrote:
> 
> It appears from the eCos source tree that only a single type of
> flash is supported.  All of my platforms have to support
> multiple types of flash (manufacturing and purchasing don't
> particularly like single-sourced parts).  In the past, I've not
> used eCos's flash driver system at all. Instead I wrote my own
> framework that detects the type of flash on the board and uses
> the appropriate set of functions to erase/burn.  
> 
> It would be nice if I didn't have to roll my own flash
> subsystem for my current project. How do other eCos users deal
> with this problem?

I was a bit surprised when i first read through the flash code to see
that i only supported one type of flash and only one block of it. But
i guess thats normal for development boards. This is not always true
for real product boards.

I think i would solve the first problem by making the flash_hwr_init
function put pointers to the flash_erase, flash_program, etc functions
into the flash_info structure. Rather than having just one
flash_hwr_init() function use the neat HAL table magic so you can
register a number of these to be called. The first one to find a flash
device it understands stops the search after initializing flash_info.

Allowing multiple blocks of flash is a little harder. I would extend
the idea above using the HAL table, but this time rather than have one
static flash_info structure associate it to the HAL table entry. The
flash API functions can then search the table which contains the flash
address being manipulated to find the correct info structure for that
block. 

Luckily, i've not had these problems yet. The only problem i've had is
manufacturing putting bigger flashes of the same type onto the board
without telling us.

        Andrew


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