builds with make
This commit is contained in:
parent
8709bcb465
commit
549d4f3403
17 changed files with 1513 additions and 1234 deletions
|
@ -15,10 +15,6 @@
|
|||
#include "f4ll_c/dmahelper.h"
|
||||
#include "f4ll_c/crcscheduler.h"
|
||||
|
||||
#ifndef MOCKABLE
|
||||
#define MOCKABLE(x) x
|
||||
#endif
|
||||
|
||||
#ifndef DIAG_RX_BUFFER_SWITCH
|
||||
# define DIAG_RX_BUFFER_SWITCH(x)
|
||||
#endif
|
||||
|
@ -80,7 +76,7 @@ static inline void StatsAddSkiped(struct usart_stats *s, uint8_t cnt) {
|
|||
#define StatsAddSkiped(x)
|
||||
#endif // USART_STATS_DISABLED
|
||||
|
||||
void MOCKABLE(Pu_Init)(
|
||||
void Pu_Init(
|
||||
struct usartstatus_t *st, USART_TypeDef *usart, DMA_TypeDef *dma,
|
||||
uint32_t stream_rx, uint32_t stream_tx,
|
||||
struct crcstatus_t *crcStatus,
|
||||
|
@ -130,19 +126,19 @@ void MOCKABLE(Pu_Init)(
|
|||
}
|
||||
|
||||
|
||||
uint8_t* MOCKABLE(Pu_GetTxBuffer)(struct usartstatus_t *status)
|
||||
uint8_t* Pu_GetTxBuffer(struct usartstatus_t *status)
|
||||
{
|
||||
return status->txBuffer.packet.payload;
|
||||
}
|
||||
|
||||
|
||||
uint8_t MOCKABLE(Pu_CheckHeader)(struct usartpacket_t *packet)
|
||||
uint8_t Pu_CheckHeader(struct usartpacket_t *packet)
|
||||
{
|
||||
return packet->header.startByte == STARTMARKER && (packet->header.startByte ^ packet->header.serial ^ packet->header.payloadLength) == packet->header.hash;
|
||||
}
|
||||
|
||||
|
||||
uint8_t MOCKABLE(Pu_Post)(struct usartstatus_t *status, uint8_t const *payload, uint8_t length, uint8_t waitForCrcQueue)
|
||||
uint8_t Pu_Post(struct usartstatus_t *status, uint8_t const *payload, uint8_t length, uint8_t waitForCrcQueue)
|
||||
{
|
||||
struct usart_buffer_t *buffer = &status->txBuffer;
|
||||
uint8_t hash = STARTMARKER;
|
||||
|
@ -169,7 +165,7 @@ uint8_t MOCKABLE(Pu_Post)(struct usartstatus_t *status, uint8_t const *payload,
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_SetupReceive)(struct usartstatus_t *status)
|
||||
void Pu_SetupReceive(struct usartstatus_t *status)
|
||||
{
|
||||
uint8_t packetIndex = status->activeRxBuf;
|
||||
|
||||
|
@ -183,7 +179,7 @@ void MOCKABLE(Pu_SetupReceive)(struct usartstatus_t *status)
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_SetupTransmit)(USART_TypeDef *usart, DMA_TypeDef* dma, uint32_t stream, void *buffer, uint32_t length)
|
||||
void Pu_SetupTransmit(USART_TypeDef *usart, DMA_TypeDef* dma, uint32_t stream, void *buffer, uint32_t length)
|
||||
{
|
||||
LL_DMA_ConfigAddresses(dma, stream, (uint32_t)buffer, LL_USART_DMA_GetRegAddr(usart), LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
|
||||
LL_DMA_SetDataLength(dma, stream, length);
|
||||
|
@ -192,7 +188,7 @@ void MOCKABLE(Pu_SetupTransmit)(USART_TypeDef *usart, DMA_TypeDef* dma, uint32_t
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_ConsumePacket)(struct usartstatus_t *status, uint8_t packetIndex)
|
||||
void Pu_ConsumePacket(struct usartstatus_t *status, uint8_t packetIndex)
|
||||
{
|
||||
struct usart_buffer_t *buffer = &status->rxBuffers[packetIndex];
|
||||
if(buffer->busy) {
|
||||
|
@ -210,7 +206,7 @@ void MOCKABLE(Pu_ConsumePacket)(struct usartstatus_t *status, uint8_t packetInde
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_HandleRxDmaIrq)(struct usartstatus_t *status)
|
||||
void Pu_HandleRxDmaIrq(struct usartstatus_t *status)
|
||||
{
|
||||
DIAG_INTERRUPT_IN();
|
||||
StatsIncRcvd(&status->stats);
|
||||
|
@ -242,7 +238,7 @@ void MOCKABLE(Pu_HandleRxDmaIrq)(struct usartstatus_t *status)
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_RxCrcComputedCallback)(void *callbackParm, uint32_t calculatedCrc, uint8_t success)
|
||||
void Pu_RxCrcComputedCallback(void *callbackParm, uint32_t calculatedCrc, uint8_t success)
|
||||
{
|
||||
struct usart_buffer_t *ub = (struct usart_buffer_t*) callbackParm;
|
||||
if(!success)
|
||||
|
@ -258,7 +254,7 @@ void MOCKABLE(Pu_RxCrcComputedCallback)(void *callbackParm, uint32_t calculatedC
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_HandleTxDmaIrq)(struct usartstatus_t *status)
|
||||
void Pu_HandleTxDmaIrq(struct usartstatus_t *status)
|
||||
{
|
||||
DIAG_INTERRUPT_IN();
|
||||
if(*status->txDmaInfo.isReg & status->txDmaInfo.tcMask) { // DMA transfer complete
|
||||
|
@ -283,7 +279,7 @@ void MOCKABLE(Pu_HandleTxDmaIrq)(struct usartstatus_t *status)
|
|||
}
|
||||
|
||||
|
||||
void MOCKABLE(Pu_HandleUsartIrq)(struct usartstatus_t *status)
|
||||
void Pu_HandleUsartIrq(struct usartstatus_t *status)
|
||||
{
|
||||
DIAG_INTERRUPT_IN();
|
||||
if(LL_USART_IsActiveFlag_IDLE(status->usart) && LL_USART_IsEnabledIT_IDLE(status->usart)) { // receiver idle
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue