correct un-updated debug handles in LC; correct TIA mode HDU handling;

82-dvmbridge---implement-notch-filter-for-2175hz-trc-guard-tone
Bryan Biedenkapp 1 year ago
parent 406943d75f
commit 2e0ffab13d

@ -108,6 +108,10 @@ bool LC::decodeHDU(const uint8_t* data, bool rawOnly)
else else
P25Utils::decode(data, raw, 114U, 780U); P25Utils::decode(data, raw, 114U, 780U);
#if DEBUG_P25_HDU
Utils::dump(2U, "LC::decodeHDU(), HDU Raw", raw, P25_HDU_LENGTH_BYTES);
#endif
// decode Golay (18,6,8) FEC // decode Golay (18,6,8) FEC
decodeHDUGolay(raw, rs); decodeHDUGolay(raw, rs);
@ -247,7 +251,7 @@ bool LC::decodeLDU1(const uint8_t* data, bool rawOnly)
decodeLDUHamming(raw, rs + 15U); decodeLDUHamming(raw, rs + 15U);
#if DEBUG_P25_LDU1 #if DEBUG_P25_LDU1
Utils::dump(2U, "LC::decodeLDU1(), LDU1 RS", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::decodeLDU1(), LDU1 RS", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// decode RS (24,12,13) FEC // decode RS (24,12,13) FEC
@ -264,7 +268,7 @@ bool LC::decodeLDU1(const uint8_t* data, bool rawOnly)
} }
#if DEBUG_P25_LDU1 #if DEBUG_P25_LDU1
Utils::dump(2U, "LC::decodeLDU1(), LDU1 LC", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::decodeLDU1(), LDU1 LC", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
return decodeLC(rs, rawOnly); return decodeLC(rs, rawOnly);
@ -282,14 +286,14 @@ void LC::encodeLDU1(uint8_t* data)
encodeLC(rs); encodeLC(rs);
#if DEBUG_P25_LDU1 #if DEBUG_P25_LDU1
Utils::dump(2U, "LC::encodeLDU1(), LDU1 LC", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::encodeLDU1(), LDU1 LC", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// encode RS (24,12,13) FEC // encode RS (24,12,13) FEC
m_rs.encode241213(rs); m_rs.encode241213(rs);
#if DEBUG_P25_LDU1 #if DEBUG_P25_LDU1
Utils::dump(2U, "LC::encodeLDU1(), LDU1 RS", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::encodeLDU1(), LDU1 RS", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// encode Hamming (10,6,3) FEC and interleave for LC data // encode Hamming (10,6,3) FEC and interleave for LC data
@ -346,7 +350,7 @@ bool LC::decodeLDU2(const uint8_t* data)
decodeLDUHamming(raw, rs + 15U); decodeLDUHamming(raw, rs + 15U);
#if DEBUG_P25_LDU2 #if DEBUG_P25_LDU2
Utils::dump(2U, "LC::decodeLDU2(), LDU2 RS", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::decodeLDU2(), LDU2 RS", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// decode RS (24,16,9) FEC // decode RS (24,16,9) FEC
@ -363,7 +367,7 @@ bool LC::decodeLDU2(const uint8_t* data)
} }
#if DEBUG_P25_LDU2 #if DEBUG_P25_LDU2
Utils::dump(2U, "LC::decodeLDU2(), LDU2 LC", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::decodeLDU2(), LDU2 LC", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
m_algId = rs[9U]; // Algorithm ID m_algId = rs[9U]; // Algorithm ID
@ -414,14 +418,14 @@ void LC::encodeLDU2(uint8_t* data)
rs[11U] = (m_kId >> 0) & 0xFFU; // ... rs[11U] = (m_kId >> 0) & 0xFFU; // ...
#if DEBUG_P25_LDU2 #if DEBUG_P25_LDU2
Utils::dump(2U, "LC::encodeLDU2(), LDU2 LC", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::encodeLDU2(), LDU2 LC", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// encode RS (24,16,9) FEC // encode RS (24,16,9) FEC
m_rs.encode24169(rs); m_rs.encode24169(rs);
#if DEBUG_P25_LDU2 #if DEBUG_P25_LDU2
Utils::dump(2U, "LC::encodeLDU2(), LDU2 RS", rs, P25_LDU_LC_LENGTH_BYTES); Utils::dump(2U, "LC::encodeLDU2(), LDU2 RS", rs, P25_LDU_LC_FEC_LENGTH_BYTES);
#endif #endif
// encode Hamming (10,6,3) FEC and interleave for LC data // encode Hamming (10,6,3) FEC and interleave for LC data

@ -1183,16 +1183,16 @@ void ModemV24::convertToAirTIA(const uint8_t *data, uint32_t length)
::memcpy(raw + 18U, m_rxCall->VHDR2, 18U); ::memcpy(raw + 18U, m_rxCall->VHDR2, 18U);
// buffer for decoded VHDR data // buffer for decoded VHDR data
uint8_t vhdr[DFSI_VHDR_RAW_LEN]; uint8_t vhdr[P25_HDU_LENGTH_BYTES];
uint32_t offset = 0U; uint32_t offset = 0U;
for (uint32_t i = 0; i < DFSI_VHDR_RAW_LEN; i++, offset += 6) for (uint32_t i = 0; i < P25_HDU_LENGTH_BYTES; i++, offset += 6)
Utils::hex2Bin(raw[i], vhdr, offset); Utils::hex2Bin(raw[i], vhdr, offset);
// try to decode the RS data // try to decode the RS data
try { try {
lc::LC lc = lc::LC(); bool ret = m_rs.decode362017(vhdr);
if (!lc.decodeHDU(raw, true)) { if (!ret) {
LogError(LOG_MODEM, "V.24/DFSI traffic failed to decode RS (36,20,17) FEC"); LogError(LOG_MODEM, "V.24/DFSI traffic failed to decode RS (36,20,17) FEC");
} else { } else {
// late entry? // late entry?
@ -1203,20 +1203,24 @@ void ModemV24::convertToAirTIA(const uint8_t *data, uint32_t length)
LogDebug(LOG_MODEM, "V24 RX VHDR late entry, resetting call data"); LogDebug(LOG_MODEM, "V24 RX VHDR late entry, resetting call data");
} }
uint8_t mi[MI_LENGTH_BYTES]; ::memcpy(m_rxCall->MI, vhdr, MI_LENGTH_BYTES);
lc.getMI(mi);
::memcpy(m_rxCall->MI, mi, MI_LENGTH_BYTES);
m_rxCall->mfId = lc.getMFId(); m_rxCall->mfId = vhdr[9U];
m_rxCall->algoId = lc.getAlgId(); m_rxCall->algoId = vhdr[10U];
m_rxCall->kId = lc.getKId(); m_rxCall->kId = __GET_UINT16B(vhdr, 11U);
m_rxCall->dstId = lc.getDstId(); m_rxCall->dstId = __GET_UINT16B(vhdr, 13U);
if (m_debug) { if (m_debug) {
LogDebug(LOG_MODEM, "P25, VHDR algId = $%02X, kId = $%04X, dstId = $%04X", m_rxCall->algoId, m_rxCall->kId, m_rxCall->dstId); LogDebug(LOG_MODEM, "P25, VHDR algId = $%02X, kId = $%04X, dstId = $%04X", m_rxCall->algoId, m_rxCall->kId, m_rxCall->dstId);
} }
// generate a HDU
lc::LC lc = lc::LC();
lc.setDstId(m_rxCall->dstId);
lc.setAlgId(m_rxCall->algoId);
lc.setKId(m_rxCall->kId);
lc.setMI(m_rxCall->MI);
// generate Sync // generate Sync
Sync::addP25Sync(buffer + 2U); Sync::addP25Sync(buffer + 2U);
@ -1762,6 +1766,30 @@ void ModemV24::startOfStreamTIA(const p25::lc::LC& control)
queueP25Frame(buffer, length, STT_NON_IMBE); queueP25Frame(buffer, length, STT_NON_IMBE);
uint8_t mi[MI_LENGTH_BYTES];
::memset(mi, 0x00U, MI_LENGTH_BYTES);
control.getMI(mi);
uint8_t vhdr[P25_HDU_LENGTH_BYTES];
::memset(vhdr, 0x00U, P25_HDU_LENGTH_BYTES);
::memcpy(vhdr, mi, MI_LENGTH_BYTES);
vhdr[9U] = control.getMFId();
vhdr[10U] = control.getAlgId();
__SET_UINT16B(control.getKId(), vhdr, 11U);
__SET_UINT16B(control.getDstId(), vhdr, 13U);
// perform RS encoding
m_rs.encode362017(vhdr);
// convert the binary bytes to hex bytes
uint8_t raw[DFSI_VHDR_RAW_LEN];
uint32_t offset = 0;
for (uint8_t i = 0; i < DFSI_VHDR_RAW_LEN; i++, offset += 6) {
raw[i] = Utils::bin2Hex(vhdr, offset);
}
::memset(buffer, 0x00U, P25_HDU_LENGTH_BYTES); ::memset(buffer, 0x00U, P25_HDU_LENGTH_BYTES);
length = 0U; length = 0U;
@ -1783,13 +1811,6 @@ void ModemV24::startOfStreamTIA(const p25::lc::LC& control)
::memset(hdu, 0x00U, P25_HDU_LENGTH_BYTES); ::memset(hdu, 0x00U, P25_HDU_LENGTH_BYTES);
lc.encodeHDU(hdu, true); lc.encodeHDU(hdu, true);
// convert the binary bytes to hex bytes
uint8_t raw[DFSI_VHDR_RAW_LEN];
uint32_t offset = 0;
for (uint8_t i = 0; i < DFSI_VHDR_RAW_LEN; i++, offset += 6) {
raw[i] = Utils::bin2Hex(hdu, offset);
}
// prepare VHDR1 // prepare VHDR1
buffer[3U] = DFSIFrameType::MOT_VHDR_1; buffer[3U] = DFSIFrameType::MOT_VHDR_1;
::memcpy(buffer + 4U, raw, 18U); ::memcpy(buffer + 4U, raw, 18U);

Loading…
Cancel
Save

Powered by TurnKey Linux.