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 |
|
|
12 |
#include "ec_globals.h"
|
|
13 |
#include "ec_types.h"
|
|
14 |
|
|
15 |
/***************************************************************/
|
|
16 |
|
|
17 |
unsigned char sm0_multi[] = {0x00, 0x18, 0xF6, 0x00, 0x26, 0x00, 0x01, 0x00};
|
|
18 |
unsigned char sm1_multi[] = {0xF6, 0x18, 0xF6, 0x00, 0x22, 0x00, 0x01, 0x00};
|
|
19 |
|
|
20 |
unsigned char sm0_1014[] = {0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00};
|
|
21 |
|
|
22 |
unsigned char sm0_2004[] = {0x00, 0x0F, 0x01, 0x00, 0x46, 0x00, 0x01, 0x00};
|
|
23 |
|
|
24 |
unsigned char sm2_31xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00};
|
|
25 |
unsigned char sm3_31xx[] = {0x00, 0x11, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00};
|
|
26 |
|
|
27 |
unsigned char sm2_4102[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00};
|
|
28 |
|
|
29 |
|
|
30 |
unsigned char fmmu0_1014[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07,
|
|
31 |
0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00};
|
|
32 |
|
|
33 |
unsigned char fmmu0_2004[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07,
|
|
34 |
0x00, 0x0F, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00};
|
|
35 |
|
|
36 |
unsigned char fmmu0_31xx[] = {0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07,
|
|
37 |
0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00};
|
|
38 |
|
|
39 |
unsigned char fmmu0_4102[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07,
|
|
40 |
0x00, 0x10, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00};
|
|
41 |
|
|
42 |
int read_1014(unsigned char *data, unsigned int channel)
|
|
43 |
{
|
|
44 |
return (data[0] >> channel) & 0x01;
|
|
45 |
}
|
|
46 |
|
|
47 |
void write_2004(unsigned char *data, unsigned int channel, int value)
|
|
48 |
{
|
|
49 |
if (value)
|
|
50 |
{
|
|
51 |
data[0] |= (1 << channel);
|
|
52 |
}
|
|
53 |
else
|
|
54 |
{
|
|
55 |
data[0] &= ~(1 << channel);
|
|
56 |
}
|
|
57 |
}
|
|
58 |
|
|
59 |
int read_31xx(unsigned char *data, unsigned int channel)
|
|
60 |
{
|
|
61 |
return (short int) ((data[channel * 3 + 2] << 8) | data[channel * 3 + 1]);
|
|
62 |
}
|
|
63 |
|
|
64 |
void write_4102(unsigned char *data, unsigned int channel, int value)
|
|
65 |
{
|
|
66 |
data[channel * 3 + 1] = (value & 0xFF00) >> 8;
|
|
67 |
data[channel * 3 + 2] = value & 0xFF;
|
|
68 |
}
|
|
69 |
|
|
70 |
/***************************************************************/
|
|
71 |
|
|
72 |
EtherCAT_slave_desc_t Beckhoff_EK1100[] =
|
|
73 |
{{
|
|
74 |
"Beckhoff", "EK1100", "Bus Coupler",
|
|
75 |
ECAT_ST_SIMPLE_NOSYNC,
|
|
76 |
NULL, NULL, NULL, NULL,
|
|
77 |
NULL,
|
|
78 |
0, 0,
|
|
79 |
NULL, NULL
|
|
80 |
}};
|
|
81 |
|
|
82 |
EtherCAT_slave_desc_t Beckhoff_EL1014[] =
|
|
83 |
{{
|
|
84 |
"Beckhoff", "EL1014", "4x Digital Input",
|
|
85 |
ECAT_ST_SIMPLE,
|
|
86 |
sm0_1014, NULL, NULL, NULL,
|
|
87 |
fmmu0_1014,
|
|
88 |
1, 4,
|
|
89 |
read_1014, NULL
|
|
90 |
}};
|
|
91 |
|
|
92 |
EtherCAT_slave_desc_t Beckhoff_EL2004[] =
|
|
93 |
{{
|
|
94 |
"Beckhoff", "EL2004", "4x Digital Output",
|
|
95 |
ECAT_ST_SIMPLE,
|
|
96 |
sm0_2004, NULL, NULL, NULL,
|
|
97 |
fmmu0_2004,
|
|
98 |
1, 4,
|
|
99 |
NULL, write_2004
|
|
100 |
}};
|
|
101 |
|
|
102 |
EtherCAT_slave_desc_t Beckhoff_EL3102[] =
|
|
103 |
{{
|
|
104 |
"Beckhoff", "EL3102", "2x Analog Input Diff",
|
|
105 |
ECAT_ST_MAILBOX,
|
|
106 |
sm0_multi, sm1_multi, sm2_31xx, sm3_31xx,
|
|
107 |
fmmu0_31xx,
|
|
108 |
6, 2,
|
|
109 |
read_31xx, NULL
|
|
110 |
}};
|
|
111 |
|
|
112 |
EtherCAT_slave_desc_t Beckhoff_EL3162[] =
|
|
113 |
{{
|
|
114 |
"Beckhoff", "EL3162", "2x Analog Input",
|
|
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_EL4102[] =
|
|
123 |
{{
|
|
124 |
"Beckhoff", "EL4102", "2x Analog Output",
|
|
125 |
ECAT_ST_MAILBOX,
|
|
126 |
sm0_multi, sm1_multi, sm2_4102, NULL,
|
|
127 |
fmmu0_4102,
|
|
128 |
4, 2,
|
|
129 |
NULL, write_4102
|
|
130 |
}};
|
|
131 |
|
|
132 |
EtherCAT_slave_desc_t Beckhoff_EL5001[] =
|
|
133 |
{{
|
|
134 |
"Beckhoff", "EL5001", "SSI-Interface",
|
|
135 |
ECAT_ST_SIMPLE,
|
|
136 |
NULL, NULL, NULL, NULL, // Noch nicht eingepflegt...
|
|
137 |
NULL,
|
|
138 |
0, 0,
|
|
139 |
NULL, NULL
|
|
140 |
}};
|
|
141 |
|
|
142 |
/***************************************************************/
|
|
143 |
|
|
144 |
unsigned int slave_idents_count = 7;
|
|
145 |
|
|
146 |
struct slave_ident slave_idents[] =
|
|
147 |
{
|
|
148 |
{0x00000002, 0x03F63052, Beckhoff_EL1014},
|
|
149 |
{0x00000002, 0x044C2C52, Beckhoff_EK1100},
|
|
150 |
{0x00000002, 0x07D43052, Beckhoff_EL2004},
|
|
151 |
{0x00000002, 0x0C1E3052, Beckhoff_EL3102},
|
|
152 |
{0x00000002, 0x0C5A3052, Beckhoff_EL3162},
|
|
153 |
{0x00000002, 0x10063052, Beckhoff_EL4102},
|
|
154 |
{0x00000002, 0x13893052, Beckhoff_EL5001}
|
|
155 |
};
|
|
156 |
|
|
157 |
/***************************************************************/
|