COSA
An Object-Oriented Platform for Arduino Programming
|
#include <S25FL127S.hh>
Classes | |
union | config_t |
union | status1_t |
union | status2_t |
Public Member Functions | |
S25FL127S (Board::DigitalPin csn=Board::D5) | |
virtual bool | begin () |
virtual bool | is_ready () |
virtual int | read (void *dest, uint32_t src, size_t size) |
virtual int | erase (uint32_t dest, uint8_t size=4) |
virtual int | write (uint32_t dest, const void *src, size_t size) |
virtual int | write_P (uint32_t dest, const void *buf, size_t size) |
uint8_t | read_config () |
uint8_t | read_status1 () |
uint8_t | read_status2 () |
virtual bool | end () |
Public Attributes | |
const uint32_t | SECTOR_BYTES |
const uint32_t | SECTOR_MASK |
const uint16_t | SECTOR_MAX |
const uint32_t | DEVICE_BYTES |
Static Public Attributes | |
static const size_t | PAGE_MAX = 256 |
static const size_t | PAGE_MASK = PAGE_MAX - 1 |
static const uint32_t | DEFAULT_SECTOR_BYTES = 4096 |
Protected Types | |
enum | Command { READ_ID = 0x90, RDRID = 0x9f, RSFDP = 0x5a, RES = 0xab, RDSR1 = 0x05, RDSR2 = 0x07, RDCR = 0x35, WRR = 0x01, WRDI = 0x04, WREN = 0x06, CLSR = 0x30, ABRD = 0x14, ABWR = 0x15, BRRD = 0x16, BRWR = 0x17, BRAC = 0x89, DLPRD = 0x41, PNVDLR = 0x43, WVDLR = 0x4A, READ = 0x03, READ4 = 0x13, FAST_READ = 0x0b, FAST_READ4 = 0x0c, DOR = 0x3b, DOR4 = 0x3c, QOR = 0x6b, QOR4 = 0x6c, DIOR = 0xbb, DIOR4 = 0xbc, QIOR = 0xeb, QIOR4 = 0xec, PP = 0x02, PP4 = 0x12, QPP = 0x32, QPP4 = 0x34, PGSP = 0x85, PGRS = 0x8a, P4E = 0x20, P4E4 = 0x21, BER = 0x60, SER = 0xd8, SER4 = 0xdc, ERSP = 0x75, ERRS = 0x7a, OTPP = 0x42, OTPR = 0x4b, DYBRD = 0xe0, DYBWR = 0xe1, PPBRD = 0xe2, PPBP = 0xe3, PPBE = 0xe4, ASPRD = 0x2b, ASPP = 0x2f, PLBRD = 0xa7, PLBWR = 0xa6, PASSRD = 0xe7, PASSP = 0xe8, PASSU = 0xe9, RESET = 0xf0, MBR = 0xff } |
Protected Member Functions | |
uint8_t | issue (Command cmd) |
void | set_clock (Clock rate) |
void | set_clock (uint32_t freq) |
Static Protected Member Functions | |
static Clock | clock (uint32_t freq) |
static Clock | cycle (uint16_t ns) |
Protected Attributes | |
status1_t | m_status |
Driver * | m_next |
List of drivers. More... | |
Interrupt::Handler * | m_irq |
Interrupt handler. More... | |
OutputPin | m_cs |
Device chip select pin. More... | |
Pulse | m_pulse |
Chip select pulse width. More... | |
uint8_t | m_spcr |
SPI/SPCR hardware control register setting. More... | |
uint8_t | m_spsr |
SPI/SPSR hardware status register. More... | |
Static Protected Attributes | |
static const uint8_t | MANUFACTURER = 0x01 |
static const uint8_t | DEVICE = 0x17 |
Cosa SPANSINO S25FL127S flash device driver class. Implements the Cosa Flash device driver interface with erase, read and write/program flash memory blocks.
Definition at line 39 of file S25FL127S.hh.
|
protected |
Command Set (table 10.2, pp. 73-74)
Enumerator | |
---|---|
READ_ID |
Read Electronic Manufacturer Signature. Read Device Identification |
RDRID |
Read ID (JEDEC). |
RSFDP | |
RES |
Read Electronic Signature. |
RDSR1 |
Read Status Register#1. Register Access |
RDSR2 |
Read Status Register#2. |
RDCR |
Read Configuration Register#1. |
WRR |
Write Register (Status-1, Config-1). |
WRDI |
Write Disable. |
WREN |
Write Enable. |
CLSR |
Clear Status Register#1. |
ABRD |
AutoBoot Register Read. |
ABWR |
AutoBoot Register Write. |
BRRD |
Bank Register Read. |
BRWR |
Bank Register Write. |
BRAC |
Bank Register Access. |
DLPRD |
Data Learning Pattern Read. |
PNVDLR |
Program NV Data Learning Register. |
WVDLR |
Write Volatile Data Learning Register. |
READ |
Read (3- or 4-byte address). Read Flash Array |
READ4 |
Read (4-byte address). |
FAST_READ |
Fast Read (3- or 4-byte address). |
FAST_READ4 |
Fast Read (4-byte address). |
DOR |
Read Dual Out (3- or 4-byte address). |
DOR4 |
Read Dual Out (4-byte address). |
QOR |
Read Quad Out (3- or 4-byte address). |
QOR4 |
Read Quad Out (4-byte address). |
DIOR |
Dual I/O Read (3- or 4-byte address). |
DIOR4 |
Dual I/O Read (4-byte address). |
QIOR |
Read Quad Out (3- or 4-byte address). |
QIOR4 |
Read Quad Out (4-byte address). |
PP |
Page Program (3- or 4-byte address). Program Flash Array |
PP4 |
Page Program (4-byte address). |
QPP |
Quad Page Program (3- or 4-byte address). |
QPP4 |
Quad Page Program (4-byte address). |
PGSP |
Program Suspend. |
PGRS |
Program Resume. |
P4E |
Parameter 4-kB, sector erase. Erase Flash Array |
P4E4 |
Parameter 4-kB, sector erase (4-byte addr). |
BER |
Bulk Erase. |
SER |
Erase 64 kB or 256 kB. |
SER4 |
Erase 64 kB or 256 kB (4-byte addr). |
ERSP |
Erase Suspend. |
ERRS |
Erase Resume. |
OTPP |
OTP Program. One Time Program Array |
OTPR |
OTP Read. |
DYBRD |
DYB Read. Advanced Sector Protection |
DYBWR |
DYB Write. |
PPBRD |
PPB Read. |
PPBP |
PPB Program. |
PPBE |
PPB Erase. |
ASPRD |
ASP Read. |
ASPP |
ASP Program. |
PLBRD |
PPB Lock Bit Read. |
PLBWR |
PPB Lock Bit Write. |
PASSRD |
Password Read. |
PASSP |
Password Program. |
PASSU |
Password unlock. |
RESET |
Software Reset. Reset |
MBR |
Mode Bit Reset. |
Definition at line 230 of file S25FL127S.hh.
|
inline |
Construct S25FL127S device driver with given chip select pin.
[in] | csn | chip select pin (default D5/D3). |
Definition at line 52 of file S25FL127S.hh.
|
virtual |
Initiate the flash memory device driver and check for valid identification. Return true(1) if the successful otherwise false(0).
Reimplemented from Flash::Device.
Definition at line 24 of file S25FL127S.cpp.
|
inlinestaticinherited |
|
inlinestaticinherited |
|
inlinevirtualinherited |
|
virtual |
Erase given flash block for given byte address. The size of the erased sector is either 4 or 64 KB. Give sector size 255 to erase chip. The default configuration consists of 16X4 KB sectors from low address followed by 255X64 KB sectors. The highest sector is reserved. Returs zero(0) if successful otherwise an negative error code (EINVAL on illegal sector size, EFAULT if not successful).
[in] | dest | destination block byte address to erase. |
Implements Flash::Device.
Definition at line 81 of file S25FL127S.cpp.
|
virtual |
Return true(1) if the device is ready, write cycle is completed, otherwise false(0).
Implements Flash::Device.
Definition at line 46 of file S25FL127S.cpp.
|
protected |
Issue given command and return result.
[in] | cmd | command code. |
Definition at line 213 of file S25FL127S.cpp.
|
virtual |
Read flash block with the given size into the buffer from the source address. Return number of bytes read or negative error code.
[in] | dest | buffer to read from flash into. |
[in] | src | address in flash to read from. |
[in] | size | number of bytes to read. |
Implements Flash::Device.
Definition at line 61 of file S25FL127S.cpp.
|
inline |
Read device configuration register 1.
Definition at line 157 of file S25FL127S.hh.
|
inline |
|
inline |
|
inherited |
|
inlineinherited |
|
virtual |
Write flash block at given destination address with the contents of the source buffer. Return number of bytes written or negative error code (EFAULT if not successful).
[in] | dest | address in flash to write to. |
[in] | src | buffer to write to flash. |
[in] | size | number of bytes to write. |
Implements Flash::Device.
Definition at line 115 of file S25FL127S.cpp.
|
virtual |
Write flash block at given destination address with contents of the source buffer in program memory. Return number of bytes written or negative error code (EFAULT is not successful).
[in] | buf | buffer to write. |
[in] | size | number of bytes to write. |
Implements Flash::Device.
Definition at line 164 of file S25FL127S.cpp.
|
staticinherited |
|
staticprotected |
Device code
Definition at line 312 of file S25FL127S.hh.
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
Latest status; is_ready() call
Definition at line 322 of file S25FL127S.hh.
|
staticprotected |
Manufacturer code
Definition at line 309 of file S25FL127S.hh.
|
static |
Definition at line 45 of file S25FL127S.hh.
|
static |
Default programming page buffer size (pp. 61, 97).
Definition at line 44 of file S25FL127S.hh.
|
inherited |
|
inherited |
|
inherited |