Reorganizing project

This commit is contained in:
Attila Body 2019-11-08 11:47:49 +01:00
commit 9924e704db
14 changed files with 1029 additions and 0 deletions

37
src/ll_memcpydma.cpp Normal file
View file

@ -0,0 +1,37 @@
/*
* llmemcpydma.cpp
*
* Created on: Nov 4, 2019
* Author: abody
*/
#include "f4ll/ll_memcpydma.h"
namespace f4ll {
LL_MemcpyDma::LL_MemcpyDma(DMA_TypeDef *dma, uint32_t stream)
: LL_DmaHelper(dma, stream)
{
LL_DMA_EnableIT_TC(dma, stream);
}
void* LL_MemcpyDma::Copy(void *dst, void const *src, uint16_t length)
{
LL_DMA_SetM2MSrcAddress(GetDma(), GetStream(), (uint32_t)src);
LL_DMA_SetM2MDstAddress(GetDma(), GetStream(), (uint32_t)dst);
LL_DMA_SetDataLength(GetDma(), GetStream(), (length+3)/4 );
m_busy = 1;
LL_DMA_EnableStream(GetDma(), GetStream());
while(m_busy);
return dst;
}
void LL_MemcpyDma::DmaTransferCompleted()
{
if(*GetIsReg() & GetTcMask()) { // DMA transfer complete
*GetIfcReg() = GetTcMask();
LL_DMA_DisableStream(GetDma(), GetStream());
m_busy = 0;
}
}
} /* namespace f4ll */