add option displayModemDebugMessages to optionally disable or enable debug log messages coming *from* the modem; properly check if we're operating in DFSI or not and if we are do not attempt to set the FIFO buffer lengths or clear buffers related to DMR or NXDN; correct deletion of array types in the DFSICallData structure; correct bad length of the VHDR1 during DFSICallData initialization, the length defaulted to TIA mode which would cause a crash when trying to delete and deallocate VHDR1 when used in V.24 mode;

r05a04_dev
Bryan Biedenkapp 6 days ago
parent a43efddc1f
commit 5c74c90f48

@ -689,6 +689,8 @@ system:
ignoreModemConfigArea: false ignoreModemConfigArea: false
# Flag indicating whether verbose dumping of the modem status is enabled. # Flag indicating whether verbose dumping of the modem status is enabled.
dumpModemStatus: false 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. # Flag indicating whether or not trace logging is enabled.
trace: false trace: false
# Flag indicating whether or not debug logging is enabled. # Flag indicating whether or not debug logging is enabled.

@ -542,13 +542,16 @@ bool Host::createModem()
bool disableOFlowReset = modemConf["disableOFlowReset"].as<bool>(false); bool disableOFlowReset = modemConf["disableOFlowReset"].as<bool>(false);
bool ignoreModemConfigArea = modemConf["ignoreModemConfigArea"].as<bool>(false); bool ignoreModemConfigArea = modemConf["ignoreModemConfigArea"].as<bool>(false);
bool dumpModemStatus = modemConf["dumpModemStatus"].as<bool>(false); bool dumpModemStatus = modemConf["dumpModemStatus"].as<bool>(false);
bool displayModemDebugMessages = modemConf["displayModemDebugMessages"].as<bool>(false);
bool respTrace = modemConf["respTrace"].as<bool>(false); bool respTrace = modemConf["respTrace"].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);
// if modem debug is being forced from the commandline -- enable modem debug // if modem debug is being forced from the commandline -- enable modem debug
if (g_modemDebug) if (g_modemDebug) {
displayModemDebugMessages = true;
debug = true; debug = true;
}
if (rfPower == 0U) { // clamp to 1 if (rfPower == 0U) { // clamp to 1
rfPower = 1U; rfPower = 1U;
@ -707,6 +710,10 @@ bool Host::createModem()
if (dumpModemStatus) { if (dumpModemStatus) {
LogInfo(" Dump Modem Status: yes"); LogInfo(" Dump Modem Status: yes");
} }
if (displayModemDebugMessages) {
LogInfo(" Display Modem Debug Messages: yes");
}
} }
if (debug) { if (debug) {
@ -715,12 +722,12 @@ bool Host::createModem()
if (m_isModemDFSI) { if (m_isModemDFSI) {
m_modem = new ModemV24(modemPort, m_duplex, m_p25QueueSizeBytes, m_p25QueueSizeBytes, rtrt, jitter, 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)->setCallTimeout(dfsiCallTimeout);
((ModemV24*)m_modem)->setTIAFormat(dfsiTIAMode); ((ModemV24*)m_modem)->setTIAFormat(dfsiTIAMode);
} else { } else {
m_modem = new Modem(modemPort, m_duplex, rxInvert, txInvert, pttInvert, dcBlocker, cosLockout, fdmaPreamble, dmrRxDelay, p25CorrCount, 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) { if (!m_modemRemote) {
m_modem->setModeParams(m_dmrEnabled, m_p25Enabled, m_nxdnEnabled); m_modem->setModeParams(m_dmrEnabled, m_p25Enabled, m_nxdnEnabled);
@ -757,6 +764,7 @@ bool Host::createModem()
return false; return false;
} }
if (!m_isModemDFSI)
m_modem->setFifoLength(dmrFifoLength, p25FifoLength, nxdnFifoLength); m_modem->setFifoLength(dmrFifoLength, p25FifoLength, nxdnFifoLength);
// are we on a protocol version older then 3? // are we on a protocol version older then 3?

@ -748,10 +748,12 @@ int Host::run()
::LogInfoEx(LOG_HOST, "[WAIT] Host is performing late initialization and warmup"); ::LogInfoEx(LOG_HOST, "[WAIT] Host is performing late initialization and warmup");
m_modem->clearNXDNFrame();
m_modem->clearP25Frame(); m_modem->clearP25Frame();
if (!m_isModemDFSI) {
m_modem->clearDMRFrame2(); m_modem->clearDMRFrame2();
m_modem->clearDMRFrame1(); m_modem->clearDMRFrame1();
m_modem->clearNXDNFrame();
}
// perform early pumping of the modem clock (this is so the DSP has time to setup its buffers), // 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) // and clock the network (so it may perform early connect)

@ -211,6 +211,7 @@ int HostCal::run(int argc, char **argv)
{ {
m_debug = !m_debug; m_debug = !m_debug;
LogInfoEx(LOG_CAL, " - Modem Debug: %s", m_debug ? "On" : "Off"); LogInfoEx(LOG_CAL, " - Modem Debug: %s", m_debug ? "On" : "Off");
m_modem->m_displayModemDebugMessages = m_debug;
writeConfig(); writeConfig();
} }
break; break;

@ -65,7 +65,7 @@ using namespace modem;
Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert, bool pttInvert, bool dcBlocker, bool cosLockout, 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, 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_port(port),
m_protoVer(0U), m_protoVer(0U),
m_dmrColorCode(0U), m_dmrColorCode(0U),
@ -158,6 +158,7 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert,
m_flashDisabled(false), m_flashDisabled(false),
m_gotModemStatus(false), m_gotModemStatus(false),
m_dumpModemStatus(dumpModemStatus), m_dumpModemStatus(dumpModemStatus),
m_displayModemDebugMessages(displayDebugMessages),
m_respTrace(false), m_respTrace(false),
m_trace(trace), m_trace(trace),
m_debug(debug) m_debug(debug)
@ -2316,6 +2317,9 @@ void Modem::processFlashConfig(const uint8_t *buffer)
void Modem::printDebug(const uint8_t* buffer, uint16_t len) void Modem::printDebug(const uint8_t* buffer, uint16_t len)
{ {
if (!m_displayModemDebugMessages)
return;
if (m_rspDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) { if (m_rspDoubleLength && buffer[3U] == CMD_DEBUG_DUMP) {
uint8_t data[512U]; uint8_t data[512U];
::memset(data, 0x00U, 512U); ::memset(data, 0x00U, 512U);

@ -306,12 +306,13 @@ namespace modem
* @param disableOFlowReset Flag indicating whether the ADC/DAC overflow reset logic is disabled. * @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 ignoreModemConfigArea Flag indicating whether the modem configuration area is ignored.
* @param dumpModemStatus Flag indicating whether the modem status is dumped to the log. * @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 trace Flag indicating whether air interface modem trace is enabled.
* @param debug Flag indicating whether air interface modem debug 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, 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, 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. * @brief Finalizes a instance of the Modem class.
*/ */
@ -827,6 +828,7 @@ namespace modem
bool m_gotModemStatus; bool m_gotModemStatus;
bool m_dumpModemStatus; bool m_dumpModemStatus;
bool m_displayModemDebugMessages;
/** /**
* @brief Internal helper to warm reset the connection to the modem. * @brief Internal helper to warm reset the connection to the modem.

@ -40,9 +40,9 @@ using namespace p25::dfsi::frames;
/* Initializes a new instance of the ModemV24 class. */ /* Initializes a new instance of the ModemV24 class. */
ModemV24::ModemV24(port::IModemPort* port, bool duplex, uint32_t p25QueueSize, uint32_t p25TxQueueSize, 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, 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_rtrt(rtrt),
m_superFrameCnt(0U), m_superFrameCnt(0U),
m_audio(), m_audio(),

@ -79,6 +79,9 @@ namespace modem
kId(0U), kId(0U),
VHDR1(nullptr), VHDR1(nullptr),
VHDR2(nullptr), VHDR2(nullptr),
LDULC(nullptr),
seqNo(0U),
n(0U),
netLDU1(nullptr), netLDU1(nullptr),
netLDU2(nullptr), netLDU2(nullptr),
pduUserData(nullptr), pduUserData(nullptr),
@ -89,8 +92,8 @@ namespace modem
errors(0U) errors(0U)
{ {
MI = new uint8_t[P25DEF::MI_LENGTH_BYTES]; MI = new uint8_t[P25DEF::MI_LENGTH_BYTES];
VHDR1 = new uint8_t[P25DFSIDEF::DFSI_TIA_VHDR_LEN]; VHDR1 = new uint8_t[P25DFSIDEF::DFSI_MOT_VHDR_1_LEN];
VHDR2 = new uint8_t[P25DFSIDEF::DFSI_TIA_VHDR_LEN]; VHDR2 = new uint8_t[P25DFSIDEF::DFSI_MOT_VHDR_2_LEN];
LDULC = new uint8_t[P25DEF::P25_LDU_LC_FEC_LENGTH_BYTES]; LDULC = new uint8_t[P25DEF::P25_LDU_LC_FEC_LENGTH_BYTES];
netLDU1 = new uint8_t[9U * 25U]; netLDU1 = new uint8_t[9U * 25U];
@ -109,20 +112,34 @@ namespace modem
*/ */
~DFSICallData() ~DFSICallData()
{ {
if (MI != nullptr) if (MI != nullptr) {
delete[] MI; delete[] MI;
if (VHDR1 != nullptr) MI = nullptr;
}
if (VHDR1 != nullptr) {
delete[] VHDR1; delete[] VHDR1;
if (VHDR2 != nullptr) VHDR1 = nullptr;
}
if (VHDR2 != nullptr) {
delete[] VHDR2; delete[] VHDR2;
if (LDULC != nullptr) VHDR2 = nullptr;
}
if (LDULC != nullptr) {
delete[] LDULC; delete[] LDULC;
if (netLDU1 != nullptr) LDULC = nullptr;
}
if (netLDU1 != nullptr) {
delete[] netLDU1; delete[] netLDU1;
if (netLDU2 != nullptr) netLDU1 = nullptr;
}
if (netLDU2 != nullptr) {
delete[] netLDU2; delete[] netLDU2;
if (pduUserData != nullptr) netLDU2 = nullptr;
}
if (pduUserData != nullptr) {
delete[] pduUserData; delete[] pduUserData;
pduUserData = nullptr;
}
} }
/** /**
@ -146,9 +163,9 @@ namespace modem
kId = 0U; kId = 0U;
if (VHDR1 != nullptr) if (VHDR1 != nullptr)
::memset(VHDR1, 0x00U, P25DFSIDEF::DFSI_TIA_VHDR_LEN); ::memset(VHDR1, 0x00U, P25DFSIDEF::DFSI_MOT_VHDR_1_LEN);
if (VHDR2 != nullptr) if (VHDR2 != nullptr)
::memset(VHDR2, 0x00U, P25DFSIDEF::DFSI_TIA_VHDR_LEN); ::memset(VHDR2, 0x00U, P25DFSIDEF::DFSI_MOT_VHDR_2_LEN);
if (LDULC != nullptr) if (LDULC != nullptr)
::memset(LDULC, 0x00U, P25DEF::P25_LDU_LC_FEC_LENGTH_BYTES); ::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 diu Flag indicating whether or not V.24 communications are to a DIU.
* @param jitter * @param jitter
* @param dumpModemStatus Flag indicating whether the modem status is dumped to the log. * @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 trace Flag indicating whether air interface modem trace is enabled.
* @param debug Flag indicating whether air interface modem debug 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, 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. * @brief Finalizes a instance of the ModemV24 class.
*/ */

@ -882,7 +882,7 @@ bool HostSetup::createModem(bool consoleDisplay)
return false; 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->setLevels(rxLevel, txLevel, txLevel, txLevel, txLevel);
m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj, nxdnSymLevel3Adj, nxdnSymLevel1Adj); m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj, nxdnSymLevel3Adj, nxdnSymLevel1Adj);
m_modem->setDCOffsetParams(txDCOffset, rxDCOffset); m_modem->setDCOffsetParams(txDCOffset, rxDCOffset);

@ -461,6 +461,7 @@ public:
}); });
m_modemDebug.addCallback("toggled", this, [&]() { m_modemDebug.addCallback("toggled", this, [&]() {
m_setup->m_modem->m_debug = m_modemDebug.isChecked(); 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->m_debug = m_modemDebug.isChecked();
m_setup->writeConfig(); m_setup->writeConfig();
}); });

Loading…
Cancel
Save

Powered by TurnKey Linux.