Nol.A library for M25P32 Micron 32Mb Serial NOR Flash Memory.
More...
#include <M25P32.hpp>
|
|
| M25P32 (uint8_t pinChipSelect, SPI &) |
| | Bind the active-low chip-select GPIO and SPI bus.
|
| void | begin () |
| | Initialize chip select, read device information, disable writes, and enter sleep.
|
| uint64_t | length () |
| | Return the exposed capacity in bytes (0x3F0000), excluding the backup sector.
|
| uint8_t | read (uint64_t addr) |
| | Read one byte at the byte address.
|
| error_t | read (void *dst, uint64_t addr, uint32_t len) |
| | Read bytes into caller-provided storage.
|
| error_t | write (uint64_t addr, uint8_t value) |
| | Write a byte using the sector backup/erase procedure.
|
| error_t | write (const uint8_t *buf, uint64_t addr, uint32_t len) |
| | Rewrite affected sectors via the reserved backup sector.
|
Nol.A library for M25P32 Micron 32Mb Serial NOR Flash Memory.
- Author
- Jongsoo Jeong (CoXlab)
- Date
- 2016. 10. 11.
Blocking SPI NOR flash Storage implementation. Call begin() first. The last 64 KiB sector is reserved for write backup; operations can wait indefinitely for the device to finish programming or erasing.
◆ begin()
Initialize chip select, read device information, disable writes, and enter sleep.
Implements Storage.
◆ length()
| uint64_t M25P32::length |
( |
| ) |
|
|
virtual |
Return the exposed capacity in bytes (0x3F0000), excluding the backup sector.
Implements Storage.
◆ read() [1/2]
| uint8_t M25P32::read |
( |
uint64_t | addr | ) |
|
|
virtual |
Read one byte at the byte address.
- Returns
- Read value, or 0xFF on invalid address (also a valid stored value).
Implements Storage.
◆ read() [2/2]
| error_t M25P32::read |
( |
void * | dst, |
|
|
uint64_t | addr, |
|
|
uint32_t | len ) |
|
virtual |
Read bytes into caller-provided storage.
- Parameters
-
| dst | Writable buffer of at least len bytes. |
| addr | Starting byte address; keep the entire range within length(). |
| len | Nonzero byte count. |
- Returns
- ERROR_INVALID_ARGS for an invalid start or zero length, otherwise ERROR_SUCCESS.
Implements Storage.
◆ write() [1/2]
| error_t M25P32::write |
( |
const uint8_t * | buf, |
|
|
uint64_t | addr, |
|
|
uint32_t | len ) |
|
virtual |
Rewrite affected sectors via the reserved backup sector.
- Parameters
-
| buf | Source buffer containing at least len bytes. |
| addr | Starting byte address; keep the entire range within length(). |
| len | Nonzero byte count. |
- Returns
- ERROR_INVALID_ARGS for an invalid start or zero length; otherwise ERROR_FAIL even after programming, matching the current implementation.
Implements Storage.
◆ write() [2/2]
| error_t M25P32::write |
( |
uint64_t | addr, |
|
|
uint8_t | value ) |
|
virtual |
Write a byte using the sector backup/erase procedure.
- Parameters
-
| addr | Target byte address below length(). |
| value | Byte to store. |
- Returns
- ERROR_INVALID_ARGS for an invalid address; otherwise ERROR_FAIL even after programming, matching the current implementation.
Implements Storage.
The documentation for this class was generated from the following file: