mirror of https://github.com/g4klx/MMDVM.git
Tweaks to the P25 TX and RX.
This commit is contained in:
parent
84c037e075
commit
f4262c3a24
20
P25Defines.h
20
P25Defines.h
|
@ -21,13 +21,21 @@
|
||||||
|
|
||||||
const unsigned int P25_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate
|
const unsigned int P25_RADIO_SYMBOL_LENGTH = 5U; // At 24 kHz sample rate
|
||||||
|
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_BYTES = 99U;
|
const unsigned int P25_HDR_FRAME_LENGTH_BYTES = 99U;
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_BITS = P25_HDR_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_HDR_FRAME_LENGTH_BITS = P25_HDR_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_HDR_FRAME_LENGTH_SYMBOLS = P25_HDR_FRAME_LENGTH_BYTES * 4U;
|
const unsigned int P25_HDR_FRAME_LENGTH_SYMBOLS = P25_HDR_FRAME_LENGTH_BYTES * 4U;
|
||||||
|
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_BYTES = 216U;
|
const unsigned int P25_LDU_FRAME_LENGTH_BYTES = 216U;
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_BITS = P25_LDU_FRAME_LENGTH_BYTES * 8U;
|
const unsigned int P25_LDU_FRAME_LENGTH_BITS = P25_LDU_FRAME_LENGTH_BYTES * 8U;
|
||||||
const unsigned int P25_LDU_FRAME_LENGTH_SYMBOLS = P25_LDU_FRAME_LENGTH_BYTES * 4U;
|
const unsigned int P25_LDU_FRAME_LENGTH_SYMBOLS = P25_LDU_FRAME_LENGTH_BYTES * 4U;
|
||||||
|
|
||||||
|
const unsigned int P25_TERMLC_FRAME_LENGTH_BYTES = 54U;
|
||||||
|
const unsigned int P25_TERMLC_FRAME_LENGTH_BITS = P25_TERMLC_FRAME_LENGTH_BYTES * 8U;
|
||||||
|
const unsigned int P25_TERMLC_FRAME_LENGTH_SYMBOLS = P25_TERMLC_FRAME_LENGTH_BYTES * 4U;
|
||||||
|
|
||||||
|
const unsigned int P25_TERM_FRAME_LENGTH_BYTES = 18U;
|
||||||
|
const unsigned int P25_TERM_FRAME_LENGTH_BITS = P25_TERM_FRAME_LENGTH_BYTES * 8U;
|
||||||
|
const unsigned int P25_TERM_FRAME_LENGTH_SYMBOLS = P25_TERM_FRAME_LENGTH_BYTES * 4U;
|
||||||
|
|
||||||
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
const unsigned int P25_SYNC_LENGTH_BYTES = 6U;
|
||||||
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
const unsigned int P25_SYNC_LENGTH_BITS = P25_SYNC_LENGTH_BYTES * 8U;
|
||||||
|
|
|
@ -36,7 +36,7 @@ const uint8_t SYNC_SYMBOL_ERRS = 0U;
|
||||||
const uint8_t SYNC_BIT_START_ERRS = 2U;
|
const uint8_t SYNC_BIT_START_ERRS = 2U;
|
||||||
const uint8_t SYNC_BIT_RUN_ERRS = 4U;
|
const uint8_t SYNC_BIT_RUN_ERRS = 4U;
|
||||||
|
|
||||||
const unsigned int MAX_SYNC_FRAMES = 4U + 1U;
|
const unsigned int MAX_SYNC_FRAMES = 3U + 1U;
|
||||||
|
|
||||||
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void CP25RX::processData(q15_t sample)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search for an early sync to indicate an LDU following a header
|
// Search for an early sync to indicate an LDU following a header
|
||||||
if (m_bufferPtr >= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS - 2U) && m_bufferPtr <= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS + 2U)) {
|
if (m_bufferPtr >= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS - 1U) && m_bufferPtr <= (P25_HDR_FRAME_LENGTH_BITS + P25_SYNC_LENGTH_BITS + 1U)) {
|
||||||
// Fuzzy matching of the data sync bit sequence
|
// Fuzzy matching of the data sync bit sequence
|
||||||
if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
if (countBits64((m_bitBuffer & P25_SYNC_BITS_MASK) ^ P25_SYNC_BITS) <= SYNC_BIT_RUN_ERRS) {
|
||||||
DEBUG2("P25RX: found LDU sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS);
|
DEBUG2("P25RX: found LDU sync in Data, pos", m_bufferPtr - P25_SYNC_LENGTH_BITS);
|
||||||
|
|
|
@ -104,7 +104,7 @@ void CP25TX::process()
|
||||||
|
|
||||||
uint8_t CP25TX::writeData(const uint8_t* data, uint8_t length)
|
uint8_t CP25TX::writeData(const uint8_t* data, uint8_t length)
|
||||||
{
|
{
|
||||||
if (length < (P25_HDR_FRAME_LENGTH_BYTES + 1U))
|
if (length < (P25_TERM_FRAME_LENGTH_BYTES + 1U))
|
||||||
return 4U;
|
return 4U;
|
||||||
|
|
||||||
uint16_t space = m_buffer.getSpace();
|
uint16_t space = m_buffer.getSpace();
|
||||||
|
|
Loading…
Reference in New Issue