make incoming data FIFO sizes consistent;

usb-support
Bryan Biedenkapp 3 years ago
parent 15937b3186
commit 267f1e7dc7

@ -13,6 +13,7 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
* Serial FIFO Control Copyright (C) 2015 by James McLaughlin KI6ZUM * Serial FIFO Control Copyright (C) 2015 by James McLaughlin KI6ZUM
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -49,6 +50,14 @@ SerialBuffer::SerialBuffer(uint16_t length) :
m_buffer = new uint8_t[length]; m_buffer = new uint8_t[length];
} }
/// <summary>
/// Finalizes a instance of the SerialBuffer class.
/// </summary>
SerialBuffer::~SerialBuffer()
{
delete[] m_buffer;
}
/// <summary> /// <summary>
/// Helper to get how much space the ring buffer has for samples. /// Helper to get how much space the ring buffer has for samples.
/// </summary> /// </summary>
@ -94,6 +103,19 @@ void SerialBuffer::reset()
m_full = false; m_full = false;
} }
/// <summary>
/// Helper to reset and reinitialize data values to defaults.
/// </summary>
void SerialBuffer::reinitialize(uint16_t length)
{
reset();
m_length = length;
delete[] m_buffer;
m_buffer = new uint8_t[length];
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

@ -13,6 +13,7 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
* Serial FIFO Control Copyright (C) 2015 by James McLaughlin KI6ZUM * Serial FIFO Control Copyright (C) 2015 by James McLaughlin KI6ZUM
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -46,7 +47,7 @@
// Constants // Constants
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
const uint16_t SERIAL_RINGBUFFER_SIZE = 1000U; const uint16_t SERIAL_RINGBUFFER_SIZE = 396U;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Class Declaration // Class Declaration
@ -57,6 +58,8 @@ class DSP_FW_API SerialBuffer {
public: public:
/// <summary>Initializes a new instance of the SerialBuffer class.</summary> /// <summary>Initializes a new instance of the SerialBuffer class.</summary>
SerialBuffer(uint16_t length = SERIAL_RINGBUFFER_SIZE); SerialBuffer(uint16_t length = SERIAL_RINGBUFFER_SIZE);
/// <summary>Finalizes a instance of the SerialBuffer class.</summary>
~SerialBuffer();
/// <summary>Helper to get how much space the ring buffer has for samples.</summary> /// <summary>Helper to get how much space the ring buffer has for samples.</summary>
uint16_t getSpace() const; uint16_t getSpace() const;
@ -66,6 +69,8 @@ public:
/// <summary>Helper to reset data values to defaults.</summary> /// <summary>Helper to reset data values to defaults.</summary>
void reset(); void reset();
/// <summary>Helper to reset and reinitialize data values to defaults.</summary>
void reinitialize(uint16_t length);
/// <summary></summary> /// <summary></summary>
bool put(uint8_t c); bool put(uint8_t c);

@ -54,7 +54,7 @@ const uint8_t PR_FILL[] =
/// Initializes a new instance of the DMRDMOTX class. /// Initializes a new instance of the DMRDMOTX class.
/// </summary> /// </summary>
DMRDMOTX::DMRDMOTX() : DMRDMOTX::DMRDMOTX() :
m_fifo(875U), m_fifo(DMR_TX_BUFFER_LEN),
m_poBuffer(), m_poBuffer(),
m_poLen(0U), m_poLen(0U),
m_poPtr(0U), m_poPtr(0U),

@ -126,6 +126,8 @@ namespace dmr
const int8_t DMR_MS_VOICE_SYNC_SYMBOLS_VALUES[] = { +3, -3, -3, -3, +3, -3, -3, +3, +3, +3, -3, +3, -3, +3, +3, +3, +3, -3, -3, +3, -3, -3, -3, +3 }; const int8_t DMR_MS_VOICE_SYNC_SYMBOLS_VALUES[] = { +3, -3, -3, -3, +3, -3, -3, +3, +3, +3, -3, +3, -3, +3, +3, +3, +3, -3, -3, +3, -3, -3, -3, +3 };
const uint32_t DMR_TX_BUFFER_LEN = 1023U; // 1023 = DMR_FRAME_LENGTH_BYTES * 31 (BUFFER_LEN = DMR_FRAME_LENGTH_BYTES * NO_OF_FRAMES)
// Data Type(s) // Data Type(s)
const uint8_t DT_VOICE_PI_HEADER = 0U; const uint8_t DT_VOICE_PI_HEADER = 0U;
const uint8_t DT_VOICE_LC_HEADER = 1U; const uint8_t DT_VOICE_LC_HEADER = 1U;

@ -84,6 +84,9 @@ DMRTX::DMRTX() :
m_cachATControl(0U), m_cachATControl(0U),
m_controlPrev(MARK_NONE) m_controlPrev(MARK_NONE)
{ {
m_fifo[0U].reinitialize(DMR_TX_BUFFER_LEN);
m_fifo[1U].reinitialize(DMR_TX_BUFFER_LEN);
::memcpy(m_newShortLC, EMPTY_SHORT_LC, 12U); ::memcpy(m_newShortLC, EMPTY_SHORT_LC, 12U);
::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U); ::memcpy(m_shortLC, EMPTY_SHORT_LC, 12U);

@ -68,7 +68,7 @@ namespace nxdn
const uint16_t NXDN_FSW_SYMBOLS = 0x014DU; const uint16_t NXDN_FSW_SYMBOLS = 0x014DU;
const uint16_t NXDN_FSW_SYMBOLS_MASK = 0x03FFU; const uint16_t NXDN_FSW_SYMBOLS_MASK = 0x03FFU;
const uint32_t NXDN_TX_BUFFER_LEN = 2000U; const uint32_t NXDN_TX_BUFFER_LEN = 2016U; // 2016 = NXDN_FRAME_LENGTH_BYTES * 42 (BUFFER_LEN = NXDN_FRAME_LENGTH_BYTES * NO_OF_FRAMES)
} // namespace nxdn } // namespace nxdn
#endif // __NXDN_DEFINES_H__ #endif // __NXDN_DEFINES_H__

@ -120,7 +120,7 @@ namespace p25
const uint32_t P25_SYNC_SYMBOLS = 0x00FB30A0U; const uint32_t P25_SYNC_SYMBOLS = 0x00FB30A0U;
const uint32_t P25_SYNC_SYMBOLS_MASK = 0x00FFFFFFU; const uint32_t P25_SYNC_SYMBOLS_MASK = 0x00FFFFFFU;
const uint32_t P25_TX_BUFFER_LEN = 2000U; const uint32_t P25_TX_BUFFER_LEN = 2592U; // 2592 = P25_LDU_FRAME_LENGTH_BYTES * 12 (BUFFER_LEN = P25_LDU_FRAME_LENGTH_BYTES * NO_OF_FRAMES)
// Data Unit ID(s) // Data Unit ID(s)
const uint8_t P25_DUID_HDU = 0x00U; // Header Data Unit const uint8_t P25_DUID_HDU = 0x00U; // Header Data Unit

Loading…
Cancel
Save

Powered by TurnKey Linux.