author | Florian Pose <fp@igh-essen.com> |
Fri, 06 Jan 2006 16:19:35 +0000 | |
changeset 49 | 3f8e769ca747 |
parent 48 | 7e75772ea28c |
child 51 | b3beaa00640f |
permissions | -rw-r--r-- |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
1 |
/****************************************************************************** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
2 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
3 |
* msr_module.c |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
4 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
5 |
* Kernelmodul für 2.6 Kernel zur Meßdatenerfassung, Steuerung und Regelung. |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
6 |
* |
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
7 |
* Autor: Wilhelm Hagemeister, Florian Pose |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
8 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
9 |
* (C) Copyright IgH 2002 |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
10 |
* Ingenieurgemeinschaft IgH |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
11 |
* Heinz-Bäcker Str. 34 |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
12 |
* D-45356 Essen |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
13 |
* Tel.: +49 201/61 99 31 |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
14 |
* Fax.: +49 201/61 98 36 |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
15 |
* E-mail: hm@igh-essen.com |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
16 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
17 |
* $Id$ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
18 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
19 |
*****************************************************************************/ |
28 | 20 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
21 |
// Linux |
28 | 22 |
#include <linux/module.h> |
23 |
#include <linux/ipipe.h> |
|
24 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
25 |
// RT_lib |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
26 |
#include <msr_main.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
27 |
#include <msr_utils.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
28 |
#include <msr_messages.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
29 |
#include <msr_float.h> |
28 | 30 |
#include <msr_reg.h> |
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
31 |
#include "msr_param.h" |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
32 |
#include "msr_jitter.h" |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
33 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
34 |
// EtherCAT |
28 | 35 |
#include "../drivers/ec_master.h" |
36 |
#include "../drivers/ec_device.h" |
|
37 |
#include "../drivers/ec_types.h" |
|
38 |
#include "../drivers/ec_module.h" |
|
39 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
40 |
// Defines/Makros |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
41 |
#define TSC2US(T1, T2) ((T2 - T1) * 1000UL / cpu_khz) |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
42 |
#define HZREDUCTION (MSR_ABTASTFREQUENZ / HZ) |
28 | 43 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
44 |
/*****************************************************************************/ |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
45 |
/* Globale Variablen */ |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
46 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
47 |
// RT_lib |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
48 |
extern struct timeval process_time; |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
49 |
struct timeval msr_time_increment; // Increment per Interrupt |
28 | 50 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
51 |
// Adeos |
28 | 52 |
static struct ipipe_domain this_domain; |
53 |
static struct ipipe_sysinfo sys_info; |
|
54 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
55 |
// EtherCAT |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
56 |
|
28 | 57 |
static EtherCAT_master_t *ecat_master = NULL; |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
58 |
static unsigned int ecat_bus_time = 0; |
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
59 |
static unsigned int ecat_timeouts = 0; |
28 | 60 |
|
61 |
static EtherCAT_slave_t ecat_slaves[] = |
|
62 |
{ |
|
63 |
// Block 1 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
64 |
ECAT_INIT_SLAVE(Beckhoff_EK1100, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
65 |
ECAT_INIT_SLAVE(Beckhoff_EL4102, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
66 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
67 |
ECAT_INIT_SLAVE(Beckhoff_EL3162, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
68 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
69 |
ECAT_INIT_SLAVE(Beckhoff_EL3102, 0), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
70 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 0), |
28 | 71 |
|
72 |
// Block 2 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
73 |
ECAT_INIT_SLAVE(Beckhoff_EK1100, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
74 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
75 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
76 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
77 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
78 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
79 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
80 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
81 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
82 |
ECAT_INIT_SLAVE(Beckhoff_EL2004, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
83 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
84 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1), |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
85 |
ECAT_INIT_SLAVE(Beckhoff_EL1014, 1) |
28 | 86 |
}; |
87 |
||
88 |
#define ECAT_SLAVES_COUNT (sizeof(ecat_slaves) / sizeof(EtherCAT_slave_t)) |
|
89 |
||
90 |
#define USE_MSR_LIB |
|
91 |
||
92 |
#ifdef USE_MSR_LIB |
|
93 |
double value; |
|
94 |
int dig1; |
|
95 |
#endif |
|
96 |
||
97 |
/****************************************************************************** |
|
98 |
* |
|
99 |
* Function: next2004 |
|
100 |
* |
|
101 |
*****************************************************************************/ |
|
102 |
||
103 |
static int next2004(int *wrap) |
|
104 |
{ |
|
105 |
static int i = 0; |
|
106 |
unsigned int j = 0; |
|
107 |
||
108 |
*wrap = 0; |
|
109 |
||
110 |
for (j = 0; j < ECAT_SLAVES_COUNT; j++) |
|
111 |
{ |
|
112 |
i++; |
|
113 |
||
114 |
i %= ECAT_SLAVES_COUNT; |
|
115 |
||
116 |
if (i == 0) *wrap = 1; |
|
117 |
||
118 |
if (ecat_slaves[i].desc == Beckhoff_EL2004) |
|
119 |
{ |
|
120 |
return i; |
|
121 |
} |
|
122 |
} |
|
123 |
||
124 |
return -1; |
|
125 |
} |
|
126 |
||
127 |
/****************************************************************************** |
|
128 |
* |
|
129 |
* Function: msr_controller_run() |
|
130 |
* |
|
131 |
*****************************************************************************/ |
|
132 |
||
133 |
static void msr_controller_run(void) |
|
134 |
{ |
|
135 |
static int ms = 0; |
|
136 |
static int cnt = 0; |
|
137 |
static int firstrun = 1; |
|
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
138 |
static unsigned int debug_counter = 0; |
28 | 139 |
|
140 |
static int klemme = 0; |
|
141 |
static int kanal = 0; |
|
142 |
static int up_down = 0; |
|
143 |
int wrap = 0; |
|
144 |
||
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
145 |
unsigned long t_bus_start, t_bus_end; |
28 | 146 |
|
147 |
// Prozessdaten lesen |
|
148 |
msr_jitter_run(MSR_ABTASTFREQUENZ); |
|
149 |
||
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
150 |
if (firstrun) { |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
151 |
klemme = next2004(&wrap); |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
152 |
firstrun = 0; |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
153 |
} |
28 | 154 |
|
155 |
ms++; |
|
156 |
ms %= 1000; |
|
40 | 157 |
if (cnt++ > 200) |
28 | 158 |
{ |
159 |
cnt = 0; |
|
160 |
||
161 |
if (++kanal > 3) |
|
162 |
{ |
|
163 |
kanal = 0; |
|
164 |
klemme = next2004(&wrap); |
|
165 |
||
166 |
if (wrap == 1) |
|
167 |
{ |
|
168 |
if (up_down == 1) up_down = 0; |
|
169 |
else up_down = 1; |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
if (klemme >= 0) { |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
175 |
EtherCAT_write_value(&ecat_slaves[klemme], kanal, up_down); |
28 | 176 |
} |
177 |
||
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
178 |
if (debug_counter == 0) { |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
179 |
ecat_master->debug_level = 0; |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
180 |
} |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
181 |
|
28 | 182 |
// Prozessdaten schreiben |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
183 |
|
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
184 |
rdtscl(t_bus_start); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
185 |
|
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
186 |
if (EtherCAT_process_data_cycle(ecat_master, 0, 40) < 0) |
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
187 |
ecat_timeouts++; |
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
188 |
|
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
189 |
if (EtherCAT_process_data_cycle(ecat_master, 1, 40) < 0) |
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
190 |
ecat_timeouts++; |
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
191 |
|
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
192 |
rdtscl(t_bus_end); |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
193 |
ecat_bus_time = TSC2US(t_bus_start, t_bus_end); |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
194 |
|
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
195 |
if (debug_counter == 0) { |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
196 |
ecat_master->debug_level = 0; |
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
197 |
} |
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
198 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
199 |
// Daten lesen und skalieren |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
200 |
#ifdef USE_MSR_LIB |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
201 |
value = EtherCAT_read_value(&ecat_slaves[5], 0) / 3276.0; |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
202 |
dig1 = EtherCAT_read_value(&ecat_slaves[2], 0); |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
203 |
#endif |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
204 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
205 |
debug_counter++; |
48
7e75772ea28c
Sinnvolle Meldung verlorener Frames, Zustand antwortender Slaves.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
206 |
if (debug_counter >= MSR_ABTASTFREQUENZ * 5) debug_counter = 0; |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
207 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
208 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
209 |
/****************************************************************************** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
210 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
211 |
* Function: msr_run(_interrupt) |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
212 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
213 |
* Beschreibung: Routine wird zyklisch im Timerinterrupt ausgeführt |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
214 |
* (hier muß alles rein, was Echtzeit ist ...) |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
215 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
216 |
* Parameter: Zeiger auf msr_data |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
217 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
218 |
* Rückgabe: |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
219 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
220 |
* Status: exp |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
221 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
222 |
*****************************************************************************/ |
28 | 223 |
|
224 |
void msr_run(unsigned irq) |
|
225 |
{ |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
226 |
static int counter = 0; |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
227 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
228 |
#ifdef USE_MSR_LIB |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
229 |
timeval_add(&process_time, &process_time, &msr_time_increment); |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
230 |
MSR_ADEOS_INTERRUPT_CODE(msr_controller_run(); msr_write_kanal_list();); |
28 | 231 |
#else |
232 |
msr_controller_run(); |
|
233 |
#endif |
|
234 |
||
40 | 235 |
ipipe_control_irq(irq,0,IPIPE_ENABLE_MASK); //Interrupt bestŽätigen |
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
236 |
if (counter++ > HZREDUCTION) { |
40 | 237 |
ipipe_propagate_irq(irq); //und weiterreichen |
28 | 238 |
counter = 0; |
239 |
} |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
240 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
241 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
242 |
/*****************************************************************************/ |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
243 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
244 |
void domain_entry(void) |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
245 |
{ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
246 |
printk("Domain %s started.\n", ipipe_current_domain->name); |
28 | 247 |
|
248 |
ipipe_get_sysinfo(&sys_info); |
|
249 |
ipipe_virtualize_irq(ipipe_current_domain,sys_info.archdep.tmirq, |
|
250 |
&msr_run, NULL, IPIPE_HANDLE_MASK); |
|
251 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
252 |
ipipe_tune_timer(1000000000UL/MSR_ABTASTFREQUENZ,0); |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
253 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
254 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
255 |
/****************************************************************************** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
256 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
257 |
* Function: msr_register_channels |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
258 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
259 |
* Beschreibung: KanŽäle registrieren |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
260 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
261 |
* Parameter: |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
262 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
263 |
* RŽückgabe: |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
264 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
265 |
* Status: exp |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
266 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
267 |
*****************************************************************************/ |
28 | 268 |
|
269 |
int msr_globals_register(void) |
|
270 |
{ |
|
271 |
#ifdef USE_MSR_LIB |
|
272 |
msr_reg_kanal("/value", "V", &value, TDBL); |
|
273 |
msr_reg_kanal("/dig1", "", &dig1, TINT); |
|
274 |
#endif |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
275 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
276 |
msr_reg_kanal("/Taskinfo/EtherCAT/BusTime", "us", &ecat_bus_time, TUINT); |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
277 |
msr_reg_kanal("/Taskinfo/EtherCAT/Timeouts", "", &ecat_timeouts, TUINT); |
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
278 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
279 |
return 0; |
28 | 280 |
} |
281 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
282 |
/****************************************************************************** |
28 | 283 |
* the init/clean material |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
284 |
*****************************************************************************/ |
28 | 285 |
|
286 |
int __init init_module() |
|
287 |
{ |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
288 |
unsigned int i; |
28 | 289 |
struct ipipe_domain_attr attr; //ipipe |
290 |
||
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
291 |
// Als allererstes die RT-lib initialisieren |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
292 |
#ifdef USE_MSR_LIB |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
293 |
if (msr_rtlib_init(1,MSR_ABTASTFREQUENZ,10,&msr_globals_register) < 0) { |
28 | 294 |
msr_print_warn("msr_modul: can't initialize rtlib!"); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
295 |
goto out_return; |
28 | 296 |
} |
297 |
#endif |
|
298 |
||
299 |
msr_jitter_init(); |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
300 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
301 |
printk(KERN_INFO "=== Starting 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
|
302 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
303 |
if ((ecat_master = EtherCAT_request(0)) == NULL) { |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
304 |
printk(KERN_ERR "EtherCAT master 0 not available!\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
305 |
goto out_msr_cleanup; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
306 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
307 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
308 |
printk("Checking EtherCAT slaves.\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
309 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
310 |
if (EtherCAT_check_slaves(ecat_master, ecat_slaves, ECAT_SLAVES_COUNT) != 0) { |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
311 |
printk(KERN_ERR "EtherCAT: Could not init slaves!\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
312 |
goto out_release_master; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
313 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
314 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
315 |
printk("Activating all EtherCAT slaves.\n"); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
316 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
317 |
for (i = 0; i < ECAT_SLAVES_COUNT; i++) { |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
318 |
if (EtherCAT_activate_slave(ecat_master, ecat_slaves + i) < 0) { |
43 | 319 |
printk(KERN_ERR "EtherCAT: Could not activate slave %i!\n", i); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
320 |
goto out_release_master; |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
321 |
} |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
322 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
323 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
324 |
do_gettimeofday(&process_time); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
325 |
msr_time_increment.tv_sec=0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
326 |
msr_time_increment.tv_usec=(unsigned int)(1000000/MSR_ABTASTFREQUENZ); |
28 | 327 |
|
328 |
ipipe_init_attr (&attr); |
|
329 |
attr.name = "IPIPE-MSR-MODULE"; |
|
330 |
attr.priority = IPIPE_ROOT_PRIO + 1; |
|
331 |
attr.entry = &domain_entry; |
|
332 |
ipipe_register_domain(&this_domain,&attr); |
|
333 |
||
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
334 |
return 0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
335 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
336 |
out_release_master: |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
337 |
EtherCAT_release(ecat_master); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
338 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
339 |
out_msr_cleanup: |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
340 |
msr_rtlib_cleanup(); |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
341 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
342 |
out_return: |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
343 |
return -1; |
28 | 344 |
} |
345 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
346 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
347 |
|
28 | 348 |
void __exit cleanup_module() |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
349 |
{ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
350 |
unsigned int i; |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
351 |
|
28 | 352 |
msr_print_info("msk_modul: unloading..."); |
353 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
354 |
ipipe_tune_timer(1000000000UL / HZ, 0); //alten Timertakt wieder herstellen |
28 | 355 |
ipipe_unregister_domain(&this_domain); |
356 |
||
357 |
if (ecat_master) |
|
358 |
{ |
|
43 | 359 |
printk(KERN_INFO "=== Stopping EtherCAT environment... ===\n"); |
360 |
||
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
361 |
printk(KERN_INFO "Deactivating slaves.\n"); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
362 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
363 |
for (i = 0; i < ECAT_SLAVES_COUNT; i++) { |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
364 |
if (EtherCAT_deactivate_slave(ecat_master, ecat_slaves + i) < 0) { |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
365 |
printk(KERN_WARNING "Warning - Could not deactivate slave!\n"); |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
366 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
367 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
368 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
369 |
EtherCAT_release(ecat_master); |
43 | 370 |
|
371 |
printk(KERN_INFO "=== EtherCAT environment stopped. ===\n"); |
|
372 |
} |
|
28 | 373 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
374 |
#ifdef USE_MSR_LIB |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
375 |
msr_rtlib_cleanup(); |
28 | 376 |
#endif |
377 |
} |
|
378 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
379 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
380 |
|
28 | 381 |
MODULE_LICENSE("GPL"); |
382 |
MODULE_AUTHOR ("Wilhelm Hagemeister <hm@igh-essen.com>"); |
|
383 |
MODULE_DESCRIPTION ("EtherCAT test environment"); |
|
384 |
||
385 |
module_init(init_module); |
|
386 |
module_exit(cleanup_module); |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
387 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
388 |
/*****************************************************************************/ |