/*
q * ll_dmahelper.cpp
 *
 *  Created on: Oct 25, 2019
 *      Author: abody
 */

#include <f4ll/dma_helper.h>

namespace f4ll {

dma_helper::dma_helper(DMA_TypeDef *dma, uint32_t stream)
    : m_dma(dma),
      m_stream(stream),
      m_is_reg(
          (dma == DMA1) ? ((m_stream < LL_DMA_STREAM_4) ? &DMA1->LISR : &DMA1->HISR)
                        : ((m_stream < LL_DMA_STREAM_4) ? &DMA2->LISR : &DMA2->HISR)),
      m_ifc_reg(
          (dma == DMA1) ? ((m_stream < LL_DMA_STREAM_4) ? &DMA1->LIFCR : &DMA1->HIFCR)
                        : ((m_stream < LL_DMA_STREAM_4) ? &DMA2->LIFCR : &DMA2->HIFCR))
{
}

} /* namespace f4ll */
