57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
/*
|
|
* dma_helper.h
|
|
*
|
|
* Created on: Sep 18, 2019
|
|
* Author: abody
|
|
*/
|
|
|
|
#ifndef DMA_HELPER_H_
|
|
#define DMA_HELPER_H_
|
|
#include <inttypes.h>
|
|
#include <platform/dma_ll.h>
|
|
|
|
#ifndef DECLARE_MOCK
|
|
#define DECLARE_MOCK(x)
|
|
#endif
|
|
|
|
namespace f4ll_cpp
|
|
{
|
|
|
|
class DmaHelper {
|
|
public:
|
|
DmaHelper(DMA_TypeDef *dma, uint32_t stream);
|
|
|
|
DMA_TypeDef* GetDma() { return m_dma; }
|
|
uint32_t GetStream() { return m_stream; }
|
|
volatile uint32_t* GetIsReg() { return m_isReg; }
|
|
volatile uint32_t* GetIfcReg() { return m_ifcReg; }
|
|
uint32_t GetDmeMask() { return m_dmeMask; }
|
|
uint32_t GetTeMask() { return m_teMask; }
|
|
uint32_t GetHtMask() { return m_htMask; }
|
|
uint32_t GetTcMask() { return m_tcMask; }
|
|
uint32_t GetFeMask() { return m_feMask; }
|
|
|
|
private:
|
|
static volatile uint32_t* _GetIsReg(DMA_TypeDef *dma, uint32_t stream);
|
|
static volatile uint32_t* _GetIfcReg(DMA_TypeDef *dma, uint32_t stream);
|
|
static uint32_t _GetDmeMask(uint32_t stream);
|
|
static uint32_t _GetTeMask(uint32_t stream);
|
|
static uint32_t _GetHtMask(uint32_t stream);
|
|
static uint32_t _GetTcMask(uint32_t stream);
|
|
static uint32_t _GetFeMask(uint32_t stream);
|
|
|
|
private:
|
|
DMA_TypeDef *m_dma;
|
|
uint32_t m_stream;
|
|
volatile uint32_t *m_isReg;
|
|
volatile uint32_t *m_ifcReg;
|
|
uint32_t m_feMask;
|
|
uint32_t m_dmeMask;
|
|
uint32_t m_teMask;
|
|
uint32_t m_htMask;
|
|
uint32_t m_tcMask;
|
|
};
|
|
|
|
} // f4ll_cpp
|
|
|
|
#endif /* DMA_HELPER_H_ */
|