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.
This is a simple example of tcDspFlash creation and usage:
{ const unsigned int FLASH_BASE_ADDR = 0x90000000; const unsigned int BANK_SEL_ADDR = 0xB0000004; // Initialize the tcDspBankSelector object for the flash device tcDspBankSelect* mpBankSel = new tcDspBankSelect((void*)BANK_SEL_ADDR); // Use the factory to obtain a base class pointer to the flash device tcDspFlash* mpFlash = new tcDspFlash((void *)FLASH_BASE_ADDR, mpBankSel); tcDspError::report(__FILE__, __LINE__, status, "FLASH Device Size is %.1f KB", mpFlash->getSizeKB()); // Can now access the flash as needed 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); : }