# HG changeset patch # User Florian Pose # Date 1164123981 0 # Node ID b17c95eac6b2f690f5eef9c581ca2ecb51877426 # Parent 9c58efb2c72d495a407382de7a322dab58334eaf Added frame counter. diff -r 9c58efb2c72d -r b17c95eac6b2 master/device.c --- a/master/device.c Tue Nov 21 15:13:48 2006 +0000 +++ b/master/device.c Tue Nov 21 15:46:21 2006 +0000 @@ -71,6 +71,9 @@ device->open = 0; device->link_state = 0; // down + device->tx_count = 0; + device->rx_count = 0; + #ifdef EC_DBG_IF if (ec_debug_init(&device->dbg)) { EC_ERR("Failed to init debug device!\n"); @@ -146,6 +149,8 @@ for (i = 0; i < 4; i++) ec_device_call_isr(device); device->link_state = 0; + device->tx_count = 0; + device->rx_count = 0; if (device->dev->open(device->dev) == 0) device->open = 1; @@ -217,6 +222,7 @@ // start sending device->dev->hard_start_xmit(device->tx_skb, device->dev); + device->tx_count++; } /*****************************************************************************/ @@ -251,6 +257,8 @@ size_t size /**< number of bytes received */ ) { + device->rx_count++; + if (unlikely(device->master->debug_level > 1)) { EC_DBG("Received frame:\n"); ec_print_data_diff(device->tx_skb->data + ETH_HLEN, diff -r 9c58efb2c72d -r b17c95eac6b2 master/device.h --- a/master/device.h Tue Nov 21 15:13:48 2006 +0000 +++ b/master/device.h Tue Nov 21 15:46:21 2006 +0000 @@ -70,6 +70,8 @@ unsigned long jiffies_isr; /**< jiffies of last ISR call */ struct module *module; /**< pointer to the device's owning module */ uint8_t link_state; /**< device link state */ + unsigned int tx_count; /**< number of frames sent */ + unsigned int rx_count; /**< number of frames received */ #ifdef EC_DBG_IF ec_debug_t dbg; /**< debug device */ #endif diff -r 9c58efb2c72d -r b17c95eac6b2 master/master.c --- a/master/master.c Tue Nov 21 15:13:48 2006 +0000 +++ b/master/master.c Tue Nov 21 15:46:21 2006 +0000 @@ -865,6 +865,13 @@ off += sprintf(buffer + off, "\nSlaves: %i\n", master->slave_count); + off += sprintf(buffer + off, "\nDevice:\n"); + off += sprintf(buffer + off, " Frames sent: %u\n", + master->device->tx_count); + off += sprintf(buffer + off, " Frames received: %u\n", + master->device->rx_count); + off += sprintf(buffer + off, " Frames lost: %u\n", + master->device->tx_count - master->device->rx_count - 1); off += sprintf(buffer + off, "\nTiming (min/avg/max) [us]:\n");