Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

Commit

Permalink
DM: cache management
Browse files Browse the repository at this point in the history
  • Loading branch information
deanm1278 committed Oct 24, 2018
1 parent 1d43acb commit 50a308a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Adafruit_QSPI.cpp
Expand Up @@ -66,10 +66,10 @@ void Adafruit_QSPI::begin() {
@param size the number of bytes to read.
*/
/**************************************************************************/
void Adafruit_QSPI::runInstruction(const QSPIInstr *instr, uint32_t addr, uint8_t *txData, uint8_t *rxData, uint32_t size)
void Adafruit_QSPI::runInstruction(const QSPIInstr *instr, uint32_t addr, uint8_t *txData, uint8_t *rxData, uint32_t size, bool invalidateCache)
{
bool needToEnableCache = false;
if(CMCC->SR.bit.CSTS){
if(invalidateCache && CMCC->SR.bit.CSTS){
// clear the cache
CMCC->CTRL.bit.CEN = 0; // disable
while(CMCC->SR.bit.CSTS);
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_QSPI.h
Expand Up @@ -161,7 +161,7 @@ class Adafruit_QSPI
void end(); ///< de-init the peripheral

void runInstruction(const QSPIInstr *instr);
void runInstruction(const QSPIInstr *instr, uint32_t addr, uint8_t *txData, uint8_t *rxData, uint32_t size);
void runInstruction(const QSPIInstr *instr, uint32_t addr, uint8_t *txData, uint8_t *rxData, uint32_t size, bool invalidateCache=true);

void setMemoryMode(QSPIMode_t mode);
void setClockDivider(uint8_t uc_div);
Expand Down
4 changes: 2 additions & 2 deletions Adafruit_QSPI_Generic.cpp
Expand Up @@ -192,9 +192,9 @@ byte Adafruit_QSPI_Generic::read8(uint32_t addr)
@returns true
*/
/**************************************************************************/
bool Adafruit_QSPI_Generic::readMemory(uint32_t addr, uint8_t *data, uint32_t size)
bool Adafruit_QSPI_Generic::readMemory(uint32_t addr, uint8_t *data, uint32_t size, bool invalidateCache)
{
QSPI0.runInstruction(&cmdSetGeneric[ADAFRUIT_QSPI_GENERIC_CMD_QUAD_READ], addr, NULL, data, size);
QSPI0.runInstruction(&cmdSetGeneric[ADAFRUIT_QSPI_GENERIC_CMD_QUAD_READ], addr, NULL, data, size, invalidateCache);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion Adafruit_QSPI_Generic.h
Expand Up @@ -35,7 +35,7 @@ class Adafruit_QSPI_Generic : public Adafruit_SPIFlash {

byte read8(uint32_t addr);

bool readMemory(uint32_t addr, uint8_t *data, uint32_t size);
bool readMemory(uint32_t addr, uint8_t *data, uint32_t size, bool invalidateCache=true);
bool writeMemory(uint32_t addr, uint8_t *data, uint32_t size);

/******** SPI FLASH CLASS METHODS *************/
Expand Down

0 comments on commit 50a308a

Please sign in to comment.