author | Florian Pose <fp@igh-essen.com> |
Wed, 05 Apr 2006 08:45:34 +0000 | |
changeset 153 | 32446a24c322 |
parent 147 | a355b587b4bc |
child 156 | 43d7d714679f |
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 |
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
111
diff
changeset
|
51 |
// Prozessdaten 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); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
54 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
55 |
// Prozessdaten verarbeiten |
117 | 56 |
//k_pos = EC_READ_U32(r_ssi_input); |
57 |
//k_stat = EC_READ_U8(r_ssi_status); |
|
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
58 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
59 |
// Prozessdaten senden |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
60 |
ecrt_domain_queue(domain1); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
61 |
ecrt_master_run(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
62 |
ecrt_master_async_send(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
63 |
#else |
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
111
diff
changeset
|
64 |
// Prozessdaten senden und empfangen |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
65 |
ecrt_domain_queue(domain1); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
66 |
ecrt_master_run(master); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
67 |
ecrt_master_sync_io(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
68 |
ecrt_domain_process(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
69 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
70 |
// Prozessdaten verarbeiten |
117 | 71 |
//k_pos = EC_READ_U32(r_ssi_input); |
72 |
//k_stat = EC_READ_U8(r_ssi_status); |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
73 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
74 |
|
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
75 |
if (counter) { |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
76 |
counter--; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
77 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
78 |
else { |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
79 |
counter = ABTASTFREQUENZ; |
117 | 80 |
//printk(KERN_INFO "k_pos = %i\n", k_pos); |
81 |
//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
|
82 |
} |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
83 |
|
62
0fb2a690f4d0
Kleinere Korrekturen an rt und mini.
Florian Pose <fp@igh-essen.com>
parents:
61
diff
changeset
|
84 |
// Timer neu starten |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
85 |
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
|
86 |
add_timer(&timer); |
0 | 87 |
} |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
88 |
|
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
89 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
90 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
91 |
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
|
92 |
{ |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
93 |
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
|
94 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
95 |
if ((master = ecrt_request_master(0)) == NULL) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
96 |
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
|
97 |
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
|
98 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
99 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
100 |
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
|
101 |
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
|
102 |
{ |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
103 |
printk(KERN_ERR "Domain creation failed!\n"); |
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
104 |
goto out_release_master; |
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
105 |
} |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
106 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
112 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
113 |
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
|
114 |
if (ecrt_master_activate(master)) { |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
115 |
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
|
116 |
goto out_release_master; |
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
65
diff
changeset
|
117 |
} |
64 | 118 |
|
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
119 |
#if 0 |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
120 |
if (ecrt_master_fetch_sdo_lists(master)) { |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
121 |
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
|
122 |
goto out_deactivate; |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
123 |
} |
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
124 |
ecrt_master_print(master, 2); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
125 |
#else |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
126 |
ecrt_master_print(master, 0); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
127 |
#endif |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
128 |
|
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
129 |
|
130 | 130 |
#if 0 |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
131 |
if (!(slave = ecrt_master_get_slave(master, "5"))) { |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
132 |
printk(KERN_ERR "Failed to get slave 5!\n"); |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
133 |
goto out_deactivate; |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
134 |
} |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
135 |
|
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
136 |
if (ecrt_slave_sdo_write_exp8(slave, 0x4061, 1, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
137 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 2, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
138 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 3, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
139 |
ecrt_slave_sdo_write_exp8(slave, 0x4066, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
140 |
ecrt_slave_sdo_write_exp8(slave, 0x4067, 0, 4) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
141 |
ecrt_slave_sdo_write_exp8(slave, 0x4068, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
142 |
ecrt_slave_sdo_write_exp8(slave, 0x4069, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
143 |
ecrt_slave_sdo_write_exp8(slave, 0x406A, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
144 |
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
|
145 |
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
|
146 |
goto out_deactivate; |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
147 |
} |
130 | 148 |
#endif |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
149 |
|
114 | 150 |
#if 0 |
151 |
printk(KERN_INFO "Writing alias...\n"); |
|
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
152 |
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
|
153 |
printk(KERN_ERR "Failed to write alias!\n"); |
114 | 154 |
goto out_deactivate; |
155 |
} |
|
156 |
#endif |
|
157 |
||
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
158 |
#ifdef ASYNC |
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
159 |
// Einmal senden und warten... |
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
160 |
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
|
161 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
162 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
163 |
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
|
164 |
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
|
165 |
timer.function = run; |
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
166 |
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
|
167 |
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
|
168 |
|
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
169 |
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
|
170 |
return 0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
171 |
|
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
172 |
#if 0 |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
173 |
out_deactivate: |
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
174 |
ecrt_master_deactivate(master); |
147
a355b587b4bc
Ausgaben verbessert, Mini-Modul angepasst.
Florian Pose <fp@igh-essen.com>
parents:
140
diff
changeset
|
175 |
#endif |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
176 |
out_release_master: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
177 |
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
|
178 |
out_return: |
111
9963537ec776
Bugfix: SDO download. SDO abort codes ausgeben.
Florian Pose <fp@igh-essen.com>
parents:
109
diff
changeset
|
179 |
return -1; |
0 | 180 |
} |
181 |
||
60
2d2b120ba734
Neue Schnittstellen in Mini ?bertragen.
Florian Pose <fp@igh-essen.com>
parents:
57
diff
changeset
|
182 |
/*****************************************************************************/ |
22
e8c2cd004e0b
Portierung der Module in drivers/ und mini/ nach Kernel 2.6.
Florian Pose <fp@igh-essen.com>
parents:
13
diff
changeset
|
183 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
184 |
void __exit cleanup_mini_module(void) |
0 | 185 |
{ |
26 | 186 |
printk(KERN_INFO "=== Stopping Minimal EtherCAT environment... ===\n"); |
0 | 187 |
|
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
130
diff
changeset
|
188 |
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
|
189 |
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
|
190 |
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
|
191 |
ecrt_master_deactivate(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
192 |
ecrt_release_master(master); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
26
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 |
|
26 | 195 |
printk(KERN_INFO "=== Minimal EtherCAT environment stopped. ===\n"); |
0 | 196 |
} |
197 |
||
198 |
/*****************************************************************************/ |
|
199 |
||
200 |
MODULE_LICENSE("GPL"); |
|
201 |
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
|
202 |
MODULE_DESCRIPTION ("EtherCAT minimal test environment"); |
0 | 203 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
204 |
module_init(init_mini_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
47
diff
changeset
|
205 |
module_exit(cleanup_mini_module); |
0 | 206 |
|
207 |
/*****************************************************************************/ |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
208 |
|
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
209 |
/* Emacs-Konfiguration |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
210 |
;;; Local Variables: *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
211 |
;;; c-basic-offset:4 *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
212 |
;;; End: *** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
36
diff
changeset
|
213 |
*/ |