make the modem playout timer configurable; fix magic number in regards to queue resizing; adjust default config to have a data queue size of 5000 for DMR and P25; correct some minor HDU state handling issues;

pull/1/head
Bryan Biedenkapp 5 years ago
parent 3c58db84b4
commit 75facc7297

@ -118,6 +118,8 @@ typedef unsigned long long ulong64_t;
const uint32_t TRAFFIC_DEFAULT_PORT = 62031; const uint32_t TRAFFIC_DEFAULT_PORT = 62031;
const uint32_t RCON_DEFAULT_PORT = 9990; const uint32_t RCON_DEFAULT_PORT = 9990;
const uint32_t QUEUE_RESIZE_SIZE = 500;
const uint8_t BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U }; const uint8_t BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U };
enum HOST_STATE { enum HOST_STATE {

@ -109,6 +109,7 @@ system:
# dmrTxLevel: 50 # dmrTxLevel: 50
# p25TxLevel: 50 # p25TxLevel: 50
rssiMappingFile: RSSI.dat rssiMappingFile: RSSI.dat
packetPlayoutTime: 10
disableOFlowReset: false disableOFlowReset: false
trace: false trace: false
debug: false debug: false

@ -449,7 +449,7 @@ void Slot::writeQueueRF(const uint8_t *data)
uint32_t space = m_queue.freeSpace(); uint32_t space = m_queue.freeSpace();
if (space < (len + 1U)) { if (space < (len + 1U)) {
uint32_t queueLen = m_queue.length(); uint32_t queueLen = m_queue.length();
m_queue.resize(queueLen + 2500); m_queue.resize(queueLen + QUEUE_RESIZE_SIZE);
LogError(LOG_DMR, "Slot %u, overflow in the DMR slot RF queue; queue resized was %u is %u", m_slotNo, queueLen, m_queue.length()); LogError(LOG_DMR, "Slot %u, overflow in the DMR slot RF queue; queue resized was %u is %u", m_slotNo, queueLen, m_queue.length());
return; return;

@ -1209,10 +1209,15 @@ bool Host::createModem()
if (!modemConf["txLevel"].isNone()) { if (!modemConf["txLevel"].isNone()) {
cwIdTXLevel = dmrTXLevel = p25TXLevel = modemConf["txLevel"].as<float>(50.0F); cwIdTXLevel = dmrTXLevel = p25TXLevel = modemConf["txLevel"].as<float>(50.0F);
} }
uint8_t packetPlayoutTime = (uint8_t)modemConf["packetPlayoutTime"].as<uint32_t>(10U);
bool disableOFlowReset = modemConf["disableOFlowReset"].as<bool>(false); bool disableOFlowReset = modemConf["disableOFlowReset"].as<bool>(false);
bool trace = modemConf["trace"].as<bool>(false); bool trace = modemConf["trace"].as<bool>(false);
bool debug = modemConf["debug"].as<bool>(false); bool debug = modemConf["debug"].as<bool>(false);
// make sure playout time is always greater than 1ms
if (packetPlayoutTime < 1U)
packetPlayoutTime = 1U;
LogInfo("Modem Parameters"); LogInfo("Modem Parameters");
LogInfo(" Port: %s", port.c_str()); LogInfo(" Port: %s", port.c_str());
LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no"); LogInfo(" RX Invert: %s", rxInvert ? "yes" : "no");
@ -1228,13 +1233,14 @@ bool Host::createModem()
LogInfo(" CW Id TX Level: %.1f%%", cwIdTXLevel); LogInfo(" CW Id TX Level: %.1f%%", cwIdTXLevel);
LogInfo(" DMR TX Level: %.1f%%", dmrTXLevel); LogInfo(" DMR TX Level: %.1f%%", dmrTXLevel);
LogInfo(" P25 TX Level: %.1f%%", p25TXLevel); LogInfo(" P25 TX Level: %.1f%%", p25TXLevel);
LogInfo(" Packet Playout Time: %u ms", packetPlayoutTime);
LogInfo(" Disable Overflow Reset: %s", disableOFlowReset ? "yes" : "no"); LogInfo(" Disable Overflow Reset: %s", disableOFlowReset ? "yes" : "no");
if (debug) { if (debug) {
LogInfo(" Debug: yes"); LogInfo(" Debug: yes");
} }
m_modem = Modem::createModem(port, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, disableOFlowReset, trace, debug); m_modem = Modem::createModem(port, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, packetPlayoutTime, disableOFlowReset, trace, debug);
m_modem->setModeParams(m_dmrEnabled, m_p25Enabled); m_modem->setModeParams(m_dmrEnabled, m_p25Enabled);
m_modem->setLevels(rxLevel, cwIdTXLevel, dmrTXLevel, p25TXLevel); m_modem->setLevels(rxLevel, cwIdTXLevel, dmrTXLevel, p25TXLevel);
m_modem->setDCOffsetParams(txDCOffset, rxDCOffset); m_modem->setDCOffsetParams(txDCOffset, rxDCOffset);

@ -67,10 +67,11 @@ using namespace modem;
/// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param> /// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param>
/// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param> /// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param>
/// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param> /// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param>
/// <param name="packetPlayoutTime">Length of time in MS between packets to send to modem.</param>
/// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param> /// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param>
/// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param> /// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param>
Modem::Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, Modem::Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug) : bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug) :
m_port(port), m_port(port),
m_dmrColorCode(0U), m_dmrColorCode(0U),
m_duplex(duplex), m_duplex(duplex),
@ -106,7 +107,7 @@ Modem::Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert,
m_txP25Data(1000U, "Modem TX P25"), m_txP25Data(1000U, "Modem TX P25"),
m_statusTimer(1000U, 0U, 250U), m_statusTimer(1000U, 0U, 250U),
m_inactivityTimer(1000U, 4U), m_inactivityTimer(1000U, 4U),
m_playoutTimer(1000U, 0U, 10U), m_playoutTimer(1000U, 0U, packetPlayoutTime),
m_dmrSpace1(0U), m_dmrSpace1(0U),
m_dmrSpace2(0U), m_dmrSpace2(0U),
m_p25Space(0U), m_p25Space(0U),
@ -1030,17 +1031,18 @@ bool Modem::sendCWId(const std::string& callsign)
/// <param name="cosLockout">Flag indicating whether the COS signal should be used to lockout the modem.</param> /// <param name="cosLockout">Flag indicating whether the COS signal should be used to lockout the modem.</param>
/// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param> /// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param>
/// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param> /// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param>
/// <param name="packetPlayoutTime">Length of time in MS between packets to send to modem.</param>
/// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param> /// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param>
/// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param> /// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param>
/// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param> /// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param>
Modem* Modem::createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, Modem* Modem::createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug) bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug)
{ {
if (port == NULL_MODEM) { if (port == NULL_MODEM) {
return new NullModem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, disableOFlowReset, trace, debug); return new NullModem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, packetPlayoutTime, disableOFlowReset, trace, debug);
} }
else { else {
return new Modem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, disableOFlowReset, trace, debug); return new Modem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, packetPlayoutTime, disableOFlowReset, trace, debug);
} }
} }

