-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig_idns.cpp
256 lines (249 loc) · 10.6 KB
/
config_idns.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#include <stdio.h>
#include <string.h>
#include "ecrt.h"
struct idn_set
{
uint8_t dno;
uint16_t idn;
char str[600];
};
struct idn_set idns00[110]={
{0, 0x0000000f, "0700"},
{0, 0x00000010, "020002003300"},
{1, 0x0000000f, "0700"},
{1, 0x00000010, "020002003300"},
{0, 0x00000018, "020002002400"},
{1, 0x00000018, "020002002400"},
{0, 0x00000001, "d007"},//d007
{0, 0x00000002, "d007"},//e803 d007
{0, 0x00000020, "0200"},
{1, 0x00000020, "0200"},
{0, 0x000080c9, "b004"},
{0, 0x000080ca, "c800"},
{0, 0x000080cb, "c800"},
{0, 0x000080cc, "0100"},
{0, 0x00008036, "100022004158353230362d303030302d23232323"},
{0, 0x00008035, "10002200414d333032322d304734312d30303030"},
{0, 0x00008032, "0000"},
{0, 0x00000088, "5e960900"},
{0, 0x00000089, "5e960900"},
{0, 0x000081c3, "0000"},
{0, 0x00000071, "401f0000"},
{0, 0x00008033, "0300"},
{0, 0x00008037, "7500"},
{0, 0x00008046, "5800"},
{0, 0x00008047, "0400040010000000"},
{0, 0x0000006d, "644b0000"},
{0, 0x0000006f, "d4120000"},
{0, 0x00008042, "08000800a90000003f010000"},
{0, 0x000000c9, "2003"},
{0, 0x000000cc, "7805"},
{0, 0x00008039, "7869"},
{0, 0x000080a5, "3c003c000000000000000000f401b80b0000000000000000f4016400f401f40104000500e1009600b80b84030000000000000000000000000000000000000000"},
{0, 0x0000803e, "080008001c02500064000100"},
{0, 0x00008044, "0400040064006400"},
{0, 0x00008059, "24002400028000003e0000003e000000c980000084030000fc080000000000000000000000000000"},
{0, 0x00008002, "3e00"},
{0, 0x0000805d, "d4120000"},
{0, 0x0000805c, "a8250000"},
{0, 0x0000006a, "6400"},
{0, 0x0000006b, "0a00"},
{0, 0x00008038, "401f0000"},
{0, 0x0000005b, "13828808"},
{0, 0x0000803d, "0000"},
{0, 0x00008098, "01000000"},
{0, 0x00008099, "01000000"},
{0, 0x00008003, "7d00"},
{0, 0x000081ff, "3200"},
{0, 0x00008004, "fa00"},
//{0, 0x00008004, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e803000000000000000000000000000000000000000000000000000001000300009018541300"},
{0, 0x00008096, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000"},
{0, 0x00000064, "fa000000"},
{0, 0x00000065, "2000"},
{0, 0x00008048, "060006008e0048030b00"},
{0, 0x000000ce, "2800"},
{0, 0x000000cf, "2400"},
{0, 0x0000803c, "0100"},
{0, 0x00008043, "c422"},
{0, 0x0000809a, "080008000000000000000000"},
{1, 0x00008036, "100022004158353230362d303030302d23232323"},
{1, 0x00008035, "10002200414d333032322d314734312d30303030"},
{1, 0x00008032, "0000"},
{1, 0x00000088, "5e960900"},
{1, 0x00000089, "5e960900"},
{1, 0x000081c3, "0000"},
{1, 0x00000071, "401f0000"},
{1, 0x00008033, "0300"},
{1, 0x00008037, "7500"},
{1, 0x00008046, "5800"},
{1, 0x00008047, "0400040010000000"},
{1, 0x0000006d, "644b0000"},
{1, 0x0000006f, "d4120000"},
{1, 0x00008042, "08000800a90000003f010000"},
{1, 0x000000c9, "2003"},
{1, 0x000000cc, "7805"},
{1, 0x00008039, "7869"},
{1, 0x000080a5, "3c003c000000000000000000f401b80b0000000000000000f4016400f401f40104000500e1009600b80b84030000000000000000000000000000000000000000"},
{1, 0x0000803e, "080008001c02500064000100"},
{1, 0x00008044, "0400040064006400"},
{1, 0x00008059, "24002400028000003e0000003e000000c980000084030000fc080000000000000000000000000000"},
{1, 0x00008002, "3e00"},
{1, 0x0000805d, "d4120000"},
{1, 0x0000805c, "a8250000"},
{1, 0x0000006a, "6400"},
{1, 0x0000006b, "0a00"},
{1, 0x00008038, "401f0000"},
{1, 0x0000005b, "13828808"},
{1, 0x0000803d, "0000"},
{1, 0x00008098, "01000000"},
{1, 0x00008099, "01000000"},
{1, 0x00008003, "7d00"},
{1, 0x000081ff, "3200"},
{1, 0x00008004, "fa00"},
//{1, 0x00008004, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200050000000000000001000500000000000008000000000000e8030000e803000000000000000000000000000000000000000000000000000001000500009018541300"},
{1, 0x00008096, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200050000000000000001000500000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010005000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000"},
{1, 0x00000064, "fa000000"},
{1, 0x00000065, "2000"},
{1, 0x00008048, "060006008e0048030b00"},
{1, 0x000000ce, "2800"},
{1, 0x000000cf, "2400"},
{1, 0x0000803c, "0100"},
{1, 0x00008043, "c422"},
{1, 0x0000809a, "080008000000000000000000"},
{0, 0x00008130, "0700"},
};
struct idn_set idns[110]={
{0, 0x0000000f, "0700"},
{0, 0x00000010, "0c000c007d017c013300bd005400c681"},
{1, 0x0000000f, "0700"},
{1, 0x00000010, "080008003300bd005400c681"},
{0, 0x00000018, "0400040024002f00"},
{1, 0x00000018, "040004002f002400"},
{0, 0x00000001, "d007"},
{0, 0x00000002, "d007"},
{0, 0x00000020, "0200"},
{1, 0x00000020, "0200"},
{0, 0x000080c9, "b004"},
{0, 0x000080ca, "c800"},
{0, 0x000080cb, "c800"},
{0, 0x000080cc, "0100"},
{0, 0x00008036, "100022004158353230362d303030302d23232323"},
{0, 0x00008035, "10002200414d333032322d304734312d30303030"},
{0, 0x00008032, "0000"},
{0, 0x00000088, "5e960900"},
{0, 0x00000089, "5e960900"},
{0, 0x000081c3, "0000"},
{0, 0x00000071, "401f0000"},
{0, 0x00008033, "0300"},
{0, 0x00008037, "7500"},
{0, 0x00008046, "5800"},
{0, 0x00008047, "0400040010000000"},
{0, 0x0000006d, "644b0000"},
{0, 0x0000006f, "d4120000"},
{0, 0x00008042, "08000800a90000003f010000"},
{0, 0x000000c9, "2003"},
{0, 0x000000cc, "7805"},
{0, 0x00008039, "7869"},
{0, 0x000080a5, "3c003c000000000000000000f401b80b0000000000000000f4016400f401f40104000500e1009600b80b84030000000000000000000000000000000000000000"},
{0, 0x0000803e, "080008001c02500064000100"},
{0, 0x00008044, "0400040064006400"},
{0, 0x00008059, "24002400028000003e0000003e000000c980000084030000fc080000000000000000000000000000"},
{0, 0x00008002, "3e00"},
{0, 0x0000805d, "d4120000"},
{0, 0x0000805c, "a8250000"},
{0, 0x0000006a, "6400"},
{0, 0x0000006b, "0a00"},
{0, 0x00008038, "401f0000"},
{0, 0x0000005b, "13828808"},
{0, 0x0000803d, "0000"},
{0, 0x00008098, "01000000"},
{0, 0x00008099, "01000000"},
{0, 0x00008003, "7d00"},
{0, 0x000081ff, "3200"},
{0, 0x00008004, "fa00"},
//{0, 0x00008004, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e803000000000000000000000000000000000000000000000000000001000300009018541300"},
{0, 0x00008096, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000"},
{0, 0x00000064, "fa000000"},
{0, 0x00000065, "2000"},
{0, 0x00008048, "060006008e0048030b00"},
{0, 0x000000ce, "2800"},
{0, 0x000000cf, "2400"},
{0, 0x0000803c, "0100"},
{0, 0x00008043, "c422"},
{0, 0x0000809a, "080008000000000000000000"},
{1, 0x00008036, "100022004158353230362d303030302d23232323"},
{1, 0x00008035, "10002200414d333032322d314734312d30303030"},
{1, 0x00008032, "0000"},
{1, 0x00000088, "5e960900"},
{1, 0x00000089, "5e960900"},
{1, 0x000081c3, "0000"},
{1, 0x00000071, "401f0000"},
{1, 0x00008033, "0300"},
{1, 0x00008037, "7500"},
{1, 0x00008046, "5800"},
{1, 0x00008047, "0400040010000000"},
{1, 0x0000006d, "644b0000"},
{1, 0x0000006f, "d4120000"},
{1, 0x00008042, "08000800a90000003f010000"},
{1, 0x000000c9, "2003"},
{1, 0x000000cc, "7805"},
{1, 0x00008039, "7869"},
{1, 0x000080a5, "3c003c000000000000000000f401b80b0000000000000000f4016400f401f40104000500e1009600b80b84030000000000000000000000000000000000000000"},
{1, 0x0000803e, "080008001c02500064000100"},
{1, 0x00008044, "0400040064006400"},
{1, 0x00008059, "24002400028000003e0000003e000000c980000084030000fc080000000000000000000000000000"},
{1, 0x00008002, "3e00"},
{1, 0x0000805d, "d4120000"},
{1, 0x0000805c, "a8250000"},
{1, 0x0000006a, "6400"},
{1, 0x0000006b, "0a00"},
{1, 0x00008038, "401f0000"},
{1, 0x0000005b, "13828808"},
{1, 0x0000803d, "0000"},
{1, 0x00008098, "01000000"},
{1, 0x00008099, "01000000"},
{1, 0x00008003, "7d00"},
{1, 0x000081ff, "3200"},
{1, 0x00008004, "fa00"},
//{1, 0x00008004, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200050000000000000001000500000000000008000000000000e8030000e803000000000000000000000000000000000000000000000000000001000500009018541300"},
{1, 0x00008096, "e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200050000000000000001000500000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010005000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000"},
{1, 0x00000064, "fa000000"},
{1, 0x00000065, "2000"},
{1, 0x00008048, "060006008e0048030b00"},
{1, 0x000000ce, "2800"},
{1, 0x000000cf, "2400"},
{1, 0x0000803c, "0100"},
{1, 0x00008043, "c422"},
{1, 0x0000809a, "080008000000000000000000"},
{0, 0x000087d0, "0100"},
};
int char2int(char in)
{
if(in >='0' && in <='9') return in-'0';
if(in >='A' && in <='F') return in-'A'+10;
if(in >='a' && in <='f') return in-'a'+10;
}
/*****************************************************************************/
int config_idns(ec_slave_config_t *sc)
{
fprintf(stdout, "start to configure IDN.\n");
int i, j;
size_t data_size;
uint8_t dno ;
uint16_t idn ;
char str[600]=" ";
uint8_t* data = new uint8_t[300];
for(j=0; j<101; j++){
dno = idns[j].dno;
idn = idns[j].idn;
strcpy(str, idns[j].str);
data_size = strlen(str)/2;
//fprintf(stdout, "%3d, %3d: %d , %x , %s \n", j+1, data_size, idns[j].dno, idns[j].idn, str);
for(i=0; i< data_size; i++) data[i] = char2int(str[2*i])*16 + char2int(str[2*i+1]);
if (ecrt_slave_config_idn(sc, dno, idn, EC_AL_STATE_PREOP, data, data_size)) {
fprintf(stderr, "..........Failed to configure IDN.\n");
return -1;
}
}
return 0;
}