Introduction
The tcDspFlash class may be used to write to and read from a Flash memory device. The tcDspFlash class probes the device, determines its geometry, and provides a common interface for accessing CFI-compliant flash devices.
- See also:
- MityDSP::tcDspFlash Class Reference
-
MityDSP::tcDspBankSelect Class Reference
Example
This is a simple example of tcDspFlash creation and usage:
{
const unsigned int FLASH_BASE_ADDR = 0x90000000;
const unsigned int BANK_SEL_ADDR = 0xB0000004;
tcDspBankSelect* mpBankSel = new tcDspBankSelect((void*)BANK_SEL_ADDR);
tcDspFlash* mpFlash = new tcDspFlash((void *)FLASH_BASE_ADDR, mpBankSel);
tcDspError::report(<strong>FILE</strong>, <strong>LINE</strong>,
status,
"FLASH Device Size is %.1f KB",
mpFlash->getSizeKB());
mnLen = 0x100;
for (int i=0; i<mnLen; i++) mpBuffer[i] = i;
mpFlash->read(0x00002000, mpBuffer, mnLen);
:
:
newLen = mnLen + 0x200;
for (int i=mnLen; i<newLen; i++) mpBuffer[i] = i;
mpFlash->write(0x00004000, mpBuffer, newLen);
:
}