mirror of
https://github.com/juribeparada/MMDVM_HS.git
synced 2025-12-06 07:12:08 +01:00
Support for interrupt counter test mode
This commit is contained in:
parent
c45a7cf38f
commit
1aab7ec355
|
|
@ -885,6 +885,7 @@ void CIO::interrupt()
|
|||
|
||||
m_watchdog++;
|
||||
m_modeTimerCnt++;
|
||||
m_int1counter++;
|
||||
|
||||
if(m_scanPauseCnt >= SCAN_PAUSE)
|
||||
m_scanPauseCnt = 0U;
|
||||
|
|
@ -906,6 +907,8 @@ void CIO::interrupt2()
|
|||
|
||||
m_rxBuffer.put(bit, m_control);
|
||||
}
|
||||
|
||||
m_int2counter++;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
14
CalDMR.cpp
14
CalDMR.cpp
|
|
@ -53,7 +53,8 @@ CCalDMR::CCalDMR() :
|
|||
m_transmit(false),
|
||||
m_state(DMRCAL1K_IDLE),
|
||||
m_dmr1k(),
|
||||
m_audioSeq(0)
|
||||
m_audioSeq(0),
|
||||
m_count(0)
|
||||
{
|
||||
::memcpy(m_dmr1k, VOICE_1K, DMR_FRAME_LENGTH_BYTES + 1U);
|
||||
}
|
||||
|
|
@ -72,6 +73,17 @@ void CCalDMR::process()
|
|||
case STATE_DMRDMO1K:
|
||||
dmrdmo1k();
|
||||
break;
|
||||
case STATE_INTCAL:
|
||||
// Simple interrupt counter for board diagnostics (TCXO, connections, etc)
|
||||
// Not intended for precise interrupt frequency measurements
|
||||
m_count++;
|
||||
if (m_count >= CAL_DLY_LOOP) {
|
||||
m_count = 0U;
|
||||
uint16_t int1, int2;
|
||||
io.getIntCounter(int1, int2);
|
||||
DEBUG3("Counter INT1/INT2:", int1 >> 1U, int2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
1
CalDMR.h
1
CalDMR.h
|
|
@ -47,6 +47,7 @@ private:
|
|||
DMRCAL1K m_state;
|
||||
uint8_t m_dmr1k[DMR_FRAME_LENGTH_BYTES + 1U];
|
||||
uint8_t m_audioSeq;
|
||||
uint32_t m_count;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
2
Debug.h
2
Debug.h
|
|
@ -36,7 +36,7 @@
|
|||
#define DEBUG1(a)
|
||||
#define DEBUG2(a,b)
|
||||
#define DEBUG2I(a,b)
|
||||
#define DEBUG3(a,b,c)
|
||||
#define DEBUG3(a,b,c) serial.writeDebug((a),(b),(c))
|
||||
#define DEBUG4(a,b,c,d)
|
||||
#define DEBUG5(a,b,c,d,e)
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ enum MMDVM_STATE {
|
|||
STATE_RSSICAL = 96,
|
||||
STATE_CWID = 97,
|
||||
STATE_DMRCAL = 98,
|
||||
STATE_DSTARCAL = 99
|
||||
STATE_DSTARCAL = 99,
|
||||
STATE_INTCAL = 100
|
||||
};
|
||||
|
||||
const uint8_t MARK_SLOT1 = 0x08U;
|
||||
|
|
|
|||
12
IO.cpp
12
IO.cpp
|
|
@ -37,7 +37,9 @@ m_scanEnable(false),
|
|||
m_scanPauseCnt(0U),
|
||||
m_scanPos(0U),
|
||||
m_ledValue(true),
|
||||
m_watchdog(0U)
|
||||
m_watchdog(0U),
|
||||
m_int1counter(0U),
|
||||
m_int2counter(0U)
|
||||
{
|
||||
Init();
|
||||
|
||||
|
|
@ -402,3 +404,11 @@ uint32_t CIO::getWatchdog()
|
|||
{
|
||||
return m_watchdog;
|
||||
}
|
||||
|
||||
void CIO::getIntCounter(uint16_t &int1, uint16_t &int2)
|
||||
{
|
||||
int1 = m_int1counter;
|
||||
int2 = m_int2counter;
|
||||
m_int1counter = 0U;
|
||||
m_int2counter = 0U;
|
||||
}
|
||||
|
|
|
|||
9
IO.h
9
IO.h
|
|
@ -47,6 +47,12 @@
|
|||
#define SCAN_TIME 1920
|
||||
#define SCAN_PAUSE 20000
|
||||
|
||||
#if defined(DUPLEX)
|
||||
#define CAL_DLY_LOOP 96100U
|
||||
#else
|
||||
#define CAL_DLY_LOOP 106000U
|
||||
#endif
|
||||
|
||||
extern uint32_t m_frequency_rx;
|
||||
extern uint32_t m_frequency_tx;
|
||||
extern uint32_t m_pocsag_freq_tx;
|
||||
|
|
@ -108,6 +114,7 @@ public:
|
|||
void setLoDevYSF(bool ysfLoDev);
|
||||
void resetWatchdog(void);
|
||||
uint32_t getWatchdog(void);
|
||||
void getIntCounter(uint16_t &int1, uint16_t &int2);
|
||||
void selfTest(void);
|
||||
|
||||
// RF interface API
|
||||
|
|
@ -162,6 +169,8 @@ private:
|
|||
MMDVM_STATE m_Modes[5];
|
||||
bool m_ledValue;
|
||||
volatile uint32_t m_watchdog;
|
||||
volatile uint16_t m_int1counter;
|
||||
volatile uint16_t m_int2counter;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void loop()
|
|||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||
pocsagTX.process();
|
||||
|
||||
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K)
|
||||
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL)
|
||||
calDMR.process();
|
||||
|
||||
#if defined(SEND_RSSI_DATA)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ void loop()
|
|||
if (m_pocsagEnable && (m_modemState == STATE_POCSAG || pocsagTX.busy()))
|
||||
pocsagTX.process();
|
||||
|
||||
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K)
|
||||
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K || m_calState == STATE_INTCAL)
|
||||
calDMR.process();
|
||||
|
||||
#if defined(SEND_RSSI_DATA)
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
|
||||
MMDVM_STATE modemState = MMDVM_STATE(data[3U]);
|
||||
|
||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL)
|
||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_INTCAL && modemState != STATE_RSSICAL)
|
||||
return 4U;
|
||||
if (modemState == STATE_DSTAR && !dstarEnable)
|
||||
return 4U;
|
||||
|
|
@ -278,7 +278,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
m_nxdnEnable = nxdnEnable;
|
||||
m_pocsagEnable = pocsagEnable;
|
||||
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) {
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) {
|
||||
m_dmrEnable = true;
|
||||
m_modemState = STATE_DMR;
|
||||
m_calState = modemState;
|
||||
|
|
@ -319,7 +319,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
|
||||
io.setLoDevYSF(ysfLoDev);
|
||||
|
||||
if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL)) {
|
||||
if (!m_firstCal || (modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL)) {
|
||||
if(m_dstarEnable)
|
||||
io.ifConf(STATE_DSTAR, true);
|
||||
else if(m_dmrEnable)
|
||||
|
|
@ -339,7 +339,7 @@ uint8_t CSerialPort::setConfig(const uint8_t* data, uint8_t length)
|
|||
io.printConf();
|
||||
#endif
|
||||
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL)
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL)
|
||||
m_firstCal = true;
|
||||
|
||||
return 0U;
|
||||
|
|
@ -356,7 +356,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
|||
if (modemState == m_modemState)
|
||||
return 0U;
|
||||
|
||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL)
|
||||
if (modemState != STATE_IDLE && modemState != STATE_DSTAR && modemState != STATE_DMR && modemState != STATE_YSF && modemState != STATE_P25 && modemState != STATE_NXDN && modemState != STATE_POCSAG && modemState != STATE_DSTARCAL && modemState != STATE_DMRCAL && modemState != STATE_DMRDMO1K && modemState != STATE_RSSICAL && modemState != STATE_INTCAL)
|
||||
return 4U;
|
||||
if (modemState == STATE_DSTAR && !m_dstarEnable)
|
||||
return 4U;
|
||||
|
|
@ -371,7 +371,7 @@ uint8_t CSerialPort::setMode(const uint8_t* data, uint8_t length)
|
|||
if (modemState == STATE_POCSAG && !m_pocsagEnable)
|
||||
return 4U;
|
||||
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL) {
|
||||
if (modemState == STATE_DMRCAL || modemState == STATE_DMRDMO1K || modemState == STATE_RSSICAL || modemState == STATE_INTCAL) {
|
||||
m_dmrEnable = true;
|
||||
tmpState = STATE_DMR;
|
||||
m_calState = modemState;
|
||||
|
|
@ -589,7 +589,7 @@ void CSerialPort::process()
|
|||
case MMDVM_CAL_DATA:
|
||||
if (m_calState == STATE_DMRCAL || m_calState == STATE_DMRDMO1K) {
|
||||
err = calDMR.write(m_buffer + 3U, m_len - 3U);
|
||||
} else if (m_calState == STATE_RSSICAL) {
|
||||
} else if (m_calState == STATE_RSSICAL || m_calState == STATE_INTCAL) {
|
||||
err = 0U;
|
||||
}
|
||||
if (err == 0U) {
|
||||
|
|
@ -1129,7 +1129,6 @@ void CSerialPort::writeRSSIData(const uint8_t* data, uint8_t length)
|
|||
#endif
|
||||
|
||||
#if defined(ENABLE_DEBUG)
|
||||
|
||||
void CSerialPort::writeDebug(const char* text)
|
||||
{
|
||||
if (!m_debug)
|
||||
|
|
@ -1198,6 +1197,7 @@ void CSerialPort::writeDebug(const char* text, int16_t n1)
|
|||
|
||||
writeInt(1U, reply, count, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
||||
{
|
||||
|
|
@ -1225,6 +1225,7 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2)
|
|||
writeInt(1U, reply, count, true);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_DEBUG)
|
||||
void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3)
|
||||
{
|
||||
if (!m_debug)
|
||||
|
|
@ -1285,6 +1286,4 @@ void CSerialPort::writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n
|
|||
|
||||
writeInt(1U, reply, count, true);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ public:
|
|||
void writeDebug(const char* text);
|
||||
void writeDebug(const char* text, int16_t n1);
|
||||
void writeDebugI(const char* text, int32_t n1);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3);
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
|
||||
#endif
|
||||
void writeDebug(const char* text, int16_t n1, int16_t n2);
|
||||
|
||||
private:
|
||||
uint8_t m_buffer[256U];
|
||||
|
|
@ -85,4 +85,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue