Set max transfer size to 1024 bytes for SPI RAM due to 1K page limit on 64M part

pull/19/head
Blackaddr 2 years ago
parent 167d8b82a1
commit f70bc3b748
  1. 9
      src/peripherals/BASpiMemory.cpp

@ -49,7 +49,7 @@ constexpr int SPI_ADDR_1_SHIFT = 8;
constexpr int SPI_ADDR_0_MASK = 0x0000FF; constexpr int SPI_ADDR_0_MASK = 0x0000FF;
constexpr int CMD_ADDRESS_SIZE = 4; constexpr int CMD_ADDRESS_SIZE = 4;
constexpr int MAX_DMA_XFER_SIZE = 0x4000; constexpr int MAX_DMA_XFER_SIZE = 0x400;
constexpr size_t MEM_ALIGNED_ALLOC = 32; // number of bytes to align DMA buffer to constexpr size_t MEM_ALIGNED_ALLOC = 32; // number of bytes to align DMA buffer to
@ -247,8 +247,9 @@ size_t BASpiMemory::m_bytesToXfer(size_t address, size_t numBytes)
{ {
// Check if this burst will cross the die boundary // Check if this burst will cross the die boundary
size_t bytesToXfer = numBytes; size_t bytesToXfer = numBytes;
if (bytesToXfer > MAX_DMA_XFER_SIZE) { bytesToXfer = MAX_DMA_XFER_SIZE; }
if (m_dieBoundary) { if (m_dieBoundary) {
if ((address < m_dieBoundary) && (address+numBytes > m_dieBoundary)) { if ((address < m_dieBoundary) && (address+bytesToXfer > m_dieBoundary)) {
// split into two xfers // split into two xfers
bytesToXfer = m_dieBoundary-address; bytesToXfer = m_dieBoundary-address;
} }
@ -415,8 +416,8 @@ void BASpiMemoryDMA::begin(void)
m_rxCommandBuffer = new uint8_t[CMD_ADDRESS_SIZE]; m_rxCommandBuffer = new uint8_t[CMD_ADDRESS_SIZE];
m_txTransfer = new DmaSpi::Transfer[2]; m_txTransfer = new DmaSpi::Transfer[2];
m_rxTransfer = new DmaSpi::Transfer[2]; m_rxTransfer = new DmaSpi::Transfer[2];
switch (m_memDeviceId) { switch (m_memDeviceId) {
case SpiDeviceId::SPI_DEVICE0 : case SpiDeviceId::SPI_DEVICE0 :
m_csPin = SPI0_CS_PIN; m_csPin = SPI0_CS_PIN;

Loading…
Cancel
Save