@ -163,7 +163,7 @@ namespace modem
public: public:
/// <summary>Initializes a new instance of the Modem class.</summary> /// <summary>Initializes a new instance of the Modem class.</summary>
Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug); bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug);
/// <summary>Finalizes a instance of the Modem class.</summary> /// <summary>Finalizes a instance of the Modem class.</summary>
virtual ~Modem(); virtual ~Modem();
@ -247,7 +247,7 @@ namespace modem
/// <summary>Helper to create an instance of the Modem class.</summary> /// <summary>Helper to create an instance of the Modem class.</summary>
static Modem* createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, static Modem* createModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug); bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug);
private: private:
std::string m_port; std::string m_port;

@ -49,12 +49,13 @@ using namespace modem;
/// <param name="cosLockout">Flag indicating whether the COS signal should be used to lockout the modem.</param> /// <param name="cosLockout">Flag indicating whether the COS signal should be used to lockout the modem.</param>
/// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param> /// <param name="fdmaPreamble">Count of FDMA preambles to transmit before data. (P25/DMR DMO)</param>
/// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param> /// <param name="dmrRxDelay">Compensate for delay in receiver audio chain in ms. Usually DSP based.</param>
/// <param name="packetPlayoutTime">Length of time in MS between packets to send to modem.</param>
/// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param> /// <param name="disableOFlowReset">Flag indicating whether the ADC/DAC overflow reset logic is disabled.</param>
/// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param> /// <param name="trace">Flag indicating whether modem DSP trace is enabled.</param>
/// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param> /// <param name="debug">Flag indicating whether modem DSP debug is enabled.</param>
NullModem::NullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, NullModem::NullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug) : bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug) :
Modem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, disableOFlowReset, trace, debug) Modem(port, duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, packetPlayoutTime, disableOFlowReset, trace, debug)
{ {
/* stub */ /* stub */
} }

