2 This file is part of CanFestival, a library implementing CanOpen Stack.
4 Copyright (C): Edouard TISSERANT and Francis DUPIN
6 See COPYING file for copyrights details.
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.
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.
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
27 // declaration of CO_Data type let us include all necessary headers
28 // struct struct_CO_Data can then be defined later
29 typedef struct struct_CO_Data CO_Data;
34 #include "objdictdef.h"
41 #include "nmtMaster.h"
43 // This structurs contains all necessary information for a CanOpen node
44 struct struct_CO_Data {
47 const indextable *objdict;
49 quick_index *firstIndex;
50 quick_index *lastIndex;
52 const UNS8 *iam_a_slave;
53 valueRangeTest_t valueRangeTest;
56 s_transfer transfers[SDO_MAX_SIMULTANEOUS_TRANSFERTS];
57 SDOtimeoutError_t SDOtimeoutError;
58 //s_sdo_parameter *sdo_parameters;
61 e_nodeState nodeState;
62 s_state_communication CurrentCommunicationState;
63 initialisation_t initialisation;
64 preOperational_t preOperational;
65 operational_t operational;
69 UNS8 *ConsumerHeartbeatCount;
70 UNS32 *ConsumerHeartbeatEntries;
71 TIMER_HANDLE *ConsumerHeartBeatTimers;
72 UNS16 *ProducerHeartBeatTime;
73 TIMER_HANDLE ProducerHeartBeatTimer;
74 heartbeatError_t heartbeatError;
75 e_nodeState NMTable[NMT_MAX_NODE_ID];
78 TIMER_HANDLE syncTimer;
80 UNS32 *Sync_Cycle_Period;
81 /*UNS32 *Sync_window_length*/;
82 post_sync_t post_sync;
83 post_TPDO_t post_TPDO;
86 s_process_var process_var;
91 scanIndexOD_t scanIndexOD;
94 // A macro to initialize the data in client app.
95 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
96 /* Object dictionary*/\
97 bDeviceNodeId:& NODE_PREFIX ## _bDeviceNodeId,\
98 objdict: NODE_PREFIX ## _objdict,\
99 count_sync: NODE_PREFIX ## _count_sync,\
100 firstIndex: & NODE_PREFIX ## _firstIndex,\
101 lastIndex: & NODE_PREFIX ## _lastIndex,\
102 ObjdictSize: & NODE_PREFIX ## _ObjdictSize,\
103 iam_a_slave: & NODE_PREFIX ## _iam_a_slave,\
104 valueRangeTest: NODE_PREFIX ## _valueRangeTest,\
118 SDOtimeoutError: &NODE_PREFIX ## _SDOtimeoutError,\
121 nodeState:Unknown_state,\
122 CurrentCommunicationState:{\
129 initialisation: &NODE_PREFIX ## _initialisation,\
130 preOperational: &NODE_PREFIX ## _preOperational,\
131 operational: &NODE_PREFIX ## _operational,\
132 stopped: &NODE_PREFIX ## _stopped,\
135 ConsumerHeartbeatCount: & NODE_PREFIX ## _highestSubIndex_obj1016,\
136 ConsumerHeartbeatEntries: NODE_PREFIX ## _obj1016,\
137 ConsumerHeartBeatTimers: NODE_PREFIX ## _heartBeatTimers,\
138 ProducerHeartBeatTime: & NODE_PREFIX ## _obj1017,\
139 ProducerHeartBeatTimer: TIMER_NONE,\
140 heartbeatError: NODE_PREFIX ## _heartbeatError,\
141 NMTable:{Unknown_state,},\
144 syncTimer: TIMER_NONE,\
145 COB_ID_Sync: & NODE_PREFIX ## _obj1005,\
146 Sync_Cycle_Period: & NODE_PREFIX ## _obj1006,\
147 /*Sync_window_length: & NODE_PREFIX ## _obj1007,*/\
148 post_sync: NODE_PREFIX ## _post_sync,\
149 post_TPDO: NODE_PREFIX ## _post_TPDO,\
158 canSend: NODE_PREFIX ## _canSend,\
159 scanIndexOD: NODE_PREFIX ## _scanIndexOD\