1 /*
2  * CANopen Object Dictionary.
3  *
4  * This file was automatically generated with CANopenNode Object
5  * Dictionary Editor. DON'T EDIT THIS FILE MANUALLY !!!!
6  * Object Dictionary Editor is currently an older, but functional web
7  * application. For more info see See 'Object_Dictionary_Editor/about.html' in
8  * <http://sourceforge.net/p/canopennode/code_complete/ci/master/tree/>
9  * For more information on CANopen Object Dictionary see <CO_SDO.h>.
10  *
11  * @file        CO_OD.h
12  * @author      Janez Paternoster
13  * @copyright   2010 - 2020 Janez Paternoster
14  *
15  * This file is part of CANopenNode, an opensource CANopen Stack.
16  * Project home page is <https://github.com/CANopenNode/CANopenNode>.
17  * For more information on CANopen see <http://www.can-cia.org/>.
18  *
19  * Licensed under the Apache License, Version 2.0 (the "License");
20  * you may not use this file except in compliance with the License.
21  * You may obtain a copy of the License at
22  *
23  *     http://www.apache.org/licenses/LICENSE-2.0
24  *
25  * Unless required by applicable law or agreed to in writing, software
26  * distributed under the License is distributed on an "AS IS" BASIS,
27  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28  * See the License for the specific language governing permissions and
29  * limitations under the License.
30  */
31 
32 
33 #ifndef CO_OD_H
34 #define CO_OD_H
35 
36 
37 /*******************************************************************************
38    CANopen DATA DYPES
39 *******************************************************************************/
40    typedef uint8_t      UNSIGNED8;
41    typedef uint16_t     UNSIGNED16;
42    typedef uint32_t     UNSIGNED32;
43    typedef uint64_t     UNSIGNED64;
44    typedef int8_t       INTEGER8;
45    typedef int16_t      INTEGER16;
46    typedef int32_t      INTEGER32;
47    typedef int64_t      INTEGER64;
48    typedef float32_t    REAL32;
49    typedef float64_t    REAL64;
50    typedef char_t       VISIBLE_STRING;
51    typedef oChar_t      OCTET_STRING;
52    typedef domain_t     DOMAIN;
53 
54    #ifndef timeOfDay_t
55     typedef union {
56         unsigned long long ullValue;
57         struct {
58             unsigned long ms:28;
59             unsigned reserved:4;
60             unsigned days:16;
61             unsigned reserved2:16;
62         };
63     }timeOfDay_t;
64 #endif
65 
66     typedef timeOfDay_t TIME_OF_DAY;
67     typedef timeOfDay_t TIME_DIFFERENCE;
68 
69 
70 /*******************************************************************************
71    FILE INFO:
72       FileName:     IO Example
73       FileVersion:  -
74       CreationTime: 18:04:29
75       CreationDate: 2016-03-25
76       CreatedBy:    JP
77 *******************************************************************************/
78 
79 
80 /*******************************************************************************
81    DEVICE INFO:
82       VendorName:     CANopenNode
83       VendorNumber:   0
84       ProductName:    CANopenNode
85       ProductNumber:  0
86 *******************************************************************************/
87 
88 
89 /*******************************************************************************
90    FEATURES
91 *******************************************************************************/
92    #define CO_NO_SYNC                     1   //Associated objects: 1005, 1006, 1007, 2103, 2104
93    #define CO_NO_TIME                     1   //Associated objects: 1012-1013
94    #define CO_NO_EMERGENCY                1   //Associated objects: 1014, 1015
95    #define CO_NO_SDO_SERVER               1   //Associated objects: 1200
96    #define CO_NO_SDO_CLIENT               0
97    #define CO_NO_RPDO                     4   //Associated objects: 1400, 1401, 1402, 1403, 1600, 1601, 1602, 1603
98    #define CO_NO_TPDO                     4   //Associated objects: 1800, 1801, 1802, 1803, 1A00, 1A01, 1A02, 1A03
99    #define CO_NO_NMT_MASTER               0
100    #define CO_NO_TRACE                    0
101    #define CO_NO_LSS_SERVER               0
102    #define CO_NO_LSS_CLIENT               0
103 
104 /*******************************************************************************
105    OBJECT DICTIONARY
106 *******************************************************************************/
107    #define CO_OD_NoOfElements             56
108 
109 
110 /*******************************************************************************
111    TYPE DEFINITIONS FOR RECORDS
112 *******************************************************************************/
113 /*1018      */ typedef struct{
114                UNSIGNED8      maxSubIndex;
115                UNSIGNED32     vendorID;
116                UNSIGNED32     productCode;
117                UNSIGNED32     revisionNumber;
118                UNSIGNED32     serialNumber;
119                }              OD_identity_t;
120 
121 /*1200[1]   */ typedef struct{
122                UNSIGNED8      maxSubIndex;
123                UNSIGNED32     COB_IDClientToServer;
124                UNSIGNED32     COB_IDServerToClient;
125                }              OD_SDOServerParameter_t;
126 
127 /*1400[4]   */ typedef struct{
128                UNSIGNED8      maxSubIndex;
129                UNSIGNED32     COB_IDUsedByRPDO;
130                UNSIGNED8      transmissionType;
131                }              OD_RPDOCommunicationParameter_t;
132 
133 /*1600[4]   */ typedef struct{
134                UNSIGNED8      numberOfMappedObjects;
135                UNSIGNED32     mappedObject1;
136                UNSIGNED32     mappedObject2;
137                UNSIGNED32     mappedObject3;
138                UNSIGNED32     mappedObject4;
139                UNSIGNED32     mappedObject5;
140                UNSIGNED32     mappedObject6;
141                UNSIGNED32     mappedObject7;
142                UNSIGNED32     mappedObject8;
143                }              OD_RPDOMappingParameter_t;
144 
145 /*1800[4]   */ typedef struct{
146                UNSIGNED8      maxSubIndex;
147                UNSIGNED32     COB_IDUsedByTPDO;
148                UNSIGNED8      transmissionType;
149                UNSIGNED16     inhibitTime;
150                UNSIGNED8      compatibilityEntry;
151                UNSIGNED16     eventTimer;
152                UNSIGNED8      SYNCStartValue;
153                }              OD_TPDOCommunicationParameter_t;
154 
155 /*1A00[4]   */ typedef struct{
156                UNSIGNED8      numberOfMappedObjects;
157                UNSIGNED32     mappedObject1;
158                UNSIGNED32     mappedObject2;
159                UNSIGNED32     mappedObject3;
160                UNSIGNED32     mappedObject4;
161                UNSIGNED32     mappedObject5;
162                UNSIGNED32     mappedObject6;
163                UNSIGNED32     mappedObject7;
164                UNSIGNED32     mappedObject8;
165                }              OD_TPDOMappingParameter_t;
166 
167 /*2120      */ typedef struct{
168                UNSIGNED8      maxSubIndex;
169                INTEGER64      I64;
170                UNSIGNED64     U64;
171                REAL32         R32;
172                REAL64         R64;
173                DOMAIN         domain;
174                }              OD_testVar_t;
175 
176 /*2130      */ typedef struct{
177                UNSIGNED8      maxSubIndex;
178                VISIBLE_STRING string[30];
179                UNSIGNED64     epochTimeBaseMs;
180                UNSIGNED32     epochTimeOffsetMs;
181                }              OD_time_t;
182 
183 
184 /*******************************************************************************
185    STRUCTURES FOR VARIABLES IN DIFFERENT MEMORY LOCATIONS
186 *******************************************************************************/
187 #define  CO_OD_FIRST_LAST_WORD     0x55 //Any value from 0x01 to 0xFE. If changed, EEPROM will be reinitialized.
188 
189 /***** Structure for RAM variables ********************************************/
190 struct sCO_OD_RAM{
191                UNSIGNED32     FirstWord;
192 
193 /*1001      */ UNSIGNED8      errorRegister;
194 /*1002      */ UNSIGNED32     manufacturerStatusRegister;
195 /*1003      */ UNSIGNED32     preDefinedErrorField[8];
196 /*1010      */ UNSIGNED32     storeParameters[1];
197 /*1011      */ UNSIGNED32     restoreDefaultParameters[1];
198 /*2100      */ OCTET_STRING   errorStatusBits[10];
199 /*2103      */ UNSIGNED16     SYNCCounter;
200 /*2104      */ UNSIGNED16     SYNCTime;
201 /*2107      */ UNSIGNED16     performance[5];
202 /*2108      */ INTEGER16      temperature[1];
203 /*2109      */ INTEGER16      voltage[1];
204 /*2110      */ INTEGER32      variableInt32[16];
205 /*2120      */ OD_testVar_t   testVar;
206 /*2130      */ OD_time_t      time;
207 /*6000      */ UNSIGNED8      readInput8Bit[8];
208 /*6200      */ UNSIGNED8      writeOutput8Bit[8];
209 /*6401      */ INTEGER16      readAnalogueInput16Bit[12];
210 /*6411      */ INTEGER16      writeAnalogueOutput16Bit[8];
211 
212                UNSIGNED32     LastWord;
213 };
214 
215 /***** Structure for EEPROM variables *****************************************/
216 struct sCO_OD_EEPROM{
217                UNSIGNED32     FirstWord;
218 
219 /*2106      */ UNSIGNED32     powerOnCounter;
220 /*2112      */ INTEGER32      variableNVInt32[16];
221 
222                UNSIGNED32     LastWord;
223 };
224 
225 
226 /***** Structure for ROM variables ********************************************/
227 struct sCO_OD_ROM{
228                UNSIGNED32     FirstWord;
229 
230 /*1000      */ UNSIGNED32     deviceType;
231 /*1005      */ UNSIGNED32     COB_ID_SYNCMessage;
232 /*1006      */ UNSIGNED32     communicationCyclePeriod;
233 /*1007      */ UNSIGNED32     synchronousWindowLength;
234 /*1008      */ VISIBLE_STRING manufacturerDeviceName[11];
235 /*1009      */ VISIBLE_STRING manufacturerHardwareVersion[4];
236 /*100A      */ VISIBLE_STRING manufacturerSoftwareVersion[4];
237 /*1012      */ UNSIGNED32     COB_ID_TIME;
238 /*1014      */ UNSIGNED32     COB_ID_EMCY;
239 /*1015      */ UNSIGNED16     inhibitTimeEMCY;
240 /*1016      */ UNSIGNED32     consumerHeartbeatTime[4];
241 /*1017      */ UNSIGNED16     producerHeartbeatTime;
242 /*1018      */ OD_identity_t  identity;
243 /*1019      */ UNSIGNED8      synchronousCounterOverflowValue;
244 /*1029      */ UNSIGNED8      errorBehavior[6];
245 /*1200[1]   */ OD_SDOServerParameter_t SDOServerParameter[1];
246 /*1400[4]   */ OD_RPDOCommunicationParameter_t RPDOCommunicationParameter[4];
247 /*1600[4]   */ OD_RPDOMappingParameter_t RPDOMappingParameter[4];
248 /*1800[4]   */ OD_TPDOCommunicationParameter_t TPDOCommunicationParameter[4];
249 /*1A00[4]   */ OD_TPDOMappingParameter_t TPDOMappingParameter[4];
250 /*1F80      */ UNSIGNED32     NMTStartup;
251 /*2101      */ UNSIGNED8      CANNodeID;
252 /*2102      */ UNSIGNED16     CANBitRate;
253 /*2111      */ INTEGER32      variableROMInt32[16];
254 
255                UNSIGNED32     LastWord;
256 };
257 
258 
259 /***** Declaration of Object Dictionary variables *****************************/
260 extern struct sCO_OD_RAM CO_OD_RAM;
261 
262 extern struct sCO_OD_EEPROM CO_OD_EEPROM;
263 
264 extern struct sCO_OD_ROM CO_OD_ROM;
265 
266 
267 /*******************************************************************************
268    ALIASES FOR OBJECT DICTIONARY VARIABLES
269 *******************************************************************************/
270 /*1000, Data Type: UNSIGNED32 */
271       #define OD_deviceType                              CO_OD_ROM.deviceType
272 
273 /*1001, Data Type: UNSIGNED8 */
274       #define OD_errorRegister                           CO_OD_RAM.errorRegister
275 
276 /*1002, Data Type: UNSIGNED32 */
277       #define OD_manufacturerStatusRegister              CO_OD_RAM.manufacturerStatusRegister
278 
279 /*1003, Data Type: UNSIGNED32, Array[8] */
280       #define OD_preDefinedErrorField                    CO_OD_RAM.preDefinedErrorField
281       #define ODL_preDefinedErrorField_arrayLength       8
282 
283 /*1005, Data Type: UNSIGNED32 */
284       #define OD_COB_ID_SYNCMessage                      CO_OD_ROM.COB_ID_SYNCMessage
285 
286 /*1006, Data Type: UNSIGNED32 */
287       #define OD_communicationCyclePeriod                CO_OD_ROM.communicationCyclePeriod
288 
289 /*1007, Data Type: UNSIGNED32 */
290       #define OD_synchronousWindowLength                 CO_OD_ROM.synchronousWindowLength
291 
292 /*1008, Data Type: VISIBLE_STRING, Array[11] */
293       #define OD_manufacturerDeviceName                  CO_OD_ROM.manufacturerDeviceName
294       #define ODL_manufacturerDeviceName_stringLength    11
295 
296 /*1009, Data Type: VISIBLE_STRING, Array[4] */
297       #define OD_manufacturerHardwareVersion             CO_OD_ROM.manufacturerHardwareVersion
298       #define ODL_manufacturerHardwareVersion_stringLength 4
299 
300 /*100A, Data Type: VISIBLE_STRING, Array[4] */
301       #define OD_manufacturerSoftwareVersion             CO_OD_ROM.manufacturerSoftwareVersion
302       #define ODL_manufacturerSoftwareVersion_stringLength 4
303 
304 /*1010, Data Type: UNSIGNED32, Array[1] */
305       #define OD_storeParameters                         CO_OD_RAM.storeParameters
306       #define ODL_storeParameters_arrayLength            1
307       #define ODA_storeParameters_saveAllParameters      0
308 
309 /*1011, Data Type: UNSIGNED32, Array[1] */
310       #define OD_restoreDefaultParameters                CO_OD_RAM.restoreDefaultParameters
311       #define ODL_restoreDefaultParameters_arrayLength   1
312       #define ODA_restoreDefaultParameters_restoreAllDefaultParameters 0
313 
314 /*1012, Data Type: UNSIGNED32 */
315       #define OD_COB_ID_TIME                             CO_OD_ROM.COB_ID_TIME
316 
317 /*1014, Data Type: UNSIGNED32 */
318       #define OD_COB_ID_EMCY                             CO_OD_ROM.COB_ID_EMCY
319 
320 /*1015, Data Type: UNSIGNED16 */
321       #define OD_inhibitTimeEMCY                         CO_OD_ROM.inhibitTimeEMCY
322 
323 /*1016, Data Type: UNSIGNED32, Array[4] */
324       #define OD_consumerHeartbeatTime                   CO_OD_ROM.consumerHeartbeatTime
325       #define ODL_consumerHeartbeatTime_arrayLength      4
326 
327 /*1017, Data Type: UNSIGNED16 */
328       #define OD_producerHeartbeatTime                   CO_OD_ROM.producerHeartbeatTime
329 
330 /*1018, Data Type: OD_identity_t */
331       #define OD_identity                                CO_OD_ROM.identity
332 
333 /*1019, Data Type: UNSIGNED8 */
334       #define OD_synchronousCounterOverflowValue         CO_OD_ROM.synchronousCounterOverflowValue
335 
336 /*1029, Data Type: UNSIGNED8, Array[6] */
337       #define OD_errorBehavior                           CO_OD_ROM.errorBehavior
338       #define ODL_errorBehavior_arrayLength              6
339       #define ODA_errorBehavior_communication            0
340       #define ODA_errorBehavior_communicationOther       1
341       #define ODA_errorBehavior_communicationPassive     2
342       #define ODA_errorBehavior_generic                  3
343       #define ODA_errorBehavior_deviceProfile            4
344       #define ODA_errorBehavior_manufacturerSpecific     5
345 
346 /*1200[1], Data Type: OD_SDOServerParameter_t, Array[1] */
347       #define OD_SDOServerParameter                      CO_OD_ROM.SDOServerParameter
348 
349 /*1400[4], Data Type: OD_RPDOCommunicationParameter_t, Array[4] */
350       #define OD_RPDOCommunicationParameter              CO_OD_ROM.RPDOCommunicationParameter
351 
352 /*1600[4], Data Type: OD_RPDOMappingParameter_t, Array[4] */
353       #define OD_RPDOMappingParameter                    CO_OD_ROM.RPDOMappingParameter
354 
355 /*1800[4], Data Type: OD_TPDOCommunicationParameter_t, Array[4] */
356       #define OD_TPDOCommunicationParameter              CO_OD_ROM.TPDOCommunicationParameter
357 
358 /*1A00[4], Data Type: OD_TPDOMappingParameter_t, Array[4] */
359       #define OD_TPDOMappingParameter                    CO_OD_ROM.TPDOMappingParameter
360 
361 /*1F80, Data Type: UNSIGNED32 */
362       #define OD_NMTStartup                              CO_OD_ROM.NMTStartup
363 
364 /*2100, Data Type: OCTET_STRING, Array[10] */
365       #define OD_errorStatusBits                         CO_OD_RAM.errorStatusBits
366       #define ODL_errorStatusBits_stringLength           10
367 
368 /*2101, Data Type: UNSIGNED8 */
369       #define OD_CANNodeID                               CO_OD_ROM.CANNodeID
370 
371 /*2102, Data Type: UNSIGNED16 */
372       #define OD_CANBitRate                              CO_OD_ROM.CANBitRate
373 
374 /*2103, Data Type: UNSIGNED16 */
375       #define OD_SYNCCounter                             CO_OD_RAM.SYNCCounter
376 
377 /*2104, Data Type: UNSIGNED16 */
378       #define OD_SYNCTime                                CO_OD_RAM.SYNCTime
379 
380 /*2106, Data Type: UNSIGNED32 */
381       #define OD_powerOnCounter                          CO_OD_EEPROM.powerOnCounter
382 
383 /*2107, Data Type: UNSIGNED16, Array[5] */
384       #define OD_performance                             CO_OD_RAM.performance
385       #define ODL_performance_arrayLength                5
386       #define ODA_performance_cyclesPerSecond            0
387       #define ODA_performance_timerCycleTime             1
388       #define ODA_performance_timerCycleMaxTime          2
389       #define ODA_performance_mainCycleTime              3
390       #define ODA_performance_mainCycleMaxTime           4
391 
392 /*2108, Data Type: INTEGER16, Array[1] */
393       #define OD_temperature                             CO_OD_RAM.temperature
394       #define ODL_temperature_arrayLength                1
395       #define ODA_temperature_mainPCB                    0
396 
397 /*2109, Data Type: INTEGER16, Array[1] */
398       #define OD_voltage                                 CO_OD_RAM.voltage
399       #define ODL_voltage_arrayLength                    1
400       #define ODA_voltage_mainPCBSupply                  0
401 
402 /*2110, Data Type: INTEGER32, Array[16] */
403       #define OD_variableInt32                           CO_OD_RAM.variableInt32
404       #define ODL_variableInt32_arrayLength              16
405 
406 /*2111, Data Type: INTEGER32, Array[16] */
407       #define OD_variableROMInt32                        CO_OD_ROM.variableROMInt32
408       #define ODL_variableROMInt32_arrayLength           16
409 
410 /*2112, Data Type: INTEGER32, Array[16] */
411       #define OD_variableNVInt32                         CO_OD_EEPROM.variableNVInt32
412       #define ODL_variableNVInt32_arrayLength            16
413 
414 /*2120, Data Type: OD_testVar_t */
415       #define OD_testVar                                 CO_OD_RAM.testVar
416 
417 /*2130, Data Type: OD_time_t */
418       #define OD_time                                    CO_OD_RAM.time
419 
420 /*6000, Data Type: UNSIGNED8, Array[8] */
421       #define OD_readInput8Bit                           CO_OD_RAM.readInput8Bit
422       #define ODL_readInput8Bit_arrayLength              8
423 
424 /*6200, Data Type: UNSIGNED8, Array[8] */
425       #define OD_writeOutput8Bit                         CO_OD_RAM.writeOutput8Bit
426       #define ODL_writeOutput8Bit_arrayLength            8
427 
428 /*6401, Data Type: INTEGER16, Array[12] */
429       #define OD_readAnalogueInput16Bit                  CO_OD_RAM.readAnalogueInput16Bit
430       #define ODL_readAnalogueInput16Bit_arrayLength     12
431 
432 /*6411, Data Type: INTEGER16, Array[8] */
433       #define OD_writeAnalogueOutput16Bit                CO_OD_RAM.writeAnalogueOutput16Bit
434       #define ODL_writeAnalogueOutput16Bit_arrayLength   8
435 
436 
437 #endif
438 
439