master/device.h
author Florian Pose <fp@igh-essen.com>
Fri, 09 Dec 2011 10:35:23 +0100
branchredundancy
changeset 2301 01e4381ebd09
parent 2158 69f2b2702336
child 2372 d895cd1db2bf
permissions -rw-r--r--
Improved resetting number of responding slaves.
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
     1
/******************************************************************************
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
     3
 *  $Id$
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     6
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     8
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    11
 *  published by the Free Software Foundation.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    12
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    16
 *  Public License for more details.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    27
 *
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
    28
 *****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    30
/**
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    31
   \file
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    32
   EtherCAT device structure.
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    33
*/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    34
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    35
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    36
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
    37
#ifndef __EC_DEVICE_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
    38
#define __EC_DEVICE_H__
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
25
7d124bfba3ce IF's im rtl8139too-Treiber vereinfacht und kein Polling mehr.
Florian Pose <fp@igh-essen.com>
parents: 19
diff changeset
    40
#include <linux/interrupt.h>
7d124bfba3ce IF's im rtl8139too-Treiber vereinfacht und kein Polling mehr.
Florian Pose <fp@igh-essen.com>
parents: 19
diff changeset
    41
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    42
#include "../devices/ecdev.h"
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
    43
#include "globals.h"
392
eaee3c8d6ae0 Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    44
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    45
/**
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    46
 * Size of the transmit ring.
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    47
 * This memory ring is used to transmit frames. It is necessary to use
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    48
 * different memory regions, because otherwise the network device DMA could
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    49
 * send the same data twice, if it is called twice.
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    50
 */
693
e341f1788608 Switched to tx socket buffer ring to avoid race conditions when multiple
Florian Pose <fp@igh-essen.com>
parents: 692
diff changeset
    51
#define EC_TX_RING_SIZE 2
e341f1788608 Switched to tx socket buffer ring to avoid race conditions when multiple
Florian Pose <fp@igh-essen.com>
parents: 692
diff changeset
    52
679
62fc387ec928 Added --enable-dummy; renamed EC_DBG_IF to EC_DEBUG_IF, ENABLE_DEBUG_IF
Florian Pose <fp@igh-essen.com>
parents: 579
diff changeset
    53
#ifdef EC_DEBUG_IF
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    54
#include "debug.h"
392
eaee3c8d6ae0 Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    55
#endif
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
692
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    57
#ifdef EC_DEBUG_RING
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    58
#define EC_DEBUG_RING_SIZE 10
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    59
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    60
typedef enum {
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    61
    TX, RX
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    62
} ec_debug_frame_dir_t;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    63
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    64
typedef struct {
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    65
    ec_debug_frame_dir_t dir;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    66
    struct timeval t;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    67
    unsigned int addr;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    68
    uint8_t data[EC_MAX_DATA_SIZE];
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    69
    unsigned int data_size;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    70
} ec_debug_frame_t;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    71
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    72
#endif
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    73
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
    74
/*****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    77
   EtherCAT device.
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    78
   An EtherCAT device is a network interface card, that is owned by an
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    79
   EtherCAT master to send and receive EtherCAT frames with.
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
*/
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
    82
