bind -a #F[n] /dev /dev/flash /dev/flash/part /dev/flash/partctl
The top level directory contains a single directory named flash for bank 0, and flashn for each other bank n. It contains two files for each partition: a data file part and an associated control file partctl, where part is the name of the partition. Each partition represents a region of flash memory that starts and ends on a flash segment (erase unit) boundary. The system initially creates a single standard partition flash representing the whole of flash memory, and the corresponding control file flashctl. Other partitions can be created by writing to flashctl as described below.
The data file part provides read and write access to the bytes on the system's flash memory. Bytes can be read and written on any byte boundary: the interface hides any alignment restrictions. A read returns the value of the bytes at the current file offset, where zero is the start of the partition. A write reprograms the flash to the given byte values, at the current file offset (relative to the start of the partition), using the physical device's reprogramming algorithm. An erased flash byte is logically 16rFF (regardless of the conventions of the physical flash device). A write can change a bit with value 1 to a 0, but cannot change a 0 bit to 1; that can only be done by erasing one or more flash segments. NAND flash typically has restrictions on the number of writes allowed to a page before requiring a block erase. Reads and writes are unbuffered.
The control file partctl can be read and written. A read returns several lines containing decimal and hexadecimal numbers (separated by white space) revealing the characteristics of memory within the partition. The first line gives the the manufacturer ID, the flash device ID, the memory width in bytes, and a string giving the flash type (currently either nor or nand). Subsequent lines give characteristics of each group of erase units within the partition, where the erase units within a group have the same properties. Each line gives the start and end (as byte addresses) of the erase units in the region that lie within the partition, followed by the size in bytes of each erase unit, which is followed for NAND flash by the size in bytes of a page. The sizes for NAND flash include the extra bytes per page typically used to hold an ECC and block status. A write contains one of the following textual commands:
The syntax of all numbers is that of strtoul(10.2); the default base is 10.
FLASH(3 ) | Rev: Tue Mar 31 02:42:38 GMT 2015 |