NNP STM Generic Remote Module git-main
Loading...
Searching...
No Matches
nmtMaster.c
Go to the documentation of this file.
1
12#include "canfestival.h"
13#include "nmtMaster.h"
14#include "sysdep.h"
15
31{
32 Message m;
33
34 MSG_WAR(0x3501, "Send_NMT cs : ", cs);
35 MSG_WAR(0x3502, " to node : ", Node_ID);
36 /* message configuration */
37 m.cob_id = 0x0000; /*(NMT) << 7*/
38 m.rtr = NOT_A_REQUEST;
39 m.len = 2;
40 m.data[0] = cs;
41 m.data[1] = Node_ID;
42
43 return canSend(d->canHandle, &m);
44}
45
46
47
59{
60 Message m;
61
62 /* message configuration */
63 UNS16 tmp = nodeId | (NODE_GUARD << 7);
64 m.cob_id = UNS16_LE(tmp);
65 m.rtr = REQUEST;
66 m.len = 0;
67
68 MSG_WAR(0x3503, "Send_NODE_GUARD to node : ", nodeId);
69
70 return canSend(d->canHandle, &m);
71}
72
82{
83 /* FIXME: should warn for bad toggle bit. */
84
85 /* NMTable configuration to indicate that the master is waiting
86 for a Node_Guard frame from the slave whose node_id is ID
87 */
88 d->NMTable[nodeId] = Unknown_state; /* A state that does not exist
89 */
90
91 if (nodeId == 0) { /* NMT broadcast */
92 UNS8 i = 0;
93 for (i = 0 ; i < NMT_MAX_NODE_ID ; i++) {
94 d->NMTable[i] = Unknown_state;
95 }
96 }
97 masterSendNMTnodeguard(d,nodeId);
98}
99
#define UNS8
Unsigned int8 representation in CANFest.
Definition applicfg.h:25
#define UNS16
Unsigned int16 representation in CANFest.
Definition applicfg.h:26
#define MSG_WAR(num, str, val)
Definition of MSG_WAR.
Definition applicfg.h:64
#define REQUEST
Definition def.h:41
UNS8 masterSendNMTstateChange(CO_Data *d, UNS8 Node_ID, UNS8 cs)
Transmit a NMT message on the network to the slave whose nodeId is node ID.
Definition nmtMaster.c:30
void masterRequestNodeState(CO_Data *d, UNS8 nodeId)
Ask the state of the slave node whose nodeId is node Id.
Definition nmtMaster.c:81
UNS8 masterSendNMTnodeguard(CO_Data *d, UNS8 nodeId)
Transmit a NodeGuard message on the network to the slave whose nodeId is node ID.
Definition nmtMaster.c:58
Definition can.h:13
UNS16 cob_id
Definition can.h:14
UNS8 data[8]
Definition can.h:17
UNS8 rtr
Definition can.h:15
UNS8 len
Definition can.h:16
This structure contains all necessary informations to define a CANOpen node.
Definition data.h:44