Remove CSerialBuffer, use CRingBuffer

This commit is contained in:
Geoffrey Merck 2020-05-10 06:50:35 +02:00
parent 16c3d418eb
commit 03f18451f7
17 changed files with 36 additions and 39 deletions

View File

@ -74,7 +74,7 @@ void CDMRDMOTX::process()
m_poLen = m_txDelay;
} else {
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++)
m_poBuffer[i] = m_fifo.get();
m_fifo.get(m_poBuffer[i]);
for (unsigned int i = 0U; i < 39U; i++)
m_poBuffer[i + DMR_FRAME_LENGTH_BYTES] = PR_FILL[i];

View File

@ -23,7 +23,7 @@
#include "Config.h"
#include "DMRDefines.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CDMRDMOTX {
public:
@ -38,7 +38,7 @@ public:
uint8_t getSpace() const;
private:
CSerialRB m_fifo;
CRingBuffer<uint8_t> m_fifo;
arm_fir_interpolate_instance_q15 m_modFilter;
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
uint8_t m_poBuffer[1200U];

View File

@ -293,7 +293,7 @@ void CDMRTX::createData(uint8_t slotIndex)
{
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
m_poBuffer[i] = m_fifo[slotIndex].get();
m_fifo[slotIndex].get(m_poBuffer[i]);
m_markBuffer[i] = MARK_NONE;
}
} else {

View File

@ -23,7 +23,7 @@
#include "Config.h"
#include "DMRDefines.h"
#include "SerialRB.h"
#include "RingBuffer.h"
enum DMRTXSTATE {
DMRTXSTATE_IDLE,
@ -59,7 +59,7 @@ public:
void setColorCode(uint8_t colorCode);
private:
CSerialRB m_fifo[2U];
CRingBuffer<uint8_t> m_fifo[2U];
arm_fir_interpolate_instance_q15 m_modFilter;
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
DMRTXSTATE m_state;

View File

@ -216,12 +216,13 @@ void CDStarTX::process()
for (uint16_t i = 0U; i < m_txDelay; i++)
m_poBuffer[m_poLen++] = BIT_SYNC;
} else {
uint8_t dummy;
// Pop the type byte off
m_buffer.get();
m_buffer.get(dummy);
uint8_t header[DSTAR_HEADER_LENGTH_BYTES];
for (uint8_t i = 0U; i < DSTAR_HEADER_LENGTH_BYTES; i++)
header[i] = m_buffer.get();
m_buffer.get(header[i]);
uint8_t buffer[86U];
txHeader(header, buffer + 2U);
@ -239,17 +240,19 @@ void CDStarTX::process()
if (type == DSTAR_DATA && m_poLen == 0U) {
// Pop the type byte off
m_buffer.get();
uint8_t dummy;
m_buffer.get(dummy);
for (uint8_t i = 0U; i < DSTAR_DATA_LENGTH_BYTES; i++)
m_poBuffer[m_poLen++] = m_buffer.get();
m_buffer.get(m_poBuffer[m_poLen++]);
m_poPtr = 0U;
}
if (type == DSTAR_EOT && m_poLen == 0U) {
// Pop the type byte off
m_buffer.get();
uint8_t dummy;
m_buffer.get(dummy);
for (uint8_t j = 0U; j < 3U; j++) {
for (uint8_t i = 0U; i < DSTAR_EOT_LENGTH_BYTES; i++)

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CDStarTX {
public:
@ -38,7 +38,7 @@ public:
uint8_t getSpace() const;
private:
CSerialRB m_buffer;
CRingBuffer<uint8_t> m_buffer;
arm_fir_interpolate_instance_q15 m_modFilter;
q15_t m_modState[20U]; // blockSize + phaseLength - 1, 8 + 9 - 1 plus some spare
uint8_t m_poBuffer[600U];

View File

@ -82,7 +82,8 @@ void CNXDNTX::process()
m_poBuffer[m_poLen++] = NXDN_PREAMBLE[2U];
} else {
for (uint8_t i = 0U; i < NXDN_FRAME_LENGTH_BYTES; i++) {
uint8_t c = m_buffer.get();
uint8_t c;
m_buffer.get(c);
m_poBuffer[m_poLen++] = c;
}
}

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CNXDNTX {
public:
@ -36,7 +36,7 @@ public:
uint8_t getSpace() const;
private:
CSerialRB m_buffer;
CRingBuffer<uint8_t> m_buffer;
arm_fir_interpolate_instance_q15 m_modFilter;
arm_fir_instance_q15 m_sincFilter;
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare

View File

@ -76,9 +76,11 @@ void CP25TX::process()
for (uint16_t i = 0U; i < m_txDelay; i++)
m_poBuffer[m_poLen++] = P25_START_SYNC;
} else {
uint8_t length = m_buffer.get();
uint8_t length;
m_buffer.get(length);
for (uint8_t i = 0U; i < length; i++) {
uint8_t c = m_buffer.get();
uint8_t c;
m_buffer.get(c);
m_poBuffer[m_poLen++] = c;
}
}

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CP25TX {
public:
@ -36,7 +36,7 @@ public:
uint8_t getSpace() const;
private:
CSerialRB m_buffer;
CRingBuffer<uint8_t> m_buffer;
arm_fir_interpolate_instance_q15 m_modFilter;
arm_fir_instance_q15 m_lpFilter;
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare

View File

@ -61,7 +61,8 @@ void CPOCSAGTX::process()
m_poBuffer[m_poLen++] = POCSAG_SYNC;
} else {
for (uint8_t i = 0U; i < POCSAG_FRAME_LENGTH_BYTES; i++) {
uint8_t c = m_buffer.get();
uint8_t c;
m_buffer.get(c);
m_poBuffer[m_poLen++] = c;
}
}

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CPOCSAGTX {
public:
@ -40,7 +40,7 @@ public:
bool busy();
private:
CSerialRB m_buffer;
CRingBuffer<uint8_t> m_buffer;
arm_fir_instance_q15 m_modFilter;
q15_t m_modState[170U]; // NoTaps + BlockSize - 1, 6 + 160 - 1 plus some spare
uint8_t m_poBuffer[200U];

View File

@ -56,8 +56,6 @@ public:
bool put(TDATATYPE item) volatile;
bool get(TDATATYPE& item);
TDATATYPE get();
TDATATYPE peek() const;

View File

@ -112,12 +112,3 @@ template <typename TDATATYPE> void CRingBuffer<TDATATYPE>::reset()
m_full = false;
m_overflow = false;
}
template <typename TDATATYPE> TDATATYPE CRingBuffer<TDATATYPE>::get()
{
TDATATYPE value;
if(get(value))
return value;
//return 0U;
}

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "Globals.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CSerialPort {
@ -66,7 +66,7 @@ private:
uint8_t m_ptr;
uint8_t m_len;
bool m_debug;
CSerialRB m_repeat;
CRingBuffer<uint8_t> m_repeat;
void sendACK();
void sendNAK(uint8_t err);

View File

@ -76,7 +76,8 @@ void CYSFTX::process()
m_poBuffer[m_poLen++] = YSF_START_SYNC;
} else {
for (uint8_t i = 0U; i < YSF_FRAME_LENGTH_BYTES; i++) {
uint8_t c = m_buffer.get();
uint8_t c;
m_buffer.get(c);
m_poBuffer[m_poLen++] = c;
}
}

View File

@ -21,7 +21,7 @@
#include "Config.h"
#include "SerialRB.h"
#include "RingBuffer.h"
class CYSFTX {
public:
@ -38,7 +38,7 @@ public:
void setParams(bool on, uint8_t txHang);
private:
CSerialRB m_buffer;
CRingBuffer<uint8_t> m_buffer;
arm_fir_interpolate_instance_q15 m_modFilter;
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
uint8_t m_poBuffer[1200U];