author | Wilhelm Hagemeister <hm@igh-essen.com> |
Fri, 16 Dec 2005 09:04:00 +0000 | |
branch | kernel2.6 |
changeset 29 | 8c16582f2394 |
parent 24 | d417dd9bdc2f |
child 35 | ed834aa98f89 |
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 |
||
29 |
unsigned char sm2_4102[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; |
|
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 |
||
41 |
unsigned char fmmu0_4102[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, |
|
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 |
||
66 |
void write_4102(unsigned char *data, unsigned int channel, int value) |
|
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 |
{{ |
|
106 |
"Beckhoff", "EL3102", "2x Analog Input Diff", |
|
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, |
|
128 |
sm0_multi, sm1_multi, sm2_4102, NULL, |
|
129 |
fmmu0_4102, |
|
130 |
4, 2, |
|
131 |
NULL, write_4102 |
|
132 |
}}; |
|
133 |
||
134 |
EtherCAT_slave_desc_t Beckhoff_EL5001[] = |
|
135 |
{{ |
|
136 |
"Beckhoff", "EL5001", "SSI-Interface", |
|
137 |
ECAT_ST_SIMPLE, |
|
138 |
NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... |
|
139 |
NULL, |
|
140 |
0, 0, |
|
141 |
NULL, NULL |
|
142 |
}}; |
|
143 |
||
144 |
/***************************************************************/ |
|
145 |
||
146 |
unsigned int slave_idents_count = 7; |
|
147 |
||
17
1b5aea4d5147
Code zum Senden/Empfangen mehrerer Kommandos in einem Frame vorerst ganz entfernt.
Florian Pose <fp@igh-essen.com>
parents:
0
diff
changeset
|
148 |
struct slave_ident slave_idents[] = |
0 | 149 |
{ |
150 |
{0x00000002, 0x03F63052, Beckhoff_EL1014}, |
|
151 |
{0x00000002, 0x044C2C52, Beckhoff_EK1100}, |
|
152 |
{0x00000002, 0x07D43052, Beckhoff_EL2004}, |
|
153 |
{0x00000002, 0x0C1E3052, Beckhoff_EL3102}, |
|
154 |
{0x00000002, 0x0C5A3052, Beckhoff_EL3162}, |
|
155 |
{0x00000002, 0x10063052, Beckhoff_EL4102}, |
|
156 |
{0x00000002, 0x13893052, Beckhoff_EL5001} |
|
157 |
}; |
|
158 |
||
159 |
/***************************************************************/ |
|
24
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
160 |
|
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
161 |
EXPORT_SYMBOL(Beckhoff_EK1100); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
162 |
EXPORT_SYMBOL(Beckhoff_EL1014); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
163 |
EXPORT_SYMBOL(Beckhoff_EL2004); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
164 |
EXPORT_SYMBOL(Beckhoff_EL3102); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
165 |
EXPORT_SYMBOL(Beckhoff_EL3162); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
166 |
EXPORT_SYMBOL(Beckhoff_EL4102); |
d417dd9bdc2f
Wilhelms ?nderungen ?bernommen.
Florian Pose <fp@igh-essen.com>
parents:
23
diff
changeset
|
167 |
EXPORT_SYMBOL(Beckhoff_EL5001); |