Set debugging on a per-file basis.

48kHz
Jonathan Naylor 2016-03-14 20:24:51 +00:00
parent 7d77f20ee9
commit 037f60ea06
10 changed files with 35 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,8 +19,6 @@
#if !defined(CONFIG_H) #if !defined(CONFIG_H)
#define CONFIG_H #define CONFIG_H
// #define WANT_DEBUG
// Allow the use of the COS line to lockout the modem // Allow the use of the COS line to lockout the modem
// #define USE_COS_AS_LOCKOUT // #define USE_COS_AS_LOCKOUT

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
// #define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
#include "DMRIdleRX.h" #include "DMRIdleRX.h"

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
#include "DMRSlotRX.h" #include "DMRSlotRX.h"
@ -119,25 +121,25 @@ bool CDMRSlotRX::processSample(q15_t sample)
switch (dataType) { switch (dataType) {
case DT_DATA_HEADER: case DT_DATA_HEADER:
// DEBUG3("DMRSlotRX: data header for slot/data type", m_slot ? 2U : 1U, dataType); DEBUG3("DMRSlotRX: data header for slot/data type", m_slot ? 2U : 1U, dataType);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_VOICE_LC_HEADER: case DT_VOICE_LC_HEADER:
// DEBUG3("DMRSlotRX: voice header for slot/data type", m_slot ? 2U : 1U, dataType); DEBUG3("DMRSlotRX: voice header for slot/data type", m_slot ? 2U : 1U, dataType);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_VOICE_PI_HEADER: case DT_VOICE_PI_HEADER:
// DEBUG3("DMRSlotRX: pi header for slot/data type", m_slot ? 2U : 1U, dataType); DEBUG3("DMRSlotRX: pi header for slot/data type", m_slot ? 2U : 1U, dataType);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
case DT_TERMINATOR_WITH_LC: case DT_TERMINATOR_WITH_LC:
// DEBUG2("DMRSlotRX: terminator for slot", m_slot ? 2U : 1U); DEBUG2("DMRSlotRX: terminator for slot", m_slot ? 2U : 1U);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
default: default:
// DEBUG3("DMRSlotRX: data sync for slot/data type", m_slot ? 2U : 1U, dataType); DEBUG3("DMRSlotRX: data sync for slot/data type", m_slot ? 2U : 1U, dataType);
m_endPtr = NOENDPTR; m_endPtr = NOENDPTR;
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
break; break;
@ -145,14 +147,14 @@ bool CDMRSlotRX::processSample(q15_t sample)
} }
} else if (m_control == 0x20U) { } else if (m_control == 0x20U) {
// Voice sync // Voice sync
// DEBUG2("DMRSlotRX: voice sync for slot", m_slot ? 2U : 1U); DEBUG2("DMRSlotRX: voice sync for slot", m_slot ? 2U : 1U);
serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U); serial.writeDMRData(m_slot, frame, DMR_FRAME_LENGTH_BYTES + 1U);
m_syncCount = 0U; m_syncCount = 0U;
m_n = 0U; m_n = 0U;
} else { } else {
m_syncCount++; m_syncCount++;
if (m_syncCount >= MAX_SYNC_LOST_FRAMES) { if (m_syncCount >= MAX_SYNC_LOST_FRAMES) {
// DEBUG2("DMRSlotRX: lost for slot", m_slot ? 2U : 1U); DEBUG2("DMRSlotRX: lost for slot", m_slot ? 2U : 1U);
serial.writeDMRLost(m_slot); serial.writeDMRLost(m_slot);
m_syncCount = 0U; m_syncCount = 0U;
m_threshold = 0; m_threshold = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
// #define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
#include "DStarRX.h" #include "DStarRX.h"
@ -319,7 +321,7 @@ void CDStarRX::processNone(bool bit)
// Exact matching of the frame sync sequence // Exact matching of the frame sync sequence
if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) == 0U) { if (countBits32((m_patternBuffer & FRAME_SYNC_MASK) ^ FRAME_SYNC_DATA) == 0U) {
// DEBUG1("DStarRX: found frame sync in None"); DEBUG1("DStarRX: found frame sync in None");
::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES); ::memset(m_rxBuffer, 0x00U, DSTAR_FEC_SECTION_LENGTH_BYTES);
m_rxBufferBits = 0U; m_rxBufferBits = 0U;
@ -371,7 +373,6 @@ void CDStarRX::processHeader(bool bit)
unsigned char header[DSTAR_HEADER_LENGTH_BYTES]; unsigned char header[DSTAR_HEADER_LENGTH_BYTES];
bool ok = rxHeader(m_rxBuffer, header); bool ok = rxHeader(m_rxBuffer, header);
if (ok) { if (ok) {
// DEBUG1("DStarRX: header checksum ok");
io.setDecode(true); io.setDecode(true);
serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES); serial.writeDStarHeader(header, DSTAR_HEADER_LENGTH_BYTES);
@ -382,8 +383,6 @@ void CDStarRX::processHeader(bool bit)
m_rxState = DSRXS_DATA; m_rxState = DSRXS_DATA;
m_dataBits = MAX_SYNC_BITS; m_dataBits = MAX_SYNC_BITS;
} else { } else {
// DEBUG1("DStarRX: header checksum failed");
// The checksum failed, return to looking for syncs // The checksum failed, return to looking for syncs
m_rxState = DSRXS_NONE; m_rxState = DSRXS_NONE;
} }
@ -401,7 +400,7 @@ void CDStarRX::processData(bool bit)
// Fuzzy matching of the end frame sequences // Fuzzy matching of the end frame sequences
if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) { if (countBits32((m_patternBuffer & END_SYNC_MASK) ^ END_SYNC_DATA) <= END_SYNC_ERRS) {
// DEBUG1("DStarRX: Found end sync in Data"); DEBUG1("DStarRX: Found end sync in Data");
io.setDecode(false); io.setDecode(false);
serial.writeDStarEOT(); serial.writeDStarEOT();
@ -440,7 +439,7 @@ void CDStarRX::processData(bool bit)
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
m_dataBits--; m_dataBits--;
if (m_dataBits == 0U) { if (m_dataBits == 0U) {
// DEBUG1("DStarRX: data sync timed out, lost lock"); DEBUG1("DStarRX: data sync timed out, lost lock");
io.setDecode(false); io.setDecode(false);
serial.writeDStarLost(); serial.writeDStarLost();

2
IO.cpp
View File

@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
// #define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
#include "IO.h" #include "IO.h"

View File

@ -19,7 +19,6 @@ Boston, MA 02110-1301, USA.
*/ */
#include "SampleRB.h" #include "SampleRB.h"
#include "Debug.h"
CSampleRB::CSampleRB(uint16_t length) : CSampleRB::CSampleRB(uint16_t length) :
m_length(length), m_length(length),

View File

@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
// #define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
@ -255,31 +257,31 @@ void CSerialPort::setMode(MMDVM_STATE modemState)
{ {
switch (modemState) { switch (modemState) {
case STATE_DMR: case STATE_DMR:
// DEBUG1("Mode set to DMR"); DEBUG1("Mode set to DMR");
dstarRX.reset(); dstarRX.reset();
ysfRX.reset(); ysfRX.reset();
break; break;
case STATE_DSTAR: case STATE_DSTAR:
// DEBUG1("Mode set to D-Star"); DEBUG1("Mode set to D-Star");
dmrIdleRX.reset(); dmrIdleRX.reset();
dmrRX.reset(); dmrRX.reset();
ysfRX.reset(); ysfRX.reset();
break; break;
case STATE_YSF: case STATE_YSF:
// DEBUG1("Mode set to System Fusion"); DEBUG1("Mode set to System Fusion");
dmrIdleRX.reset(); dmrIdleRX.reset();
dmrRX.reset(); dmrRX.reset();
dstarRX.reset(); dstarRX.reset();
break; break;
case STATE_CALIBRATE: case STATE_CALIBRATE:
// DEBUG1("Mode set to Calibrate"); DEBUG1("Mode set to Calibrate");
dmrIdleRX.reset(); dmrIdleRX.reset();
dmrRX.reset(); dmrRX.reset();
dstarRX.reset(); dstarRX.reset();
ysfRX.reset(); ysfRX.reset();
break; break;
default: default:
// DEBUG1("Mode set to Idle"); DEBUG1("Mode set to Idle");
// STATE_IDLE // STATE_IDLE
break; break;
} }
@ -689,8 +691,6 @@ void CSerialPort::write(const uint8_t* data, uint16_t length, bool flush)
#endif #endif
} }
#if defined(WANT_DEBUG)
void CSerialPort::writeDump(const uint8_t* data, uint8_t length) void CSerialPort::writeDump(const uint8_t* data, uint8_t length)
{ {
ASSERT(length <= 252U); ASSERT(length <= 252U);
@ -870,5 +870,3 @@ void CSerialPort::writeAssert(bool cond, const char* text, const char* file, lon
write(reply, count, true); write(reply, count, true);
} }
#endif

View File

@ -44,16 +44,17 @@ public:
void writeCalData(const uint8_t* data, uint8_t length); void writeCalData(const uint8_t* data, uint8_t length);
#if defined(WANT_DEBUG)
void writeDump(const uint8_t* data, uint8_t length); void writeDump(const uint8_t* data, uint8_t length);
void writeSamples(const q15_t* data, uint8_t length); void writeSamples(const q15_t* data, uint8_t length);
void writeDebug(const char* text); void writeDebug(const char* text);
void writeDebug(const char* text, int16_t n1); void writeDebug(const char* text, int16_t n1);
void writeDebug(const char* text, int16_t n1, int16_t n2); 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);
void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4); void writeDebug(const char* text, int16_t n1, int16_t n2, int16_t n3, int16_t n4);
void writeAssert(bool cond, const char* text, const char* file, long line); void writeAssert(bool cond, const char* text, const char* file, long line);
#endif
private: private:
#if defined(__MBED__) #if defined(__MBED__)

View File

@ -19,7 +19,6 @@ Boston, MA 02110-1301, USA.
*/ */
#include "SerialRB.h" #include "SerialRB.h"
#include "Debug.h"
CSerialRB::CSerialRB(uint16_t length) : CSerialRB::CSerialRB(uint16_t length) :
m_length(length), m_length(length),

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2015 by Jonathan Naylor G4KLX * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
// #define WANT_DEBUG
#include "Config.h" #include "Config.h"
#include "Globals.h" #include "Globals.h"
#include "YSFRX.h" #include "YSFRX.h"
@ -503,7 +505,7 @@ void CYSFRX::processData(q15_t sample)
// We've not seen a data sync for too long, signal RXLOST and change to RX_NONE // We've not seen a data sync for too long, signal RXLOST and change to RX_NONE
m_lostCount--; m_lostCount--;
if (m_lostCount == 0U) { if (m_lostCount == 0U) {
// DEBUG1("YSFRX: sync timed out, lost lock"); DEBUG1("YSFRX: sync timed out, lost lock");
io.setDecode(false); io.setDecode(false);
serial.writeYSFLost(); serial.writeYSFLost();
@ -528,7 +530,7 @@ void CYSFRX::processData(q15_t sample)
serial.writeYSFData(m_outBuffer, YSF_FRAME_LENGTH_BYTES + 1U); serial.writeYSFData(m_outBuffer, YSF_FRAME_LENGTH_BYTES + 1U);
if (ok && (FICH[0U] & 0xC0U) == 0x80U) { if (ok && (FICH[0U] & 0xC0U) == 0x80U) {
// DEBUG1("YSFRX: end of transmission"); DEBUG1("YSFRX: end of transmission");
io.setDecode(false); io.setDecode(false);
m_state = YSFRXS_NONE; m_state = YSFRXS_NONE;
} else { } else {