packetusart unit tests
This commit is contained in:
parent
c2f84b23ee
commit
5d26fdc64d
8 changed files with 219 additions and 151 deletions
10
memcpydma.c
10
memcpydma.c
|
@ -15,17 +15,21 @@
|
|||
# define DIAG_INTERRUPT_OUT()
|
||||
#endif
|
||||
|
||||
#ifndef MOCKABLE
|
||||
#define MOCKABLE(x) x
|
||||
#endif // MOCKABLE
|
||||
|
||||
volatile uint8_t g_memcpyDmaBusy = 0;
|
||||
|
||||
static struct dmainfo_t g_memcpyDmaInfo;
|
||||
|
||||
void Mcd_Init(DMA_TypeDef *dma, uint32_t stream)
|
||||
void MOCKABLE(Mcd_Init)(DMA_TypeDef *dma, uint32_t stream)
|
||||
{
|
||||
Dma_Init(&g_memcpyDmaInfo, dma, stream);
|
||||
LL_DMA_EnableIT_TC(dma, stream);
|
||||
}
|
||||
|
||||
void * Mcd_Copy(void *dst, void const *src, size_t length)
|
||||
void * MOCKABLE(Mcd_Copy)(void *dst, void const *src, size_t length)
|
||||
{
|
||||
LL_DMA_SetM2MSrcAddress(g_memcpyDmaInfo.dma, g_memcpyDmaInfo.stream, (uint32_t)src);
|
||||
LL_DMA_SetM2MDstAddress(g_memcpyDmaInfo.dma, g_memcpyDmaInfo.stream, (uint32_t)dst);
|
||||
|
@ -36,7 +40,7 @@ void * Mcd_Copy(void *dst, void const *src, size_t length)
|
|||
return dst;
|
||||
}
|
||||
|
||||
void Mcd_HandleDmaIrq()
|
||||
void MOCKABLE(Mcd_HandleDmaIrq)(void)
|
||||
{
|
||||
DIAG_INTERRUPT_IN();
|
||||
if(*g_memcpyDmaInfo.isReg & g_memcpyDmaInfo.tcMask) { // DMA transfer complete
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue