author | Florian Pose <fp@igh-essen.com> |
Sun, 02 Apr 2006 09:26:56 +0000 | |
changeset 143 | f6c4f38b699f |
parent 142 | e933f1adb550 |
child 144 | fdc24bf62f80 |
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> |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
24 |
#include <linux/slab.h> |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
25 |
#include <linux/vmalloc.h> |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
26 |
#include <linux/delay.h> |
28 | 27 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
28 |
// RT_lib |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
29 |
#include <msr_main.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
30 |
#include <msr_utils.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
31 |
#include <msr_messages.h> |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
32 |
#include <msr_float.h> |
28 | 33 |
#include <msr_reg.h> |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
34 |
#include <msr_time.h> |
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
35 |
#include "msr_param.h" |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
36 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
37 |
// EtherCAT |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
38 |
#include "../include/ecrt.h" |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
39 |
|
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
40 |
#define ASYNC |
142 | 41 |
//#define BLOCK1 |
28 | 42 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
43 |
// Defines/Makros |
47
ad5f969f263b
Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents:
45
diff
changeset
|
44 |
#define HZREDUCTION (MSR_ABTASTFREQUENZ / HZ) |
28 | 45 |
|
45
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 |
/* Globale Variablen */ |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
48 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
49 |
// Adeos |
28 | 50 |
static struct ipipe_domain this_domain; |
51 |
static struct ipipe_sysinfo sys_info; |
|
52 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
53 |
// EtherCAT |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
54 |
ec_master_t *master = NULL; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
55 |
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
|
56 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
57 |
// Prozessdaten |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
58 |
#ifdef BLOCK1 |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
59 |
void *r_ssi, *r_ssi_st; |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
60 |
#else |
82
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
61 |
void *r_inc; |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
62 |
#endif |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
63 |
|
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
64 |
uint32_t k_ssi_pos; |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
65 |
uint32_t k_ssi_status; |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
66 |
uint32_t k_angle; |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
67 |
uint32_t k_preio; |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
68 |
uint32_t k_postio; |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
69 |
uint32_t k_finished; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
70 |
|
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
71 |
#ifdef BLOCK1 |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
72 |
ec_field_init_t domain1_fields[] = { |
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
73 |
{&r_ssi, "5", "Beckhoff", "EL5001", "InputValue", 0}, |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
74 |
{&r_ssi_st, "5", "Beckhoff", "EL5001", "Status", 0}, |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
75 |
{} |
61
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
76 |
}; |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
77 |
#else |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
78 |
ec_field_init_t domain1_fields[] = { |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
79 |
{&r_inc, "4", "Beckhoff", "EL5101", "InputValue", 0}, |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
80 |
{} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
81 |
}; |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
82 |
#endif |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
83 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
84 |
/*****************************************************************************/ |
28 | 85 |
|
86 |
static void msr_controller_run(void) |
|
87 |
{ |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
88 |
cycles_t offset; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
89 |
static unsigned int counter = 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
90 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
91 |
offset = get_cycles(); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
92 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
93 |
if (counter) counter--; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
94 |
else { |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
95 |
//EtherCAT_rt_master_debug(master, 2); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
96 |
counter = MSR_ABTASTFREQUENZ; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
97 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
98 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
99 |
k_preio = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz; |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
100 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
101 |
#ifdef ASYNC |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
102 |
// Empfangen |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
103 |
ecrt_master_async_receive(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
104 |
ecrt_domain_process(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
105 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
106 |
// Prozessdaten verarbeiten |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
107 |
#ifdef BLOCK1 |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
108 |
k_ssi_pos = EC_READ_U32(r_ssi); |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
109 |
k_ssi_status = EC_READ_U32(r_ssi_st); |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
110 |
#else |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
111 |
k_angle = EC_READ_U16(r_inc); |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
112 |
#endif |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
113 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
114 |
// Senden |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
115 |
ecrt_domain_queue(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
116 |
ecrt_master_async_send(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
117 |
#else |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
118 |
// Senden und empfangen |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
119 |
ecrt_domain_queue(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
120 |
ecrt_master_sync_io(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
121 |
ecrt_domain_process(domain1); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
122 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
123 |
// Prozessdaten verarbeiten |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
124 |
#ifdef BLOCK1 |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
125 |
k_ssi_pos = EC_READ_U32(r_ssi); |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
126 |
k_ssi_status = EC_READ_U32(r_ssi_st); |
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
127 |
#else |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
128 |
k_angle = EC_READ_U16(r_inc); |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
129 |
#endif |
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
130 |
|
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
131 |
#endif // ASYNC |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
132 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
133 |
k_postio = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz; |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
134 |
|
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
135 |
//ecrt_master_debug(master, 0); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
136 |
k_finished = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz; |
82
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
137 |
} |
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
138 |
|
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
139 |
/*****************************************************************************/ |
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
140 |
|
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
141 |
int msr_globals_register(void) |
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
142 |
{ |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
143 |
msr_reg_kanal("/angle0", "", &k_angle, TUINT); |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
144 |
msr_reg_kanal("/pos0", "", &k_ssi_pos, TUINT); |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
145 |
msr_reg_kanal("/ssi-status0", "", &k_ssi_status, TUINT); |
82
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
146 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
147 |
msr_reg_kanal("/Timing/Pre-IO", "ns", &k_preio, TUINT); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
148 |
msr_reg_kanal("/Timing/Post-IO", "ns", &k_postio, TUINT); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
149 |
msr_reg_kanal("/Timing/Finished", "ns", &k_finished, TUINT); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
150 |
|
82
30d0708229b9
Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents:
81
diff
changeset
|
151 |
return 0; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
152 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
153 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
154 |
/*****************************************************************************/ |
28 | 155 |
|
156 |
void msr_run(unsigned irq) |
|
157 |
{ |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
158 |
static int counter = 0; |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
159 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
160 |
MSR_ADEOS_INTERRUPT_CODE(msr_controller_run(); msr_write_kanal_list();); |
28 | 161 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
162 |
ipipe_control_irq(irq, 0, IPIPE_ENABLE_MASK); // Interrupt bestŽätigen |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
163 |
if (++counter >= HZREDUCTION) { |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
164 |
ipipe_propagate_irq(irq); // und weiterreichen |
28 | 165 |
counter = 0; |
166 |
} |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
167 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
168 |
|
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
169 |
/*****************************************************************************/ |
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
170 |
|
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
171 |
void domain_entry(void) |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
172 |
{ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
173 |
printk("Domain %s started.\n", ipipe_current_domain->name); |
28 | 174 |
|
175 |
ipipe_get_sysinfo(&sys_info); |
|
176 |
ipipe_virtualize_irq(ipipe_current_domain,sys_info.archdep.tmirq, |
|
177 |
&msr_run, NULL, IPIPE_HANDLE_MASK); |
|
178 |
||
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
62
diff
changeset
|
179 |
ipipe_tune_timer(1000000000UL / MSR_ABTASTFREQUENZ, 0); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
180 |
} |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
181 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
182 |
/*****************************************************************************/ |
28 | 183 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
184 |
int __init init_rt_module(void) |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
185 |
{ |
28 | 186 |
struct ipipe_domain_attr attr; //ipipe |
139 | 187 |
uint8_t string[20]; |
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
188 |
size_t size; |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
189 |
ec_slave_t *slave; |
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
190 |
|
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
191 |
// Als allererstes die RT-Lib initialisieren |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
192 |
if (msr_rtlib_init(1, MSR_ABTASTFREQUENZ, 10, &msr_globals_register) < 0) { |
28 | 193 |
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
|
194 |
goto out_return; |
28 | 195 |
} |
196 |
||
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
197 |
if ((master = ecrt_request_master(0)) == NULL) { |
55
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
198 |
printk(KERN_ERR "Error requesting master 0!\n"); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
199 |
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
|
200 |
} |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
201 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
202 |
printk(KERN_INFO "Registering domains...\n"); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
203 |
if (!(domain1 = ecrt_master_create_domain(master))) { |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
204 |
printk(KERN_ERR "Could not register domain!\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
205 |
goto out_release_master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
206 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
207 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
208 |
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
|
209 |
if (ecrt_domain_register_field_list(domain1, domain1_fields)) { |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
210 |
printk(KERN_ERR "Failed to register domain fields.\n"); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
211 |
goto out_release_master; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
212 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
213 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
214 |
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
|
215 |
if (ecrt_master_activate(master)) { |
80
8cd08d73b560
CANopen SDO read implementiert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
216 |
printk(KERN_ERR "Could not activate master!\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
217 |
goto out_release_master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
218 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
219 |
|
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
139
diff
changeset
|
220 |
#if 0 |
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
134
diff
changeset
|
221 |
if (ecrt_master_fetch_sdo_lists(master)) { |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
134
diff
changeset
|
222 |
printk(KERN_ERR "Failed to fetch SDO lists!\n"); |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
134
diff
changeset
|
223 |
goto out_deactivate; |
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
134
diff
changeset
|
224 |
} |
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
139
diff
changeset
|
225 |
ecrt_master_print(master, 2); |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
139
diff
changeset
|
226 |
#else |
142 | 227 |
ecrt_master_print(master, 1); |
140
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
139
diff
changeset
|
228 |
#endif |
b09658e50d6f
Verbosity level in ecrt_master_print().
Florian Pose <fp@igh-essen.com>
parents:
139
diff
changeset
|
229 |
|
135
80d493917205
Laden der SDO Dictionaries funktioniert.
Florian Pose <fp@igh-essen.com>
parents:
134
diff
changeset
|
230 |
|
136
a03a684cac89
Dynamische Mailbox-Kommunikation, auch mit unbekannten Slaves.
Florian Pose <fp@igh-essen.com>
parents:
135
diff
changeset
|
231 |
#ifdef BLOCK1 |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
232 |
if (!(slave = ecrt_master_get_slave(master, "1"))) { |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
233 |
printk(KERN_ERR "Failed to get slave 1!\n"); |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
234 |
goto out_deactivate; |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
235 |
} |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
236 |
|
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
237 |
size = 10; |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
238 |
if (ecrt_slave_sdo_read(slave, 0x100A, 0, string, &size)) { |
80
8cd08d73b560
CANopen SDO read implementiert.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
239 |
printk(KERN_ERR "Could not read SSI version!\n"); |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
240 |
goto out_deactivate; |
68
a452700db994
Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents:
62
diff
changeset
|
241 |
} |
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
242 |
printk(KERN_INFO "Software-version 1: %s\n", string); |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
243 |
|
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
244 |
if (!(slave = ecrt_master_get_slave(master, "5"))) { |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
245 |
printk(KERN_ERR "Failed to get slave 5!\n"); |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
246 |
goto out_deactivate; |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
247 |
} |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
248 |
|
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
249 |
size = 10; |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
250 |
if (ecrt_slave_sdo_read(slave, 0x100A, 0, string, &size)) { |
137
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
251 |
printk(KERN_ERR "Could not read SSI version!\n"); |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
252 |
goto out_deactivate; |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
253 |
} |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
254 |
printk(KERN_INFO "Software-version 5: %s\n", string); |
3fb18812871a
SDO-Zugriff aufgeteilt in Expedited und Normal. Noch nicht fertig...
Florian Pose <fp@igh-essen.com>
parents:
136
diff
changeset
|
255 |
|
139 | 256 |
size = 20; |
257 |
if (ecrt_slave_sdo_read(slave, 0x1008, 0, string, &size)) { |
|
258 |
printk(KERN_ERR "Could not read string!\n"); |
|
259 |
goto out_deactivate; |
|
260 |
} |
|
261 |
printk(KERN_INFO "String: %s\n", string); |
|
262 |
||
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
263 |
if (ecrt_slave_sdo_write_exp8(slave, 0x4061, 1, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
264 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 2, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
265 |
ecrt_slave_sdo_write_exp8(slave, 0x4061, 3, 1) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
266 |
ecrt_slave_sdo_write_exp8(slave, 0x4066, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
267 |
ecrt_slave_sdo_write_exp8(slave, 0x4067, 0, 4) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
268 |
ecrt_slave_sdo_write_exp8(slave, 0x4068, 0, 0) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
269 |
ecrt_slave_sdo_write_exp8(slave, 0x4069, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
270 |
ecrt_slave_sdo_write_exp8(slave, 0x406A, 0, 25) || |
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
137
diff
changeset
|
271 |
ecrt_slave_sdo_write_exp8(slave, 0x406B, 0, 50)) { |
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
272 |
printk(KERN_ERR "Failed to configure SSI slave!\n"); |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
273 |
goto out_deactivate; |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
274 |
} |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
275 |
#endif |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
276 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
277 |
#ifdef ASYNC |
106
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
278 |
// Einmal senden und warten... |
d6679c77ad3f
ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
279 |
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
|
280 |
#endif |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
281 |
|
61
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
282 |
ipipe_init_attr(&attr); |
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
283 |
attr.name = "IPIPE-MSR-MODULE"; |
28 | 284 |
attr.priority = IPIPE_ROOT_PRIO + 1; |
61
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
285 |
attr.entry = &domain_entry; |
cd014255f94f
register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents:
59
diff
changeset
|
286 |
ipipe_register_domain(&this_domain, &attr); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
287 |
return 0; |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
288 |
|
133
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
289 |
out_deactivate: |
b36d187ecc0b
Unterst?tzte Prot. auslesen, Mailbox in Slave ausgelagert, Bugfix in Anzeige des Watch-Frames und erste SDO-List-Abfrage.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
290 |
ecrt_master_deactivate(master); |
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
291 |
out_release_master: |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
292 |
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
|
293 |
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
|
294 |
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
|
295 |
out_return: |
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
296 |
return -1; |
28 | 297 |
} |
298 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
299 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
300 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
301 |
void __exit cleanup_rt_module(void) |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
302 |
{ |
28 | 303 |
msr_print_info("msk_modul: unloading..."); |
304 |
||
45
f525f7db2d90
Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents:
43
diff
changeset
|
305 |
ipipe_tune_timer(1000000000UL / HZ, 0); //alten Timertakt wieder herstellen |
28 | 306 |
ipipe_unregister_domain(&this_domain); |
307 |
||
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
308 |
if (master) |
28 | 309 |
{ |
43 | 310 |
printk(KERN_INFO "=== Stopping EtherCAT environment... ===\n"); |
311 |
||
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
312 |
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
|
313 |
ecrt_master_deactivate(master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
98
diff
changeset
|
314 |
ecrt_release_master(master); |
43 | 315 |
|
316 |
printk(KERN_INFO "=== EtherCAT environment stopped. ===\n"); |
|
317 |
} |
|
28 | 318 |
|
36
6e9de6fbf74c
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents:
33
diff
changeset
|
319 |
msr_rtlib_cleanup(); |
28 | 320 |
} |
321 |
||
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
322 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
40
diff
changeset
|
323 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
324 |
#define EC_LIT(X) #X |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
325 |
#define EC_STR(X) EC_LIT(X) |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
326 |
#define COMPILE_INFO "Revision " EC_STR(SVNREV) \ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
327 |
", compiled by " EC_STR(USER) \ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
328 |
" at " __DATE__ " " __TIME__ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
329 |
|
28 | 330 |
MODULE_LICENSE("GPL"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
331 |
MODULE_AUTHOR ("Florian Pose <fp@igh-essen.com>"); |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
68
diff
changeset
|
332 |
MODULE_DESCRIPTION ("EtherCAT real-time test environment"); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
91
diff
changeset
|
333 |
MODULE_VERSION(COMPILE_INFO); |
28 | 334 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
335 |
module_init(init_rt_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
336 |
module_exit(cleanup_rt_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
337 |
|
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
51
diff
changeset
|
338 |
/*****************************************************************************/ |
55
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
339 |
|
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
340 |
/* Emacs-Konfiguration |
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
341 |
;;; Local Variables: *** |
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
342 |
;;; c-basic-offset:4 *** |
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
343 |
;;; End: *** |
059a9e712aa7
Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents:
54
diff
changeset
|
344 |
*/ |