@ -45,7 +45,7 @@ namespace modem
public: public:
/// <summary>Initializes a new instance of the NullModem class.</summary> /// <summary>Initializes a new instance of the NullModem class.</summary>
NullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, NullModem(const std::string& port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, bool disableOFlowReset, bool trace, bool debug); bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, bool disableOFlowReset, bool trace, bool debug);
/// <summary>Finalizes a instance of the NullModem class.</summary> /// <summary>Finalizes a instance of the NullModem class.</summary>
~NullModem(); ~NullModem();

@ -330,16 +330,16 @@ bool Control::processFrame(uint8_t* data, uint32_t len)
} }
if (!sync && m_rfState == RS_RF_LISTENING) { if (!sync && m_rfState == RS_RF_LISTENING) {
if (m_verbose) { uint8_t sync[P25_SYNC_LENGTH_BYTES];
uint8_t sync[P25_SYNC_LENGTH_BYTES]; ::memcpy(sync, data + 2U, P25_SYNC_LENGTH_BYTES);
::memcpy(sync, data + 2U, P25_SYNC_LENGTH_BYTES);
uint8_t errs = 0U; uint8_t errs = 0U;
for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++) for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++)
errs += Utils::countBits8(sync[i] ^ P25_SYNC_BYTES[i]); errs += Utils::countBits8(sync[i] ^ P25_SYNC_BYTES[i]);
LogWarning(LOG_RF, "P25, possible sync word rejected, errs = %u, sync word = %02X %02X %02X %02X %02X %02X", errs,
sync[0U], sync[1U], sync[2U], sync[3U], sync[4U], sync[5U]);
LogDebug(LOG_RF, "P25, possible sync word rejected, errs = %u", errs);
}
return false; return false;
} }
@ -626,7 +626,7 @@ void Control::writeQueueRF(const uint8_t* data, uint32_t length)
uint32_t space = m_queue.freeSpace(); uint32_t space = m_queue.freeSpace();
if (space < (length + 1U)) { if (space < (length + 1U)) {
uint32_t queueLen = m_queue.length(); uint32_t queueLen = m_queue.length();
m_queue.resize(queueLen + 2500); m_queue.resize(queueLen + QUEUE_RESIZE_SIZE);
LogError(LOG_P25, "overflow in the P25 RF queue; queue resized was %u is %u", queueLen, m_queue.length()); LogError(LOG_P25, "overflow in the P25 RF queue; queue resized was %u is %u", queueLen, m_queue.length());
return; return;

@ -115,13 +115,17 @@ bool VoicePacket::process(uint8_t* data, uint32_t len)
m_p25->m_rfTGHang.start(); m_p25->m_rfTGHang.start();
} }
if (duid == P25_DUID_HDU && m_lastDUID == P25_DUID_HDU) {
duid = P25_DUID_LDU1;
}
// handle individual DUIDs // handle individual DUIDs
if (duid == P25_DUID_HDU) { if (duid == P25_DUID_HDU) {
m_p25->m_trunk->resetStatusCommand(); m_p25->m_trunk->resetStatusCommand();
m_lastDUID = P25_DUID_HDU; m_lastDUID = P25_DUID_HDU;
if (m_p25->m_rfState == RS_RF_LISTENING) { if (m_p25->m_rfState == RS_RF_LISTENING && m_p25->m_ccRunning) {
m_p25->m_modem->clearP25Data(); m_p25->m_modem->clearP25Data();
m_p25->m_queue.clear(); m_p25->m_queue.clear();
resetRF(); resetRF();

Loading…
Cancel
Save

Powered by TurnKey Linux.