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 s_PDO_status *PDO_status;
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 UNS8 toggle;
00087 CAN_HANDLE canHandle;
00088 scanIndexOD_t scanIndexOD;
00089 storeODSubIndex_t storeODSubIndex;
00090
00091
00092 UNS8* dcf_cursor;
00093 UNS32 dcf_count_targets;
00094
00095 };
00096
00097 #define NMTable_Initializer Unknown_state,
00098
00099 #define s_transfer_Initializer {\
00100 0, \
00101 0, \
00102 SDO_RESET, \
00103 0, \
00104 0, \
00105 0, \
00106 0, \
00107 0, \
00108 0, \
00109 {0}, \
00110 0, \
00111 -1, \
00112 NULL \
00113 },
00114
00115
00116
00117 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
00118 \
00119 & NODE_PREFIX ## _bDeviceNodeId, \
00120 NODE_PREFIX ## _objdict, \
00121 NODE_PREFIX ## _PDO_status, \
00122 & NODE_PREFIX ## _firstIndex, \
00123 & NODE_PREFIX ## _lastIndex, \
00124 & NODE_PREFIX ## _ObjdictSize, \
00125 & NODE_PREFIX ## _iam_a_slave, \
00126 NODE_PREFIX ## _valueRangeTest, \
00127 \
00128 \
00129 {\
00130 REPEAT_SDO_MAX_SIMULTANEOUS_TRANSFERTS_TIMES(s_transfer_Initializer)\
00131 },\
00132 \
00133 \
00134 Unknown_state, \
00135 \
00136 {\
00137 0, \
00138 0, \
00139 0, \
00140 0, \
00141 0, \
00142 0 \
00143 },\
00144 _initialisation, \
00145 _preOperational, \
00146 _operational, \
00147 _stopped, \
00148 \
00149 \
00150 & NODE_PREFIX ## _highestSubIndex_obj1016, \
00151 NODE_PREFIX ## _obj1016, \
00152 NODE_PREFIX ## _heartBeatTimers, \
00153 & NODE_PREFIX ## _obj1017, \
00154 TIMER_NONE, \
00155 _heartbeatError, \
00156 \
00157 {REPEAT_NMT_MAX_NODE_ID_TIMES(NMTable_Initializer)},\
00158 \
00159 \
00160 \
00161 TIMER_NONE, \
00162 & NODE_PREFIX ## _obj1005, \
00163 & NODE_PREFIX ## _obj1006, \
00164 \
00165 _post_sync, \
00166 _post_TPDO, \
00167 \
00168 \
00169 0, \
00170 NULL, \
00171 NODE_PREFIX ## _scanIndexOD, \
00172 _storeODSubIndex, \
00173 NULL, \
00174 1 \
00175 }
00176
00177 #endif
00178
00179