tmp 1
This commit is contained in:
parent
bc01b1f0e8
commit
3957af107d
235 changed files with 159562 additions and 189150 deletions
38
components/f4ll/src/memcpy_dma.cpp
Normal file
38
components/f4ll/src/memcpy_dma.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* llmemcpydma.cpp
|
||||
*
|
||||
* Created on: Nov 4, 2019
|
||||
* Author: abody
|
||||
*/
|
||||
|
||||
#include <f4ll/memcpy_dma.h>
|
||||
|
||||
namespace f4ll {
|
||||
|
||||
MemcpyDma::MemcpyDma(DMA_TypeDef *dma, uint32_t stream)
|
||||
: dma_helper(dma, stream)
|
||||
{
|
||||
LL_DMA_EnableIT_TC(dma, stream);
|
||||
}
|
||||
|
||||
void *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 MemcpyDma::DmaTransferCompleted()
|
||||
{
|
||||
if (*GetIsReg() & GetTcMask()) { // DMA transfer complete
|
||||
*GetIfcReg() = GetTcMask();
|
||||
LL_DMA_DisableStream(GetDma(), GetStream());
|
||||
m_busy = 0;
|
||||
}
|
||||
}
|
||||
} /* namespace f4ll */
|
Loading…
Add table
Add a link
Reference in a new issue