diff --git a/configs/config.example.yml b/configs/config.example.yml index 8c4c6f59..07d7acfc 100644 --- a/configs/config.example.yml +++ b/configs/config.example.yml @@ -689,6 +689,8 @@ system: ignoreModemConfigArea: false # Flag indicating whether verbose dumping of the modem status is enabled. dumpModemStatus: false + # Flag indicating whether or not modem debug messages are displayed to the log. + displayModemDebugMessages: false # Flag indicating whether or not trace logging is enabled. trace: false # Flag indicating whether or not debug logging is enabled. diff --git a/src/host/Host.Config.cpp b/src/host/Host.Config.cpp index 08285c77..75c70c39 100644 --- a/src/host/Host.Config.cpp +++ b/src/host/Host.Config.cpp @@ -542,13 +542,16 @@ bool Host::createModem() bool disableOFlowReset = modemConf["disableOFlowReset"].as(false); bool ignoreModemConfigArea = modemConf["ignoreModemConfigArea"].as(false); bool dumpModemStatus = modemConf["dumpModemStatus"].as(false); + bool displayModemDebugMessages = modemConf["displayModemDebugMessages"].as(false); bool respTrace = modemConf["respTrace"].as(false); bool trace = modemConf["trace"].as(false); bool debug = modemConf["debug"].as(false); // if modem debug is being forced from the commandline -- enable modem debug - if (g_modemDebug) + if (g_modemDebug) { + displayModemDebugMessages = true; debug = true; + } if (rfPower == 0U) { // clamp to 1 rfPower = 1U; @@ -707,6 +710,10 @@ bool Host::createModem() if (dumpModemStatus) { LogInfo(" Dump Modem Status: yes"); } + + if (displayModemDebugMessages) { + LogInfo(" Display Modem Debug Messages: yes"); + } } if (debug) { @@ -715,12 +722,12 @@ bool Host::createModem() if (m_isModemDFSI) { m_modem = new ModemV24(modemPort, m_duplex, m_p25QueueSizeBytes, m_p25QueueSizeBytes, rtrt, jitter, - dumpModemStatus, trace, debug); + dumpModemStatus, displayModemDebugMessages, trace, debug); ((ModemV24*)m_modem)->setCallTimeout(dfsiCallTimeout); ((ModemV24*)m_modem)->setTIAFormat(dfsiTIAMode); } else { m_modem = new Modem(modemPort, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, p25CorrCount, - m_dmrQueueSizeBytes, m_p25QueueSizeBytes, m_nxdnQueueSizeBytes, disableOFlowReset, ignoreModemConfigArea, dumpModemStatus, trace, debug); + m_dmrQueueSizeBytes, m_p25QueueSizeBytes, m_nxdnQueueSizeBytes, disableOFlowReset, ignoreModemConfigArea, dumpModemStatus, displayModemDebugMessages, trace, debug); } if (!m_modemRemote) { m_modem->setModeParams(m_dmrEnabled, m_p25Enabled, m_nxdnEnabled); @@ -757,7 +764,8 @@ bool Host::createModem() return false; } - m_modem->setFifoLength(dmrFifoLength, p25FifoLength, nxdnFifoLength); + if (!m_isModemDFSI) + m_modem->setFifoLength(dmrFifoLength, p25FifoLength, nxdnFifoLength); // are we on a protocol version older then 3? if (m_modem->getVersion() < 3U) { diff --git a/src/host/Host.cpp b/src/host/Host.cpp index 6d554b25..b5eecc9a 100644 --- a/src/host/Host.cpp +++ b/src/host/Host.cpp @@ -748,10 +748,12 @@ int Host::run() ::LogInfoEx(LOG_HOST, "[WAIT] Host is performing late initialization and warmup"); - m_modem->clearNXDNFrame(); m_modem->clearP25Frame(); - m_modem->clearDMRFrame2(); - m_modem->clearDMRFrame1(); + if (!m_isModemDFSI) { + m_modem->clearDMRFrame2(); + m_modem->clearDMRFrame1(); + m_modem->clearNXDNFrame(); + } // perform early pumping of the modem clock (this is so the DSP has time to setup its buffers), // and clock the network (so it may perform early connect) diff --git a/src/host/calibrate/HostCal.cpp b/src/host/calibrate/HostCal.cpp index 511f5aac..f69db7af 100644 --- a/src/host/calibrate/HostCal.cpp +++ b/src/host/calibrate/HostCal.cpp @@ -211,6 +211,7 @@ int HostCal::run(int argc, char **argv) { m_debug = !m_debug; LogInfoEx(LOG_CAL, " - Modem Debug: %s", m_debug ? "On" : "Off"); + m_modem->m_displayModemDebugMessages = m_debug; writeConfig(); } break; diff --git a/src/host/modem/Modem.cpp b/src/host/modem/Modem.cpp index b565ff14..49625ab2 100644 --- a/src/host/modem/Modem.cpp +++ b/src/host/modem/Modem.cpp @@ -65,7 +65,7 @@ using namespace modem; 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, uint32_t dmrQueueSize, uint32_t p25QueueSize, uint32_t nxdnQueueSize, - bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug) : + bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool displayDebugMessages, bool trace, bool debug) : m_port(port), m_protoVer(0U), m_dmrColorCode(0U), @@ -158,6 +158,7 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, m_flashDisabled(false), m_gotModemStatus(false), m_dumpModemStatus(dumpModemStatus), + m_displayModemDebugMessages(displayDebugMessages), m_respTrace(false), m_trace(trace), m_debug(debug) @@ -2316,6 +2317,9 @@ void Modem::processFlashConfig(const uint8_t *buffer) void Modem::printDebug(const uint8_t* buffer, uint16_t len) { + if (!m_displayModemDebugMessages) + return; + if (m_rspDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) { uint8_t data[512U]; ::memset(data, 0x00U, 512U); diff --git a/src/host/modem/Modem.h b/src/host/modem/Modem.h index 219a8cd5..8c2b145c 100644 --- a/src/host/modem/Modem.h +++ b/src/host/modem/Modem.h @@ -306,12 +306,13 @@ namespace modem * @param disableOFlowReset Flag indicating whether the ADC/DAC overflow reset logic is disabled. * @param ignoreModemConfigArea Flag indicating whether the modem configuration area is ignored. * @param dumpModemStatus Flag indicating whether the modem status is dumped to the log. + * @param displayDebugMessages Flag indicating whether or not modem debug messages are displayed in the log. * @param trace Flag indicating whether air interface modem trace is enabled. * @param debug Flag indicating whether air interface modem debug is enabled. */ 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, uint32_t dmrQueueSize, uint32_t p25QueueSize, uint32_t nxdnQueueSize, - bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool trace, bool debug); + bool disableOFlowReset, bool ignoreModemConfigArea, bool dumpModemStatus, bool displayDebugMessages, bool trace, bool debug); /** * @brief Finalizes a instance of the Modem class. */ @@ -827,6 +828,7 @@ namespace modem bool m_gotModemStatus; bool m_dumpModemStatus; + bool m_displayModemDebugMessages; /** * @brief Internal helper to warm reset the connection to the modem. diff --git a/src/host/modem/ModemV24.cpp b/src/host/modem/ModemV24.cpp index ea6ef12f..48c23410 100644 --- a/src/host/modem/ModemV24.cpp +++ b/src/host/modem/ModemV24.cpp @@ -40,9 +40,9 @@ using namespace p25::dfsi::frames; /* Initializes a new instance of the ModemV24 class. */ ModemV24::ModemV24(port::IModemPort* port, bool duplex, uint32_t p25QueueSize, uint32_t p25TxQueueSize, - bool rtrt, uint16_t jitter, bool dumpModemStatus, bool trace, bool debug) : + bool rtrt, uint16_t jitter, bool dumpModemStatus, bool displayDebugMessages, bool trace, bool debug) : Modem(port, duplex, false, false, false, false, false, 80U, 7U, 8U, 1U, p25QueueSize, 1U, - false, false, dumpModemStatus, trace, debug), + false, false, dumpModemStatus, displayDebugMessages, trace, debug), m_rtrt(rtrt), m_superFrameCnt(0U), m_audio(), diff --git a/src/host/modem/ModemV24.h b/src/host/modem/ModemV24.h index 25dfffe4..7b7e6d36 100644 --- a/src/host/modem/ModemV24.h +++ b/src/host/modem/ModemV24.h @@ -79,6 +79,9 @@ namespace modem kId(0U), VHDR1(nullptr), VHDR2(nullptr), + LDULC(nullptr), + seqNo(0U), + n(0U), netLDU1(nullptr), netLDU2(nullptr), pduUserData(nullptr), @@ -89,8 +92,8 @@ namespace modem errors(0U) { MI = new uint8_t[P25DEF::MI_LENGTH_BYTES]; - VHDR1 = new uint8_t[P25DFSIDEF::DFSI_TIA_VHDR_LEN]; - VHDR2 = new uint8_t[P25DFSIDEF::DFSI_TIA_VHDR_LEN]; + VHDR1 = new uint8_t[P25DFSIDEF::DFSI_MOT_VHDR_1_LEN]; + VHDR2 = new uint8_t[P25DFSIDEF::DFSI_MOT_VHDR_2_LEN]; LDULC = new uint8_t[P25DEF::P25_LDU_LC_FEC_LENGTH_BYTES]; netLDU1 = new uint8_t[9U * 25U]; @@ -109,20 +112,34 @@ namespace modem */ ~DFSICallData() { - if (MI != nullptr) + if (MI != nullptr) { delete[] MI; - if (VHDR1 != nullptr) + MI = nullptr; + } + if (VHDR1 != nullptr) { delete[] VHDR1; - if (VHDR2 != nullptr) + VHDR1 = nullptr; + } + if (VHDR2 != nullptr) { delete[] VHDR2; - if (LDULC != nullptr) + VHDR2 = nullptr; + } + if (LDULC != nullptr) { delete[] LDULC; - if (netLDU1 != nullptr) + LDULC = nullptr; + } + if (netLDU1 != nullptr) { delete[] netLDU1; - if (netLDU2 != nullptr) + netLDU1 = nullptr; + } + if (netLDU2 != nullptr) { delete[] netLDU2; - if (pduUserData != nullptr) + netLDU2 = nullptr; + } + if (pduUserData != nullptr) { delete[] pduUserData; + pduUserData = nullptr; + } } /** @@ -146,9 +163,9 @@ namespace modem kId = 0U; if (VHDR1 != nullptr) - ::memset(VHDR1, 0x00U, P25DFSIDEF::DFSI_TIA_VHDR_LEN); + ::memset(VHDR1, 0x00U, P25DFSIDEF::DFSI_MOT_VHDR_1_LEN); if (VHDR2 != nullptr) - ::memset(VHDR2, 0x00U, P25DFSIDEF::DFSI_TIA_VHDR_LEN); + ::memset(VHDR2, 0x00U, P25DFSIDEF::DFSI_MOT_VHDR_2_LEN); if (LDULC != nullptr) ::memset(LDULC, 0x00U, P25DEF::P25_LDU_LC_FEC_LENGTH_BYTES); @@ -500,11 +517,12 @@ namespace modem * @param diu Flag indicating whether or not V.24 communications are to a DIU. * @param jitter * @param dumpModemStatus Flag indicating whether the modem status is dumped to the log. + * @param displayDebugMessages Flag indicating whether or not modem debug messages are displayed in the log. * @param trace Flag indicating whether air interface modem trace is enabled. * @param debug Flag indicating whether air interface modem debug is enabled. */ ModemV24(port::IModemPort* port, bool duplex, uint32_t p25QueueSize, uint32_t p25TxQueueSize, - bool rtrt, uint16_t jitter, bool dumpModemStatus, bool trace, bool debug); + bool rtrt, uint16_t jitter, bool dumpModemStatus, bool displayDebugMessages, bool trace, bool debug); /** * @brief Finalizes a instance of the ModemV24 class. */ diff --git a/src/host/setup/HostSetup.cpp b/src/host/setup/HostSetup.cpp index f3d42fe2..66a4199f 100644 --- a/src/host/setup/HostSetup.cpp +++ b/src/host/setup/HostSetup.cpp @@ -882,7 +882,7 @@ bool HostSetup::createModem(bool consoleDisplay) return 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 = new Modem(modemPort, false, rxInvert, txInvert, pttInvert, dcBlocker, false, fdmaPreamble, dmrRxDelay, p25CorrCount, 3960U, 2592U, 1488U, false, ignoreModemConfigArea, false, 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/src/host/setup/SetupMainWnd.h b/src/host/setup/SetupMainWnd.h index 401b90d6..05fae774 100644 --- a/src/host/setup/SetupMainWnd.h +++ b/src/host/setup/SetupMainWnd.h @@ -461,6 +461,7 @@ public: }); m_modemDebug.addCallback("toggled", this, [&]() { m_setup->m_modem->m_debug = m_modemDebug.isChecked(); + m_setup->m_modem->m_displayModemDebugMessages = m_modemDebug.isChecked(); m_setup->m_debug = m_modemDebug.isChecked(); m_setup->writeConfig(); });