include/data.h
changeset 284 24bf3d692993
parent 251 cab66ef3e68e
child 314 68e83c3ffbb5
equal deleted inserted replaced
283:e0b3096230e5 284:24bf3d692993
    41 #include "pdo.h"
    41 #include "pdo.h"
    42 #include "states.h"
    42 #include "states.h"
    43 #include "lifegrd.h"
    43 #include "lifegrd.h"
    44 #include "sync.h"
    44 #include "sync.h"
    45 #include "nmtMaster.h"
    45 #include "nmtMaster.h"
       
    46 #include "emcy.h"
    46 
    47 
    47 /* This structurs contains all necessary information for a CanOpen node */
    48 /* This structurs contains all necessary information for a CanOpen node */
    48 struct struct_CO_Data {
    49 struct struct_CO_Data {
    49 	/* Object dictionary */
    50 	/* Object dictionary */
    50 	UNS8 *bDeviceNodeId;
    51 	UNS8 *bDeviceNodeId;
    92 	storeODSubIndex_t storeODSubIndex; 
    93 	storeODSubIndex_t storeODSubIndex; 
    93 	
    94 	
    94 	/* DCF concise */
    95 	/* DCF concise */
    95 	UNS8* dcf_cursor;
    96 	UNS8* dcf_cursor;
    96 	UNS32 dcf_count_targets;
    97 	UNS32 dcf_count_targets;
       
    98 	
       
    99 	/* EMCY */
       
   100 	e_errorState error_state;
       
   101 	UNS8 error_history_size;
       
   102 	UNS8* error_number;
       
   103 	UNS32* error_first_element;
       
   104 	UNS8* error_register;
       
   105 	s_errors error_data[EMCY_MAX_ERRORS];
       
   106 	post_emcy_t post_emcy;
    97 	
   107 	
    98 };
   108 };
    99 
   109 
   100 #define NMTable_Initializer Unknown_state,
   110 #define NMTable_Initializer Unknown_state,
   101 
   111 
   113 		0,          /* dataType */\
   123 		0,          /* dataType */\
   114 		-1,         /* timer */\
   124 		-1,         /* timer */\
   115 		NULL        /* Callback */\
   125 		NULL        /* Callback */\
   116 	  },
   126 	  },
   117 
   127 
       
   128 #define ERROR_DATA_INITIALIZER \
       
   129 	{\
       
   130 	0, /* errCode */\
       
   131 	0, /* errRegMask */\
       
   132 	0 /* active */\
       
   133 	},
       
   134 
   118 /* A macro to initialize the data in client app.*/
   135 /* A macro to initialize the data in client app.*/
   119 /* CO_Data structure */
   136 /* CO_Data structure */
   120 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
   137 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
   121 	/* Object dictionary*/\
   138 	/* Object dictionary*/\
   122 	& NODE_PREFIX ## _bDeviceNodeId,     /* bDeviceNodeId */\
   139 	& NODE_PREFIX ## _bDeviceNodeId,     /* bDeviceNodeId */\
   172 	0,                                         /* toggle */\
   189 	0,                                         /* toggle */\
   173 	NULL,                   /* canSend */\
   190 	NULL,                   /* canSend */\
   174 	NODE_PREFIX ## _scanIndexOD,                /* scanIndexOD */\
   191 	NODE_PREFIX ## _scanIndexOD,                /* scanIndexOD */\
   175 	_storeODSubIndex,                /* storeODSubIndex */\
   192 	_storeODSubIndex,                /* storeODSubIndex */\
   176 	NULL,		/*dcf_cursor*/\
   193 	NULL,		/*dcf_cursor*/\
   177 	1		/*dcf_count_targets*/\
   194 	1,		/*dcf_count_targets*/\
       
   195 	\
       
   196 	/* EMCY */\
       
   197 	Error_free,                      /* error_state */\
       
   198 	sizeof(NODE_PREFIX ## _obj1003) / sizeof(NODE_PREFIX ## _obj1003[0]),      /* error_history_size */\
       
   199 	& NODE_PREFIX ## _highestSubIndex_obj1003,    /* error_number */\
       
   200 	& NODE_PREFIX ## _obj1003[0],    /* error_first_element */\
       
   201 	& NODE_PREFIX ## _obj1001,       /* error_register */\
       
   202 	/* error_data: structure s_errors */\
       
   203 	{\
       
   204 	REPEAT_EMCY_MAX_ERRORS_TIMES(ERROR_DATA_INITIALIZER)\
       
   205 	},\
       
   206 	_post_emcy              /* post_emcy */\
   178 }
   207 }
   179 
   208 
   180 #ifdef __cplusplus
   209 #ifdef __cplusplus
   181 };
   210 };
   182 #endif
   211 #endif