IgH EtherCAT Master  1.6.1
ecdev.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT Master.
6  *
7  * The IgH EtherCAT Master is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version 2, as
9  * published by the Free Software Foundation.
10  *
11  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with the IgH EtherCAT Master; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  ****************************************************************************/
21 
35 /****************************************************************************/
36 
37 #ifndef __ECDEV_H__
38 #define __ECDEV_H__
39 
40 #include <linux/netdevice.h>
41 
42 /****************************************************************************/
43 
44 struct ec_device;
45 typedef struct ec_device ec_device_t;
49 typedef void (*ec_pollfunc_t)(struct net_device *);
50 
51 /*****************************************************************************
52  * Offering/withdrawal functions
53  ****************************************************************************/
54 
55 ec_device_t *ecdev_offer(struct net_device *net_dev, ec_pollfunc_t poll,
56  struct module *module);
57 void ecdev_withdraw(ec_device_t *device);
58 
59 /*****************************************************************************
60  * Device methods
61  ****************************************************************************/
62 
63 int ecdev_open(ec_device_t *device);
64 void ecdev_close(ec_device_t *device);
65 void ecdev_receive(ec_device_t *device, const void *data, size_t size);
66 void ecdev_set_link(ec_device_t *device, uint8_t state);
67 uint8_t ecdev_get_link(const ec_device_t *device);
68 
69 /****************************************************************************/
70 
71 #endif
void ecdev_close(ec_device_t *device)
Makes the master leave IDLE phase and closes the network device.
Definition: device.c:597
int ecdev_open(ec_device_t *device)
Opens the network device and makes the master enter IDLE phase.
Definition: device.c:559
void(* ec_pollfunc_t)(struct net_device *)
Device poll function type.
Definition: ecdev.h:49
EtherCAT device.
Definition: device.h:73
uint8_t ecdev_get_link(const ec_device_t *device)
Reads the link state.
Definition: device.c:691
void ecdev_receive(ec_device_t *device, const void *data, size_t size)
Accepts a received frame.
Definition: device.c:621
ec_device_t * ecdev_offer(struct net_device *net_dev, ec_pollfunc_t poll, struct module *module)
Offers an EtherCAT device to a certain master.
Definition: module.c:480
void ecdev_set_link(ec_device_t *device, uint8_t state)
Sets a new link state.
Definition: device.c:665
void ecdev_withdraw(ec_device_t *device)
Withdraws an EtherCAT device from the master.
Definition: device.c:528