src/lifegrd.c
changeset 185 d529e20c323c
parent 177 d485a3fc5739
child 207 b6572d0336c3
equal deleted inserted replaced
184:fb253029c7d4 185:d529e20c323c
    25 #include "canfestival.h"
    25 #include "canfestival.h"
    26 
    26 
    27 /* Prototypes for internals functions */
    27 /* Prototypes for internals functions */
    28 void ConsumerHearbeatAlarm(CO_Data* d, UNS32 id);
    28 void ConsumerHearbeatAlarm(CO_Data* d, UNS32 id);
    29 void ProducerHearbeatAlarm(CO_Data* d, UNS32 id);
    29 void ProducerHearbeatAlarm(CO_Data* d, UNS32 id);
    30 UNS32 OnHearbeatUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex);
    30 UNS32 OnHearbeatProducerUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex);
    31 
       
    32 
    31 
    33 /*****************************************************************************/
    32 /*****************************************************************************/
    34 e_nodeState getNodeState (CO_Data* d, UNS8 nodeId)
    33 e_nodeState getNodeState (CO_Data* d, UNS8 nodeId)
    35 {
    34 {
    36 	e_nodeState networkNodeState = d->NMTable[nodeId];
    35 	e_nodeState networkNodeState = d->NMTable[nodeId];
   135 	}
   134 	}
   136 }
   135 }
   137 
   136 
   138 /*****************************************************************************/
   137 /*****************************************************************************/
   139 /* This is called when Index 0x1017 is updated.*/
   138 /* This is called when Index 0x1017 is updated.*/
   140 UNS32 OnHeartbeatProducerUpdate(CO_Data* d)
   139 UNS32 OnHeartbeatProducerUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
   141 {
   140 {
   142 	heartbeatStop(d);
   141 	heartbeatStop(d);
   143 	heartbeatInit(d);
   142 	heartbeatInit(d);
   144 	return 0;
   143 	return 0;
   145 }
   144 }
   147 
   146 
   148 void heartbeatInit(CO_Data* d)
   147 void heartbeatInit(CO_Data* d)
   149 {
   148 {
   150 		
   149 		
   151     UNS8 index; /* Index to scan the table of heartbeat consumers */
   150     UNS8 index; /* Index to scan the table of heartbeat consumers */
   152 	RegisterSetODentryCallBack(d, 0x1017,0x00, &OnHeartbeatProducerUpdate);
   151 	RegisterSetODentryCallBack(d, 0x1017, 0x00, &OnHeartbeatProducerUpdate);
   153     
   152     
   154     d->toggle = 0;
   153     d->toggle = 0;
   155 	
   154 	
   156     for( index = (UNS8)0x00; index < *d->ConsumerHeartbeatCount; index++ )
   155     for( index = (UNS8)0x00; index < *d->ConsumerHeartbeatCount; index++ )
   157     {
   156     {