1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

AT32 SD card support (#14070)

This commit is contained in:
Steve Evans 2024-12-07 20:52:58 +00:00 committed by GitHub
parent 896c8ee29b
commit b5ab83b3bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 90 additions and 46 deletions

View file

@ -208,6 +208,10 @@ void spiInternalStartDMA(const extDevice_t *dev)
dmaChannelDescriptor_t *dmaTx = dev->bus->dmaTx;
dmaChannelDescriptor_t *dmaRx = dev->bus->dmaRx;
DMA_ARCH_TYPE *streamRegsTx = (DMA_ARCH_TYPE *)dmaTx->ref;
// Wait for any ongoing transmission to complete
while (spi_i2s_flag_get(dev->bus->busType_u.spi.instance, SPI_I2S_BF_FLAG) == SET);
if (dmaRx) {
DMA_ARCH_TYPE *streamRegsRx = (DMA_ARCH_TYPE *)dmaRx->ref;
@ -229,10 +233,10 @@ void spiInternalStartDMA(const extDevice_t *dev)
xDMA_Init(streamRegsRx, dev->bus->initRx);
// Enable streams
xDMA_Cmd(streamRegsTx, TRUE);
xDMA_Cmd(streamRegsRx, TRUE);
xDMA_Cmd(streamRegsTx, TRUE);
/* Enable the receiver before the transmitter to ensure that not bits are missed on reception. An interrupt between
/* Enable the receiver before the transmitter to ensure that no bits are missed on reception. An interrupt between
* the transmitter and receiver being enabled can otherwise cause a hang.
*/
spi_i2s_dma_receiver_enable(dev->bus->busType_u.spi.instance, TRUE);