|
|
@ -372,12 +372,12 @@ void BASpiMemoryDMA::write(size_t address, uint8_t *src, size_t numBytes) |
|
|
|
size_t nextAddress = address; |
|
|
|
size_t nextAddress = address; |
|
|
|
while (bytesRemaining > 0) { |
|
|
|
while (bytesRemaining > 0) { |
|
|
|
m_txXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); |
|
|
|
m_txXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); |
|
|
|
while ( m_txTransfer[1].busy()) {Serial.println("W1");} // wait until not busy
|
|
|
|
while ( m_txTransfer[1].busy()) {} // wait until not busy
|
|
|
|
m_setSpiCmdAddr(SPI_WRITE_CMD, nextAddress, m_txCommandBuffer); |
|
|
|
m_setSpiCmdAddr(SPI_WRITE_CMD, nextAddress, m_txCommandBuffer); |
|
|
|
m_txTransfer[1] = DmaSpi::Transfer(m_txCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); |
|
|
|
m_txTransfer[1] = DmaSpi::Transfer(m_txCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); |
|
|
|
m_spiDma->registerTransfer(m_txTransfer[1]); |
|
|
|
m_spiDma->registerTransfer(m_txTransfer[1]); |
|
|
|
|
|
|
|
|
|
|
|
while ( m_txTransfer[0].busy()) { Serial.println("W2");} // wait until not busy
|
|
|
|
while ( m_txTransfer[0].busy()) {} // wait until not busy
|
|
|
|
m_txTransfer[0] = DmaSpi::Transfer(srcPtr, m_txXferCount, nullptr, 0, m_cs, TransferType::NO_START_CS); |
|
|
|
m_txTransfer[0] = DmaSpi::Transfer(srcPtr, m_txXferCount, nullptr, 0, m_cs, TransferType::NO_START_CS); |
|
|
|
m_spiDma->registerTransfer(m_txTransfer[0]); |
|
|
|
m_spiDma->registerTransfer(m_txTransfer[0]); |
|
|
|
bytesRemaining -= m_txXferCount; |
|
|
|
bytesRemaining -= m_txXferCount; |
|
|
@ -426,12 +426,12 @@ void BASpiMemoryDMA::read(size_t address, uint8_t *dest, size_t numBytes) |
|
|
|
while (bytesRemaining > 0) { |
|
|
|
while (bytesRemaining > 0) { |
|
|
|
m_setSpiCmdAddr(SPI_READ_CMD, nextAddress, m_rxCommandBuffer); |
|
|
|
m_setSpiCmdAddr(SPI_READ_CMD, nextAddress, m_rxCommandBuffer); |
|
|
|
|
|
|
|
|
|
|
|
while ( m_rxTransfer[1].busy()) { Serial.println("R1"); } |
|
|
|
while ( m_rxTransfer[1].busy()) {} |
|
|
|
m_rxTransfer[1] = DmaSpi::Transfer(m_rxCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); |
|
|
|
m_rxTransfer[1] = DmaSpi::Transfer(m_rxCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); |
|
|
|
m_spiDma->registerTransfer(m_rxTransfer[1]); |
|
|
|
m_spiDma->registerTransfer(m_rxTransfer[1]); |
|
|
|
|
|
|
|
|
|
|
|
m_rxXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); |
|
|
|
m_rxXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); |
|
|
|
while ( m_rxTransfer[0].busy()) {Serial.println("R2");} |
|
|
|
while ( m_rxTransfer[0].busy()) {} |
|
|
|
m_rxTransfer[0] = DmaSpi::Transfer(nullptr, m_rxXferCount, destPtr, 0, m_cs, TransferType::NO_START_CS); |
|
|
|
m_rxTransfer[0] = DmaSpi::Transfer(nullptr, m_rxXferCount, destPtr, 0, m_cs, TransferType::NO_START_CS); |
|
|
|
m_spiDma->registerTransfer(m_rxTransfer[0]); |
|
|
|
m_spiDma->registerTransfer(m_rxTransfer[0]); |
|
|
|
|
|
|
|
|
|
|
|