author | greg |
Tue, 29 Jan 2008 09:02:47 +0100 | |
changeset 371 | b13cfb3c6c16 |
parent 357 | 838e5397ae67 |
child 378 | d2abf6c8c27b |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
|
3 |
||
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
|
5 |
||
6 |
See COPYING file for copyrights details. |
|
7 |
||
8 |
This library is free software; you can redistribute it and/or |
|
9 |
modify it under the terms of the GNU Lesser General Public |
|
10 |
License as published by the Free Software Foundation; either |
|
11 |
version 2.1 of the License, or (at your option) any later version. |
|
12 |
||
13 |
This library is distributed in the hope that it will be useful, |
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
Lesser General Public License for more details. |
|
17 |
||
18 |
You should have received a copy of the GNU Lesser General Public |
|
19 |
License along with this library; if not, write to the Free Software |
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
*/ |
|
22 |
||
23 |
#ifndef __states_h__ |
|
24 |
#define __states_h__ |
|
25 |
||
26 |
#include <applicfg.h> |
|
27 |
||
71 | 28 |
/* The nodes states |
29 |
* ----------------- |
|
30 |
* values are choosen so, that they can be sent directly |
|
31 |
* for heartbeat messages... |
|
32 |
* Must be coded on 7 bits only |
|
33 |
* */ |
|
0 | 34 |
/* Should not be modified */ |
35 |
enum enum_nodeState { |
|
36 |
Initialisation = 0x00, |
|
37 |
Disconnected = 0x01, |
|
38 |
Connecting = 0x02, |
|
39 |
Preparing = 0x02, |
|
40 |
Stopped = 0x04, |
|
41 |
Operational = 0x05, |
|
42 |
Pre_operational = 0x7F, |
|
357
838e5397ae67
Fixed some build errors and warnigs, thanks to Martin Hollenweger (geautomotive.eu)
etisserant
parents:
343
diff
changeset
|
43 |
Unknown_state = 0x0F |
343 | 44 |
#ifdef CO_ENABLE_LSS |
357
838e5397ae67
Fixed some build errors and warnigs, thanks to Martin Hollenweger (geautomotive.eu)
etisserant
parents:
343
diff
changeset
|
45 |
,LssTimingDelay = 0x10 |
343 | 46 |
#endif |
0 | 47 |
}; |
48 |
||
49 |
typedef enum enum_nodeState e_nodeState; |
|
50 |
||
51 |
typedef struct |
|
52 |
{ |
|
291
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
53 |
INTEGER8 csBoot_Up; |
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
54 |
INTEGER8 csSDO; |
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
55 |
INTEGER8 csEmergency; |
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
56 |
INTEGER8 csSYNC; |
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
57 |
INTEGER8 csHeartbeat; |
6165554cbfe9
Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents:
150
diff
changeset
|
58 |
INTEGER8 csPDO; |
343 | 59 |
INTEGER8 csLSS; |
0 | 60 |
} s_state_communication; |
61 |
||
149 | 62 |
/** Function that user app can overload |
0 | 63 |
* |
64 |
*/ |
|
65 |
typedef void (*initialisation_t)(void); |
|
66 |
typedef void (*preOperational_t)(void); |
|
67 |
typedef void (*operational_t)(void); |
|
68 |
typedef void (*stopped_t)(void); |
|
69 |
||
150
d2fc5d5f8a36
Some win32 fixes following yesterday's API changes.
etisserant
parents:
149
diff
changeset
|
70 |
void _initialisation(void); |
d2fc5d5f8a36
Some win32 fixes following yesterday's API changes.
etisserant
parents:
149
diff
changeset
|
71 |
void _preOperational(void); |
d2fc5d5f8a36
Some win32 fixes following yesterday's API changes.
etisserant
parents:
149
diff
changeset
|
72 |
void _operational(void); |
d2fc5d5f8a36
Some win32 fixes following yesterday's API changes.
etisserant
parents:
149
diff
changeset
|
73 |
void _stopped(void); |
149 | 74 |
|
0 | 75 |
#include "data.h" |
76 |
||
77 |
/************************* prototypes ******************************/ |
|
78 |
||
79 |
/** Called by driver/app when receiving messages |
|
80 |
*/ |
|
81 |
void canDispatch(CO_Data* d, Message *m); |
|
82 |
||
83 |
/** Returns the state of the node |
|
84 |
*/ |
|
85 |
e_nodeState getState (CO_Data* d); |
|
86 |
||
87 |
/** Change the state of the node |
|
88 |
*/ |
|
89 |
UNS8 setState (CO_Data* d, e_nodeState newState); |
|
90 |
||
91 |
/** Returns the nodId |
|
92 |
*/ |
|
93 |
UNS8 getNodeId (CO_Data* d); |
|
94 |
||
95 |
/** Define the node ID. Initialize the object dictionary |
|
96 |
*/ |
|
97 |
void setNodeId (CO_Data* d, UNS8 nodeId); |
|
98 |
||
99 |
/** Some stuff to do when the node enter in reset mode |
|
100 |
* |
|
101 |
*/ |
|
71 | 102 |
/* void initResetMode (CO_Data* d); */ |
0 | 103 |
|
104 |
||
105 |
/** Some stuff to do when the node enter in pre-operational mode |
|
106 |
* |
|
107 |
*/ |
|
108 |
void initPreOperationalMode (CO_Data* d); |
|
109 |
||
110 |
#endif |