diff --git a/host/Host.cpp b/host/Host.cpp index ba1f7bea..036f566b 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -134,6 +134,9 @@ Host::Host(const std::string& confFile) : m_p25SysId(1U), m_p25RfssId(1U), m_nxdnRAN(1U), + m_dmrQueueSizeBytes(3960U), // 24 frames + m_p25QueueSizeBytes(2592U), // 12 frames + m_nxdnQueueSizeBytes(1488U), // 31 frames m_authoritative(true), m_activeTickDelay(5U), m_idleTickDelay(5U), @@ -372,25 +375,9 @@ int Host::run() bool dumpTAData = dmrProtocol["dumpTAData"].as(true); uint32_t callHang = dmrProtocol["callHang"].as(3U); uint32_t txHang = dmrProtocol["txHang"].as(4U); - uint32_t queueSize = dmrProtocol["queueSize"].as(31U); bool dmrVerbose = dmrProtocol["verbose"].as(true); bool dmrDebug = dmrProtocol["debug"].as(false); - // clamp queue size to no less then 24 and no greater the 100 - if (queueSize <= 24U) { - LogWarning(LOG_HOST, "DMR queue size must be greater then 24 frames, defaulting to 24 frames!"); - queueSize = 24U; - } - if (queueSize > 100U) { - LogWarning(LOG_HOST, "DMR queue size must be less then 100 frames, defaulting to 100 frames!"); - queueSize = 100U; - } - if (queueSize > 60U) { - LogWarning(LOG_HOST, "DMR queue size is excessive, >60 frames!"); - } - - uint32_t queueSizeBytes = queueSize * (dmr::DMR_FRAME_LENGTH_BYTES * 5U); - uint32_t jitter = m_conf["network"]["jitter"].as(360U); if (txHang > m_rfModeHang) @@ -408,7 +395,6 @@ int Host::run() LogInfo(" Dump CSBK Data: %s", dmrDumpCsbkData ? "yes" : "no"); LogInfo(" Call Hang: %us", callHang); LogInfo(" TX Hang: %us", txHang); - LogInfo(" Queue Size: %u (%u bytes)", queueSize, queueSizeBytes); // forcibly enable beacons when TSCC is enabled but not in dedicated mode if (m_dmrTSCCData && !dmrCtrlChannel && !m_dmrBeacons) { @@ -442,7 +428,7 @@ int Host::run() g_fireDMRBeacon = true; } - dmr = std::unique_ptr(new dmr::Control(m_authoritative, m_dmrColorCode, callHang, queueSizeBytes, embeddedLCOnly, dumpTAData, m_timeout, m_rfTalkgroupHang, + dmr = std::unique_ptr(new dmr::Control(m_authoritative, m_dmrColorCode, callHang, m_dmrQueueSizeBytes, embeddedLCOnly, dumpTAData, m_timeout, m_rfTalkgroupHang, m_modem, m_network, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, jitter, dmrDumpDataPacket, dmrRepeatDataPacket, dmrDumpCsbkData, dmrDebug, dmrVerbose)); dmr->setOptions(m_conf, m_dmrNetId, m_siteId, m_channelId, m_channelNo, true); @@ -480,31 +466,14 @@ int Host::run() bool p25RepeatDataPacket = p25Protocol["repeatDataPacket"].as(true); bool p25DumpTsbkData = p25Protocol["dumpTsbkData"].as(false); uint32_t callHang = p25Protocol["callHang"].as(3U); - uint16_t queueSize = p25Protocol["queueSize"].as(12U); bool p25Verbose = p25Protocol["verbose"].as(true); bool p25Debug = p25Protocol["debug"].as(false); - // clamp queue size to no less then 5 and no greater the 100 frames - if (queueSize <= 10U) { - LogWarning(LOG_HOST, "P25 queue size must be greater then 10 frames, defaulting to 10 frames!"); - queueSize = 10U; - } - if (queueSize > 100U) { - LogWarning(LOG_HOST, "P25 queue size must be less then 100 frames, defaulting to 100 frames!"); - queueSize = 100U; - } - if (queueSize > 30U) { - LogWarning(LOG_HOST, "P25 queue size is excessive, >30 frames!"); - } - - uint32_t queueSizeBytes = queueSize * p25::P25_LDU_FRAME_LENGTH_BYTES; - LogInfo(" TDU Preamble before Voice: %u", tduPreambleCount); LogInfo(" Dump Packet Data: %s", p25DumpDataPacket ? "yes" : "no"); LogInfo(" Repeat Packet Data: %s", p25RepeatDataPacket ? "yes" : "no"); LogInfo(" Dump TSBK Data: %s", p25DumpTsbkData ? "yes" : "no"); LogInfo(" Call Hang: %us", callHang); - LogInfo(" Queue Size: %u (%u bytes)", queueSize, queueSizeBytes); LogInfo(" Control: %s", m_p25CCData ? "yes" : "no"); @@ -532,7 +501,7 @@ int Host::run() } } - p25 = std::unique_ptr(new p25::Control(m_authoritative, m_p25NAC, callHang, queueSizeBytes, m_modem, m_network, m_timeout, m_rfTalkgroupHang, + p25 = std::unique_ptr(new p25::Control(m_authoritative, m_p25NAC, callHang, m_p25QueueSizeBytes, m_modem, m_network, m_timeout, m_rfTalkgroupHang, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, p25DumpDataPacket, p25RepeatDataPacket, p25DumpTsbkData, p25Debug, p25Verbose)); p25->setOptions(m_conf, m_cwCallsign, m_voiceChNo, m_p25PatchSuperGroup, m_p25NetId, m_p25SysId, m_p25RfssId, @@ -566,27 +535,10 @@ int Host::run() bool nxdnCtrlBroadcast = nxdnProtocol["control"]["broadcast"].as(true); bool nxdnDumpRcchData = nxdnProtocol["dumpRcchData"].as(false); uint32_t callHang = nxdnProtocol["callHang"].as(3U); - uint32_t queueSize = nxdnProtocol["queueSize"].as(31U); bool nxdnVerbose = nxdnProtocol["verbose"].as(true); bool nxdnDebug = nxdnProtocol["debug"].as(false); - // clamp queue size to no less then 5 and no greater the 100 frames - if (queueSize <= 10U) { - LogWarning(LOG_HOST, "NXDN queue size must be greater then 10 frames, defaulting to 10 frames!"); - queueSize = 10U; - } - if (queueSize > 100U) { - LogWarning(LOG_HOST, "NXDN queue size must be less then 100 frames, defaulting to 100 frames!"); - queueSize = 100U; - } - if (queueSize > 30U) { - LogWarning(LOG_HOST, "NXDN queue size is excessive, >30 frames!"); - } - - uint32_t queueSizeBytes = queueSize * (nxdn::NXDN_FRAME_LENGTH_BYTES * 5U); - LogInfo(" Call Hang: %us", callHang); - LogInfo(" Queue Size: %u (%u bytes)", queueSize, queueSizeBytes); LogInfo(" Control: %s", m_nxdnCCData ? "yes" : "no"); @@ -614,7 +566,7 @@ int Host::run() } } - nxdn = std::unique_ptr(new nxdn::Control(m_authoritative, m_nxdnRAN, callHang, queueSizeBytes, m_timeout, m_rfTalkgroupHang, + nxdn = std::unique_ptr(new nxdn::Control(m_authoritative, m_nxdnRAN, callHang, m_nxdnQueueSizeBytes, m_timeout, m_rfTalkgroupHang, m_modem, m_network, m_duplex, m_ridLookup, m_tidLookup, m_idenTable, rssi, nxdnDumpRcchData, nxdnDebug, nxdnVerbose)); nxdn->setOptions(m_conf, m_cwCallsign, m_voiceChNo, m_siteId, m_channelId, m_channelNo, true); @@ -1982,6 +1934,62 @@ bool Host::readParams() /// bool Host::createModem() { + yaml::Node protocolConf = m_conf["protocols"]; + + yaml::Node dmrProtocol = protocolConf["dmr"]; + uint32_t dmrQueueSize = dmrProtocol["queueSize"].as(24U); + + // clamp queue size to no less then 24 and no greater the 100 + if (dmrQueueSize <= 24U) { + LogWarning(LOG_HOST, "DMR queue size must be greater then 24 frames, defaulting to 24 frames!"); + dmrQueueSize = 24U; + } + if (dmrQueueSize > 100U) { + LogWarning(LOG_HOST, "DMR queue size must be less then 100 frames, defaulting to 100 frames!"); + dmrQueueSize = 100U; + } + if (dmrQueueSize > 60U) { + LogWarning(LOG_HOST, "DMR queue size is excessive, >60 frames!"); + } + + m_dmrQueueSizeBytes = dmrQueueSize * (dmr::DMR_FRAME_LENGTH_BYTES * 5U); + + yaml::Node p25Protocol = protocolConf["p25"]; + uint32_t p25QueueSize = p25Protocol["queueSize"].as(12U); + + // clamp queue size to no less then 12 and no greater the 100 frames + if (p25QueueSize <= 12U) { + LogWarning(LOG_HOST, "P25 queue size must be greater then 12 frames, defaulting to 12 frames!"); + p25QueueSize = 12U; + } + if (p25QueueSize > 50U) { + LogWarning(LOG_HOST, "P25 queue size must be less then 50 frames, defaulting to 50 frames!"); + p25QueueSize = 50U; + } + if (p25QueueSize > 30U) { + LogWarning(LOG_HOST, "P25 queue size is excessive, >30 frames!"); + } + + m_p25QueueSizeBytes = p25QueueSize * p25::P25_LDU_FRAME_LENGTH_BYTES; + + yaml::Node nxdnProtocol = protocolConf["nxdn"]; + uint32_t nxdnQueueSize = nxdnProtocol["queueSize"].as(31U); + + // clamp queue size to no less then 31 and no greater the 50 frames + if (nxdnQueueSize <= 31U) { + LogWarning(LOG_HOST, "NXDN queue size must be greater then 31 frames, defaulting to 31 frames!"); + nxdnQueueSize = 31U; + } + if (nxdnQueueSize > 50U) { + LogWarning(LOG_HOST, "NXDN queue size must be less then 50 frames, defaulting to 50 frames!"); + nxdnQueueSize = 50U; + } + if (nxdnQueueSize > 30U) { + LogWarning(LOG_HOST, "NXDN queue size is excessive, >30 frames!"); + } + + m_nxdnQueueSizeBytes = nxdnQueueSize * nxdn::NXDN_FRAME_LENGTH_BYTES; + yaml::Node modemConf = m_conf["system"]["modem"]; yaml::Node modemProtocol = modemConf["protocol"]; @@ -2172,6 +2180,9 @@ bool Host::createModem() LogInfo(" P25 TX Level: %.1f%%", p25TXLevel); LogInfo(" NXDN TX Level: %.1f%%", nxdnTXLevel); LogInfo(" Disable Overflow Reset: %s", disableOFlowReset ? "yes" : "no"); + LogInfo(" DMR Queue Size: %u (%u bytes)", dmrQueueSize, m_dmrQueueSizeBytes); + LogInfo(" P25 Queue Size: %u (%u bytes)", p25QueueSize, m_p25QueueSizeBytes); + LogInfo(" NXDN Queue Size: %u (%u bytes)", nxdnQueueSize, m_nxdnQueueSizeBytes); if (m_useDFSI) { LogInfo(" Digital Fixed Station Interface: yes"); @@ -2191,7 +2202,7 @@ bool Host::createModem() } m_modem = new Modem(modemPort, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, p25CorrCount, - disableOFlowReset, ignoreModemConfigArea, dumpModemStatus, trace, debug); + m_dmrQueueSizeBytes, m_p25QueueSizeBytes, m_nxdnQueueSizeBytes, disableOFlowReset, ignoreModemConfigArea, dumpModemStatus, trace, debug); if (!m_modemRemote) { m_modem->setModeParams(m_dmrEnabled, m_p25Enabled, m_nxdnEnabled); m_modem->setLevels(rxLevel, cwIdTXLevel, dmrTXLevel, p25TXLevel, nxdnTXLevel); diff --git a/host/Host.h b/host/Host.h index 53911c91..fd511f0a 100644 --- a/host/Host.h +++ b/host/Host.h @@ -133,6 +133,10 @@ private: uint8_t m_p25RfssId; uint32_t m_nxdnRAN; + uint32_t m_dmrQueueSizeBytes; + uint32_t m_p25QueueSizeBytes; + uint32_t m_nxdnQueueSizeBytes; + bool m_authoritative; uint8_t m_activeTickDelay; diff --git a/host/calibrate/HostCal.cpp b/host/calibrate/HostCal.cpp index 61d6475d..09a4378b 100644 --- a/host/calibrate/HostCal.cpp +++ b/host/calibrate/HostCal.cpp @@ -421,7 +421,7 @@ int HostCal::run() p25::lc::TSBK::setWarnCRC(true); p25::lc::tsbk::TSBKFactory::setWarnCRC(true); - m_modem = new Modem(modemPort, false, rxInvert, txInvert, pttInvert, dcBlocker, false, fdmaPreamble, dmrRxDelay, p25CorrCount, false, ignoreModemConfigArea, false, false, false); + m_modem = new Modem(modemPort, false, rxInvert, txInvert, pttInvert, dcBlocker, false, fdmaPreamble, dmrRxDelay, p25CorrCount, 3960U, 2592U, 1488U, false, ignoreModemConfigArea, false, false, false); m_modem->setLevels(rxLevel, txLevel, txLevel, txLevel, txLevel); m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj, nxdnSymLevel3Adj, nxdnSymLevel1Adj); m_modem->setDCOffsetParams(txDCOffset, rxDCOffset); diff --git a/modem/Modem.cpp b/modem/Modem.cpp index 33d686aa..e1657f3c 100644 --- a/modem/Modem.cpp +++ b/modem/Modem.cpp @@ -105,14 +105,17 @@ using namespace modem; /// Count of FDMA preambles to transmit before data. (P25/DMR DMO) /// Compensate for delay in receiver audio chain in ms. Usually DSP based. /// P25 Correlation Countdown. +/// Modem DMR frame buffer queue size (bytes). +/// Modem P25 frame buffer queue size (bytes). +/// Modem NXDN frame buffer queue size (bytes). /// Flag indicating whether the ADC/DAC overflow reset logic is disabled. /// Flag indicating whether the modem configuration area is ignored. /// Flag indicating whether the modem status is dumped to the log. /// Flag indicating whether air interface modem trace is enabled. /// Flag indicating whether air interface modem debug is enabled. Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, bool cosLockout, - uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, bool disableOFlowReset, - bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug) : + uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint32_t dmrQueueSize, uint32_t p25QueueSize, uint32_t nxdnQueueSize, + bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug) : m_port(port), m_protoVer(0U), m_dmrColorCode(0U), @@ -178,10 +181,10 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, m_openPortHandler(nullptr), m_closePortHandler(nullptr), m_rspHandler(nullptr), - m_rxDMRData1(1000U, "Modem RX DMR1"), - m_rxDMRData2(1000U, "Modem RX DMR2"), - m_rxP25Data(1000U, "Modem RX P25"), - m_rxNXDNData(1000U, "Modem RX NXDN"), + m_rxDMRData1(dmrQueueSize, "Modem RX DMR1"), + m_rxDMRData2(dmrQueueSize, "Modem RX DMR2"), + m_rxP25Data(p25QueueSize, "Modem RX P25"), + m_rxNXDNData(nxdnQueueSize, "Modem RX NXDN"), m_useDFSI(false), m_statusTimer(1000U, 0U, 250U), m_inactivityTimer(1000U, 4U), diff --git a/modem/Modem.h b/modem/Modem.h index 2fd27c95..fa39cfd0 100644 --- a/modem/Modem.h +++ b/modem/Modem.h @@ -217,8 +217,8 @@ namespace modem public: /// Initializes a new instance of the Modem class. Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, bool cosLockout, - uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, bool disableOFlowReset, - bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug); + uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t p25CorrCount, uint32_t dmrQueueSize, uint32_t p25QueueSize, uint32_t nxdnQueueSize, + bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug); /// Finalizes a instance of the Modem class. ~Modem();