/*
 * 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>

typedef struct {
	DMA_TypeDef			*dma;
	uint32_t 			stream;
	volatile uint32_t	*isReg;
	volatile uint32_t	*ifcReg;
	uint32_t			feMask;
	uint32_t			dmeMask;
	uint32_t			teMask;
	uint32_t			htMask;
	uint32_t			tcMask;
} DMAINFO;

volatile uint32_t* GetIsReg(DMA_TypeDef *dma, uint32_t stream);
volatile uint32_t* GetIcfReg(DMA_TypeDef *dma, uint32_t stream);
uint32_t GetDmeMask(uint32_t stream);
uint32_t GetTeMask(uint32_t stream);
uint32_t GetHtMask(uint32_t stream);
uint32_t GetTcMask(uint32_t stream);

void InitDmaInfo(DMAINFO *info, DMA_TypeDef *dma, uint32_t stream);

#endif /* DMA_HELPER_H_ */
