author | Florian Pose <fp@igh-essen.com> |
Fri, 07 Apr 2006 14:23:49 +0000 | |
changeset 172 | e84c21548a8d |
parent 156 | 43d7d714679f |
child 195 | 674071846ee3 |
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 |
* |
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
5 |
* Minimalmodul für EtherCAT |
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 |
* |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
9 |
*****************************************************************************/ |
0 | 10 |
|
11 |
#include <linux/module.h> |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
12 |
#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
|
13 |
#include <linux/timer.h> |
0 | 14 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
15 |
#include "../include/ecrt.h" // Echtzeitschnittstelle |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
16 |
|
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
17 |
#define ASYNC |
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
|
18 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
19 |
/*****************************************************************************/ |
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
|
20 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
83
diff
changeset
|
21 |
#define ABTASTFREQUENZ 100 |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
22 |
|
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
23 |
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
|
24 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
25 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
26 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
27 |
// EtherCAT |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
28 |
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
|
29 |
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
|
30 |
|
83
e8b76a509bc9
Beispiel-Echtzeitcode angepasst.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
31 |
// Datenfelder |
130 | 32 |
//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
|
33 |
|
83
e8b76a509bc9
Beispiel-Echtzeitcode angepasst.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
34 |
// Kanäle |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
35 |
uint32_t k_pos; |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
36 |
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
|
37 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
38 |
ec_field_init_t domain1_fields[] = { |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
39 |
{NULL, "1", "Beckhoff", "EL5001", "InputValue", 0}, |
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
40 |
{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
|
41 |
{} |
61
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
60
diff
changeset
|
42 |
}; |
0 | 43 |
|
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
44 |
/*****************************************************************************/ |
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
45 |
|
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
46 |
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
|
47 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
48 |
static unsigned int counter = 0; |
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
49 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
50 |
#ifdef ASYNC |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
51 |
// Empfangen |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
52 |
ecrt_master_async_receive(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
53 |
ecrt_domain_process(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
54 |
#else |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
55 |
// Senden und empfangen |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
56 |
ecrt_domain_queue(domain1); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
57 |
ecrt_master_run(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
58 |
ecrt_master_sync_io(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
59 |
ecrt_domain_process(domain1); |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
60 |
#endif |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
61 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
62 |
// Prozessdaten verarbeiten |
156
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
63 |
//k_pos = EC_READ_U32(r_ssi); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
64 |
|
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
65 |
#ifdef ASYNC |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
66 |
// Senden |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
67 |
ecrt_domain_queue(domain1); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
68 |
ecrt_master_run(master); |
43d7d714679f
Plugfest: rt und mini angepasst.
Florian Pose <fp@igh-essen.com>
parents:
147
diff
changeset
|
69 |
ecrt_master_async_send(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
70 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
71 |
|
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
72 |
if (counter) { |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
73 |
counter--; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
74 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
75 |
else { |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
76 |
counter = ABTASTFREQUENZ; |
117 | 77 |
//printk(KERN_INFO "k_pos = %i\n", k_pos); |
78 |
//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
|
79 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
80 |
|
62
0fb2a690f4d0
Kleinere Korrekturen an rt und mini.
Florian Pose <fp@igh-essen.com>
parents:
61
diff
changeset
|
81 |
// Timer neu starten |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
82 |
timer.expires += HZ / ABTASTFREQUENZ; |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
83 |
add_timer(&timer); |
0 | 84 |
} |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
85 |
|
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
86 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
87 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
88 |
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
|
89 |
{ |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
90 |
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
|
91 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
92 |
if ((master = ecrt_request_master(0)) == NULL) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
93 |
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
|
94 |
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
|
95 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
96 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
97 |
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
|
98 |
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
|
99 |
{ |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
100 |
printk(KERN_ERR "Domain creation failed!\n"); |
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
101 |
goto out_release_master; |
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
102 |
} |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
103 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
109 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
110 |
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
|
111 |
if (ecrt_master_activate(master)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
112 |
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
|
113 |
goto out_release_master; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
114 |
} |
64 | 115 |
|
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
116 |
#if 0 |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
117 |
if (ecrt_master_fetch_sdo_lists(master)) { |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
118 |
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
|
119 |
goto out_deactivate; |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
120 |
} |
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
121 |
ecrt_master_print(master, 2); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
122 |
#else |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
123 |
ecrt_master_print(master, 0); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
124 |
#endif |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
125 |
|
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
126 |
|
130 | 127 |
#if 0 |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
128 |
if (!(slave = ecrt_master_get_slave(master, "5"))) { |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
129 |
printk(KERN_ERR "Failed to get slave 5!\n"); |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
130 |
goto out_deactivate; |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
131 |
} |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
132 |
|
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
133 |
if (ecrt_slave_sdo_write_exp8(slave, 0x4061, 1, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
134 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 2, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
135 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 3, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
136 |
ecrt_slave_sdo_write_exp8(slave, 0x4066, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
137 |
ecrt_slave_sdo_write_exp8(slave, 0x4067, 0, 4) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
138 |
ecrt_slave_sdo_write_exp8(slave, 0x4068, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
139 |
ecrt_slave_sdo_write_exp8(slave, 0x4069, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
140 |
ecrt_slave_sdo_write_exp8(slave, 0x406A, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
141 |
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
|
142 |
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
|
143 |
goto out_deactivate; |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
144 |
} |
130 | 145 |
#endif |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
146 |
|
114 | 147 |
#if 0 |
148 |
printk(KERN_INFO "Writing alias...\n"); |
|
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
149 |
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
|
150 |
printk(KERN_ERR "Failed to write alias!\n"); |
114 | 151 |
goto out_deactivate; |
152 |
} |
|
153 |
#endif |
|
154 |
||
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
155 |
#ifdef ASYNC |
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
156 |
// Einmal senden und warten... |
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
157 |
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
|
158 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
159 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
160 |
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
|
161 |
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
|
162 |
timer.function = run; |
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
163 |
timer.expires = jiffies + 10; // Das erste Mal sofort feuern |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
164 |
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
|
165 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
166 |
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
|
167 |
return 0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
168 |
|
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
169 |
#if 0 |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
170 |
out_deactivate: |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
171 |
ecrt_master_deactivate(master); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
172 |
#endif |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
173 |
out_release_master: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
174 |
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
|
175 |
out_return: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
176 |
return -1; |
0 | 177 |
} |
178 |
||
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
179 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
180 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
181 |
void __exit cleanup_mini_module(void) |
0 | 182 |
{ |
26 | 183 |
printk(KERN_INFO "=== Stopping Minimal EtherCAT environment... ===\n"); |
0 | 184 |
|
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
185 |
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
|
186 |
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
|
187 |
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
|
188 |
ecrt_master_deactivate(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
189 |
ecrt_release_master(master); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
26
diff
changeset
|
190 |
} |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
191 |
|
26 | 192 |
printk(KERN_INFO "=== Minimal EtherCAT environment stopped. ===\n"); |
0 | 193 |
} |
194 |
||
195 |
/*****************************************************************************/ |
|
196 |
||
197 |
MODULE_LICENSE("GPL"); |
|
198 |
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
|
199 |
MODULE_DESCRIPTION ("EtherCAT minimal test environment"); |
0 | 200 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
201 |
module_init(init_mini_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
202 |
module_exit(cleanup_mini_module); |
0 | 203 |
|
204 |
/*****************************************************************************/ |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
205 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
206 |
/* Emacs-Konfiguration |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
207 |
;;; Local Variables: *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
208 |
;;; c-basic-offset:4 *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
209 |
;;; End: *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
210 |
*/ |