mirror of https://github.com/markqvist/MMDVM.git
Merge branch 'master' into nxdn
commit
14a4dc2bf9
|
@ -54,6 +54,7 @@ const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02
|
|||
#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
|
||||
|
||||
const uint32_t STARTUP_COUNT = 20U;
|
||||
const uint32_t ABORT_COUNT = 6U;
|
||||
|
||||
CDMRTX::CDMRTX() :
|
||||
m_fifo(),
|
||||
|
@ -69,6 +70,7 @@ m_poBuffer(),
|
|||
m_poLen(0U),
|
||||
m_poPtr(0U),
|
||||
m_frameCount(0U),
|
||||
m_abortCount(),
|
||||
m_abort()
|
||||
{
|
||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||
|
@ -83,6 +85,9 @@ m_abort()
|
|||
|
||||
m_abort[0U] = false;
|
||||
m_abort[1U] = false;
|
||||
|
||||
m_abortCount[0U] = 0U;
|
||||
m_abortCount[1U] = 0U;
|
||||
}
|
||||
|
||||
void CDMRTX::process()
|
||||
|
@ -210,10 +215,12 @@ uint8_t CDMRTX::writeAbort(const uint8_t* data, uint8_t length)
|
|||
|
||||
switch (data[0U]) {
|
||||
case 1U:
|
||||
m_abortCount[0U] = 0U;
|
||||
m_abort[0U] = true;
|
||||
return 0U;
|
||||
|
||||
case 2U:
|
||||
m_abortCount[1U] = 0U;
|
||||
m_abort[1U] = true;
|
||||
return 0U;
|
||||
|
||||
|
@ -227,6 +234,8 @@ void CDMRTX::setStart(bool start)
|
|||
m_state = start ? DMRTXSTATE_SLOT1 : DMRTXSTATE_IDLE;
|
||||
|
||||
m_frameCount = 0U;
|
||||
m_abortCount[0U] = 0U;
|
||||
m_abortCount[1U] = 0U;
|
||||
|
||||
m_abort[0U] = false;
|
||||
m_abort[1U] = false;
|
||||
|
@ -282,7 +291,7 @@ uint8_t CDMRTX::getSpace2() const
|
|||
|
||||
void CDMRTX::createData(uint8_t slotIndex)
|
||||
{
|
||||
if (m_fifo[slotIndex].getData() > 0U && m_frameCount >= STARTUP_COUNT) {
|
||||
if (m_fifo[slotIndex].getData() >= DMR_FRAME_LENGTH_BYTES && m_frameCount >= STARTUP_COUNT && m_abortCount[slotIndex] >= ABORT_COUNT) {
|
||||
for (unsigned int i = 0U; i < DMR_FRAME_LENGTH_BYTES; i++) {
|
||||
m_poBuffer[i] = m_fifo[slotIndex].get();
|
||||
m_markBuffer[i] = MARK_NONE;
|
||||
|
@ -335,6 +344,8 @@ void CDMRTX::createCal()
|
|||
void CDMRTX::createCACH(uint8_t txSlotIndex, uint8_t rxSlotIndex)
|
||||
{
|
||||
m_frameCount++;
|
||||
m_abortCount[0U]++;
|
||||
m_abortCount[1U]++;
|
||||
|
||||
if (m_cachPtr >= 12U)
|
||||
m_cachPtr = 0U;
|
||||
|
|
|
@ -72,6 +72,7 @@ private:
|
|||
uint16_t m_poLen;
|
||||
uint16_t m_poPtr;
|
||||
uint32_t m_frameCount;
|
||||
uint32_t m_abortCount[2U];
|
||||
bool m_abort[2U];
|
||||
|
||||
void createData(uint8_t slotIndex);
|
||||
|
|
12
P25TX.cpp
12
P25TX.cpp
|
@ -30,12 +30,10 @@ static q15_t RC_0_2_FILTER[] = {-897, -1636, -1840, -1278, 0, 1613, 2936, 3310,
|
|||
-3011, 0, 2315, 3310, 2936, 1613, 0, -1278, -1840, -1636, -897, 0}; // numTaps = 40, L = 5
|
||||
const uint16_t RC_0_2_FILTER_PHASE_LEN = 8U; // phaseLength = numTaps/L
|
||||
|
||||
// Generated in MATLAB using the following commands, and then normalised for unity gain
|
||||
// shape2 = 'Inverse-sinc Lowpass';
|
||||
// d2 = fdesign.interpolator(1, shape2);
|
||||
// h2 = design(d2, 'SystemObject', true);
|
||||
static q15_t LOWPASS_FILTER[] = {1294, -2251, 4312, -8402, 20999, 20999, -8402, 4312, -2251, 1294};
|
||||
const uint16_t LOWPASS_FILTER_LEN = 10U;
|
||||
static q15_t LOWPASS_FILTER[] = {124, -188, -682, 1262, 556, -621, -1912, -911, 2058, 3855, 1234, -4592, -7692, -2799,
|
||||
8556, 18133, 18133, 8556, -2799, -7692, -4592, 1234, 3855, 2058, -911, -1912, -621,
|
||||
556, 1262, -682, -188, 124};
|
||||
const uint16_t LOWPASS_FILTER_LEN = 32U;
|
||||
|
||||
const q15_t P25_LEVELA = 1260;
|
||||
const q15_t P25_LEVELB = 420;
|
||||
|
@ -56,7 +54,7 @@ m_poPtr(0U),
|
|||
m_txDelay(240U) // 200ms
|
||||
{
|
||||
::memset(m_modState, 0x00U, 16U * sizeof(q15_t));
|
||||
::memset(m_lpState, 0x00U, 70U * sizeof(q15_t));
|
||||
::memset(m_lpState, 0x00U, 60U * sizeof(q15_t));
|
||||
|
||||
m_modFilter.L = P25_RADIO_SYMBOL_LENGTH;
|
||||
m_modFilter.phaseLength = RC_0_2_FILTER_PHASE_LEN;
|
||||
|
|
2
P25TX.h
2
P25TX.h
|
@ -40,7 +40,7 @@ private:
|
|||
arm_fir_interpolate_instance_q15 m_modFilter;
|
||||
arm_fir_instance_q15 m_lpFilter;
|
||||
q15_t m_modState[16U]; // blockSize + phaseLength - 1, 4 + 9 - 1 plus some spare
|
||||
q15_t m_lpState[70U]; // NoTaps + BlockSize - 1, 44 + 20 - 1 plus some spare
|
||||
q15_t m_lpState[60U]; // NoTaps + BlockSize - 1, 32 + 20 - 1 plus some spare
|
||||
uint8_t m_poBuffer[1200U];
|
||||
uint16_t m_poLen;
|
||||
uint16_t m_poPtr;
|
||||
|
|
Loading…
Reference in New Issue