prepared dmahelper to push back upstream
This commit is contained in:
parent
17b146c018
commit
4754b65041
2 changed files with 27 additions and 53 deletions
51
dmahelper.h
51
dmahelper.h
|
@ -10,6 +10,13 @@
|
|||
#include <inttypes.h>
|
||||
#include <platform/dma_ll.h>
|
||||
|
||||
#ifndef DECLARE_MOCKPTR
|
||||
#define DECLARE_MOCKPTR(...)
|
||||
#endif
|
||||
#ifndef MOCKABLE
|
||||
#define MOCKABLE(x) x
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -26,7 +33,6 @@ struct dmainfo_t {
|
|||
uint32_t tcMask;
|
||||
};
|
||||
|
||||
//>>>>>>>>>> MOCK <<<<<<<<<<
|
||||
#ifdef UNITTEST
|
||||
DECLARE_MOCKPTR(volatile uint32_t*, Dma_GetIsReg, DMA_TypeDef*, uint32_t)
|
||||
DECLARE_MOCKPTR(volatile uint32_t*, Dma_GetIfcReg, DMA_TypeDef*, uint32_t)
|
||||
|
@ -36,43 +42,16 @@ DECLARE_MOCKPTR(uint32_t, Dma_GetHtMask, uint32_t)
|
|||
DECLARE_MOCKPTR(uint32_t, Dma_GetTcMask, uint32_t)
|
||||
DECLARE_MOCKPTR(uint32_t, Dma_GetFeMask, uint32_t)
|
||||
DECLARE_MOCKPTR(void, Dma_Init, struct dmainfo_t*, DMA_TypeDef*, uint32_t)
|
||||
|
||||
#define Dma_GetIsReg(...) Dma_GetIsReg_(__VA_ARGS__)
|
||||
#define Dma_GetIfcReg(...) Dma_GetIfcReg_(__VA_ARGS__)
|
||||
#define Dma_GetDmeMask(...) Dma_GetDmeMask_(__VA_ARGS__)
|
||||
#define Dma_GetTeMask(...) Dma_GetTeMask_(__VA_ARGS__)
|
||||
#define Dma_GetHtMask(...) Dma_GetHtMask_(__VA_ARGS__)
|
||||
#define Dma_GetTcMask(...) Dma_GetTcMask_(__VA_ARGS__)
|
||||
#define Dma_GetFeMask(...) Dma_GetFeMask_(__VA_ARGS__)
|
||||
#define Dma_Init(...) Dma_Init_(__VA_ARGS__)
|
||||
//#define (...) _(__VA_ARGS__)
|
||||
#endif // UNITTEST
|
||||
//>>>>>>>>>> MOCK end <<<<<<<<<<
|
||||
|
||||
//>>>>>> Real Stuff (tm) <<<<<<<<
|
||||
|
||||
volatile uint32_t* Dma_GetIsReg(DMA_TypeDef *dma, uint32_t stream);
|
||||
volatile uint32_t* Dma_GetIfcReg(DMA_TypeDef *dma, uint32_t stream);
|
||||
uint32_t Dma_GetDmeMask(uint32_t stream);
|
||||
uint32_t Dma_GetTeMask(uint32_t stream);
|
||||
uint32_t Dma_GetHtMask(uint32_t stream);
|
||||
uint32_t Dma_GetTcMask(uint32_t stream);
|
||||
uint32_t Dma_GetFeMask(uint32_t stream);
|
||||
void Dma_Init(struct dmainfo_t *info, DMA_TypeDef *dma, uint32_t stream);
|
||||
|
||||
//>>>>>> Real Stuff (tm) end <<<<<<<<
|
||||
|
||||
//>>>>>>>>>> MOCK <<<<<<<<<<
|
||||
#ifdef UNITTEST
|
||||
#undef Dma_GetIsReg
|
||||
#undef Dma_GetIfcReg
|
||||
#undef Dma_GetDmeMask
|
||||
#undef Dma_GetHtMask
|
||||
#undef Dma_GetTcMask
|
||||
#undef Dma_GetFeMask
|
||||
#undef Dma_Init
|
||||
#endif // UNITTEST
|
||||
//>>>>>>>>>> MOCK end <<<<<<<<<<
|
||||
volatile uint32_t* MOCKABLE(Dma_GetIsReg)(DMA_TypeDef *dma, uint32_t stream);
|
||||
volatile uint32_t* MOCKABLE(Dma_GetIfcReg)(DMA_TypeDef *dma, uint32_t stream);
|
||||
uint32_t MOCKABLE(Dma_GetDmeMask)(uint32_t stream);
|
||||
uint32_t MOCKABLE(Dma_GetTeMask)(uint32_t stream);
|
||||
uint32_t MOCKABLE(Dma_GetHtMask)(uint32_t stream);
|
||||
uint32_t MOCKABLE(Dma_GetTcMask)(uint32_t stream);
|
||||
uint32_t MOCKABLE(Dma_GetFeMask)(uint32_t stream);
|
||||
void MOCKABLE(Dma_Init)(struct dmainfo_t *info, DMA_TypeDef *dma, uint32_t stream);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue