f407ve_hs_uart/lib/ll_dmahelper.h
2019-10-25 14:47:46 +02:00

46 lines
1.2 KiB
C++

/*
* ll_dmahelper.h
*
* Created on: Oct 25, 2019
* Author: abody
*/
#ifndef LL_DMAHELPER_H_
#define LL_DMAHELPER_H_
#include <inttypes.h>
#include <platform/dma_ll.h>
namespace f4ll {
class LL_DmaHelper {
public:
LL_DmaHelper(DMA_TypeDef *dma, uint32_t stream);
~LL_DmaHelper() = delete;
inline DMA_TypeDef* GetDMA() { return m_dma; }
inline uint32_t GetStream() { return m_stream; }
inline volatile uint32_t* GetIsReg() { return m_isReg; }
inline volatile uint32_t* GetIcfReg() { return m_ifcReg; }
inline uint32_t GetFeMask() { return m_FEMasks[m_stream]; }
inline uint32_t GetDmeMask() { return m_DMEMasks[m_stream]; }
inline uint32_t GetTeMask() { return m_TEMasks[m_stream]; }
inline uint32_t GetHtMask() { return m_HTMasks[m_stream]; }
inline uint32_t GetTcMask() { return m_TCMasks[m_stream]; }
private:
DMA_TypeDef *m_dma;
uint32_t m_stream;
volatile uint32_t *m_isReg;
volatile uint32_t *m_ifcReg;
static const uint32_t m_FEMasks[8];
static const uint32_t m_DMEMasks[8];
static const uint32_t m_TEMasks[8];
static const uint32_t m_HTMasks[8];
static const uint32_t m_TCMasks[8];
};
} /* namespace f4ll */
#endif /* LL_DMAHELPER_H_ */