1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: global include file for EPL-NMT-Modules
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
50 -------------------------------------------------------------------------
52 $RCSfile: EplNmt.h,v $
56 $Revision: 1.6 $ $Date: 2008/11/17 16:40:39 $
63 -------------------------------------------------------------------------
67 2006/06/09 k.t.: start of the implementation
70 ****************************************************************************/
77 //---------------------------------------------------------------------------
79 //---------------------------------------------------------------------------
81 // define super-states and masks to identify a super-state
82 #define EPL_NMT_GS_POWERED 0x0008 // super state
83 #define EPL_NMT_GS_INITIALISATION 0x0009 // super state
84 #define EPL_NMT_GS_COMMUNICATING 0x000C // super state
85 #define EPL_NMT_CS_EPLMODE 0x000D // super state
86 #define EPL_NMT_MS_EPLMODE 0x000D // super state
88 #define EPL_NMT_SUPERSTATE_MASK 0x000F // mask to select state
90 #define EPL_NMT_TYPE_UNDEFINED 0x0000 // type of NMT state is still undefined
91 #define EPL_NMT_TYPE_CS 0x0100 // CS type of NMT state
92 #define EPL_NMT_TYPE_MS 0x0200 // MS type of NMT state
93 #define EPL_NMT_TYPE_MASK 0x0300 // mask to select type of NMT state (i.e. CS or MS)
95 //---------------------------------------------------------------------------
97 //---------------------------------------------------------------------------
99 // the lower Byte of the NMT-State is encoded
100 // like the values in the EPL-Standard
101 // the higher byte is used to encode MN
102 // (Bit 1 of the higher byte = 1) or CN (Bit 0 of the
104 // the super-states are not mentioned in this
105 // enum because they are no real states
106 // --> there are masks defined to indentify the
111 kEplNmtGsOff = 0x0000,
112 kEplNmtGsInitialising = 0x0019,
113 kEplNmtGsResetApplication = 0x0029,
114 kEplNmtGsResetCommunication = 0x0039,
115 kEplNmtGsResetConfiguration = 0x0079,
116 kEplNmtCsNotActive = 0x011C,
117 kEplNmtCsPreOperational1 = 0x011D,
118 kEplNmtCsStopped = 0x014D,
119 kEplNmtCsPreOperational2 = 0x015D,
120 kEplNmtCsReadyToOperate = 0x016D,
121 kEplNmtCsOperational = 0x01FD,
122 kEplNmtCsBasicEthernet = 0x011E,
123 kEplNmtMsNotActive = 0x021C,
124 kEplNmtMsPreOperational1 = 0x021D,
125 kEplNmtMsPreOperational2 = 0x025D,
126 kEplNmtMsReadyToOperate = 0x026D,
127 kEplNmtMsOperational = 0x02FD,
128 kEplNmtMsBasicEthernet = 0x021E
136 // Events defined by EPL V2 specification
137 kEplNmtEventNoEvent = 0x00,
138 // kEplNmtEventDllMePres = 0x01,
139 kEplNmtEventDllMePresTimeout = 0x02,
140 // kEplNmtEventDllMeAsnd = 0x03,
141 // kEplNmtEventDllMeAsndTimeout = 0x04,
142 kEplNmtEventDllMeSoaSent = 0x04,
143 kEplNmtEventDllMeSocTrig = 0x05,
144 kEplNmtEventDllMeSoaTrig = 0x06,
145 kEplNmtEventDllCeSoc = 0x07,
146 kEplNmtEventDllCePreq = 0x08,
147 kEplNmtEventDllCePres = 0x09,
148 kEplNmtEventDllCeSoa = 0x0A,
149 kEplNmtEventDllCeAsnd = 0x0B,
150 kEplNmtEventDllCeFrameTimeout = 0x0C,
152 // Events triggered by NMT-Commands
153 kEplNmtEventSwReset = 0x10, // NMT_GT1, NMT_GT2, NMT_GT8
154 kEplNmtEventResetNode = 0x11,
155 kEplNmtEventResetCom = 0x12,
156 kEplNmtEventResetConfig = 0x13,
157 kEplNmtEventEnterPreOperational2= 0x14,
158 kEplNmtEventEnableReadyToOperate= 0x15,
159 kEplNmtEventStartNode = 0x16, // NMT_CT7
160 kEplNmtEventStopNode = 0x17,
162 // Events triggered by higher layer
163 kEplNmtEventEnterResetApp = 0x20,
164 kEplNmtEventEnterResetCom = 0x21,
165 kEplNmtEventInternComError = 0x22, // NMT_GT6, internal communication error -> enter ResetCommunication
166 kEplNmtEventEnterResetConfig = 0x23,
167 kEplNmtEventEnterCsNotActive = 0x24,
168 kEplNmtEventEnterMsNotActive = 0x25,
169 kEplNmtEventTimerBasicEthernet = 0x26, // NMT_CT3; timer triggered state change (NotActive -> BasicEth)
170 kEplNmtEventTimerMsPreOp1 = 0x27, // enter PreOp1 on MN (NotActive -> MsPreOp1)
171 kEplNmtEventNmtCycleError = 0x28, // NMT_CT11, NMT_MT6; error during cycle -> enter PreOp1
172 kEplNmtEventTimerMsPreOp2 = 0x29, // enter PreOp2 on MN (MsPreOp1 -> MsPreOp2 if kEplNmtEventAllMandatoryCNIdent)
173 kEplNmtEventAllMandatoryCNIdent = 0x2A, // enter PreOp2 on MN if kEplNmtEventTimerMsPreOp2
174 kEplNmtEventEnterReadyToOperate = 0x2B, // application ready for the state ReadyToOp
175 kEplNmtEventEnterMsOperational = 0x2C, // enter Operational on MN
176 kEplNmtEventSwitchOff = 0x2D, // enter state Off
177 kEplNmtEventCriticalError = 0x2E, // enter state Off because of critical error
182 // type for argument of event kEplEventTypeNmtStateChange
185 tEplNmtState m_NewNmtState;
186 tEplNmtEvent m_NmtEvent;
188 } tEplEventNmtStateChange;
191 // structure for kEplEventTypeHeartbeat
194 unsigned int m_uiNodeId; // NodeId
195 tEplNmtState m_NmtState; // NMT state (remember distinguish between MN / CN)
196 WORD m_wErrorCode; // EPL error code in case of NMT state NotActive
198 } tEplHeartbeatEvent;
203 kEplNmtNodeEventFound = 0x00,
204 kEplNmtNodeEventUpdateSw = 0x01, // application shall update software on CN
205 kEplNmtNodeEventCheckConf = 0x02, // application / Configuration Manager shall check and update configuration on CN
206 kEplNmtNodeEventUpdateConf = 0x03, // application / Configuration Manager shall update configuration on CN (check was done by NmtMn module)
207 kEplNmtNodeEventVerifyConf = 0x04, // application / Configuration Manager shall verify configuration of CN
208 kEplNmtNodeEventReadyToStart= 0x05, // issued if EPL_NMTST_NO_STARTNODE set
209 // application must call EplNmtMnuSendNmtCommand(kEplNmtCmdStartNode) manually
210 kEplNmtNodeEventNmtState = 0x06,
211 kEplNmtNodeEventError = 0x07, // NMT error of CN
218 kEplNmtNodeCommandBoot = 0x01, // if EPL_NODEASSIGN_START_CN not set it must be issued after kEplNmtNodeEventFound
219 kEplNmtNodeCommandSwOk = 0x02, // application updated software on CN successfully
220 kEplNmtNodeCommandSwUpdated = 0x03, // application updated software on CN successfully
221 kEplNmtNodeCommandConfOk = 0x04, // application / Configuration Manager has updated configuration on CN successfully
222 kEplNmtNodeCommandConfReset = 0x05, // application / Configuration Manager has updated configuration on CN successfully
223 // and CN needs ResetConf so that the configuration gets actived
224 kEplNmtNodeCommandConfErr = 0x06, // application / Configuration Manager failed on updating configuration on CN
225 kEplNmtNodeCommandStart = 0x07, // if EPL_NMTST_NO_STARTNODE set it must be issued after kEplNmtNodeEventReadyToStart
227 } tEplNmtNodeCommand;
232 kEplNmtBootEventBootStep1Finish = 0x00, // PreOp2 is possible
233 kEplNmtBootEventBootStep2Finish = 0x01, // ReadyToOp is possible
234 kEplNmtBootEventCheckComFinish = 0x02, // Operational is possible
235 kEplNmtBootEventOperational = 0x03, // all mandatory CNs are Operational
236 kEplNmtBootEventError = 0x04, // boot process halted because of an error
241 //---------------------------------------------------------------------------
242 // function prototypes
243 //---------------------------------------------------------------------------
246 #endif // #ifndef _EPLNMT_H_