equal
deleted
inserted
replaced
10 ***************************************************************/ |
10 ***************************************************************/ |
11 |
11 |
12 #include <linux/skbuff.h> |
12 #include <linux/skbuff.h> |
13 #include <linux/if_ether.h> |
13 #include <linux/if_ether.h> |
14 #include <linux/netdevice.h> |
14 #include <linux/netdevice.h> |
15 #include <rtai.h> |
|
16 #include <linux/delay.h> |
15 #include <linux/delay.h> |
17 |
16 |
18 #include "ec_device.h" |
17 #include "ec_device.h" |
19 #include "ec_dbg.h" |
18 #include "ec_dbg.h" |
20 |
19 |
21 /***************************************************************/ |
20 /***************************************************************/ |
22 |
21 |
23 /** |
22 /** |
24 EtherCAT-Geräte-Konstuktor. |
23 EtherCAT-Geräte-Konstuktor. |
25 |
24 |
26 Initialisiert ein EtherCAT-Gerät, indem es die Variablen |
25 Initialisiert ein EtherCAT-Gerät, indem es die Variablen |
27 in der Struktur auf die Default-Werte setzt. |
26 in der Struktur auf die Default-Werte setzt. |
28 |
27 |
29 @param ecd Zu initialisierendes EtherCAT-Gerät |
28 @param ecd Zu initialisierendes EtherCAT-Gerät |
30 */ |
29 */ |
46 |
45 |
47 /***************************************************************/ |
46 /***************************************************************/ |
48 |
47 |
49 /** |
48 /** |
50 EtherCAT-Geräte-Destuktor. |
49 EtherCAT-Geräte-Destuktor. |
51 |
50 |
52 Gibt den dynamisch allozierten Speicher des |
51 Gibt den dynamisch allozierten Speicher des |
53 EtherCAT-Gerätes (die beiden Socket-Buffer) wieder frei. |
52 EtherCAT-Gerätes (die beiden Socket-Buffer) wieder frei. |
54 |
53 |
55 @param ecd EtherCAT-Gerät |
54 @param ecd EtherCAT-Gerät |
56 */ |
55 */ |
74 |
73 |
75 /***************************************************************/ |
74 /***************************************************************/ |
76 |
75 |
77 /** |
76 /** |
78 Weist einem EtherCAT-Gerät das entsprechende net_device zu. |
77 Weist einem EtherCAT-Gerät das entsprechende net_device zu. |
79 |
78 |
80 Prüft das net_device, allokiert Socket-Buffer in Sende- und |
79 Prüft das net_device, allokiert Socket-Buffer in Sende- und |
81 Empfangsrichtung und weist dem EtherCAT-Gerät und den |
80 Empfangsrichtung und weist dem EtherCAT-Gerät und den |
82 Socket-Buffern das net_device zu. |
81 Socket-Buffern das net_device zu. |
83 |
82 |
84 @param ecd EtherCAT-Device |
83 @param ecd EtherCAT-Device |
273 |
272 |
274 cnt = min(ecd->rx_data_length, size); |
273 cnt = min(ecd->rx_data_length, size); |
275 memcpy(data,ecd->rx_data, cnt); |
274 memcpy(data,ecd->rx_data, cnt); |
276 |
275 |
277 return cnt; |
276 return cnt; |
|
277 } |
|
278 |
|
279 /***************************************************************/ |
|
280 |
|
281 /** |
|
282 Ruft manuell die Interrupt-Routine der Netzwerkkarte auf. |
|
283 |
|
284 @param ecd EtherCAT-Gerät |
|
285 |
|
286 @return Anzahl der kopierten Bytes bei Erfolg, sonst < 0 |
|
287 */ |
|
288 |
|
289 void EtherCAT_device_call_isr(EtherCAT_device_t *ecd) |
|
290 { |
|
291 EC_DBG(KERN_DEBUG "EtherCAT: Calling ISR...\n"); |
|
292 |
|
293 // Manuell die ISR aufrufen |
|
294 rtl8139_interrupt(0, ecd->dev, NULL); |
|
295 |
|
296 EC_DBG(KERN_DEBUG "EtherCAT: ISR finished.\n"); |
278 } |
297 } |
279 |
298 |
280 /***************************************************************/ |
299 /***************************************************************/ |
281 |
300 |
282 /** |
301 /** |