author | Florian Pose <fp@igh-essen.com> |
Tue, 07 Nov 2006 13:49:04 +0000 | |
changeset 491 | 07a7c5951ebc |
parent 398 | ff37601361a8 |
child 493 | b17c95eac6b2 |
child 1739 | 5fcbd29151d2 |
permissions | -rw-r--r-- |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
1 |
/****************************************************************************** |
0 | 2 |
* |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
3 |
* $Id$ |
0 | 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:
231
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:
231
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:
231
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:
231
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:
231
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:
231
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:
231
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:
231
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:
231
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:
231
diff
changeset
|
30 |
* Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
231
diff
changeset
|
31 |
* |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
32 |
*****************************************************************************/ |
0 | 33 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
34 |
/** |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
35 |
\file |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
36 |
EtherCAT device methods. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
37 |
*/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
38 |
|
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 |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
41 |
#include <linux/module.h> |
0 | 42 |
#include <linux/skbuff.h> |
43 |
#include <linux/if_ether.h> |
|
44 |
#include <linux/netdevice.h> |
|
2
b0a7a4745bf9
?nderungen an no_rtai r110:110 in drivers gemergt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
45 |
#include <linux/delay.h> |
0 | 46 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
47 |
#include "device.h" |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
48 |
#include "master.h" |
0 | 49 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
50 |
/*****************************************************************************/ |
0 | 51 |
|
52 |
/** |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
53 |
Device constructor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
54 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
55 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
56 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
57 |
int ec_device_init(ec_device_t *device, /**< EtherCAT device */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
58 |
ec_master_t *master, /**< master owning the device */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
59 |
struct net_device *net_dev, /**< net_device structure */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
60 |
ec_isr_t isr, /**< pointer to device's ISR */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
61 |
struct module *module /**< pointer to the owning module */ |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
62 |
) |
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
63 |
{ |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
64 |
struct ethhdr *eth; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
65 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
66 |
device->master = master; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
67 |
device->dev = net_dev; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
68 |
device->isr = isr; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
69 |
device->module = module; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
70 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
71 |
device->open = 0; |
96 | 72 |
device->link_state = 0; // down |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
73 |
|
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
74 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
75 |
if (ec_debug_init(&device->dbg)) { |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
76 |
EC_ERR("Failed to init debug device!\n"); |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
77 |
goto out_return; |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
78 |
} |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
79 |
#endif |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
80 |
|
211
c684b6b7adaf
Using kernel Ethernet constants.
Florian Pose <fp@igh-essen.com>
parents:
199
diff
changeset
|
81 |
if (!(device->tx_skb = dev_alloc_skb(ETH_FRAME_LEN))) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
82 |
EC_ERR("Error allocating device socket buffer!\n"); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
83 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
84 |
goto out_debug; |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
85 |
#else |
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
86 |
goto out_return; |
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
87 |
#endif |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
88 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
89 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
90 |
device->tx_skb->dev = net_dev; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
91 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
92 |
// add Ethernet-II-header |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
93 |
skb_reserve(device->tx_skb, ETH_HLEN); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
94 |
eth = (struct ethhdr *) skb_push(device->tx_skb, ETH_HLEN); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
95 |
eth->h_proto = htons(0x88A4); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
96 |
memcpy(eth->h_source, net_dev->dev_addr, net_dev->addr_len); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
97 |
memset(eth->h_dest, 0xFF, net_dev->addr_len); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
98 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
99 |
return 0; |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
100 |
|
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
101 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
102 |
out_debug: |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
103 |
ec_debug_clear(&device->dbg); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
104 |
#endif |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
105 |
out_return: |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
106 |
return -1; |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
107 |
} |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
108 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
109 |
/*****************************************************************************/ |
0 | 110 |
|
111 |
/** |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
112 |
EtherCAT device destuctor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
113 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
114 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
115 |
void ec_device_clear(ec_device_t *device /**< EtherCAT device */) |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
116 |
{ |
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
117 |
if (device->open) ec_device_close(device); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
118 |
if (device->tx_skb) dev_kfree_skb(device->tx_skb); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
119 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
120 |
ec_debug_clear(&device->dbg); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
121 |
#endif |
0 | 122 |
} |
123 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
124 |
/*****************************************************************************/ |
0 | 125 |
|
126 |
/** |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
127 |
Opens the EtherCAT device. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
128 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
129 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
130 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
131 |
int ec_device_open(ec_device_t *device /**< EtherCAT device */) |
0 | 132 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
133 |
unsigned int i; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
134 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
135 |
if (!device->dev) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
136 |
EC_ERR("No net_device to open!\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
137 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
138 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
139 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
140 |
if (device->open) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
141 |
EC_WARN("Device already opened!\n"); |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
142 |
return 0; |
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
143 |
} |
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
144 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
145 |
// device could have received frames before |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
146 |
for (i = 0; i < 4; i++) ec_device_call_isr(device); |
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
147 |
|
96 | 148 |
device->link_state = 0; |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
149 |
|
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
84
diff
changeset
|
150 |
if (device->dev->open(device->dev) == 0) device->open = 1; |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
151 |
|
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
152 |
return device->open ? 0 : -1; |
0 | 153 |
} |
154 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
155 |
/*****************************************************************************/ |
0 | 156 |
|
157 |
/** |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
158 |
Stops the EtherCAT device. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
159 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
160 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
161 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
162 |
int ec_device_close(ec_device_t *device /**< EtherCAT device */) |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
163 |
{ |
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
164 |
if (!device->dev) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
165 |
EC_ERR("No device to close!\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
166 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
167 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
168 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
169 |
if (!device->open) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
170 |
EC_WARN("Device already closed!\n"); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
171 |
return 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
172 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
173 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
174 |
if (device->dev->stop(device->dev) == 0) device->open = 0; |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
175 |
|
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
176 |
return !device->open ? 0 : -1; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
177 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
178 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
179 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
180 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
181 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
182 |
Returns a pointer to the device's transmit memory. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
183 |
\return pointer to the TX socket buffer |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
184 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
185 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
186 |
uint8_t *ec_device_tx_data(ec_device_t *device /**< EtherCAT device */) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
187 |
{ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
188 |
return device->tx_skb->data + ETH_HLEN; |
0 | 189 |
} |
190 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
191 |
/*****************************************************************************/ |
0 | 192 |
|
193 |
/** |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
194 |
Sends the content of the transmit socket buffer. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
195 |
Cuts the socket buffer content to the (now known) size, and calls the |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
196 |
start_xmit() function of the assigned net_device. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
197 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
198 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
199 |
void ec_device_send(ec_device_t *device, /**< EtherCAT device */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
200 |
size_t size /**< number of bytes to send */ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
201 |
) |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
202 |
{ |
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
203 |
if (unlikely(!device->link_state)) // Link down |
96 | 204 |
return; |
205 |
||
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
206 |
// set the right length for the data |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
207 |
device->tx_skb->len = ETH_HLEN + size; |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
208 |
|
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
209 |
if (unlikely(device->master->debug_level > 1)) { |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
210 |
EC_DBG("sending frame:\n"); |
152
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
211 |
ec_print_data(device->tx_skb->data + ETH_HLEN, size); |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
212 |
} |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
213 |
|
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
214 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
215 |
ec_debug_send(&device->dbg, device->tx_skb->data, ETH_HLEN + size); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
216 |
#endif |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
217 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
218 |
// start sending |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
219 |
device->dev->hard_start_xmit(device->tx_skb, device->dev); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
220 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
221 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
222 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
223 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
224 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
225 |
Calls the interrupt service routine of the assigned net_device. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
226 |
The master itself works without using interrupts. Therefore the processing |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
227 |
of received data and status changes of the network device has to be |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
228 |
done by the master calling the ISR "manually". |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
229 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
230 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
231 |
void ec_device_call_isr(ec_device_t *device /**< EtherCAT device */) |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
232 |
{ |
398
ff37601361a8
Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents:
392
diff
changeset
|
233 |
device->cycles_isr = get_cycles(); |
ff37601361a8
Fixed serveral races while starting up under high CPU load.
Florian Pose <fp@igh-essen.com>
parents:
392
diff
changeset
|
234 |
device->jiffies_isr = jiffies; |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
235 |
if (likely(device->isr)) device->isr(0, device->dev, NULL); |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
236 |
} |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
237 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
238 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
239 |
* Device interface |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
240 |
*****************************************************************************/ |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
241 |
|
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
242 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
243 |
Accepts a received frame. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
244 |
Forwards the received data to the master. The master will analyze the frame |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
245 |
and dispatch the received commands to the sending instances. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
246 |
\ingroup DeviceInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
247 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
248 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
249 |
void ecdev_receive(ec_device_t *device, /**< EtherCAT device */ |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
250 |
const void *data, /**< pointer to received data */ |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
251 |
size_t size /**< number of bytes received */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
252 |
) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
70
diff
changeset
|
253 |
{ |
78
3d74183d6c6b
Frame-Debugging ins Device ausgelagert und verbessert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
254 |
if (unlikely(device->master->debug_level > 1)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
78
diff
changeset
|
255 |
EC_DBG("Received frame:\n"); |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
256 |
ec_print_data_diff(device->tx_skb->data + ETH_HLEN, |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
257 |
data + ETH_HLEN, size - ETH_HLEN); |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
258 |
} |
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
259 |
|
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
260 |
#ifdef EC_DBG_IF |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
261 |
ec_debug_send(&device->dbg, data, size); |
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
331
diff
changeset
|
262 |
#endif |
231
767548c75bf3
Added debug interface for network monitors.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
263 |
|
331
17f58fe99511
Renamed ec_master_receive() to ec_master_receive_datagrams().
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
264 |
ec_master_receive_datagrams(device->master, |
17f58fe99511
Renamed ec_master_receive() to ec_master_receive_datagrams().
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
265 |
data + ETH_HLEN, |
17f58fe99511
Renamed ec_master_receive() to ec_master_receive_datagrams().
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
266 |
size - ETH_HLEN); |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
267 |
} |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
268 |
|
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
269 |
/*****************************************************************************/ |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
42
diff
changeset
|
270 |
|
96 | 271 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
272 |
Sets a new link state. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
273 |
If the device notifies the master about the link being down, the master |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
274 |
will not try to send frames using this device. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
275 |
\ingroup DeviceInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
276 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
277 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
278 |
void ecdev_link_state(ec_device_t *device, /**< EtherCAT device */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
279 |
uint8_t state /**< new link state */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
280 |
) |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
281 |
{ |
191 | 282 |
if (unlikely(!device)) { |
283 |
EC_WARN("ecdev_link_state: no device!\n"); |
|
284 |
return; |
|
285 |
} |
|
286 |
||
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
287 |
if (likely(state != device->link_state)) { |
96 | 288 |
device->link_state = state; |
289 |
EC_INFO("Link state changed to %s.\n", (state ? "UP" : "DOWN")); |
|
290 |
} |
|
291 |
} |
|
292 |
||
293 |
/*****************************************************************************/ |
|
294 |
||
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
295 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
296 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
297 |
EXPORT_SYMBOL(ecdev_receive); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
298 |
EXPORT_SYMBOL(ecdev_link_state); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
26
diff
changeset
|
299 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
300 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
301 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
302 |
/*****************************************************************************/ |