| |||
| Home > Basic Principles > Buffering | |||
The Eclipse Flash Programmer plug-in and the test harness
transfer data to and from the flash algorithm using a buffer. The
address of the buffer is passed as a parameter to the flashWriteBlocks(), flashReadBlocks() and flashVerifyBlocks() methods.
The Eclipse Flash Programmer allocates as much RAM as possible for the buffer, to try to access as many blocks as possible in a single operation. In this case the buffer is always a whole multiple of the block size.
If there is insufficient RAM available to buffer even a single
block, then the Eclipse Flash Programmer plug-in and the test harness
switch to a sub-block access scheme. In this case, the buffer size
starts off at the block size, and is repeatedly halved until it
fits into RAM. When the flashWriteBlocks(), flashReadBlocks() and flashVerifyBlocks() methods
are called, the blocks->count parameter is set
to 1 and the blocks->size parameter is set to
the buffer size, which in this case is less than the size of the
whole block.
Some flash devices place restrictions of the alignment of the buffer or the minimum or maximum buffer size. There is no way for flash algorithms to express these restrictions to the Eclipse Flash Programmer plug-in. Instead your flash algorithm must allocate a buffer internally that does meet the requirements and copy data between it and the buffer that is supplied to the method.