1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 03:20:00 +03:00

Fix DMA buffer addresses

This commit is contained in:
Steve Evans 2025-06-29 22:50:03 +01:00
parent 01e9901459
commit e94428fc74

View file

@ -347,6 +347,10 @@ void spiInternalInitStream(const extDevice_t *dev, bool preInit)
#else #else
UNUSED(preInit); UNUSED(preInit);
busDevice_t *bus = dev->bus;
volatile busSegment_t *segment = bus->curSegment;
const spiDevice_t *spi = &spiDevice[spiDeviceByInstance(dev->bus->busType_u.spi.instance)]; const spiDevice_t *spi = &spiDevice[spiDeviceByInstance(dev->bus->busType_u.spi.instance)];
dma_channel_config config = dma_channel_get_default_config(dev->bus->dmaTx->channel); dma_channel_config config = dma_channel_get_default_config(dev->bus->dmaTx->channel);
channel_config_set_transfer_data_size(&config, DMA_SIZE_8); channel_config_set_transfer_data_size(&config, DMA_SIZE_8);
@ -354,7 +358,7 @@ void spiInternalInitStream(const extDevice_t *dev, bool preInit)
channel_config_set_write_increment(&config, false); channel_config_set_write_increment(&config, false);
channel_config_set_dreq(&config, spi_get_dreq(SPI_INST(spi->dev), true)); channel_config_set_dreq(&config, spi_get_dreq(SPI_INST(spi->dev), true));
dma_channel_configure(dev->bus->dmaTx->channel, &config, &spi_get_hw(SPI_INST(spi->dev))->dr, dev->txBuf, 0, false); dma_channel_configure(dev->bus->dmaTx->channel, &config, &spi_get_hw(SPI_INST(spi->dev))->dr, segment->u.buffers.txData, 0, false);
config = dma_channel_get_default_config(dev->bus->dmaRx->channel); config = dma_channel_get_default_config(dev->bus->dmaRx->channel);
channel_config_set_transfer_data_size(&config, DMA_SIZE_8); channel_config_set_transfer_data_size(&config, DMA_SIZE_8);
@ -362,7 +366,7 @@ void spiInternalInitStream(const extDevice_t *dev, bool preInit)
channel_config_set_write_increment(&config, true); channel_config_set_write_increment(&config, true);
channel_config_set_dreq(&config, spi_get_dreq(SPI_INST(spi->dev), false)); channel_config_set_dreq(&config, spi_get_dreq(SPI_INST(spi->dev), false));
dma_channel_configure(dev->bus->dmaRx->channel, &config, dev->rxBuf, &spi_get_hw(SPI_INST(spi->dev))->dr, 0, false); dma_channel_configure(dev->bus->dmaRx->channel, &config, segment->u.buffers.rxData, &spi_get_hw(SPI_INST(spi->dev))->dr, 0, false);
#endif #endif
} }