devices/ecdev.h
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 05 Oct 2018 18:01:39 +0200
branchstable-1.5
changeset 2721 d3855a6b0a9f
parent 1363 11c0b2caa253
permissions -rw-r--r--
RTDM : dropped wrong size check in mmap
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 191
diff changeset
     3
 *  $Id$
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 1011
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: 199
diff changeset
    27
 *
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    30
/** \file
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    31
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    32
 * EtherCAT interface for EtherCAT device drivers.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    33
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    34
 * \defgroup DeviceInterface EtherCAT Device Interface
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    35
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    36
 * Master interface for EtherCAT-capable network device drivers. Through the
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    37
 * EtherCAT device interface, EtherCAT-capable network device drivers are able
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    38
 * to connect their device(s) to the master, pass received frames and notify
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    39
 * the master about status changes. The master on his part, can send his
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    40
 * frames through connected devices.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    41
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    42
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    43
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    44
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    45
#ifndef __ECDEV_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    46
#define __ECDEV_H__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
#include <linux/netdevice.h>
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
struct ec_device;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    53
typedef struct ec_device ec_device_t; /**< \see ec_device */
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    54
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    55
/** Device poll function type.
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    56
 */
533
acdd1f9ef7ab Replaced ec_isr_t by ec_pollfunc_t; added poll function s in network drivers.
Florian Pose <fp@igh-essen.com>
parents: 498
diff changeset
    57
typedef void (*ec_pollfunc_t)(struct net_device *);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    59
/******************************************************************************
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    60
 * Offering/withdrawal functions
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    61
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    63
ec_device_t *ecdev_offer(struct net_device *net_dev, ec_pollfunc_t poll,
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    64
        struct module *module);
573
cdee4ea90ce9 Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents: 533
diff changeset
    65
void ecdev_withdraw(ec_device_t *device);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    67
/******************************************************************************
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    68
 * Device methods
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    69
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
497
04552130dd54 Re-introduced ecdev_open() and ecdev_close(), to avoid a race condition regarding the link state.
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    71
int ecdev_open(ec_device_t *device);
498
fbf44b0d6b54 Fixed return type of ecdev_close().
Florian Pose <fp@igh-essen.com>
parents: 497
diff changeset
    72
void ecdev_close(ec_device_t *device);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
void ecdev_receive(ec_device_t *device, const void *data, size_t size);
670
f57de4585a5f Replaced ecdev_link_state() with ecdev_set_link(); added
Florian Pose <fp@igh-essen.com>
parents: 668
diff changeset
    74
void ecdev_set_link(ec_device_t *device, uint8_t state);
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    75
uint8_t ecdev_get_link(const ec_device_t *device);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
#endif