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: HAL_FLASH_CACHES_XXX


Jay Foster wrote:
The comments for the HAL_FLASH_CACHES_ON and HAL_FLASH_CACHES_OFF macros in
flash.h state that these macros must be called with interrupts disabled.
This seems to make sense.  However, code inspection reveals that they are
called with interrupts enabled.  I see no interrupt disabling in
flash_dev_query(), flash_erase(), flash_program(), flash_lock() and
flash_unlock() or in the functions that call these.  Am I missing something
here?  It seems unlikely that if this were a real problem that it would have
gone unoticed for very long.

Only in as much as that the caller should disable interrupts if needed.


The comment in flash.h is slightly exaggerating - it's generally true in most cases people use it, but it's possible to use this safely with interrupts enabled if you are running out of RAM or somewhere that isn't flash anyway (such that an interrupt can't touch flash, although also that it won't go and re-enable the cache either!). Saying you "can't" is safer, but actually forcing ints off is unfriendly.

The flash layer was originally only written to be used with RedBoot, not ecos, and this is a throwback to then, and something that will have to be solved properly throughout the package, not just here. And then we could also document the API properly too :-).

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 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]