Flash driver
Embedded Xinu uses a multi-layered approach to dealing with Flash memory. This allows the presentation of a simple and consistent interface to user programs, while handling the more complicated hardware interface underneath.
Contents
High level API
Like other drivers in Embedded Xinu, the Flash driver provides user level calls to open()
, close()
, read()
, write()
, control()
, and seek()
.
read()
and write()
Both read()
and write()
take three parameters (device_id
, buffer
, and block_number
). This is unlike other device calls where the final parameter is the size of the buffer.
Logical Layer
Maps the high level 512 byte block size to the underlying erase block size and location for reading and writing. Loads an entire erase block into RAM and marks it as dirty if modified.
Physical Layer
Handles interfacing with the underlying hardware by erasing the erase blocks when needed.
Intel
Provides an interface for working with the Intel Standard Command Set.
AMD/Samsung
Provides an interface for working with the AMD/Samsung Standard Command Set.
NVRAM
Since NVRAM settings are part of Flash memory, the code to modify them is closely related to the Flash driver.