4.2. Device Structure

The Versatile PB926EJ-S board contains two 16-bit flash devices in parallel. To achieve maximal performance the flash algorithm accesses both flash devices in parallel using 32-bit accesses. A macro, EXPAND, is used to convert 16-bit commands and data from the flash device data sheet into 32-bit values to be written to the bus:

#define EXPAND(value)
    (((uint32_t)(value)) | (((uint32_t)(value)) << 16))

When reading the flash device status register, the EXPAND macro is also used to convert the 16-bit expected values to 32-bits. This allows a direct comparison against the 32-bit values read from the bus.

When polling the flash device to wait for an operation to complete, care is taken to ensure that both devices are complete before proceeding. This is necessary because both flash devices may operate at slightly different speeds due to process variations and local temperature and voltage fluctuations.

The block structure of the flash device is determined at run-time by querying the CFI information block. The querying of the block structure is performed in the flashSelect() method, and the results are stored in a static array for later use in the flashGetBlockStructure() method. The array is static rather than dynamic because flash algorithms running in Eclipse cannot rely on the C library being initialized or on having a heap available. The array size is fixed at four; it is extremely unlikely that a flash block contains more than three block groups and one extra entry in the array is needed to terminate it.

The code that queries the block structure only uses the values from one flash device, even though the bus contains two devices in parallel. This is because the flash devices are assumed to use identical block structures, so it is easiest to query one device and multiply the block sizes by two. The flash programmer does not support parallel flash devices using different block structures.

Copyright © 2007. All rights reserved.DAI0190A
Non-Confidential