mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Improve performance for ELRS SX1280 SPI callbacks and SPI/ELRS handlers. (#11460)
* SPI - Mark the SPI IRQ handler as FAST_IRQ_HANDLER. Since it's used by both the gyro code, at 8k (or 2x8k on dual gyro boards) having it in RAM removes a significant amount of potential flash latency. It is also used by the ELRS SPI code. The ELRS code runs at 500hz, but each cycle uses multiple SPI transfers, for clear irq, read, start-recieving, change-frequency, etc. I.e. invokd at least 1000hz in addition to gyro reads. * ELRS - Move some frequently used functions to RAM and mark some irq handlers as FAST. * SPI/LL - Move some frequently called code to FAST_CODE. Also remove some invalid characters that Eclipse with encoding as UTF-8 complained about. * SPI - Mark the spiRx and spiTx dma handlers as FAST_IRQ_HANDLER. * Filter - move nullFilterApply out of FAST_CODE. Since it doesn't do anything, it doesn't need to be fast. Instead we keep more `fast` RAM for other code that really benefits from being in fast RAM. There is a slight penalty to jump into slower RAM. * Gyro - Move `performGyroCalibration`out of 'fast' ram. On F7X2 it was being inlined, saved 478 bytes of ITCM. * Prevent handling of crash recovery handling, not detection of crash recovery, from being inlined to save ITCM for code that runs more frequently.
This commit is contained in:
parent
4494805202
commit
738ed32cff
6 changed files with 22 additions and 22 deletions
|
@ -378,7 +378,7 @@ uint32_t spiCalculateClock(uint16_t spiClkDivisor)
|
|||
}
|
||||
|
||||
// Interrupt handler for SPI receive DMA completion
|
||||
static void spiIrqHandler(const extDevice_t *dev)
|
||||
FAST_IRQ_HANDLER static void spiIrqHandler(const extDevice_t *dev)
|
||||
{
|
||||
busDevice_t *bus = dev->bus;
|
||||
busSegment_t *nextSegment;
|
||||
|
@ -447,7 +447,7 @@ static void spiIrqHandler(const extDevice_t *dev)
|
|||
}
|
||||
|
||||
// Interrupt handler for SPI receive DMA completion
|
||||
static void spiRxIrqHandler(dmaChannelDescriptor_t* descriptor)
|
||||
FAST_IRQ_HANDLER static void spiRxIrqHandler(dmaChannelDescriptor_t* descriptor)
|
||||
{
|
||||
const extDevice_t *dev = (const extDevice_t *)descriptor->userParam;
|
||||
|
||||
|
@ -484,7 +484,7 @@ static void spiRxIrqHandler(dmaChannelDescriptor_t* descriptor)
|
|||
|
||||
#if !defined(STM32G4) && !defined(STM32H7)
|
||||
// Interrupt handler for SPI transmit DMA completion
|
||||
static void spiTxIrqHandler(dmaChannelDescriptor_t* descriptor)
|
||||
FAST_IRQ_HANDLER static void spiTxIrqHandler(dmaChannelDescriptor_t* descriptor)
|
||||
{
|
||||
const extDevice_t *dev = (const extDevice_t *)descriptor->userParam;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue