make incorrect/possible sync word messages normal warnings; add support for air interface firmware level P25 NAC checking; add support to enable/disable selectable modem debug in calibration mode; add display of possible sync bytes to the calibration mode for P25; comment out unused variable (for now) causing compilation warning; ensure P25_DENY_RSN_PTT_BONK is transmitted as a denial for a group grant when the channel is in use;

pull/1/head
Bryan Biedenkapp 5 years ago
parent 75facc7297
commit 91158f84da

@ -212,22 +212,21 @@ bool Slot::processFrame(uint8_t *data, uint32_t len)
bool voiceSync = (data[1U] & DMR_SYNC_VOICE) == DMR_SYNC_VOICE; bool voiceSync = (data[1U] & DMR_SYNC_VOICE) == DMR_SYNC_VOICE;
if (!(dataSync || voiceSync) && m_rfState == RS_RF_LISTENING) { if (!(dataSync || voiceSync) && m_rfState == RS_RF_LISTENING) {
if (m_verbose) { uint8_t sync[DMR_SYNC_LENGTH_BYTES];
uint8_t sync[DMR_SYNC_LENGTH_BYTES]; ::memcpy(sync, data + 2U, DMR_SYNC_LENGTH_BYTES);
::memcpy(sync, data + 2U, DMR_SYNC_LENGTH_BYTES);
// count data sync errors // count data sync errors
uint8_t dataErrs = 0U; uint8_t dataErrs = 0U;
for (uint8_t i = 0U; i < DMR_SYNC_LENGTH_BYTES; i++) for (uint8_t i = 0U; i < DMR_SYNC_LENGTH_BYTES; i++)
dataErrs += Utils::countBits8(sync[i] ^ DMR_MS_DATA_SYNC_BYTES[i]); dataErrs += Utils::countBits8(sync[i] ^ DMR_MS_DATA_SYNC_BYTES[i]);
// count voice sync errors // count voice sync errors
uint8_t voiceErrs = 0U; uint8_t voiceErrs = 0U;
for (uint8_t i = 0U; i < DMR_SYNC_LENGTH_BYTES; i++) for (uint8_t i = 0U; i < DMR_SYNC_LENGTH_BYTES; i++)
voiceErrs += Utils::countBits8(sync[i] ^ DMR_MS_VOICE_SYNC_BYTES[i]); voiceErrs += Utils::countBits8(sync[i] ^ DMR_MS_VOICE_SYNC_BYTES[i]);
LogDebug(LOG_RF, "DMR, sync word rejected, dataErrs = %u, voiceErrs = %u", dataErrs, voiceErrs); LogWarning(LOG_RF, "DMR, possible sync word rejected, dataErrs = %u, voiceErrs = %u, sync word = %02X %02X %02X %02X %02X %02X", dataErrs, voiceErrs,
} sync[0U], sync[1U], sync[2U], sync[3U], sync[4U], sync[5U]);
} }
if ((dataSync || voiceSync) && m_debug) { if ((dataSync || voiceSync) && m_debug) {

@ -1244,7 +1244,8 @@ bool Host::createModem()
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);
m_modem->setDMRParams(m_dmrColorCode); m_modem->setDMRColorCode(m_dmrColorCode);
m_modem->setP25NAC(m_p25NAC);
bool ret = m_modem->open(); bool ret = m_modem->open();
if (!ret) { if (!ret) {

@ -275,6 +275,13 @@ int HostCal::run()
writeConfig(); writeConfig();
} }
break; break;
case 'D':
{
m_debug = !m_debug;
LogMessage(LOG_CAL, " - Modem Debug: %s", m_debug ? "On" : "Off");
writeConfig();
}
break;
case 'R': case 'R':
setRXLevel(1); setRXLevel(1);
break; break;
@ -307,7 +314,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
if (m_mode == STATE_DMR_CAL) { if (m_mode == STATE_DMR_CAL) {
m_modeStr = DMR_SYM_LA_TST_STR; m_modeStr = DMR_SYM_LA_TST_STR;
@ -330,7 +336,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
if (m_mode == STATE_DMR_CAL) { if (m_mode == STATE_DMR_CAL) {
m_modeStr = DMR_SYM_LB_TST_STR; m_modeStr = DMR_SYM_LB_TST_STR;
@ -353,7 +358,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
if (m_mode == STATE_DMR_CAL) { if (m_mode == STATE_DMR_CAL) {
m_modeStr = DMR_SYM_LC_TST_STR; m_modeStr = DMR_SYM_LC_TST_STR;
@ -376,7 +380,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
if (m_mode == STATE_DMR_CAL) { if (m_mode == STATE_DMR_CAL) {
m_modeStr = DMR_SYM_LD_TST_STR; m_modeStr = DMR_SYM_LD_TST_STR;
@ -403,7 +406,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -418,7 +420,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -433,7 +434,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -448,7 +448,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -463,7 +462,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -478,7 +476,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -499,7 +496,6 @@ int HostCal::run()
m_duplex = false; m_duplex = false;
m_dmrEnabled = true; m_dmrEnabled = true;
m_p25Enabled = false; m_p25Enabled = false;
m_debug = true;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -520,7 +516,6 @@ int HostCal::run()
m_duplex = false; m_duplex = false;
m_dmrEnabled = false; m_dmrEnabled = false;
m_p25Enabled = true; m_p25Enabled = true;
m_debug = true;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -535,7 +530,6 @@ int HostCal::run()
m_dmrRx1K = false; m_dmrRx1K = false;
m_p25Enabled = false; m_p25Enabled = false;
m_p25Rx1K = false; m_p25Rx1K = false;
m_debug = false;
LogMessage(LOG_CAL, " - %s", m_modeStr.c_str()); LogMessage(LOG_CAL, " - %s", m_modeStr.c_str());
writeConfig(); writeConfig();
@ -571,6 +565,8 @@ int HostCal::run()
end = true; end = true;
break; break;
case 13:
case 10:
case -1: case -1:
break; break;
default: default:
@ -802,8 +798,6 @@ bool HostCal::initModem()
bool ret = writeConfig(); bool ret = writeConfig();
if (!ret) { if (!ret) {
LogMessage(LOG_CAL, " - Modem unresponsive, retrying...");
sleep(2500U);
ret = writeConfig(); ret = writeConfig();
if (!ret) { if (!ret) {
LogError(LOG_CAL, "Modem unresponsive to configuration set after 2 attempts, calibration may fail."); LogError(LOG_CAL, "Modem unresponsive to configuration set after 2 attempts, calibration may fail.");
@ -1072,6 +1066,16 @@ void HostCal::processP25BER(const uint8_t* buffer)
{ {
using namespace p25; using namespace p25;
uint8_t sync[P25_SYNC_LENGTH_BYTES];
::memcpy(sync, buffer + 1U, P25_SYNC_LENGTH_BYTES);
uint8_t syncErrs = 0U;
for (uint8_t i = 0U; i < P25_SYNC_LENGTH_BYTES; i++)
syncErrs += Utils::countBits8(sync[i] ^ P25_SYNC_BYTES[i]);
LogMessage(LOG_CAL, "P25, sync word, errs = %u, sync word = %02X %02X %02X %02X %02X %02X", syncErrs,
sync[0U], sync[1U], sync[2U], sync[3U], sync[4U], sync[5U]);
uint8_t nid[P25_NID_LENGTH_BYTES]; uint8_t nid[P25_NID_LENGTH_BYTES];
P25Utils::decode(buffer + 1U, nid, 48U, 114U); P25Utils::decode(buffer + 1U, nid, 48U, 114U);
uint8_t duid = nid[1U] & 0x0FU; uint8_t duid = nid[1U] & 0x0FU;
@ -1090,7 +1094,7 @@ void HostCal::processP25BER(const uint8_t* buffer)
m_berUndecodableLC++; m_berUndecodableLC++;
} }
else { else {
LogMessage(LOG_RF, "P25_DUID_HDU (Header), dstId = %u, algo = %X, kid = %X", lc.getDstId(), lc.getAlgId(), lc.getKId()); LogMessage(LOG_CAL, "P25_DUID_HDU (Header), dstId = %u, algo = %X, kid = %X", lc.getDstId(), lc.getAlgId(), lc.getKId());
} }
m_berBits = 0U; m_berBits = 0U;
@ -1474,7 +1478,10 @@ bool HostCal::writeConfig(uint8_t modeOverride)
buffer[9U] = 1U; buffer[9U] = 1U;
buffer[10U] = m_dmrRxDelay; buffer[10U] = m_dmrRxDelay;
buffer[11U] = 128U;
uint32_t nac = 0xF7EU;
buffer[11U] = (nac >> 4) & 0xFFU;
buffer[12U] = (nac << 4) & 0xF0U;
buffer[13U] = (uint8_t)(m_txLevel * 2.55F + 0.5F); buffer[13U] = (uint8_t)(m_txLevel * 2.55F + 0.5F);
buffer[15U] = (uint8_t)(m_txLevel * 2.55F + 0.5F); buffer[15U] = (uint8_t)(m_txLevel * 2.55F + 0.5F);

@ -74,6 +74,7 @@ Modem::Modem(const std::string& port, bool duplex, bool rxInvert, bool txInvert,
bool cosLockout, uint8_t fdmaPreamble, uint8_t dmrRxDelay, uint8_t packetPlayoutTime, 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_p25NAC(0x293U),
m_duplex(duplex), m_duplex(duplex),
m_rxInvert(rxInvert), m_rxInvert(rxInvert),
m_txInvert(txInvert), m_txInvert(txInvert),
@ -170,13 +171,24 @@ void Modem::setLevels(float rxLevel, float cwIdTXLevel, float dmrTXLevel, float
/// Sets the modem DSP DMR color code. /// Sets the modem DSP DMR color code.
/// </summary> /// </summary>
/// <param name="colorCode"></param> /// <param name="colorCode"></param>
void Modem::setDMRParams(uint32_t colorCode) void Modem::setDMRColorCode(uint32_t colorCode)
{ {
assert(colorCode < 16U); assert(colorCode < 16U);
m_dmrColorCode = colorCode; m_dmrColorCode = colorCode;
} }
/// <summary>
/// Sets the modem DSP P25 NAC.
/// </summary>
/// <param name="nac"></param>
void Modem::setP25NAC(uint32_t nac)
{
assert(nac < 0xFFFU);
m_p25NAC = nac;
}
/// <summary> /// <summary>
/// Sets the modem DSP RF receive deviation levels. /// Sets the modem DSP RF receive deviation levels.
/// </summary> /// </summary>
@ -1156,7 +1168,8 @@ bool Modem::writeConfig()
buffer[10U] = m_dmrRxDelay; buffer[10U] = m_dmrRxDelay;
buffer[11U] = 128U; // Was OscOffset buffer[11U] = (m_p25NAC >> 4) & 0xFFU;
buffer[12U] = (m_p25NAC << 4) & 0xF0U;
buffer[13U] = (uint8_t)(m_dmrTXLevel * 2.55F + 0.5F); buffer[13U] = (uint8_t)(m_dmrTXLevel * 2.55F + 0.5F);
buffer[15U] = (uint8_t)(m_p25TXLevel * 2.55F + 0.5F); buffer[15U] = (uint8_t)(m_p25TXLevel * 2.55F + 0.5F);

@ -140,6 +140,8 @@ namespace modem
RSN_INVALID_DMR_START = 14U, RSN_INVALID_DMR_START = 14U,
RSN_INVALID_DMR_RX_DELAY = 15U, RSN_INVALID_DMR_RX_DELAY = 15U,
RSN_INVALID_P25_NAC = 16U,
RSN_DMR_DISABLED = 63U, RSN_DMR_DISABLED = 63U,
RSN_P25_DISABLED = 64U, RSN_P25_DISABLED = 64U,
}; };
@ -174,7 +176,9 @@ namespace modem
/// <summary>Sets the modem DSP RF deviation levels.</summary> /// <summary>Sets the modem DSP RF deviation levels.</summary>
virtual void setLevels(float rxLevel, float cwIdTXLevel, float dmrTXLevel, float p25TXLevel); virtual void setLevels(float rxLevel, float cwIdTXLevel, float dmrTXLevel, float p25TXLevel);
/// <summary>Sets the modem DSP DMR color code.</summary> /// <summary>Sets the modem DSP DMR color code.</summary>
virtual void setDMRParams(uint32_t colorCode); virtual void setDMRColorCode(uint32_t colorCode);
/// <summary>Sets the modem DSP P25 NAC.</summary>
virtual void setP25NAC(uint32_t nac);
/// <summary>Sets the modem DSP RF receive deviation levels.</summary> /// <summary>Sets the modem DSP RF receive deviation levels.</summary>
virtual void setRXLevel(float rxLevel); virtual void setRXLevel(float rxLevel);
@ -253,6 +257,7 @@ namespace modem
std::string m_port; std::string m_port;
uint32_t m_dmrColorCode; uint32_t m_dmrColorCode;
uint32_t m_p25NAC;
bool m_duplex; bool m_duplex;

@ -56,7 +56,7 @@ namespace modem
/// <summary>Sets the modem DSP RF deviation levels.</summary> /// <summary>Sets the modem DSP RF deviation levels.</summary>
virtual void setLevels(float rxLevel, float cwIdTXLevel, float dmrTXLevel, float p25TXLevel) { return; } virtual void setLevels(float rxLevel, float cwIdTXLevel, float dmrTXLevel, float p25TXLevel) { return; }
/// <summary>Sets the modem DSP DMR color code.</summary> /// <summary>Sets the modem DSP DMR color code.</summary>
virtual void setDMRParams(uint32_t colorCode) { return; } virtual void setDMRColorCode(uint32_t colorCode) { return; }
/// <summary>Sets the modem DSP RF receive deviation levels.</summary> /// <summary>Sets the modem DSP RF receive deviation levels.</summary>
virtual void setRXLevel(float rxLevel) { return; } virtual void setRXLevel(float rxLevel) { return; }

@ -849,7 +849,7 @@ void DataPacket::writeNet_PDU_Header()
m_netBlocksToFollow = m_netDataHeader.getBlocksToFollow(); m_netBlocksToFollow = m_netDataHeader.getBlocksToFollow();
uint32_t bitLength = ((m_netDataHeader.getBlocksToFollow() + 1U) * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS; //uint32_t bitLength = ((m_netDataHeader.getBlocksToFollow() + 1U) * P25_PDU_FEC_LENGTH_BITS) + P25_PREAMBLE_LENGTH_BITS;
m_netBitOffset = P25_PREAMBLE_LENGTH_BITS; m_netBitOffset = P25_PREAMBLE_LENGTH_BITS;
::memset(buffer, 0x00U, P25_PDU_FEC_LENGTH_BYTES); ::memset(buffer, 0x00U, P25_PDU_FEC_LENGTH_BYTES);

@ -1858,6 +1858,8 @@ bool TrunkPacket::writeRF_TSDU_Grant(bool grp, bool skip)
// don't transmit grants if the destination ID's don't match and the network TG hang timer is running // don't transmit grants if the destination ID's don't match and the network TG hang timer is running
if (m_p25->m_rfLastDstId != 0U) { if (m_p25->m_rfLastDstId != 0U) {
if (m_p25->m_rfLastDstId != m_rfTSBK.getDstId() && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) { if (m_p25->m_rfLastDstId != m_rfTSBK.getDstId() && (m_p25->m_rfTGHang.isRunning() && !m_p25->m_rfTGHang.hasExpired())) {
writeRF_TSDU_Deny(P25_DENY_RSN_PTT_BONK, (grp) ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH);
m_p25->checkAndReject();
m_rfTSBK.setLCO(lco); m_rfTSBK.setLCO(lco);
return false; return false;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.