master/debug.h
author Florian Pose <fp@igh-essen.com>
Mon, 17 Nov 2008 17:18:02 +0000
changeset 1313 ed15eef57d5c
parent 1305 de3fcbb6773e
child 1326 ef907b0b5125
permissions -rw-r--r--
Improved error case return codes of many functions.
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    12
 *  License, or (at your option) any later version.
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    24
 *  charge under condition of compatibility of product made by
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 231
diff changeset
    31
 *
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   Network interface for debugging purposes.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include <linux/netdevice.h>
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
   Debugging network interface.
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
*/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
typedef struct
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
{
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
    struct net_device *dev; /**< net_device for virtual ethernet device */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    struct net_device_stats stats; /**< device statistics */
1305
de3fcbb6773e Create debug interface with address of physical device on attachment.
Florian Pose <fp@igh-essen.com>
parents: 687
diff changeset
    53
    uint8_t registered; /**< net_device is opened */
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
    uint8_t opened; /**< net_device is opened */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
ec_debug_t;
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
687
6de97f276423 Changed names of debug interfaces.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    60
int ec_debug_init(ec_debug_t *, const char *);
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
void ec_debug_clear(ec_debug_t *);
1305
de3fcbb6773e Create debug interface with address of physical device on attachment.
Florian Pose <fp@igh-essen.com>
parents: 687
diff changeset
    62
void ec_debug_register(ec_debug_t *, const struct net_device *);
de3fcbb6773e Create debug interface with address of physical device on attachment.
Florian Pose <fp@igh-essen.com>
parents: 687
diff changeset
    63
void ec_debug_unregister(ec_debug_t *);
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
void ec_debug_send(ec_debug_t *, const uint8_t *, size_t);
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
/*****************************************************************************/