Selaa lähdekoodia

T4 - Async updates - Hack for high memory...

If a buffer is up in the high memory, that is either in the area marked DMARAM or created by malloc and you try to do a SPI transfer using DMA, the code detects the addresses >= 0x20200000 and then calls the system functions to either flush the cache or delete the cache on the read...
main
Kurt Eckhardt 5 vuotta sitten
vanhempi
commit
138f3b56ee
1 muutettua tiedostoa jossa 2 lisäystä ja 0 poistoa
  1. +2
    -0
      SPI.cpp

+ 2
- 0
SPI.cpp Näytä tiedosto

@@ -1583,6 +1583,7 @@ bool SPIClass::transfer(const void *buf, void *retbuf, size_t count, EventRespon
if (buf) {
_dmaTX->sourceBuffer((uint8_t*)write_data, count);
_dmaTX->TCD->SLAST = 0; // Finish with it pointing to next location
if ((uint32_t)write_data >= 0x20200000u) arm_dcache_flush(write_data, count);
} else {
_dmaTX->source((uint8_t&)_transferWriteFill); // maybe have setable value
DMAChanneltransferCount(_dmaTX, count);
@@ -1592,6 +1593,7 @@ bool SPIClass::transfer(const void *buf, void *retbuf, size_t count, EventRespon
_dmaRX->TCD->ATTR_SRC = 0; //Make sure set for 8 bit mode...
_dmaRX->destinationBuffer((uint8_t*)retbuf, count);
_dmaRX->TCD->DLASTSGA = 0; // At end point after our bufffer
if ((uint32_t)retbuf >= 0x20200000u) arm_dcache_delete(retbuf, count);
} else {
// Write only mode
_dmaRX->TCD->ATTR_SRC = 0; //Make sure set for 8 bit mode...

Loading…
Peruuta
Tallenna