builds with make
This commit is contained in:
parent
8709bcb465
commit
549d4f3403
17 changed files with 1513 additions and 1234 deletions
|
@ -6,7 +6,29 @@
|
|||
*/
|
||||
#include "cmsis.h"
|
||||
#include <stdlib.h>
|
||||
#include <CppUTestExt/MockSupport_c.h>
|
||||
#include <platform/helpers.h>
|
||||
|
||||
void __disable_irq)() {}
|
||||
uint32_t __get_PRIMASK() { return 0; }
|
||||
void __set_PRIMASK(uint32_t primask) {}
|
||||
uint32_t g_effective_primask = 0;
|
||||
|
||||
void __disable_irq() {
|
||||
g_effective_primask = 1;
|
||||
mock_c()->actualCall(__FUNCTION__);
|
||||
}
|
||||
|
||||
void __enable_irq() {
|
||||
g_effective_primask = 0;
|
||||
mock_c()->actualCall(__FUNCTION__);
|
||||
}
|
||||
|
||||
uint32_t __get_PRIMASK() {
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
returnUnsignedIntValueOrDefault(g_effective_primask);
|
||||
}
|
||||
|
||||
|
||||
void __set_PRIMASK(uint32_t primask) {
|
||||
g_effective_primask = primask;
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withUnsignedIntParameters(TOSTR(primask), primask);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,9 @@ extern "C" {
|
|||
#define READ_REG(REG) ((REG))
|
||||
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
||||
|
||||
extern uint32_t g_effective_primask;
|
||||
void __disable_irq();
|
||||
void __enable_irq();
|
||||
uint32_t __get_PRIMASK();
|
||||
void __set_PRIMASK(uint32_t priMask);
|
||||
|
||||
|
|
|
@ -5,13 +5,90 @@
|
|||
* Author: abody
|
||||
*/
|
||||
#include "dma_ll.h"
|
||||
#include <CppUTestExt/MockSupport_c.h>
|
||||
#include <platform/helpers.h>
|
||||
|
||||
__attribute__((weak)) DMA_TypeDef _DMA1;
|
||||
__attribute__((weak)) DMA_TypeDef _DMA2;
|
||||
|
||||
|
||||
void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_SetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream)->
|
||||
withUnsignedIntParameters(TOSTR(MemoryAddress), MemoryAddress);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_SetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream)->
|
||||
withUnsignedIntParameters(TOSTR(MemoryAddress), MemoryAddress);
|
||||
}
|
||||
|
||||
|
||||
uint32_t LL_DMA_GetDataLength(DMA_TypeDef* DMAx, uint32_t Stream)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream)->
|
||||
returnUnsignedIntValueOrDefault(0);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_SetDataLength(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t NbData)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream)->
|
||||
withUnsignedIntParameters(TOSTR(NbData), NbData);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_EnableStream(DMA_TypeDef *DMAx, uint32_t Stream)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_DisableStream(DMA_TypeDef *DMAx, uint32_t Stream)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream);
|
||||
}
|
||||
|
||||
|
||||
void LL_DMA_ConfigAddresses(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t SrcAddress, uint32_t DstAddress, uint32_t Direction)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(DMAx), DMAx)->
|
||||
withUnsignedIntParameters(TOSTR(Stream), Stream)->
|
||||
withUnsignedIntParameters(TOSTR(SrcAddress), SrcAddress)->
|
||||
withUnsignedIntParameters(TOSTR(DstAddress), DstAddress)->
|
||||
withUnsignedIntParameters(TOSTR(Direction), Direction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream) {}
|
||||
void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream) {}
|
||||
void LL_DMA_SetM2MDstAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress) {}
|
||||
void LL_DMA_SetM2MSrcAddress(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t MemoryAddress) {}
|
||||
uint32_t LL_DMA_GetDataLength(DMA_TypeDef* DMAx, uint32_t Stream) { return 0; }
|
||||
void LL_DMA_SetDataLength(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t NbData) {}
|
||||
void LL_DMA_EnableStream(DMA_TypeDef *DMAx, uint32_t Stream) {}
|
||||
void LL_DMA_DisableStream(DMA_TypeDef *DMAx, uint32_t Stream) {}
|
||||
void LL_DMA_ConfigAddresses(DMA_TypeDef* DMAx, uint32_t Stream, uint32_t SrcAddress, uint32_t DstAddress, uint32_t Direction) {}
|
||||
|
|
|
@ -608,8 +608,11 @@ typedef struct
|
|||
|
||||
|
||||
|
||||
extern DMA_TypeDef *DMA1;
|
||||
extern DMA_TypeDef *DMA2;
|
||||
extern DMA_TypeDef _DMA1;
|
||||
extern DMA_TypeDef _DMA2;
|
||||
|
||||
#define DMA1 (&_DMA1)
|
||||
#define DMA2 (&_DMA2)
|
||||
|
||||
void LL_DMA_EnableIT_TC(DMA_TypeDef *DMAx, uint32_t Stream);
|
||||
void LL_DMA_EnableIT_TE(DMA_TypeDef *DMAx, uint32_t Stream);
|
||||
|
|
13
platforms/platform-test-f4-ll/platform/helpers.h
Normal file
13
platforms/platform-test-f4-ll/platform/helpers.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* helpers.h
|
||||
*
|
||||
* Created on: Feb 25, 2021
|
||||
* Author: compi
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_HELPERS_H_
|
||||
#define PLATFORM_HELPERS_H_
|
||||
|
||||
#define TOSTR(x) #x
|
||||
|
||||
#endif /* PLATFORM_HELPERS_H_ */
|
7
platforms/platform-test-f4-ll/platform/test_main.cpp
Normal file
7
platforms/platform-test-f4-ll/platform/test_main.cpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <CppUTest/CommandLineTestRunner.h>
|
||||
|
||||
int main(int ac, char** av)
|
||||
{
|
||||
return CommandLineTestRunner::RunAllTests(ac, av);
|
||||
}
|
|
@ -6,22 +6,115 @@
|
|||
*/
|
||||
|
||||
#include "usart_ll.h"
|
||||
#include <CppUTestExt/MockSupport_c.h>
|
||||
#include <platform/helpers.h>
|
||||
|
||||
void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_EnableIT_TC(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_DisableIT_TC(USART_TypeDef *USARTx) {}
|
||||
uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx) { return 1; }
|
||||
uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx) { return 1; }
|
||||
__attribute__((weak)) USART_TypeDef _USART1;
|
||||
__attribute__((weak)) USART_TypeDef _USART2;
|
||||
__attribute__((weak)) USART_TypeDef _USART3;
|
||||
__attribute__((weak)) USART_TypeDef _USART6;
|
||||
|
||||
void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx) { return 0; }
|
||||
|
||||
uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx) { return 1; }
|
||||
uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx) { return 1; }
|
||||
void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_EnableIT_TC(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_DisableIT_TC(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx)->
|
||||
returnUnsignedIntValueOrDefault(1);
|
||||
}
|
||||
|
||||
|
||||
uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx)->
|
||||
returnUnsignedIntValueOrDefault(1);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx)->
|
||||
returnUnsignedIntValueOrDefault(0);
|
||||
}
|
||||
|
||||
|
||||
uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx)->
|
||||
returnUnsignedIntValueOrDefault(1);
|
||||
}
|
||||
|
||||
|
||||
uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx)
|
||||
{
|
||||
return mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx)->
|
||||
returnUnsignedIntValueOrDefault(1);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx)
|
||||
{
|
||||
mock_c()->actualCall(__FUNCTION__)->
|
||||
withPointerParameters(TOSTR(USARTx), USARTx);
|
||||
}
|
||||
|
||||
|
||||
void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx) {}
|
||||
void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx) {}
|
||||
|
|
|
@ -198,10 +198,15 @@ typedef struct
|
|||
|
||||
/*----------- cut here -----------*/
|
||||
|
||||
extern USART_TypeDef *USART1;
|
||||
extern USART_TypeDef *USART2;
|
||||
extern USART_TypeDef *USART3;
|
||||
extern USART_TypeDef *USART6;
|
||||
extern USART_TypeDef _USART1;
|
||||
extern USART_TypeDef _USART2;
|
||||
extern USART_TypeDef _USART3;
|
||||
extern USART_TypeDef _USART6;
|
||||
|
||||
#define USART1 (&_USART1)
|
||||
#define USART2 (&_USART2)
|
||||
#define USART3 (&_USART3)
|
||||
#define USART6 (&_USART6)
|
||||
|
||||
void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx);
|
||||
void LL_USART_EnableIT_TC(USART_TypeDef *USARTx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue