The device geometry varies for different flash device families. Following sections describes the geometry of different flash device families:
Intel Flash Device Geometry
Flash memory space is segmented into areas called blocks. The size of each block is based on a power of 2. A region is defined as a contiguous set of blocks of the same size. Some parts have several regions while others have one. The arrangement of blocks and regions is referred to by this module as the geometry of parts. Some Intel flash supports multiple banks on the same device. This library supports single and multiple bank flash devices.
AMD Flash Device Geometry
Flash memory space is segmented into areas called banks and in regions and blocks. The size of each block is based on a power of 2. A region is defined as a contiguous set of blocks of the same size. Some parts have several regions while others have one. A bank is defined as a contiguous set of blocks. The bank contains blocks of different size. The arrangement of blocks, regions, and banks is referred by this module as the geometry of parts. The cells within the part are always programmed from logic 1 to logic 0 and not the other way around. To change a cell back to a logic 1, the entire block containing that cell is erased. When a block is erased, all bytes contain the value 0xFF. A block can be erased for a finite number of times only. Afterwards, it does not support erase. Currently, the typical flash block can be erased by 100,000 times or more.
Write Operation
This operation writes a minimum of zero bytes and a maximum of entire flash. If the offset address specified to write is out of flash or if the number of bytes specified from the offset address exceed flash boundaries, an error is reported back to the user. The write operation is blocking in nature. The control is returned back to user only after the write operation is completed successfully or an error is reported.
Read Operation
The read call reads a minimum of zero bytes and maximum of entire flash. If the Offset Address specified to write is out of flash boundary an error is reported back to the user. The read function reads memory locations beyond Flash boundary. Ensure that the number of bytes + offset address is within the Flash address boundaries. The read is blocking in nature in that the control is returned back to user only after the read operation is completed successfully or an error is reported.
Erase Operation
The erase operations are provided to erase a Block in the Flash memory. The erase call is blocking in nature in that the control is returned back to user only after the erase operation is completed successfully or an error is reported.
Sector Protection
The Flash Device is divided into Blocks. Each Block can be protected individually from
unwarranted writing/erasing. The Block locking can be achieved using XFlash_Lock() lock. All the memory locations from the
Offset address specified is locked. The block can be unlocked using XFlash_UnLock()
call. All the Blocks which are previously locked is unlocked. The Lock and Unlock calls
are blocking in nature in that the control is returned back to user only after the
operation is completed successfully or an error is reported. The AMD flash device
requires high voltage on Reset pin to perform lock and unlock operation. Provide this
high voltage (as defined in datasheet) to reset pin before calling lock and unlock API
for AMD flash devices. Lock and Unlock features are not tested for AMD flash device.
Device Control
Functionalities specific to a Flash Device Family are implemented as Device Control. The following are the Intel specific device control:
- Retrieve the last error data.
- Get Device geometry.
- Get Device properties.
- Set RYBY pin mode.
- Set the Configuration register (Platform Flash only).
The following are the AMD specific device control:
- Get Device geometry.
- Get Device properties.
- Erase Resume.
- Erase Suspend.
- Enter Extended Mode.
- Exit Extended Mode.
- Get Protection Status of Block Group.
- Erase Chip.