/*
 * llmemcpydma.h
 *
 *  Created on: Nov 4, 2019
 *      Author: abody
 */
#pragma once

#include <f4ll/dma_helper.h>
#include <f4ll/initialized_singleton.h>

namespace f4ll {

class memcpy_dma : public initialized_singleton<memcpy_dma>, private dma_helper
{
    friend class initialized_singleton<memcpy_dma>;

public:
    void *copy(void *dst, void const *src, uint16_t length);
    void dma_transfer_completed();

private:
    memcpy_dma(DMA_TypeDef *dma, uint32_t stream);
    bool volatile m_busy = false;
};

} // namespace f4ll
