#include "nmtSlave.h"
#include "states.h"
#include "canfestival.h"
+#include "sysdep.h"
/*!
** put the slave in the state wanted by the master
MSG_WAR(0x3400, "NMT received. for node : ", (*m).data[1]);
- /*! Check if this NMT-message is for this node */
- /*! byte 1 = 0 : all the nodes are concerned (broadcast) */
+ /* Check if this NMT-message is for this node */
+ /* byte 1 = 0 : all the nodes are concerned (broadcast) */
if( ( (*m).data[1] == 0 ) || ( (*m).data[1] == *d->bDeviceNodeId ) ){
- switch( (*m).data[0]){ /*! command specifier (cs) */
+ switch( (*m).data[0]){ /* command specifier (cs) */
case NMT_Start_Node:
if ( (d->nodeState == Pre_operational) || (d->nodeState == Stopped) )
setState(d,Operational);
break;
case NMT_Reset_Node:
+ if(d->NMT_Slave_Node_Reset_Callback != NULL)
+ d->NMT_Slave_Node_Reset_Callback(d);
setState(d,Initialisation);
break;
case NMT_Reset_Comunication:
+ if(d->NMT_Slave_Communications_Reset_Callback != NULL)
+ d->NMT_Slave_Communications_Reset_Callback(d);
+#ifdef CO_ENABLE_LSS
+ if(getNodeId(d)!=d->lss_transfer.nodeID && getNodeId(d)>0 && getNodeId(d)<=127)
+ setNodeId(d, d->lss_transfer.nodeID);
+#endif
setState(d,Initialisation);
break;
- }/*! end switch */
+ }/* end switch */
- }/*! end if( ( (*m).data[1] == 0 ) || ( (*m).data[1] ==
+ }/* end if( ( (*m).data[1] == 0 ) || ( (*m).data[1] ==
bDeviceNodeId ) ) */
}
}
{
Message m;
+#ifdef CO_ENABLE_LSS
+ if(*d->bDeviceNodeId==0xFF)return 0;
+#endif
+
MSG_WAR(0x3407, "Send a Boot-Up msg ", 0);
- /*! message configuration */
- m.cob_id.w = NODE_GUARD << 7 | *d->bDeviceNodeId;
+ /* message configuration */
+ {
+ UNS16 tmp = NODE_GUARD << 7 | *d->bDeviceNodeId;
+ m.cob_id = UNS16_LE(tmp);
+ }
m.rtr = NOT_A_REQUEST;
m.len = 1;
m.data[0] = 0x00;