struct ec_device
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
{
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    84
    ec_master_t *master; /**< EtherCAT master */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    85
    struct net_device *dev; /**< pointer to the assigned net_device */
579
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
    86
    ec_pollfunc_t poll; /**< pointer to the device's poll function */
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
    87
    struct module *module; /**< pointer to the device's owning module */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    88
    uint8_t open; /**< true, if the net_device has been opened */
579
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
    89
    uint8_t link_state; /**< device link state */
693
e341f1788608 Switched to tx socket buffer ring to avoid race conditions when multiple
Florian Pose <fp@igh-essen.com>
parents: 692
diff changeset
    90
    struct sk_buff *tx_skb[EC_TX_RING_SIZE]; /**< transmit skb ring */
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 693
diff changeset
    91
    unsigned int tx_ring_index; /**< last ring entry used to transmit */
1040
d2527675cdd5 Disable use of CPU timestamp counter by default.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    92
#ifdef EC_HAVE_CYCLES
533
acdd1f9ef7ab Replaced ec_isr_t by ec_pollfunc_t; added poll function s in network drivers.
Florian Pose <fp@igh-essen.com>
parents: 493
diff changeset
    93
    cycles_t cycles_poll; /**< cycles of last poll */
1040
d2527675cdd5 Disable use of CPU timestamp counter by default.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    94
#endif
692
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    95
#ifdef EC_DEBUG_RING
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    96
    struct timeval timeval_poll;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
    97
#endif
533
acdd1f9ef7ab Replaced ec_isr_t by ec_pollfunc_t; added poll function s in network drivers.
Florian Pose <fp@igh-essen.com>
parents: 493
diff changeset
    98
    unsigned long jiffies_poll; /**< jiffies of last poll */
1854
b61bece1ec1c Clear frame statistics on link loss.
Florian Pose <fp@igh-essen.com>
parents: 1851
diff changeset
    99
b61bece1ec1c Clear frame statistics on link loss.
Florian Pose <fp@igh-essen.com>
parents: 1851
diff changeset
   100
    // Frame statistics
1863
8ea4a79dfe84 64 bit frame statistics.
Florian Pose <fp@igh-essen.com>
parents: 1857
diff changeset
   101
    u64 tx_count; /**< Number of frames sent. */
8ea4a79dfe84 64 bit frame statistics.
Florian Pose <fp@igh-essen.com>
parents: 1857
diff changeset
   102
    u64 last_tx_count; /**< Number of frames sent of last statistics cycle. */
8ea4a79dfe84 64 bit frame statistics.
Florian Pose <fp@igh-essen.com>
parents: 1857
diff changeset
   103
    u64 rx_count; /**< Number of frames received. */
2158
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   104
    u64 last_rx_count; /**< Number of frames received of last statistics
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   105
                         cycle. */
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   106
    u64 tx_bytes; /**< Number of bytes sent. */
1863
8ea4a79dfe84 64 bit frame statistics.
Florian Pose <fp@igh-essen.com>
parents: 1857
diff changeset
   107
    u64 last_tx_bytes; /**< Number of bytes sent of last statistics cycle. */
2158
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   108
    u64 rx_bytes; /**< Number of bytes received. */
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   109
    u64 last_rx_bytes; /**< Number of bytes received of last statistics cycle.
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   110
                        */
1863
8ea4a79dfe84 64 bit frame statistics.
Florian Pose <fp@igh-essen.com>
parents: 1857
diff changeset
   111
    u64 tx_errors; /**< Number of transmit errors. */
1857
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   112
    unsigned int tx_frame_rates[EC_RATE_COUNT]; /**< Transmit rates in
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   113
                                                  frames/s for different
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   114
                                                  statistics cycle periods. */
2158
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   115
    unsigned int rx_frame_rates[EC_RATE_COUNT]; /**< Receive rates in
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   116
                                                  frames/s for different
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   117
                                                  statistics cycle periods. */
1857
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   118
    unsigned int tx_byte_rates[EC_RATE_COUNT]; /**< Transmit rates in byte/s
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   119
                                                 for different statistics
ed8b490b5bc3 Output tx errors and tx rate in byte/s.
Florian Pose <fp@igh-essen.com>
parents: 1856
diff changeset
   120
                                                 cycle periods. */
2158
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   121
    unsigned int rx_byte_rates[EC_RATE_COUNT]; /**< Receive rates in byte/s
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   122
                                                 for different statistics
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   123
                                                 cycle periods. */
1854
b61bece1ec1c Clear frame statistics on link loss.
Florian Pose <fp@igh-essen.com>
parents: 1851
diff changeset
   124
679
62fc387ec928 Added --enable-dummy; renamed EC_DBG_IF to EC_DEBUG_IF, ENABLE_DEBUG_IF
Florian Pose <fp@igh-essen.com>
parents: 579
diff changeset
   125
#ifdef EC_DEBUG_IF
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
   126
    ec_debug_t dbg; /**< debug device */
392
eaee3c8d6ae0 Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   127
#endif
692
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   128
#ifdef EC_DEBUG_RING
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   129
    ec_debug_frame_t debug_frames[EC_DEBUG_RING_SIZE];
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   130
    unsigned int debug_frame_index;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   131
    unsigned int debug_frame_count;
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   132
#endif
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
   133
};
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   135
/*****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
579
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
   137
int ec_device_init(ec_device_t *, ec_master_t *);
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
   138
void ec_device_clear(ec_device_t *);
78
3d74183d6c6b Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   139
579
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
   140
void ec_device_attach(ec_device_t *, struct net_device *, ec_pollfunc_t,
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
   141
        struct module *);
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
   142
void ec_device_detach(ec_device_t *);
17c6fd3b076e Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents: 575
diff changeset
   143
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
   144
int ec_device_open(ec_device_t *);
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 41
diff changeset
   145
int ec_device_close(ec_device_t *);
78
3d74183d6c6b Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   146
533
acdd1f9ef7ab Replaced ec_isr_t by ec_pollfunc_t; added poll function s in network drivers.
Florian Pose <fp@igh-essen.com>
parents: 493
diff changeset
   147
void ec_device_poll(ec_device_t *);
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 96
diff changeset
   148
uint8_t *ec_device_tx_data(ec_device_t *);
78
3d74183d6c6b Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   149
void ec_device_send(ec_device_t *, size_t);
1856
10175d5f35ea Fixed clearing frame statistics on link down.
Florian Pose <fp@igh-essen.com>
parents: 1854
diff changeset
   150
void ec_device_clear_stats(ec_device_t *);
2158
69f2b2702336 Adjusted frame statistics for the use with two devices.
Florian Pose <fp@igh-essen.com>
parents: 1863
diff changeset
   151
void ec_device_update_stats(ec_device_t *);
78
3d74183d6c6b Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   152
692
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   153
#ifdef EC_DEBUG_RING
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   154
void ec_device_debug_ring_append(ec_device_t *, ec_debug_frame_dir_t,
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   155
        const void *, size_t);
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   156
void ec_device_debug_ring_print(const ec_device_t *);
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   157
#endif
fe7cf37c33f1 Implemented debug frame ring to output the last n frames for debugging
Florian Pose <fp@igh-essen.com>
parents: 679
diff changeset
   158
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   159
/*****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
#endif