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]

Reworking eCos flash interfaces...


Many moons ago (in February, I hadn't realized it was quite so long!) I
discussed improving the eCos flash interface, initially my requirement
was to support paged flash, but it turned into a fairly general cleanup
with a secondary aim of supporting multiple flash devices
  http://sources.redhat.com/ml/ecos-discuss/2003-02/msg00262.html

We have been quietly working on this amoung the other projects we've
been on, and would like to get the current patch out in the wild for
feedback and such.

Currently the patch implenents a cleaner separation between driver API
functions and publicy exported funnctions. The flash driver is now
called via a structure of function pointers via a flash device table,
this should allow (in principle) the use of multiple flash drivers (I've
never tried it, but I do have a board with AMD and Strataflash, so I
will one of these days).

The patch tries to maintain compatability with drivers which have not
been updated to the new interface by defining a legacy device which
interfaces with the old function names. We use this on a board with
AM29XXXX flash and it seems to work fine. This is incompatible with
having multiple flash devices, since it also modifies the types of the
function pointers used for the device driver API (i.e. all drivers need
to be new API if you have more than one, not a problem in my book).

In addition the public API has been updated to be prefixed with cyg_ and
to use offsets into flash rather than absolute memory addresses. In
addition all the functions take as there first parameter a pointer to a
flash_info structure. The old API is supported (via a CDL option) using
#defines.

We have updated RedBoot to the new API, so legacy support has not been
extensively tested. I did try briefly with an unpatched redboot and it
seemed to work.

The only driver we have updated to the new API is the strataflash one,
we have also updated it to use paged flash (via a CDL option).

We have now been using the patched version on 2 or 3 different targets
without problems, including using paged flash and the legacy driver
support (the legacy public API support has only been looked at briefly)

Three patches are attached.

flash2_io_flash_2003_07_15.patch is the main API update
flash2_redboot_2003_07_15.patch and
flash2_devs_flash_strata_2003_07_15.patch update RedBoot to the new
public API and the strata flash to the new driver API respectivly.

In theory, once the io/flash part is applied then one, both or neither
of the other patches can be applied and the various legacy support bits
should keep everything working. In practice, well... 

The patches are against CVS (HEAD I think) from 2003-05-29. I appreciate
that this is quite some time ago, I need to find the time to pull the
latest stuff into our local CVS, then I'll try and post updated patches.

I've attached interfaces.txt which is my notes on what the interfaces
are. They weren't really intended as documentation.

I've also attached the flash support for one of our (unreleased)
platforms which uses the new flash API as an example... It's not very
exciting. It has just now occured to me that any HAL which provides
strataflash support needs to provide a devtab entry, which breaks
compatability. Possibly the strataflash driver could provide the entry
itself if CYGBLD_LEGACY_FLASH_DEVICE (or another option) says it should.

Cheers,
Ian.

-- 
Ian Campbell, Senior Design Engineer

Arcom, Clifton Road, 			Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom	Phone:  +44 (0)1223 411 200


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________

Attachment: flash2_io_flash_2003_07_15.patch
Description: Text document

Attachment: flash2_devs_flash_strata_2003_07_15.patch
Description: Text document

Attachment: flash2_redboot_2003_07_15.patch
Description: Text document

Attachment: interface.txt
Description: Text document

#include <cyg/io/flash.h>

/* FIXME: This shouldn't be here really... */
extern int strata_flash_query(struct cyg_flashdevtab_entry *tab);

FLASHDEVTAB_ENTRY(hal_arm_viper_flashdev_entry, "flash", &strata_flash_query, 0);

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

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