HsUsart renamed to PacketUsart, volatile usage review

This commit is contained in:
Attila Body 2019-11-13 15:24:01 +01:00
parent 7cdc79c2ac
commit 23a75f43c7
12 changed files with 179 additions and 171 deletions

View file

@ -8,7 +8,7 @@
#include <string.h>
#include <stdlib.h>
#include "f4ll/hsusart.h"
#include "f4ll/packetusart.h"
#include "f4ll/crchandler.h"
#include "f4ll/memcpydma.h"
#include "f4ll/consolehandler.h"
@ -30,7 +30,7 @@ extern "C" {
extern "C" void MainLoop()
{
uint8_t const text2Send[] __attribute__((aligned(4))) =
uint8_t const text2Send[] __attribute__((aligned(16))) =
"Megszentsegtelenithetetlensegeskedeseitekert\r\n"
"--------------------------------------------\r\n\0\0\0";
@ -38,12 +38,12 @@ extern "C" void MainLoop()
f4ll::CrcHandler::Init(DMA2, LL_DMA_STREAM_4);
f4ll::ConsoleHandler::Init(UART4, CONSOLE_DMA_ENGINE, 0u, CONSOLE_TX_DMA_STREAM);
f4ll::HsUsart u1{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 };
f4ll::HsUsart u2{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 };
f4ll::HsUsart u3{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 };
f4ll::HsUsart u6{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 };
f4ll::PacketUsart u1{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 };
f4ll::PacketUsart u2{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 };
f4ll::PacketUsart u3{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 };
f4ll::PacketUsart u6{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 };
f4ll::HsUsart * usarts[] = { &u1, &u2, &u3, &u6 };
f4ll::PacketUsart * usarts[] = { &u1, &u2, &u3, &u6 };
for(unsigned int i=0; i < sizeof(usarts) / sizeof(usarts[0]); ++i)
g_usarts[i] = usarts[i];
@ -81,8 +81,11 @@ extern "C" void MainLoop()
//DIAG_EXIT_BUSY();
}
for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
if(u->IsRxBusy((bool)rIdx) || u->IsRxFailed(rIdx))
if(u->IsRxBusy((bool)rIdx) || u->IsRxFailed(rIdx)) {
u->GetRxPacketBuffer(rIdx);
// ...
u->RxProcessed((bool)rIdx);
}
}
if(tick - lastStatsTick > STATS_DELAY_MS) {
f4ll::ConsoleHandler::Instance().PrintStats(statId, *usarts[statId]);

View file

@ -6,8 +6,8 @@
*/
#include "globals.h"
#include <f4ll/hsusart.h>
#include <f4ll/packetusart.h>
#include <f4ll/memcpydma.h>
f4ll::HsUsart *g_usarts[4];
f4ll::PacketUsart *g_usarts[4];

View file

@ -9,9 +9,9 @@
#define GLOBALS_CPP_H_
#ifdef __cplusplus
#include "f4ll/hsusart.h"
#include "f4ll/packetusart.h"
extern f4ll::HsUsart *g_usarts[4];
extern f4ll::PacketUsart *g_usarts[4];
#endif // __cplusplus
#endif /* GLOBALS_CPP_H_ */