STM32 debug helpers: printing RX queue length

This commit is contained in:
Pavel Kirienko
2014-04-11 19:34:41 +04:00
parent bba89bdd3d
commit ad49bc1ece
3 changed files with 21 additions and 0 deletions
@@ -172,6 +172,12 @@ public:
*/
virtual uavcan::uint64_t getErrorCount() const;
/**
* Returns number of frames pending in the RX queue.
* This is intended for debug use only.
*/
unsigned getRxQueueLength() const;
/**
* Returns last hardware error code (LEC field in the register ESR)
*/
@@ -518,6 +518,12 @@ uavcan::uint64_t CanIface::getErrorCount() const
return error_cnt_ + rx_queue_.getOverflowCount();
}
unsigned CanIface::getRxQueueLength() const
{
CriticalSectionLocker lock;
return rx_queue_.getLength();
}
uavcan::uint8_t CanIface::yieldLastHardwareErrorCode()
{
CriticalSectionLocker lock;
@@ -124,7 +124,16 @@ public:
{
lowsyslog("Spin failure: %i\n", spin_res);
}
lowsyslog("Time sync master: %u\n", unsigned(time_sync_slave.getMasterNodeID().get()));
lowsyslog("Memory usage: used=%u free=%u\n",
node.getAllocator().getNumUsedBlocks(), node.getAllocator().getNumFreeBlocks());
lowsyslog("RX queues: %u %u\n",
can.driver.getIface(0)->getRxQueueLength(),
can.driver.getIface(1)->getRxQueueLength());
node.logInfo("app", "UTC %* sec, %* corr, %* jumps",
uavcan_stm32::clock::getUtc().toMSec() / 1000,
uavcan_stm32::clock::getUtcSpeedCorrectionPPM(),