1 //--------------------------------------------------------------- |
|
2 // |
|
3 // e c _ s l a v e . c |
|
4 // |
|
5 // $LastChangedDate$ |
|
6 // $Author$ |
|
7 // |
|
8 //--------------------------------------------------------------- |
|
9 |
|
10 #include <stdlib.h> |
|
11 |
|
12 #include "ec_globals.h" |
|
13 #include "ec_slave.h" |
|
14 |
|
15 //--------------------------------------------------------------- |
|
16 |
|
17 void EtherCAT_slave_init(EtherCAT_slave_t *slave) |
|
18 { |
|
19 slave->type = 0; |
|
20 slave->revision = 0; |
|
21 slave->build = 0; |
|
22 |
|
23 slave->ring_position = 0; |
|
24 slave->station_address = 0; |
|
25 |
|
26 slave->vendor_id = 0; |
|
27 slave->product_code = 0; |
|
28 slave->revision_number = 0; |
|
29 |
|
30 slave->desc = NULL; |
|
31 |
|
32 slave->logical_address0 = 0; |
|
33 |
|
34 slave->current_state = EC_STATE_UNKNOWN; |
|
35 slave->requested_state = EC_STATE_UNKNOWN; |
|
36 } |
|
37 |
|
38 //--------------------------------------------------------------- |
|
39 |
|
40 void EtherCAT_slave_clear(EtherCAT_slave_t *slave) |
|
41 { |
|
42 // Nothing yet... |
|
43 } |
|
44 |
|
45 //--------------------------------------------------------------- |
|
46 |
|
47 void EtherCAT_slave_print(EtherCAT_slave_t *slave) |
|
48 { |
|
49 } |
|
50 |
|
51 //--------------------------------------------------------------- |
|
52 |
|
53 unsigned char sm0_multi[] = {0x00, 0x18, 0xF6, 0x00, 0x26, 0x00, 0x01, 0x00}; |
|
54 unsigned char sm1_multi[] = {0xF6, 0x18, 0xF6, 0x00, 0x22, 0x00, 0x01, 0x00}; |
|
55 |
|
56 unsigned char sm0_1014[] = {0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}; |
|
57 |
|
58 unsigned char sm0_2004[] = {0x00, 0x0F, 0x01, 0x00, 0x46, 0x00, 0x01, 0x00}; |
|
59 |
|
60 unsigned char sm2_31xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00}; |
|
61 unsigned char sm3_31xx[] = {0x00, 0x11, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00}; |
|
62 |
|
63 unsigned char sm2_4102[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; |
|
64 |
|
65 |
|
66 unsigned char fmmu0_1014[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
67 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
68 |
|
69 unsigned char fmmu0_2004[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, |
|
70 0x00, 0x0F, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
|
71 |
|
72 unsigned char fmmu0_31xx[] = {0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07, |
|
73 0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; |
|
74 |
|
75 unsigned char fmmu0_4102[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, |
|
76 0x00, 0x10, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; |
|
77 |
|
78 //--------------------------------------------------------------- |
|
79 |
|
80 EtherCAT_slave_desc_t Beckhoff_EK1100[] = {"Beckhoff", "EK1100", "Bus Coupler", |
|
81 SIMPLE, |
|
82 NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... |
|
83 NULL, |
|
84 0}; |
|
85 |
|
86 EtherCAT_slave_desc_t Beckhoff_EL1014[] = {"Beckhoff", "EL1014", "4x Digital Input", |
|
87 SIMPLE, |
|
88 sm0_1014, NULL, NULL, NULL, |
|
89 fmmu0_1014, |
|
90 1}; |
|
91 |
|
92 EtherCAT_slave_desc_t Beckhoff_EL2004[] = {"Beckhoff", "EL2004", "4x Digital Output", |
|
93 SIMPLE, |
|
94 sm0_2004, NULL, NULL, NULL, |
|
95 fmmu0_2004, |
|
96 1}; |
|
97 |
|
98 EtherCAT_slave_desc_t Beckhoff_EL3102[] = {"Beckhoff", "EL3102", "2x Analog Input Diff", |
|
99 MAILBOX, |
|
100 sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
101 fmmu0_31xx, |
|
102 6}; |
|
103 |
|
104 EtherCAT_slave_desc_t Beckhoff_EL3162[] = {"Beckhoff", "EL3162", "2x Analog Input", |
|
105 MAILBOX, |
|
106 sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, |
|
107 fmmu0_31xx, |
|
108 6}; |
|
109 |
|
110 EtherCAT_slave_desc_t Beckhoff_EL4102[] = {"Beckhoff", "EL4102", "2x Analog Output", |
|
111 MAILBOX, |
|
112 sm0_multi, sm1_multi, sm2_4102, NULL, |
|
113 fmmu0_4102, |
|
114 4}; |
|
115 |
|
116 EtherCAT_slave_desc_t Beckhoff_EL5001[] = {"Beckhoff", "EL5001", "SSI-Interface", |
|
117 SIMPLE, |
|
118 NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... |
|
119 NULL, |
|
120 0}; |
|
121 |
|
122 //--------------------------------------------------------------- |
|
123 |
|
124 unsigned int slave_idents_count = 7; |
|
125 |
|
126 struct slave_ident slave_idents[] = |
|
127 { |
|
128 {0x00000002, 0x03F63052, Beckhoff_EL1014}, |
|
129 {0x00000002, 0x044C2C52, Beckhoff_EK1100}, |
|
130 {0x00000002, 0x07D43052, Beckhoff_EL2004}, |
|
131 {0x00000002, 0x0C1E3052, Beckhoff_EL3102}, |
|
132 {0x00000002, 0x0C5A3052, Beckhoff_EL3162}, |
|
133 {0x00000002, 0x10063052, Beckhoff_EL4102}, |
|
134 {0x00000002, 0x13893052, Beckhoff_EL5001} |
|
135 }; |
|
136 |
|
137 //--------------------------------------------------------------- |
|