author | Florian Pose <fp@igh-essen.com> |
Tue, 25 Apr 2006 11:39:33 +0000 | |
changeset 203 | c1f305e339c6 |
parent 202 | d5141123a5af |
child 206 | 60a10d85c20b |
permissions | -rw-r--r-- |
0 | 1 |
/****************************************************************************** |
2 |
* |
|
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
3 |
* m i n i . c |
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
4 |
* |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
5 |
* Minimal module for EtherCAT. |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
6 |
* |
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
7 |
* $Id$ |
0 | 8 |
* |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
9 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
10 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
11 |
* 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
|
12 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
13 |
* 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
|
14 |
* and/or modify it under the terms of the GNU General Public License |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
15 |
* as published by the Free Software Foundation; version 2 of the License. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
16 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
17 |
* 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
|
18 |
* 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
|
19 |
* 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
|
20 |
* GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
21 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
22 |
* 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
|
23 |
* 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
|
24 |
* 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
|
25 |
* |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
26 |
*****************************************************************************/ |
0 | 27 |
|
28 |
#include <linux/module.h> |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
29 |
#include <linux/delay.h> |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
30 |
#include <linux/timer.h> |
0 | 31 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
32 |
#include "../include/ecrt.h" // EtherCAT realtime interface |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
33 |
|
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
34 |
#define ASYNC |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
35 |
#define FREQUENCY 100 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
36 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
37 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
38 |
|
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
39 |
struct timer_list timer; |
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
40 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
41 |
// EtherCAT |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
42 |
ec_master_t *master = NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
43 |
ec_domain_t *domain1 = NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
44 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
45 |
// data fields |
130 | 46 |
//void *r_ssi_input, *r_ssi_status, *r_4102[3]; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
47 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
48 |
// channels |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
49 |
uint32_t k_pos; |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
50 |
uint8_t k_stat; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
51 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
52 |
ec_field_init_t domain1_fields[] = { |
202 | 53 |
{NULL, "3", "Beckhoff", "EL5001", "InputValue", 0}, |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
54 |
{NULL, "2", "Beckhoff", "EL4132", "OutputValue", 0}, |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
55 |
{} |
61
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
60
diff
changeset
|
56 |
}; |
0 | 57 |
|
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
58 |
/*****************************************************************************/ |
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
59 |
|
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
60 |
void run(unsigned long data) |
5
6f2508af550c
Alle ?nderungen aus den Branches no_rtai und no_int nach Trunk portiert.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
61 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
62 |
static unsigned int counter = 0; |
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
63 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
64 |
#ifdef ASYNC |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
65 |
// receive |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
66 |
ecrt_master_async_receive(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
67 |
ecrt_domain_process(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
68 |
#else |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
69 |
// send and receive |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
70 |
ecrt_domain_queue(domain1); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
71 |
ecrt_master_run(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
72 |
ecrt_master_sync_io(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
73 |
ecrt_domain_process(domain1); |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
74 |
#endif |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
75 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
76 |
// process data |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
77 |
//k_pos = EC_READ_U32(r_ssi); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
78 |
|
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
79 |
#ifdef ASYNC |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
80 |
// send |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
81 |
ecrt_domain_queue(domain1); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
82 |
ecrt_master_run(master); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
83 |
ecrt_master_async_send(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
84 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
85 |
|
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
86 |
if (counter) { |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
87 |
counter--; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
88 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
89 |
else { |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
90 |
counter = FREQUENCY; |
117 | 91 |
//printk(KERN_INFO "k_pos = %i\n", k_pos); |
92 |
//printk(KERN_INFO "k_stat = 0x%02X\n", k_stat); |
|
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
93 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
94 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
95 |
// restart timer |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
96 |
timer.expires += HZ / FREQUENCY; |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
97 |
add_timer(&timer); |
0 | 98 |
} |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
99 |
|
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
100 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
101 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
102 |
int __init init_mini_module(void) |
5
6f2508af550c
Alle ?nderungen aus den Branches no_rtai und no_int nach Trunk portiert.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
103 |
{ |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
104 |
printk(KERN_INFO "=== Starting Minimal EtherCAT environment... ===\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
105 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
106 |
if ((master = ecrt_request_master(0)) == NULL) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
107 |
printk(KERN_ERR "Requesting master 0 failed!\n"); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
108 |
goto out_return; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
109 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
110 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
111 |
printk(KERN_INFO "Registering domain...\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
112 |
if (!(domain1 = ecrt_master_create_domain(master))) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
113 |
{ |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
114 |
printk(KERN_ERR "Domain creation failed!\n"); |
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
115 |
goto out_release_master; |
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
116 |
} |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
117 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
118 |
printk(KERN_INFO "Registering domain fields...\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
119 |
if (ecrt_domain_register_field_list(domain1, domain1_fields)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
120 |
printk(KERN_ERR "Field registration failed!\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
121 |
goto out_release_master; |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
122 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
123 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
124 |
printk(KERN_INFO "Activating master...\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
125 |
if (ecrt_master_activate(master)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
126 |
printk(KERN_ERR "Failed to activate master!\n"); |
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
127 |
goto out_release_master; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
128 |
} |
64 | 129 |
|
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
130 |
#if 0 |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
131 |
if (ecrt_master_fetch_sdo_lists(master)) { |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
132 |
printk(KERN_ERR "Failed to fetch SDO lists!\n"); |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
133 |
goto out_deactivate; |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
134 |
} |
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
135 |
ecrt_master_print(master, 2); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
136 |
#else |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
137 |
ecrt_master_print(master, 0); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
138 |
#endif |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
139 |
|
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
140 |
|
130 | 141 |
#if 0 |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
142 |
if (!(slave = ecrt_master_get_slave(master, "5"))) { |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
143 |
printk(KERN_ERR "Failed to get slave 5!\n"); |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
144 |
goto out_deactivate; |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
145 |
} |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
146 |
|
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
147 |
if (ecrt_slave_sdo_write_exp8(slave, 0x4061, 1, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
148 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 2, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
149 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 3, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
150 |
ecrt_slave_sdo_write_exp8(slave, 0x4066, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
151 |
ecrt_slave_sdo_write_exp8(slave, 0x4067, 0, 4) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
152 |
ecrt_slave_sdo_write_exp8(slave, 0x4068, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
153 |
ecrt_slave_sdo_write_exp8(slave, 0x4069, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
154 |
ecrt_slave_sdo_write_exp8(slave, 0x406A, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
155 |
ecrt_slave_sdo_write_exp8(slave, 0x406B, 0, 50)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
156 |
printk(KERN_ERR "Failed to configure SSI slave!\n"); |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
157 |
goto out_deactivate; |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
158 |
} |
130 | 159 |
#endif |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
160 |
|
114 | 161 |
#if 0 |
162 |
printk(KERN_INFO "Writing alias...\n"); |
|
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
163 |
if (ecrt_slave_sdo_write_exp16(slave, 0xBEEF)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
164 |
printk(KERN_ERR "Failed to write alias!\n"); |
114 | 165 |
goto out_deactivate; |
166 |
} |
|
167 |
#endif |
|
168 |
||
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
169 |
#ifdef ASYNC |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
170 |
// send once and wait... |
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
171 |
ecrt_master_prepare_async_io(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
172 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
173 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
174 |
printk("Starting cyclic sample thread.\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
175 |
init_timer(&timer); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
176 |
timer.function = run; |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
156
diff
changeset
|
177 |
timer.expires = jiffies + 10; |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
178 |
add_timer(&timer); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
179 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
180 |
printk(KERN_INFO "=== Minimal EtherCAT environment started. ===\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
181 |
return 0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
182 |
|
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
183 |
#if 0 |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
184 |
out_deactivate: |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
185 |
ecrt_master_deactivate(master); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
186 |
#endif |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
187 |
out_release_master: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
188 |
ecrt_release_master(master); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
189 |
out_return: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
190 |
return -1; |
0 | 191 |
} |
192 |
||
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
193 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
194 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
195 |
void __exit cleanup_mini_module(void) |
0 | 196 |
{ |
26 | 197 |
printk(KERN_INFO "=== Stopping Minimal EtherCAT environment... ===\n"); |
0 | 198 |
|
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
199 |
if (master) { |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
200 |
del_timer_sync(&timer); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
201 |
printk(KERN_INFO "Deactivating master...\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
202 |
ecrt_master_deactivate(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
203 |
ecrt_release_master(master); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
26
diff
changeset
|
204 |
} |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
205 |
|
26 | 206 |
printk(KERN_INFO "=== Minimal EtherCAT environment stopped. ===\n"); |
0 | 207 |
} |
208 |
||
209 |
/*****************************************************************************/ |
|
210 |
||
211 |
MODULE_LICENSE("GPL"); |
|
212 |
MODULE_AUTHOR ("Florian Pose <fp@igh-essen.com>"); |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
213 |
MODULE_DESCRIPTION ("EtherCAT minimal test environment"); |
0 | 214 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
215 |
module_init(init_mini_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
216 |
module_exit(cleanup_mini_module); |
0 | 217 |
|
218 |
/*****************************************************************************/ |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
219 |