00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __data_h__
00025 #define __data_h__
00026
00027
00028
00029
00030 typedef struct struct_CO_Data CO_Data;
00031
00032 #include "applicfg.h"
00033 #include "def.h"
00034 #include "can.h"
00035 #include "objdictdef.h"
00036 #include "objacces.h"
00037 #include "sdo.h"
00038 #include "pdo.h"
00039 #include "states.h"
00040 #include "lifegrd.h"
00041 #include "sync.h"
00042 #include "nmtMaster.h"
00043
00044
00045 struct struct_CO_Data {
00046
00047 UNS8 *bDeviceNodeId;
00048 const indextable *objdict;
00049 UNS8 *count_sync;
00050 quick_index *firstIndex;
00051 quick_index *lastIndex;
00052 UNS16 *ObjdictSize;
00053 const UNS8 *iam_a_slave;
00054 valueRangeTest_t valueRangeTest;
00055
00056
00057 s_transfer transfers[SDO_MAX_SIMULTANEOUS_TRANSFERTS];
00058
00059
00060
00061 e_nodeState nodeState;
00062 s_state_communication CurrentCommunicationState;
00063 initialisation_t initialisation;
00064 preOperational_t preOperational;
00065 operational_t operational;
00066 stopped_t stopped;
00067
00068
00069 UNS8 *ConsumerHeartbeatCount;
00070 UNS32 *ConsumerHeartbeatEntries;
00071 TIMER_HANDLE *ConsumerHeartBeatTimers;
00072 UNS16 *ProducerHeartBeatTime;
00073 TIMER_HANDLE ProducerHeartBeatTimer;
00074 heartbeatError_t heartbeatError;
00075 e_nodeState NMTable[NMT_MAX_NODE_ID];
00076
00077
00078 TIMER_HANDLE syncTimer;
00079 UNS32 *COB_ID_Sync;
00080 UNS32 *Sync_Cycle_Period;
00081
00082 post_sync_t post_sync;
00083 post_TPDO_t post_TPDO;
00084
00085
00086 s_process_var process_var;
00087
00088
00089 UNS8 toggle;
00090 CAN_HANDLE canHandle;
00091 scanIndexOD_t scanIndexOD;
00092 storeODSubIndex_t storeODSubIndex;
00093
00094
00095 UNS8* dcf_cursor;
00096 UNS32 dcf_count_targets;
00097
00098 };
00099
00100 #define NMTable_Initializer Unknown_state,
00101
00102 #define s_transfer_Initializer {\
00103 0, \
00104 0, \
00105 SDO_RESET, \
00106 0, \
00107 0, \
00108 0, \
00109 0, \
00110 0, \
00111 0, \
00112 {0}, \
00113 0, \
00114 -1, \
00115 NULL \
00116 },
00117
00118
00119
00120 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
00121 \
00122 & NODE_PREFIX ## _bDeviceNodeId, \
00123 NODE_PREFIX ## _objdict, \
00124 NODE_PREFIX ## _count_sync, \
00125 & NODE_PREFIX ## _firstIndex, \
00126 & NODE_PREFIX ## _lastIndex, \
00127 & NODE_PREFIX ## _ObjdictSize, \
00128 & NODE_PREFIX ## _iam_a_slave, \
00129 NODE_PREFIX ## _valueRangeTest, \
00130 \
00131 \
00132 {\
00133 REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(s_transfer_Initializer)\
00134 },\
00135 \
00136 \
00137 Unknown_state, \
00138 \
00139 {\
00140 0, \
00141 0, \
00142 0, \
00143 0, \
00144 0, \
00145 0 \
00146 },\
00147 _initialisation, \
00148 _preOperational, \
00149 _operational, \
00150 _stopped, \
00151 \
00152 \
00153 & NODE_PREFIX ## _highestSubIndex_obj1016, \
00154 NODE_PREFIX ## _obj1016, \
00155 NODE_PREFIX ## _heartBeatTimers, \
00156 & NODE_PREFIX ## _obj1017, \
00157 TIMER_NONE, \
00158 _heartbeatError, \
00159 \
00160 {REPEAT_NMT_MAX_NODE_ID_TIMES(NMTable_Initializer)},\
00161 \
00162 \
00163 \
00164 TIMER_NONE, \
00165 & NODE_PREFIX ## _obj1005, \
00166 & NODE_PREFIX ## _obj1006, \
00167 \
00168 _post_sync, \
00169 _post_TPDO, \
00170 \
00171 \
00172 {\
00173 0, \
00174 {0} \
00175 },\
00176 \
00177 \
00178 0, \
00179 NULL, \
00180 NODE_PREFIX ## _scanIndexOD, \
00181 _storeODSubIndex, \
00182 NULL, \
00183 1 \
00184 }
00185
00186 #endif
00187
00188