On Tue, Feb 15, 2011 at 10:07, Tom Schouten <t...@zwizwa.be> wrote: > Hi folks, > > It seems that many Flash devices expose separate "program" and "erase" > operations. It also seems fairly common to represent an erased bit as > "1" and a programmed bit as "0". In this view "program" can only > perform a 1->0 transition and "erase" resets bits back to 1. So a > Flash chip's "program" operation is logically an "and-mask" operation. > > Since the erase operation is one that ages the chip, it makes sense in > some applications to use multiple overlaying "and-mask" operations to > incrementally write to data units that are smaller than the smallest > erase unit. > > Is there any interest to add support for this behaviour to the eCos > API? > > If I understand correctly, the cyg_flash_program() operation erases > before program such that the resulting bit pattern in the Flash always > represents the input bit pattern exactly, instead of being the result > of an "and-mask" operation. > > A single extra API function could be enough: > > int cyg_flash_program_mask(cyg_flashaddr_t flash_base, > void *ram_base, size_t len, > cyg_flashaddr_t *err_address); >
You have to be very careful doing this. At least some NAND flash parts have restrictions on how many 'partial page program' cycles you can do. For the part I am using, the restriction is 4 for normal memory pages, and 8 for the one time programmable area. -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss