include/data.h
changeset 343 118c1cabd0b0
parent 322 78615d6a8ddd
child 349 1e6dd4ef46b9
equal deleted inserted replaced
342:66f007300c10 343:118c1cabd0b0
    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 #include "emcy.h"
       
    47 #ifdef CO_ENABLE_LSS
       
    48 #include "lss.h"
       
    49 #endif
    47 
    50 
    48 /* This structurs contains all necessary information for a CanOpen node */
    51 /* This structurs contains all necessary information for a CanOpen node */
    49 struct struct_CO_Data {
    52 struct struct_CO_Data {
    50 	/* Object dictionary */
    53 	/* Object dictionary */
    51 	UNS8 *bDeviceNodeId;
    54 	UNS8 *bDeviceNodeId;
    83 	UNS32 *COB_ID_Sync;
    86 	UNS32 *COB_ID_Sync;
    84 	UNS32 *Sync_Cycle_Period;
    87 	UNS32 *Sync_Cycle_Period;
    85 	/*UNS32 *Sync_window_length;;*/
    88 	/*UNS32 *Sync_window_length;;*/
    86 	post_sync_t post_sync;
    89 	post_sync_t post_sync;
    87 	post_TPDO_t post_TPDO;
    90 	post_TPDO_t post_TPDO;
       
    91 	post_SlaveBootup_t post_SlaveBootup;
    88 	
    92 	
    89 	/* General */
    93 	/* General */
    90 	UNS8 toggle;
    94 	UNS8 toggle;
    91 	CAN_HANDLE canHandle;	
    95 	CAN_HANDLE canHandle;	
    92 	scanIndexOD_t scanIndexOD;
    96 	scanIndexOD_t scanIndexOD;
   105 	UNS8* error_register;
   109 	UNS8* error_register;
   106     UNS32* error_cobid;
   110     UNS32* error_cobid;
   107 	s_errors error_data[EMCY_MAX_ERRORS];
   111 	s_errors error_data[EMCY_MAX_ERRORS];
   108 	post_emcy_t post_emcy;
   112 	post_emcy_t post_emcy;
   109 	
   113 	
       
   114 #ifdef CO_ENABLE_LSS
       
   115 	/* LSS */
       
   116 	lss_transfer_t lss_transfer;
       
   117 	lss_StoreConfiguration_t lss_StoreConfiguration;
       
   118 	lss_ChangeBaudRate_t lss_ChangeBaudRate;
       
   119 #endif	
   110 };
   120 };
   111 
   121 
   112 #define NMTable_Initializer Unknown_state,
   122 #define NMTable_Initializer Unknown_state,
   113 
   123 
   114 #define s_transfer_Initializer {\
   124 #define s_transfer_Initializer {\
   131 	{\
   141 	{\
   132 	0, /* errCode */\
   142 	0, /* errCode */\
   133 	0, /* errRegMask */\
   143 	0, /* errRegMask */\
   134 	0 /* active */\
   144 	0 /* active */\
   135 	},
   145 	},
       
   146 	
       
   147 #ifdef CO_ENABLE_LSS
       
   148 #define lss_Initializer {\
       
   149 		LSS_RESET,  			/* state */\
       
   150 		0,						/* command */\
       
   151 		LSS_WAITING_MODE, 		/* mode */\
       
   152 		0,						/* dat1 */\
       
   153 		0,						/* dat2 */\
       
   154 		Unknown_state,  		/* currentState */\
       
   155 		0,          			/* NodeID */\
       
   156 		0,          			/* addr_sel_match */\
       
   157 		0,          			/* addr_ident_match */\
       
   158 		"none",         		/* BaudRate */\
       
   159 		0,          			/* SwitchDelay */\
       
   160 		SDELAY_OFF,   			/* SwitchDelayState */\
       
   161 		{-1,-1},          		/* Timers[2] */\
       
   162 		NULL,        			/* Callback */\
       
   163 		0,						/* IDNumber */\
       
   164   		128, 					/* BitChecked */\
       
   165   		0,						/* LSSSub */\
       
   166   		0, 						/* LSSNext */\
       
   167   		0, 						/* LSSPos */\
       
   168   		LSS_FS_RESET			/* FastScan_SM */\
       
   169 	  },\
       
   170 	  NULL, 	/* _lss_StoreConfiguration*/\
       
   171 	  NULL    /* _lss_ChangeBaudRate */
       
   172 #else
       
   173 #define lss_Initializer
       
   174 #endif
       
   175 
   136 
   176 
   137 /* A macro to initialize the data in client app.*/
   177 /* A macro to initialize the data in client app.*/
   138 /* CO_Data structure */
   178 /* CO_Data structure */
   139 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
   179 #define CANOPEN_NODE_DATA_INITIALIZER(NODE_PREFIX) {\
   140 	/* Object dictionary*/\
   180 	/* Object dictionary*/\
   184 	& NODE_PREFIX ## _obj1005,                 /* COB_ID_Sync */\
   224 	& NODE_PREFIX ## _obj1005,                 /* COB_ID_Sync */\
   185 	& NODE_PREFIX ## _obj1006,                 /* Sync_Cycle_Period */\
   225 	& NODE_PREFIX ## _obj1006,                 /* Sync_Cycle_Period */\
   186 	/*& NODE_PREFIX ## _obj1007, */            /* Sync_window_length */\
   226 	/*& NODE_PREFIX ## _obj1007, */            /* Sync_window_length */\
   187 	_post_sync,                 /* post_sync */\
   227 	_post_sync,                 /* post_sync */\
   188 	_post_TPDO,                 /* post_TPDO */\
   228 	_post_TPDO,                 /* post_TPDO */\
       
   229 	_post_SlaveBootup,			/* post_SlaveBootup */\
   189 	\
   230 	\
   190 	/* General */\
   231 	/* General */\
   191 	0,                                         /* toggle */\
   232 	0,                                         /* toggle */\
   192 	NULL,                   /* canSend */\
   233 	NULL,                   /* canSend */\
   193 	NODE_PREFIX ## _scanIndexOD,                /* scanIndexOD */\
   234 	NODE_PREFIX ## _scanIndexOD,                /* scanIndexOD */\
   206     & NODE_PREFIX ## _obj1014,       /* error_cobid */\
   247     & NODE_PREFIX ## _obj1014,       /* error_cobid */\
   207 	/* error_data: structure s_errors */\
   248 	/* error_data: structure s_errors */\
   208 	{\
   249 	{\
   209 	REPEAT_EMCY_MAX_ERRORS_TIMES(ERROR_DATA_INITIALIZER)\
   250 	REPEAT_EMCY_MAX_ERRORS_TIMES(ERROR_DATA_INITIALIZER)\
   210 	},\
   251 	},\
   211 	_post_emcy              /* post_emcy */\
   252 	_post_emcy,              /* post_emcy */\
       
   253 	/* LSS */\
       
   254 	lss_Initializer\
   212 }
   255 }
   213 
   256 
   214 #ifdef __cplusplus
   257 #ifdef __cplusplus
   215 };
   258 };
   216 #endif
   259 #endif