0
|
1 |
/*
|
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack.
|
|
3 |
|
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN
|
|
5 |
|
|
6 |
See COPYING file for copyrights details.
|
|
7 |
|
|
8 |
This library is free software; you can redistribute it and/or
|
|
9 |
modify it under the terms of the GNU Lesser General Public
|
|
10 |
License as published by the Free Software Foundation; either
|
|
11 |
version 2.1 of the License, or (at your option) any later version.
|
|
12 |
|
|
13 |
This library is distributed in the hope that it will be useful,
|
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16 |
Lesser General Public License for more details.
|
|
17 |
|
|
18 |
You should have received a copy of the GNU Lesser General Public
|
|
19 |
License along with this library; if not, write to the Free Software
|
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21 |
*/
|
|
22 |
|
|
23 |
/* File generated by gen_cfile.py. Should not be modified. */
|
|
24 |
|
|
25 |
#include "TestSlave.h"
|
|
26 |
|
|
27 |
/**************************************************************************/
|
|
28 |
/* Declaration of the mapped variables */
|
|
29 |
/**************************************************************************/
|
|
30 |
UNS8 SlaveMap1 = 0x0; // Mapped at index 0x2000, subindex 0x00
|
|
31 |
UNS8 SlaveMap2 = 0x0; // Mapped at index 0x2001, subindex 0x00
|
|
32 |
UNS8 SlaveMap3 = 0x0; // Mapped at index 0x2002, subindex 0x00
|
|
33 |
UNS8 SlaveMap4 = 0x0; // Mapped at index 0x2003, subindex 0x00
|
|
34 |
|
|
35 |
/**************************************************************************/
|
|
36 |
/* Declaration of the value range types */
|
|
37 |
/**************************************************************************/
|
|
38 |
|
|
39 |
UNS32 TestSlave_valueRangeTest (UNS8 typeValue, void * value)
|
|
40 |
{
|
|
41 |
switch (typeValue) {
|
|
42 |
}
|
|
43 |
return 0;
|
|
44 |
}
|
|
45 |
|
|
46 |
/**************************************************************************/
|
|
47 |
/* The node id */
|
|
48 |
/**************************************************************************/
|
|
49 |
/* node_id default value.*/
|
|
50 |
UNS8 TestSlave_bDeviceNodeId = 0x00;
|
|
51 |
|
|
52 |
//*****************************************************************************/
|
|
53 |
/* Array of message processing information */
|
|
54 |
|
|
55 |
const UNS8 TestSlave_iam_a_slave = 1;
|
|
56 |
|
|
57 |
TIMER_HANDLE TestSlave_heartBeatTimers[0];
|
|
58 |
|
|
59 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
60 |
//
|
|
61 |
// OBJECT DICTIONARY
|
|
62 |
//
|
|
63 |
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
|
64 |
|
|
65 |
/* index 0x1000 : Device Type. */
|
|
66 |
UNS32 TestSlave_obj1000 = 0x12D;
|
|
67 |
subindex TestSlave_Index1000[] =
|
|
68 |
{
|
|
69 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1000 }
|
|
70 |
};
|
|
71 |
|
|
72 |
/* index 0x1001 : Error Register. */
|
|
73 |
UNS8 TestSlave_obj1001 = 0x0;
|
|
74 |
subindex TestSlave_Index1001[] =
|
|
75 |
{
|
|
76 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_obj1001 }
|
|
77 |
};
|
|
78 |
|
|
79 |
/* index 0x1005 : SYNC COB ID. */
|
|
80 |
UNS32 TestSlave_obj1005 = 0x80;
|
|
81 |
ODCallback_t TestSlave_Index1005_callbacks[] =
|
|
82 |
{
|
|
83 |
NULL,
|
|
84 |
};
|
|
85 |
subindex TestSlave_Index1005[] =
|
|
86 |
{
|
|
87 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1005 }
|
|
88 |
};
|
|
89 |
|
|
90 |
/* index 0x1006 : Communication / Cycle Period. */
|
|
91 |
UNS32 TestSlave_obj1006 = 0x0;
|
|
92 |
ODCallback_t TestSlave_Index1006_callbacks[] =
|
|
93 |
{
|
|
94 |
NULL,
|
|
95 |
};
|
|
96 |
subindex TestSlave_Index1006[] =
|
|
97 |
{
|
|
98 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1006 }
|
|
99 |
};
|
|
100 |
|
|
101 |
/* index 0x1016 : Consumer Heartbeat Time */
|
|
102 |
UNS8 TestSlave_highestSubIndex_obj1016 = 0;
|
|
103 |
UNS32 TestSlave_obj1016[0];
|
|
104 |
subindex TestSlave_Index1016[0];
|
|
105 |
|
|
106 |
/* index 0x1017 : Producer Heartbeat Time. */
|
|
107 |
UNS16 TestSlave_obj1017 = 0x3E8;
|
|
108 |
subindex TestSlave_Index1017[] =
|
|
109 |
{
|
|
110 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1017 }
|
|
111 |
};
|
|
112 |
|
|
113 |
/* index 0x1018 : Identity. */
|
|
114 |
UNS8 TestSlave_highestSubIndex_obj1018 = 4; // number of subindex - 1
|
|
115 |
UNS32 TestSlave_obj1018_Vendor_ID = 0x0;
|
|
116 |
UNS32 TestSlave_obj1018_Product_Code = 0x0;
|
|
117 |
UNS32 TestSlave_obj1018_Revision_Number = 0x0;
|
|
118 |
UNS32 TestSlave_obj1018_Serial_Number = 0x0;
|
|
119 |
subindex TestSlave_Index1018[] =
|
|
120 |
{
|
|
121 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1018 },
|
|
122 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Vendor_ID },
|
|
123 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Product_Code },
|
|
124 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Revision_Number },
|
|
125 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1018_Serial_Number }
|
|
126 |
};
|
|
127 |
|
|
128 |
/* index 0x1200 : Server SDO Parameter. */
|
|
129 |
UNS8 TestSlave_highestSubIndex_obj1200 = 2; // number of subindex - 1
|
|
130 |
UNS32 TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO = 0x601;
|
|
131 |
UNS32 TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO = 0x581;
|
|
132 |
subindex TestSlave_Index1200[] =
|
|
133 |
{
|
|
134 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1200 },
|
|
135 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Client_to_Server_Receive_SDO },
|
|
136 |
{ RO, uint32, sizeof (UNS32), (void*)&TestSlave_obj1200_COB_ID_Server_to_Client_Transmit_SDO }
|
|
137 |
};
|
|
138 |
|
|
139 |
/* index 0x1800 : Transmit PDO 1 Parameter. */
|
|
140 |
UNS8 TestSlave_highestSubIndex_obj1800 = 5; // number of subindex - 1
|
|
141 |
UNS32 TestSlave_obj1800_COB_ID_used_by_PDO = 0x182;
|
|
142 |
UNS8 TestSlave_obj1800_Transmission_Type = 0x1;
|
|
143 |
UNS16 TestSlave_obj1800_Inhibit_Time = 0x0;
|
|
144 |
UNS16 TestSlave_obj1800_Compatibility_Entry = 0x0;
|
|
145 |
UNS16 TestSlave_obj1800_Event_Timer = 0x0;
|
|
146 |
subindex TestSlave_Index1800[] =
|
|
147 |
{
|
|
148 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1800 },
|
|
149 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1800_COB_ID_used_by_PDO },
|
|
150 |
{ RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1800_Transmission_Type },
|
|
151 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Inhibit_Time },
|
|
152 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Compatibility_Entry },
|
|
153 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1800_Event_Timer }
|
|
154 |
};
|
|
155 |
|
|
156 |
/* index 0x1801 : Transmit PDO 2 Parameter. */
|
|
157 |
UNS8 TestSlave_highestSubIndex_obj1801 = 5; // number of subindex - 1
|
|
158 |
UNS32 TestSlave_obj1801_COB_ID_used_by_PDO = 0x282;
|
|
159 |
UNS8 TestSlave_obj1801_Transmission_Type = 0x1;
|
|
160 |
UNS16 TestSlave_obj1801_Inhibit_Time = 0x0;
|
|
161 |
UNS16 TestSlave_obj1801_Compatibility_Entry = 0x0;
|
|
162 |
UNS16 TestSlave_obj1801_Event_Timer = 0x0;
|
|
163 |
subindex TestSlave_Index1801[] =
|
|
164 |
{
|
|
165 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1801 },
|
|
166 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1801_COB_ID_used_by_PDO },
|
|
167 |
{ RW, uint8, sizeof (UNS8), (void*)&TestSlave_obj1801_Transmission_Type },
|
|
168 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Inhibit_Time },
|
|
169 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Compatibility_Entry },
|
|
170 |
{ RW, uint16, sizeof (UNS16), (void*)&TestSlave_obj1801_Event_Timer }
|
|
171 |
};
|
|
172 |
|
|
173 |
/* index 0x1A00 : Transmit PDO 1 Mapping. */
|
|
174 |
UNS8 TestSlave_highestSubIndex_obj1A00 = 2; // number of subindex - 1
|
|
175 |
UNS32 TestSlave_obj1A00[] =
|
|
176 |
{
|
|
177 |
536870920,
|
|
178 |
536936456
|
|
179 |
};
|
|
180 |
subindex TestSlave_Index1A00[] =
|
|
181 |
{
|
|
182 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A00 },
|
|
183 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[0] },
|
|
184 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A00[1] }
|
|
185 |
};
|
|
186 |
|
|
187 |
/* index 0x1A01 : Transmit PDO 2 Mapping. */
|
|
188 |
UNS8 TestSlave_highestSubIndex_obj1A01 = 2; // number of subindex - 1
|
|
189 |
UNS32 TestSlave_obj1A01[] =
|
|
190 |
{
|
|
191 |
537001992,
|
|
192 |
537067528
|
|
193 |
};
|
|
194 |
subindex TestSlave_Index1A01[] =
|
|
195 |
{
|
|
196 |
{ RO, uint8, sizeof (UNS8), (void*)&TestSlave_highestSubIndex_obj1A01 },
|
|
197 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[0] },
|
|
198 |
{ RW, uint32, sizeof (UNS32), (void*)&TestSlave_obj1A01[1] }
|
|
199 |
};
|
|
200 |
|
|
201 |
/* index 0x2000 : Mapped variable SlaveMap1 */
|
|
202 |
subindex TestSlave_Index2000[] =
|
|
203 |
{
|
|
204 |
{ RW, uint8, sizeof (UNS8), (void*)&SlaveMap1 }
|
|
205 |
};
|
|
206 |
|
|
207 |
/* index 0x2001 : Mapped variable SlaveMap2 */
|
|
208 |
subindex TestSlave_Index2001[] =
|
|
209 |
{
|
|
210 |
{ RW, uint8, sizeof (UNS8), (void*)&SlaveMap2 }
|
|
211 |
};
|
|
212 |
|
|
213 |
/* index 0x2002 : Mapped variable SlaveMap3 */
|
|
214 |
subindex TestSlave_Index2002[] =
|
|
215 |
{
|
|
216 |
{ RW, uint8, sizeof (UNS8), (void*)&SlaveMap3 }
|
|
217 |
};
|
|
218 |
|
|
219 |
/* index 0x2003 : Mapped variable SlaveMap4 */
|
|
220 |
subindex TestSlave_Index2003[] =
|
|
221 |
{
|
|
222 |
{ RW, uint8, sizeof (UNS8), (void*)&SlaveMap4 }
|
|
223 |
};
|
|
224 |
|
|
225 |
const indextable TestSlave_objdict[] =
|
|
226 |
{
|
|
227 |
{ (subindex*)TestSlave_Index1000,sizeof(TestSlave_Index1000)/sizeof(TestSlave_Index1000[0]), 0x1000},
|
|
228 |
{ (subindex*)TestSlave_Index1001,sizeof(TestSlave_Index1001)/sizeof(TestSlave_Index1001[0]), 0x1001},
|
|
229 |
{ (subindex*)TestSlave_Index1005,sizeof(TestSlave_Index1005)/sizeof(TestSlave_Index1005[0]), 0x1005},
|
|
230 |
{ (subindex*)TestSlave_Index1006,sizeof(TestSlave_Index1006)/sizeof(TestSlave_Index1006[0]), 0x1006},
|
|
231 |
{ (subindex*)TestSlave_Index1017,sizeof(TestSlave_Index1017)/sizeof(TestSlave_Index1017[0]), 0x1017},
|
|
232 |
{ (subindex*)TestSlave_Index1018,sizeof(TestSlave_Index1018)/sizeof(TestSlave_Index1018[0]), 0x1018},
|
|
233 |
{ (subindex*)TestSlave_Index1200,sizeof(TestSlave_Index1200)/sizeof(TestSlave_Index1200[0]), 0x1200},
|
|
234 |
{ (subindex*)TestSlave_Index1800,sizeof(TestSlave_Index1800)/sizeof(TestSlave_Index1800[0]), 0x1800},
|
|
235 |
{ (subindex*)TestSlave_Index1801,sizeof(TestSlave_Index1801)/sizeof(TestSlave_Index1801[0]), 0x1801},
|
|
236 |
{ (subindex*)TestSlave_Index1A00,sizeof(TestSlave_Index1A00)/sizeof(TestSlave_Index1A00[0]), 0x1A00},
|
|
237 |
{ (subindex*)TestSlave_Index1A01,sizeof(TestSlave_Index1A01)/sizeof(TestSlave_Index1A01[0]), 0x1A01},
|
|
238 |
{ (subindex*)TestSlave_Index2000,sizeof(TestSlave_Index2000)/sizeof(TestSlave_Index2000[0]), 0x2000},
|
|
239 |
{ (subindex*)TestSlave_Index2001,sizeof(TestSlave_Index2001)/sizeof(TestSlave_Index2001[0]), 0x2001},
|
|
240 |
{ (subindex*)TestSlave_Index2002,sizeof(TestSlave_Index2002)/sizeof(TestSlave_Index2002[0]), 0x2002},
|
|
241 |
{ (subindex*)TestSlave_Index2003,sizeof(TestSlave_Index2003)/sizeof(TestSlave_Index2003[0]), 0x2003},
|
|
242 |
};
|
|
243 |
|
|
244 |
const indextable * TestSlave_scanIndexOD (UNS16 wIndex, UNS32 * errorCode, ODCallback_t **callbacks)
|
|
245 |
{
|
|
246 |
int i;
|
|
247 |
switch(wIndex){
|
|
248 |
case 0x1000: i = 0; *callbacks = NULL; break;
|
|
249 |
case 0x1001: i = 1; *callbacks = NULL; break;
|
|
250 |
case 0x1005: i = 2; *callbacks = TestSlave_Index1005_callbacks; break;
|
|
251 |
case 0x1006: i = 3; *callbacks = TestSlave_Index1006_callbacks; break;
|
|
252 |
case 0x1017: i = 4; *callbacks = NULL; break;
|
|
253 |
case 0x1018: i = 5; *callbacks = NULL; break;
|
|
254 |
case 0x1200: i = 6; *callbacks = NULL; break;
|
|
255 |
case 0x1800: i = 7; *callbacks = NULL; break;
|
|
256 |
case 0x1801: i = 8; *callbacks = NULL; break;
|
|
257 |
case 0x1A00: i = 9; *callbacks = NULL; break;
|
|
258 |
case 0x1A01: i = 10; *callbacks = NULL; break;
|
|
259 |
case 0x2000: i = 11; *callbacks = NULL; break;
|
|
260 |
case 0x2001: i = 12; *callbacks = NULL; break;
|
|
261 |
case 0x2002: i = 13; *callbacks = NULL; break;
|
|
262 |
case 0x2003: i = 14; *callbacks = NULL; break;
|
|
263 |
default:
|
|
264 |
*errorCode = OD_NO_SUCH_OBJECT;
|
|
265 |
return NULL;
|
|
266 |
}
|
|
267 |
*errorCode = OD_SUCCESSFUL;
|
|
268 |
return &TestSlave_objdict[i];
|
|
269 |
}
|
|
270 |
|
|
271 |
// To count at which received SYNC a PDO must be sent.
|
|
272 |
// Even if no pdoTransmit are defined, at least one entry is computed
|
|
273 |
// for compilations issues.
|
|
274 |
UNS8 TestSlave_count_sync[2] = {0,};
|
|
275 |
|
|
276 |
quick_index TestSlave_firstIndex = {
|
|
277 |
SDO_SVR : 6,
|
|
278 |
SDO_CLT : 0,
|
|
279 |
PDO_RCV : 0,
|
|
280 |
PDO_RCV_MAP : 0,
|
|
281 |
PDO_TRS : 7,
|
|
282 |
PDO_TRS_MAP : 9
|
|
283 |
};
|
|
284 |
|
|
285 |
quick_index TestSlave_lastIndex = {
|
|
286 |
SDO_SVR : 6,
|
|
287 |
SDO_CLT : 0,
|
|
288 |
PDO_RCV : 0,
|
|
289 |
PDO_RCV_MAP : 0,
|
|
290 |
PDO_TRS : 8,
|
|
291 |
PDO_TRS_MAP : 10
|
|
292 |
};
|
|
293 |
|
|
294 |
UNS16 TestSlave_ObjdictSize = sizeof(TestSlave_objdict)/sizeof(TestSlave_objdict[0]);
|
|
295 |
|
|
296 |
CO_Data TestSlave_Data = CANOPEN_NODE_DATA_INITIALIZER(TestSlave);
|
|
297 |
|