added cache maintenance op

This commit is contained in:
Robin Müller 2021-06-05 14:50:02 +02:00
parent a35fdbc5dc
commit 93db545a1a
No known key found for this signature in database
GPG Key ID: BE6480244DFE612C
1 changed files with 6 additions and 0 deletions

View File

@ -232,6 +232,12 @@ ReturnValue_t SpiComIF::handleIrqSendOperation(uint8_t *recvPtr, SpiCookie *spiC
// yet another HAL driver which is not const-correct..
HAL_StatusTypeDef status = HAL_OK;
if(transferMode == spi::TransferModes::DMA) {
if(cacheMaintenanceOnTxBuffer) {
/* Clean D-cache. Make sure the address is 32-byte aligned and add 32-bytes to length,
in case it overlaps cacheline */
SCB_CleanDCache_by_Addr((uint32_t*)(((uint32_t) sendData ) & ~(uint32_t)0x1F),
sendLen + 32);
}
status = HAL_SPI_TransmitReceive_DMA(spiHandle, const_cast<uint8_t*>(sendData),
currentRecvPtr, sendLen);
}