master/debug.h
author Edouard Tisserant <edouard.tisserant@gmail.com>
Thu, 27 Sep 2018 00:21:27 +0200
branchstable-1.5
changeset 2712 5d21d80777a6
parent 1921 d9cf40facbc4
permissions -rw-r--r--
Use new RTDM's mmap, not anymore a special case compared to normal linux mmap.
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
 *
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: 1305
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
231
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
 *
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: 1305
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: 1305
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: 1305
diff changeset
    11
 *  published by the Free Software Foundation.
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
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: 1305
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: 1305
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: 1305
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: 1305
diff changeset
    16
 *  Public License for more details.
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
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: 1305
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: 1305
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  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
    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
 *
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
/**
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
   \file
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
   Network interface for debugging purposes.
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
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    37
#ifndef __EC_DEBUG_H__
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    38
#define __EC_DEBUG_H__
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    39
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    40
#include "../devices/ecdev.h"
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
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
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    44
/** Debugging network interface.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    45
 */
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
typedef struct
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
{
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    48
    ec_device_t *device; /**< Parent device. */
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
    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
    50
    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
    51
    uint8_t registered; /**< net_device is opened */
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
    uint8_t opened; /**< net_device is opened */
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
}
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
ec_debug_t;
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
/*****************************************************************************/
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    58
int ec_debug_init(ec_debug_t *, ec_device_t *, const char *);
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
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
    60
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
    61
void ec_debug_unregister(ec_debug_t *);
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
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
    63
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    64
#endif
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    65
231
767548c75bf3 Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
/*****************************************************************************/