devices/ecdev.h
author Florian Pose <fp@igh-essen.com>
Wed, 16 Apr 2008 08:33:04 +0000
changeset 893 d921fff3d6e2
parent 883 4963e22a267a
child 1011 a0759d0dded4
permissions -rw-r--r--
Exported ecrt_slave_config_sdo(); added documentation.
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
 *
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
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
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
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: 199
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: 199
diff changeset
    12
 *  License, or (at your option) any later version.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    13
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *  GNU General Public License for more details.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    18
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *  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
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
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: 199
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: 199
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: 199
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: 199
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: 199
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: 199
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: 199
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    31
 *
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
786
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    34
/** \file
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
 * EtherCAT interface for EtherCAT device drivers.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    37
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    38
 * \defgroup DeviceInterface EtherCAT Device Interface
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    39
 *
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    40
 * Master interface for EtherCAT-capable network device drivers. Through the
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    41
 * EtherCAT device interface, EtherCAT-capable network device drivers are able
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    42
 * 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
    43
 * 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
    44
 * frames through connected devices.
ad618c76e9bd Updated doxygen docs.
Florian Pose <fp@igh-essen.com>
parents: 670
diff changeset
    45
 */
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    46
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    47
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    48
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    49
#ifndef __ECDEV_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 786
diff changeset
    50
#define __ECDEV_H__
104
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
#include <linux/netdevice.h>
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
struct ec_device;
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    57
typedef struct ec_device ec_device_t; /**< \see ec_device */
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    58
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    59
/**
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
    60
   Device poll function type.
286
f3352378b4d4 Added missing documentation.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    61
*/
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
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
    63
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
    64
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
/*****************************************************************************/
573
cdee4ea90ce9 Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents: 533
diff changeset
    66
// Offering/withdrawal functions
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
639
aa23c48dca2d Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents: 573
diff changeset
    68
int ecdev_offer(struct net_device *net_dev, ec_pollfunc_t poll,
aa23c48dca2d Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents: 573
diff changeset
    69
        struct module *module, ec_device_t **);
573
cdee4ea90ce9 Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents: 533
diff changeset
    70
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
    71
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
// Device methods
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
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
    75
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
    76
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
    77
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
    78
void ecdev_set_link(ec_device_t *device, uint8_t state);
f57de4585a5f Replaced ecdev_link_state() with ecdev_set_link(); added
Florian Pose <fp@igh-essen.com>
parents: 668
diff changeset
    79
uint8_t ecdev_get_link(ec_device_t *device);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
/*****************************************************************************/
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
#endif