author | Florian Pose <fp@igh-essen.com> |
Fri, 16 Dec 2005 15:25:13 +0000 | |
branch | kernel2.6 |
changeset 36 | 6e9de6fbf74c |
parent 35 | ed834aa98f89 |
child 39 | 6965c23a6826 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************** |
2 |
* |
|
3 |
* e c _ t y p e s . c |
|
4 |
* |
|
5 |
* EtherCAT-Slave-Typen. |
|
6 |
* |
|
7 |
* $Date: 2005-09-07 17:50:50 +0200 (Mit, 07 Sep 2005) $ |
|
8 |
* $Author: fp $ |
|
9 |
* |
|
10 |
***************************************************************/ |
|
11 |
||
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
12 |
#include <linux/module.h> |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
13 |
|
0 | 14 |
#include "ec_globals.h" |
15 |
#include "ec_types.h" |
|
16 |
||
17 |
/***************************************************************/ |
|
18 |
||
19 |
unsigned char sm0_multi[] = {0x00, 0x18, 0xF6, 0x00, 0x26, 0x00, 0x01, 0x00}; |
|
20 |
unsigned char sm1_multi[] = {0xF6, 0x18, 0xF6, 0x00, 0x22, 0x00, 0x01, 0x00}; |
|
21 |
||
22 |
unsigned char sm0_1014[] = {0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}; |
|
23 |
||
24 |
unsigned char sm0_2004[] = {0x00, 0x0F, 0x01, 0x00, 0x46, 0x00, 0x01, 0x00}; |
|
25 |
||
26 |
unsigned char sm2_31xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00}; |
|
27 |
unsigned char sm3_31xx[] = {0x00, 0x11, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00}; |
|
28 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
29 |
unsigned char sm2_41xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; |
0 | 30 |
|
31 |
||
32 |
unsigned char fmmu0_1014[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
33 |
0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
34 |
||
35 |
unsigned char fmmu0_2004[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
36 |
0x00, 0x0F, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
|
37 |
||
38 |
unsigned char fmmu0_31xx[] = {0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07, |
|
39 |
0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
40 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
41 |
unsigned char fmmu0_41xx[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, |
0 | 42 |
0x00, 0x10, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
43 |
||
44 |
int read_1014(unsigned char *data, unsigned int channel) |
|
45 |
{ |
|
46 |
return (data[0] >> channel) & 0x01; |
|
47 |
} |
|
48 |
||
49 |
void write_2004(unsigned char *data, unsigned int channel, int value) |
|
50 |
{ |
|
51 |
if (value) |
|
52 |
{ |
|
53 |
data[0] |= (1 << channel); |
|
54 |
} |
|
55 |
else |
|
56 |
{ |
|
57 |
data[0] &= ~(1 << channel); |
|
58 |
} |
|
59 |
} |
|
60 |
||
61 |
int read_31xx(unsigned char *data, unsigned int channel) |
|
62 |
{ |
|
63 |
return (short int) ((data[channel * 3 + 2] << 8) | data[channel * 3 + 1]); |
|
64 |
} |
|
65 |
||
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
66 |
void write_41xx(unsigned char *data, unsigned int channel, int value) |
0 | 67 |
{ |
68 |
data[channel * 3 + 1] = (value & 0xFF00) >> 8; |
|
69 |
data[channel * 3 + 2] = value & 0xFF; |
|
70 |
} |
|
71 |
||
72 |
/***************************************************************/ |
|
73 |
||
74 |
EtherCAT_slave_desc_t Beckhoff_EK1100[] = |
|
75 |
{{ |
|
76 |
"Beckhoff", "EK1100", "Bus Coupler", |
|
77 |
ECAT_ST_SIMPLE_NOSYNC, |
|
78 |
NULL, NULL, NULL, NULL, |
|
79 |
NULL, |
|
80 |
0, 0, |
|
81 |
NULL, NULL |
|
82 |
}}; |
|
83 |
||
84 |
EtherCAT_slave_desc_t Beckhoff_EL1014[] = |
|
85 |
{{ |
|
86 |
"Beckhoff", "EL1014", "4x Digital Input", |
|
87 |
ECAT_ST_SIMPLE, |
|
88 |
sm0_1014, NULL, NULL, NULL, |
|
89 |
fmmu0_1014, |
|
90 |
1, 4, |
|
91 |
read_1014, NULL |
|
92 |
}}; |
|
93 |
||
94 |
EtherCAT_slave_desc_t Beckhoff_EL2004[] = |
|
95 |
{{ |
|
96 |
"Beckhoff", "EL2004", "4x Digital Output", |
|
97 |
ECAT_ST_SIMPLE, |
|
98 |
sm0_2004, NULL, NULL, NULL, |
|
99 |
fmmu0_2004, |
|
100 |
1, 4, |
|
101 |
NULL, write_2004 |
|
102 |
}}; |
|
103 |
||
104 |
EtherCAT_slave_desc_t Beckhoff_EL3102[] = |
|
105 |
{{ |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
106 |
"Beckhoff", "EL3102", "2x Analog Input diff.", |
0 | 107 |
ECAT_ST_MAILBOX, |
108 |
sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
109 |
fmmu0_31xx, |
|
110 |
6, 2, |
|
111 |
read_31xx, NULL |
|
112 |
}}; |
|
113 |
||
114 |
EtherCAT_slave_desc_t Beckhoff_EL3162[] = |
|
115 |
{{ |
|
116 |
"Beckhoff", "EL3162", "2x Analog Input", |
|
117 |
ECAT_ST_MAILBOX, |
|
118 |
sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
119 |
fmmu0_31xx, |
|
120 |
6, 2, |
|
121 |
read_31xx, NULL |
|
122 |
}}; |
|
123 |
||
124 |
EtherCAT_slave_desc_t Beckhoff_EL4102[] = |
|
125 |
{{ |
|
126 |
"Beckhoff", "EL4102", "2x Analog Output", |
|
127 |
ECAT_ST_MAILBOX, |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
128 |
sm0_multi, sm1_multi, sm2_41xx, NULL, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
129 |
fmmu0_41xx, |
0 | 130 |
4, 2, |
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
131 |
NULL, write_41xx |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
132 |
}}; |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
133 |
|
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
134 |
EtherCAT_slave_desc_t Beckhoff_EL4132[] = |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
135 |
{{ |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
136 |
"Beckhoff", "EL4132", "2x Analog Output diff.", |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
137 |
ECAT_ST_MAILBOX, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
138 |
sm0_multi, sm1_multi, sm2_41xx, NULL, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
139 |
fmmu0_41xx, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
140 |
4, 2, |
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
141 |
NULL, write_41xx |
0 | 142 |
}}; |
143 |
||
144 |
EtherCAT_slave_desc_t Beckhoff_EL5001[] = |
|
145 |
{{ |
|
146 |
"Beckhoff", "EL5001", "SSI-Interface", |
|
147 |
ECAT_ST_SIMPLE, |
|
148 |
NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... |
|
149 |
NULL, |
|
150 |
0, 0, |
|
151 |
NULL, NULL |
|
152 |
}}; |
|
153 |
||
154 |
/***************************************************************/ |
|
155 |
||
156 |
unsigned int slave_idents_count = 7; |
|
157 |
||
17
1b5aea4d5147
Code zum Senden/Empfangen mehrerer Kommandos in einem Frame vorerst ganz entfernt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
158 |
struct slave_ident slave_idents[] = |
0 | 159 |
{ |
160 |
{0x00000002, 0x03F63052, Beckhoff_EL1014}, |
|
161 |
{0x00000002, 0x044C2C52, Beckhoff_EK1100}, |
|
162 |
{0x00000002, 0x07D43052, Beckhoff_EL2004}, |
|
163 |
{0x00000002, 0x0C1E3052, Beckhoff_EL3102}, |
|
164 |
{0x00000002, 0x0C5A3052, Beckhoff_EL3162}, |
|
165 |
{0x00000002, 0x10063052, Beckhoff_EL4102}, |
|
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
166 |
{0x00000002, 0x10243052, Beckhoff_EL4132}, |
0 | 167 |
{0x00000002, 0x13893052, Beckhoff_EL5001} |
168 |
}; |
|
169 |
||
170 |
/***************************************************************/ |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
171 |
|
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
172 |
EXPORT_SYMBOL(Beckhoff_EK1100); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
173 |
EXPORT_SYMBOL(Beckhoff_EL1014); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
174 |
EXPORT_SYMBOL(Beckhoff_EL2004); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
175 |
EXPORT_SYMBOL(Beckhoff_EL3102); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
176 |
EXPORT_SYMBOL(Beckhoff_EL3162); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
177 |
EXPORT_SYMBOL(Beckhoff_EL4102); |
35
ed834aa98f89
Klemme Beckhoff EL4132 hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
24
diff
changeset
|
178 |
EXPORT_SYMBOL(Beckhoff_EL4132); |
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
179 |
EXPORT_SYMBOL(Beckhoff_EL5001); |