[ECOS] Flash callback function

Andrew Lunn andrew.lunn@ascom.ch
Fri Oct 26 05:12:00 GMT 2001


Hi Folks

We have users of our hardware with impatient fingers. They are doing
software upgrades or configuration changes and immediately hitting the
reset button while a flash write or erase operation is active. Im
thinking of adding a callback function which is called at regular
intervals so that i can flash an LED. To do this i would need to
extend the flash API

typedef void _flash_callback(void);

flash_register_callback(_flast_callback *cf);

I would add a new entry to flash_info to hold the callback, and
within the code for the specific devices i'm uses call the callback
every time around the while loop.

The flash has a CDL option CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM, which
copies the implementation code into a local RAM buffer so that you
don't have problem of executing code in FLASH while you are
erasing/writing. I will leave it up to the implementor of the callback
to ensure they do this if required. There would be a warning comment
in the header file specifying this restriction and suggesting to do as
little as possible in the callback.

What's people opinion about this. Have i missed anything?

       Thanks
          Andrew



More information about the Ecos-discuss mailing list