/*
 * memcpy_dma.h
 *
 *  Created on: Oct 1, 2019
 *      Author: abody
 */

#ifndef MEMCPY_DMA_H_
#define MEMCPY_DMA_H_

#include <inttypes.h>
#include <platform/dma_ll.h>
#include <f4ll_cpp/dmahelper.h>
#include <f4ll_cpp/singleton.h>


namespace f4ll_cpp {

class MemcpyDma : public DmaHelper, public Singleton<MemcpyDma>
{
public:
	MemcpyDma(DMA_TypeDef *dma, uint32_t stream);
	void* Copy(void *dst, void const *src, size_t length);
	static inline void HandleDmaIrq(void *param) { reinterpret_cast<MemcpyDma*>(param)->HandleDmaIrq(); }

private:
	void HandleDmaIrq();
	volatile bool m_busy;
};

} // namespace f4ll_cpp

#endif /* MEMCPY_DMA_H_ */
