• Krzysztof Blazewicz's avatar
    stmhal/dma: precalculate register base and bitshift on handle init · 63ca7a21
    Krzysztof Blazewicz authored
    Current version of HAL drivers optimize IRQ handler by using precalculated
    DMA register address and stream bitshift instead of calculating it on every interrupt.
    
    Since we skip call to `HAL_DMA_Init` on reused DMA, fields StreamBaseAddress and StreamIndex
    of DMA handle are not initialized and thus leads to SegFault in `DMA_IRQHandler`.
    
    HAL_DMA_Init is a big routine and we do not need to call it on each use of DMA
    (ex.: series of I2C operations) and DMA_CalcBaseAndBitshift is really small and
    releasing it increases code size by only 8 bytes.
    63ca7a21
dma.c 25.8 KB