devices/ecdev.h
author Florian Pose <fp@igh-essen.com>
Mon, 26 Jan 2009 11:59:07 +0000
changeset 1333 7b9898062c8f
parent 1326 ef907b0b5125
child 1363 11c0b2caa253
permissions -rw-r--r--
merge -c1614 branches/stable-1.4: Fixed datagram cleaning.
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
 *
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
    22
 *  Using the EtherCAT technology and brand is permitted in compliance with
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
    23
 *  the 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
    24
 *
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    27
/** \file
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    28
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    29
 * EtherCAT interface for EtherCAT device drivers.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    30
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    31
 * \defgroup DeviceInterface EtherCAT Device Interface
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    32
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    33
 * Master interface for EtherCAT-capable network device drivers. Through the
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    34
 * EtherCAT device interface, EtherCAT-capable network device drivers are able
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    35
 * 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
    36
 * 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
    37
 * frames through connected devices.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    38
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    39
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    40
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    41
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    42
#ifndef __ECDEV_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    43
#define __ECDEV_H__
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
#include <linux/netdevice.h>
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
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
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
struct ec_device;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    50
typedef struct ec_device ec_device_t; /**< \see ec_device */
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    51
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    52
/** Device poll function type.
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    53
 */
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
    54
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
    55
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    56
/******************************************************************************
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    57
 * Offering/withdrawal functions
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    58
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    60
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
    61
        struct module *module);
573
cdee4ea90ce9 Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents: 533
diff changeset
    62
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
    63
1011
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    64
/******************************************************************************
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    65
 * Device methods
a0759d0dded4 Improved ecdev_offer().
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    66
 *****************************************************************************/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
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
    68
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
    69
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
    70
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
    71
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
    72
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
    73
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
#endif