author | Florian Pose <fp@igh-essen.com> |
Fri, 23 Dec 2005 08:20:10 +0000 | |
changeset 40 | d07ebafe62dd |
parent 39 | 6965c23a6826 |
permissions | -rw-r--r-- |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
1 |
/****************************************************************************** |
0 | 2 |
* |
3 |
* e c _ t y p e s . c |
|
4 |
* |
|
5 |
* EtherCAT-Slave-Typen. |
|
6 |
* |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
7 |
* $Id$ |
0 | 8 |
* |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
9 |
*****************************************************************************/ |
0 | 10 |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
11 |
#include <linux/module.h> |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
12 |
|
0 | 13 |
#include "ec_globals.h" |
14 |
#include "ec_types.h" |
|
15 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
16 |
/*****************************************************************************/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
17 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
18 |
/* Konfigurationen der Sync-Manager */ |
0 | 19 |
|
20 |
unsigned char sm0_multi[] = {0x00, 0x18, 0xF6, 0x00, 0x26, 0x00, 0x01, 0x00}; |
|
21 |
unsigned char sm1_multi[] = {0xF6, 0x18, 0xF6, 0x00, 0x22, 0x00, 0x01, 0x00}; |
|
22 |
||
23 |
unsigned char sm0_1014[] = {0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}; |
|
24 |
||
25 |
unsigned char sm0_2004[] = {0x00, 0x0F, 0x01, 0x00, 0x46, 0x00, 0x01, 0x00}; |
|
26 |
||
27 |
unsigned char sm2_31xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00}; |
|
28 |
unsigned char sm3_31xx[] = {0x00, 0x11, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00}; |
|
29 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
30 |
unsigned char sm2_41xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; |
0 | 31 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
32 |
/* Konfigurationen der Memory-Management-Units */ |
0 | 33 |
|
34 |
unsigned char fmmu0_1014[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
35 |
0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
36 |
||
37 |
unsigned char fmmu0_2004[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
38 |
0x00, 0x0F, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
|
39 |
||
40 |
unsigned char fmmu0_31xx[] = {0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07, |
|
41 |
0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
42 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
43 |
unsigned char fmmu0_41xx[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, |
0 | 44 |
0x00, 0x10, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
45 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
46 |
/*****************************************************************************/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
47 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
48 |
/* Lese- und Schreibfunktionen */ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
49 |
|
0 | 50 |
int read_1014(unsigned char *data, unsigned int channel) |
51 |
{ |
|
52 |
return (data[0] >> channel) & 0x01; |
|
53 |
} |
|
54 |
||
55 |
void write_2004(unsigned char *data, unsigned int channel, int value) |
|
56 |
{ |
|
57 |
if (value) |
|
58 |
{ |
|
59 |
data[0] |= (1 << channel); |
|
60 |
} |
|
61 |
else |
|
62 |
{ |
|
63 |
data[0] &= ~(1 << channel); |
|
64 |
} |
|
65 |
} |
|
66 |
||
67 |
int read_31xx(unsigned char *data, unsigned int channel) |
|
68 |
{ |
|
69 |
return (short int) ((data[channel * 3 + 2] << 8) | data[channel * 3 + 1]); |
|
70 |
} |
|
71 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
72 |
void write_41xx(unsigned char *data, unsigned int channel, int value) |
0 | 73 |
{ |
74 |
data[channel * 3 + 1] = (value & 0xFF00) >> 8; |
|
75 |
data[channel * 3 + 2] = value & 0xFF; |
|
76 |
} |
|
77 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
78 |
/*****************************************************************************/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
79 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
80 |
/* Klemmen-Objekte */ |
0 | 81 |
|
82 |
EtherCAT_slave_desc_t Beckhoff_EK1100[] = |
|
83 |
{{ |
|
84 |
"Beckhoff", "EK1100", "Bus Coupler", |
|
85 |
ECAT_ST_SIMPLE_NOSYNC, |
|
86 |
NULL, NULL, NULL, NULL, |
|
87 |
NULL, |
|
88 |
0, 0, |
|
89 |
NULL, NULL |
|
90 |
}}; |
|
91 |
||
92 |
EtherCAT_slave_desc_t Beckhoff_EL1014[] = |
|
93 |
{{ |
|
94 |
"Beckhoff", "EL1014", "4x Digital Input", |
|
95 |
ECAT_ST_SIMPLE, |
|
96 |
sm0_1014, NULL, NULL, NULL, |
|
97 |
fmmu0_1014, |
|
98 |
1, 4, |
|
99 |
read_1014, NULL |
|
100 |
}}; |
|
101 |
||
102 |
EtherCAT_slave_desc_t Beckhoff_EL2004[] = |
|
103 |
{{ |
|
104 |
"Beckhoff", "EL2004", "4x Digital Output", |
|
105 |
ECAT_ST_SIMPLE, |
|
106 |
sm0_2004, NULL, NULL, NULL, |
|
107 |
fmmu0_2004, |
|
108 |
1, 4, |
|
109 |
NULL, write_2004 |
|
110 |
}}; |
|
111 |
||
112 |
EtherCAT_slave_desc_t Beckhoff_EL3102[] = |
|
113 |
{{ |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
114 |
"Beckhoff", "EL3102", "2x Analog Input diff.", |
0 | 115 |
ECAT_ST_MAILBOX, |
116 |
sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
117 |
fmmu0_31xx, |
|
118 |
6, 2, |
|
119 |
read_31xx, NULL |
|
120 |
}}; |
|
121 |
||
122 |
EtherCAT_slave_desc_t Beckhoff_EL3162[] = |
|
123 |
{{ |
|
124 |
"Beckhoff", "EL3162", "2x Analog Input", |
|
125 |
ECAT_ST_MAILBOX, |
|
126 |
sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
127 |
fmmu0_31xx, |
|
128 |
6, 2, |
|
129 |
read_31xx, NULL |
|
130 |
}}; |
|
131 |
||
132 |
EtherCAT_slave_desc_t Beckhoff_EL4102[] = |
|
133 |
{{ |
|
134 |
"Beckhoff", "EL4102", "2x Analog Output", |
|
135 |
ECAT_ST_MAILBOX, |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
136 |
sm0_multi, sm1_multi, sm2_41xx, NULL, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
137 |
fmmu0_41xx, |
0 | 138 |
4, 2, |
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
139 |
NULL, write_41xx |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
140 |
}}; |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
141 |
|
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
142 |
EtherCAT_slave_desc_t Beckhoff_EL4132[] = |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
143 |
{{ |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
144 |
"Beckhoff", "EL4132", "2x Analog Output diff.", |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
145 |
ECAT_ST_MAILBOX, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
146 |
sm0_multi, sm1_multi, sm2_41xx, NULL, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
147 |
fmmu0_41xx, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
148 |
4, 2, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
149 |
NULL, write_41xx |
0 | 150 |
}}; |
151 |
||
152 |
EtherCAT_slave_desc_t Beckhoff_EL5001[] = |
|
153 |
{{ |
|
154 |
"Beckhoff", "EL5001", "SSI-Interface", |
|
155 |
ECAT_ST_SIMPLE, |
|
156 |
NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... |
|
157 |
NULL, |
|
158 |
0, 0, |
|
159 |
NULL, NULL |
|
160 |
}}; |
|
161 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
162 |
/*****************************************************************************/ |
0 | 163 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
164 |
/** |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
165 |
Beziehung zwischen Identifikationsnummern und Klemmen-Objekt. |
0 | 166 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
167 |
Diese Tabelle stellt die Beziehungen zwischen bestimmten Kombinationen |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
168 |
aus Vendor-IDs und Product-Codes und der entsprechenden Klemme her. |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
169 |
Neue Klemmen müssen hier eingetragen werden. |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
170 |
*/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
171 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
172 |
EtherCAT_slave_ident_t slave_idents[] = |
0 | 173 |
{ |
174 |
{0x00000002, 0x03F63052, Beckhoff_EL1014}, |
|
175 |
{0x00000002, 0x044C2C52, Beckhoff_EK1100}, |
|
176 |
{0x00000002, 0x07D43052, Beckhoff_EL2004}, |
|
177 |
{0x00000002, 0x0C1E3052, Beckhoff_EL3102}, |
|
178 |
{0x00000002, 0x0C5A3052, Beckhoff_EL3162}, |
|
179 |
{0x00000002, 0x10063052, Beckhoff_EL4102}, |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
180 |
{0x00000002, 0x10243052, Beckhoff_EL4132}, |
0 | 181 |
{0x00000002, 0x13893052, Beckhoff_EL5001} |
182 |
}; |
|
183 |
||
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
184 |
unsigned int slave_ident_count = sizeof(slave_idents) |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
185 |
/ sizeof(EtherCAT_slave_ident_t); |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
186 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
187 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
188 |
/*****************************************************************************/ |
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
189 |
|
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
190 |
EXPORT_SYMBOL(Beckhoff_EK1100); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
191 |
EXPORT_SYMBOL(Beckhoff_EL1014); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
192 |
EXPORT_SYMBOL(Beckhoff_EL2004); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
193 |
EXPORT_SYMBOL(Beckhoff_EL3102); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
194 |
EXPORT_SYMBOL(Beckhoff_EL3162); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
195 |
EXPORT_SYMBOL(Beckhoff_EL4102); |
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
196 |
EXPORT_SYMBOL(Beckhoff_EL4132); |
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
197 |
EXPORT_SYMBOL(Beckhoff_EL5001); |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
198 |
|
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
35
diff
changeset
|
199 |
/*****************************************************************************/ |