removing prefix LL_ from class/struct names under f4ll namespace

This commit is contained in:
Attila Body 2019-11-12 15:26:16 +01:00
parent 180f2ef624
commit 7cdc79c2ac
17 changed files with 184 additions and 183 deletions

View file

@ -8,15 +8,15 @@
#ifndef LL_CONSOLEHANDLER_H_
#define LL_CONSOLEHANDLER_H_
#include "f4ll/ll_hsusart.h"
#include "f4ll/hsusart.h"
#include "singleton.h"
namespace f4ll {
class LL_ConsoleHandler: public LL_UsartCore, public Singleton<LL_ConsoleHandler>
class ConsoleHandler: public UsartCore, public Singleton<ConsoleHandler>
{
friend class Singleton<LL_ConsoleHandler>;
friend class Singleton<ConsoleHandler>;
public:
// LL_UsartCore pure virtual function implementations
@ -24,15 +24,15 @@ public:
virtual void TransmissionComplete(void);
virtual void RxDmaTransferComplete(void);
virtual void RxDmaHalfTransfer(void);
virtual void RxDmaError(LL_DmaHelper::DmaErrorType reason);
virtual void RxDmaError(DmaHelper::DmaErrorType reason);
virtual void TxDmaTransferComplete(void);
virtual void TxDmaHalfTransfer(void);
virtual void TxDmaError(LL_DmaHelper::DmaErrorType reason);
virtual void TxDmaError(DmaHelper::DmaErrorType reason);
void PrintStats(uint8_t id, LL_HsUsart &usart);
void PrintStats(uint8_t id, HsUsart &usart);
private:
LL_ConsoleHandler(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
ConsoleHandler(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
char m_buffer[128];
uint16_t m_used = 0;

View file

@ -9,16 +9,16 @@
#define LL_CRCHANDLER_H_
#include <inttypes.h>
#include <platform/dma_ll.h>
#include "f4ll/ll_dmahelper.h"
#include "f4ll/dmahelper.h"
#include "singleton.h"
extern "C" void _HandleCrcDmaIrq(void);
namespace f4ll {
class LL_CrcHandler : public Singleton<LL_CrcHandler>
class CrcHandler : public Singleton<CrcHandler>
{
friend class Singleton<LL_CrcHandler>;
friend class Singleton<CrcHandler>;
public:
struct ICallback
@ -29,12 +29,12 @@ public:
class SlotBase
{
friend class LL_CrcHandler;
friend class CrcHandler;
public:
struct CrcTask {
void const * volatile m_address; // changed to nullptr when execution starts
uint16_t volatile m_wordCount;
LL_CrcHandler::ICallback *m_callback;
ICallback *m_callback;
uintptr_t m_callbackParam;
};
@ -71,13 +71,13 @@ public:
void DmaTransferCompleted(void);
private:
LL_CrcHandler(DMA_TypeDef *dma, uint32_t stream);
CrcHandler(DMA_TypeDef *dma, uint32_t stream);
friend void ::_HandleCrcDmaIrq(void);
void StartNextTask(void);
void WaitResults(SlotBase &slot, uint8_t task) const;
LL_DmaHelper m_dma;
DmaHelper m_dma;
SlotBase * volatile m_firstSlot = nullptr;
SlotBase * volatile m_activeSlot = nullptr;
int volatile m_activeTask;

View file

@ -13,10 +13,10 @@
namespace f4ll {
class LL_DmaHelper {
class DmaHelper {
public:
LL_DmaHelper(DMA_TypeDef *dma, uint32_t stream);
LL_DmaHelper(LL_DmaHelper const &base) = default;
DmaHelper(DMA_TypeDef *dma, uint32_t stream);
DmaHelper(DmaHelper const &base) = default;
inline DMA_TypeDef* GetDma() const { return m_dma; }
inline uint32_t GetStream() const { return m_stream; }

View file

@ -8,17 +8,17 @@
#ifndef LL_HSUSART_H_
#define LL_HSUSART_H_
#include <platform/usart_ll.h>
#include "f4ll/ll_usartcore.h"
#include "f4ll/ll_crchandler.h"
#include "f4ll/usartcore.h"
#include "f4ll/crchandler.h"
namespace f4ll {
struct DMAINFO;
class LL_HsUsart : public LL_CrcHandler::ICallback, public LL_UsartCore
class HsUsart : public CrcHandler::ICallback, public UsartCore
{
public:
LL_HsUsart(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t stream_rx, uint32_t stream_tx);
HsUsart(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t stream_rx, uint32_t stream_tx);
struct PacketHeader { // !!! size should be multiple of 4 !!!
uint8_t startByte;
@ -48,22 +48,22 @@ public:
};
struct IHsUsartCallback {
virtual bool PacketReceived(LL_HsUsart *caller, uintptr_t userParam, Packet const &packet) = 0;
virtual bool PacketReceived(HsUsart *caller, uintptr_t userParam, Packet const &packet) = 0;
};
// LL_CRCHandler::ICallback interface functions
// CRCHandler::ICallback interface functions
virtual void CrcSucceeded(uintptr_t callbackParam, uint32_t crc, uint8_t task);
virtual void CrcFailed(uintptr_t callbackParam, uint32_t crc, uint8_t task);
// LL_UsartCore pure virtual function implementations
// UsartCore pure virtual function implementations
virtual void ReceiverIdle(void);
virtual void TransmissionComplete(void);
virtual void RxDmaTransferComplete(void);
virtual void RxDmaHalfTransfer(void);
virtual void RxDmaError(LL_DmaHelper::DmaErrorType reason);
virtual void RxDmaError(DmaHelper::DmaErrorType reason);
virtual void TxDmaTransferComplete(void);
virtual void TxDmaHalfTransfer(void);
virtual void TxDmaError(LL_DmaHelper::DmaErrorType reason);
virtual void TxDmaError(DmaHelper::DmaErrorType reason);
void PostPacket(uint8_t const *payload, uint8_t length, bool waitForCrcQueue = true);
void SetupReceive(void);
@ -100,7 +100,7 @@ private:
Stats m_stats;
bool m_rxBufferSelector = false;
LL_CrcHandler::Slot<2> m_crcSlot;
CrcHandler::Slot<2> m_crcSlot;
IHsUsartCallback *m_userCallback = nullptr;
uintptr_t m_userCallbackParam = 0;
Buffer m_txBuffer;

View file

@ -7,19 +7,19 @@
#ifndef LL_MEMCPY_DMA_H_
#define LL_MEMCPY_DMA_H_
#include "f4ll/ll_dmahelper.h"
#include "f4ll/dmahelper.h"
#include "singleton.h"
namespace f4ll {
class LL_MemcpyDma : public Singleton<LL_MemcpyDma>, private LL_DmaHelper
class MemcpyDma : public Singleton<MemcpyDma>, private DmaHelper
{
friend class Singleton<LL_MemcpyDma>;
friend class Singleton<MemcpyDma>;
public:
void* Copy(void *dst, void const *src, uint16_t length);
void DmaTransferCompleted();
private:
LL_MemcpyDma(DMA_TypeDef *dma, uint32_t stream);
MemcpyDma(DMA_TypeDef *dma, uint32_t stream);
bool volatile m_busy = false;
};

View file

@ -9,30 +9,30 @@
#define LL_USARTCORE_H_
#include <platform/usart_ll.h>
#include "f4ll/ll_dmahelper.h"
#include "f4ll/dmahelper.h"
namespace f4ll {
class LL_UsartCore
class UsartCore
{
public:
static inline void HandleUsartIrq(LL_UsartCore *_this) { _this->UsartIsr(); }
static inline void HandleRxDmaIrq(LL_UsartCore *_this) { _this->RxDmaIsr(); }
static inline void HandleTxDmaIrq(LL_UsartCore *_this) { _this->TxDmaIsr(); }
static inline void HandleUsartIrq(UsartCore *_this) { _this->UsartIsr(); }
static inline void HandleRxDmaIrq(UsartCore *_this) { _this->RxDmaIsr(); }
static inline void HandleTxDmaIrq(UsartCore *_this) { _this->TxDmaIsr(); }
protected:
LL_UsartCore(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
UsartCore(USART_TypeDef *usart, DMA_TypeDef *dma, uint32_t streamRx, uint32_t streamTx);
virtual void ReceiverIdle() = 0;
virtual void TransmissionComplete() = 0;
virtual void RxDmaTransferComplete() = 0;
virtual void RxDmaHalfTransfer() = 0;
virtual void RxDmaError(LL_DmaHelper::DmaErrorType reason) = 0;
virtual void RxDmaError(DmaHelper::DmaErrorType reason) = 0;
virtual void TxDmaTransferComplete() = 0;
virtual void TxDmaHalfTransfer() = 0;
virtual void TxDmaError(LL_DmaHelper::DmaErrorType reason) = 0;
virtual void TxDmaError(DmaHelper::DmaErrorType reason) = 0;
void SetupTransmit(void const *buffer, uint16_t length);
void SetupReceive(void *buffer, uint16_t length);
@ -42,8 +42,8 @@ protected:
void TxDmaIsr();
USART_TypeDef *m_usart;
LL_DmaHelper m_rxDma;
LL_DmaHelper m_txDma;
DmaHelper m_rxDma;
DmaHelper m_txDma;
};
} /* namespace f4ll */