Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1 | /**************************************************************************** |
| 2 | |
| 3 | (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29 |
| 4 | www.systec-electronic.com |
| 5 | |
| 6 | Project: openPOWERLINK |
| 7 | |
| 8 | Description: source file for NMT-Kernelspace-Module |
| 9 | |
| 10 | License: |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions |
| 14 | are met: |
| 15 | |
| 16 | 1. Redistributions of source code must retain the above copyright |
| 17 | notice, this list of conditions and the following disclaimer. |
| 18 | |
| 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. |
| 22 | |
| 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. |
| 27 | |
| 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. |
| 40 | |
| 41 | Severability Clause: |
| 42 | |
| 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. |
| 49 | |
| 50 | ------------------------------------------------------------------------- |
| 51 | |
| 52 | $RCSfile: EplNmtk.c,v $ |
| 53 | |
| 54 | $Author: D.Krueger $ |
| 55 | |
| 56 | $Revision: 1.12 $ $Date: 2008/11/13 17:13:09 $ |
| 57 | |
| 58 | $State: Exp $ |
| 59 | |
| 60 | Build Environment: |
| 61 | GCC V3.4 |
| 62 | |
| 63 | ------------------------------------------------------------------------- |
| 64 | |
| 65 | Revision History: |
| 66 | |
| 67 | 2006/06/09 k.t.: start of the implementation |
| 68 | |
| 69 | ****************************************************************************/ |
| 70 | |
| 71 | #include "kernel/EplNmtk.h" |
| 72 | #include "kernel/EplTimerk.h" |
| 73 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 74 | #include "kernel/EplDllk.h" // for EplDllkProcess() |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 75 | |
| 76 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0) |
| 77 | /***************************************************************************/ |
| 78 | /* */ |
| 79 | /* */ |
| 80 | /* G L O B A L D E F I N I T I O N S */ |
| 81 | /* */ |
| 82 | /* */ |
| 83 | /***************************************************************************/ |
| 84 | |
| 85 | //--------------------------------------------------------------------------- |
| 86 | // const defines |
| 87 | //--------------------------------------------------------------------------- |
| 88 | |
| 89 | // TracePoint support for realtime-debugging |
| 90 | #ifdef _DBG_TRACE_POINTS_ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 91 | void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p); |
| 92 | void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p); |
| 93 | #define TGT_DBG_SIGNAL_TRACE_POINT(p) TgtDbgSignalTracePoint(p) |
| 94 | #define TGT_DBG_POST_TRACE_VALUE(v) TgtDbgPostTraceValue(v) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 95 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 96 | #define TGT_DBG_SIGNAL_TRACE_POINT(p) |
| 97 | #define TGT_DBG_POST_TRACE_VALUE(v) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 98 | #endif |
| 99 | #define EPL_NMTK_DBG_POST_TRACE_VALUE(NmtEvent_p, OldNmtState_p, NewNmtState_p) \ |
| 100 | TGT_DBG_POST_TRACE_VALUE((kEplEventSinkNmtk << 28) | (NmtEvent_p << 16) \ |
| 101 | | ((OldNmtState_p & 0xFF) << 8) \ |
| 102 | | (NewNmtState_p & 0xFF)) |
| 103 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 104 | //--------------------------------------------------------------------------- |
| 105 | // local types |
| 106 | //--------------------------------------------------------------------------- |
| 107 | // struct for instance table |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 108 | INSTANCE_TYPE_BEGIN EPL_MCO_DECL_INSTANCE_MEMBER() |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 109 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 110 | STATIC volatile tEplNmtState INST_FAR m_NmtState; |
| 111 | STATIC volatile BOOL INST_FAR m_fEnableReadyToOperate; |
| 112 | STATIC volatile BOOL INST_FAR m_fAppReadyToOperate; |
| 113 | STATIC volatile BOOL INST_FAR m_fTimerMsPreOp2; |
| 114 | STATIC volatile BOOL INST_FAR m_fAllMandatoryCNIdent; |
| 115 | STATIC volatile BOOL INST_FAR m_fFrozen; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 116 | |
| 117 | INSTANCE_TYPE_END |
| 118 | //--------------------------------------------------------------------------- |
| 119 | // modul globale vars |
| 120 | //--------------------------------------------------------------------------- |
| 121 | // This macro replace the unspecific pointer to an instance through |
| 122 | // the modul specific type for the local instance table. This macro |
| 123 | // must defined in each modul. |
| 124 | //#define tEplPtrInstance tEplInstanceInfo MEM* |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 125 | EPL_MCO_DECL_INSTANCE_VAR() |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 126 | //--------------------------------------------------------------------------- |
| 127 | // local function prototypes |
| 128 | //--------------------------------------------------------------------------- |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 129 | EPL_MCO_DEFINE_INSTANCE_FCT() |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 130 | |
| 131 | /***************************************************************************/ |
| 132 | /* */ |
| 133 | /* */ |
| 134 | /* C L A S S <NMT_Kernel-Module> */ |
| 135 | /* */ |
| 136 | /* */ |
| 137 | /***************************************************************************/ |
| 138 | // |
| 139 | // Description: This module realize the NMT-State-Machine of the EPL-Stack |
| 140 | // |
| 141 | // |
| 142 | /***************************************************************************/ |
| 143 | //=========================================================================// |
| 144 | // // |
| 145 | // P U B L I C F U N C T I O N S // |
| 146 | // // |
| 147 | //=========================================================================// |
| 148 | //--------------------------------------------------------------------------- |
| 149 | // |
| 150 | // Function: EplNmtkInit |
| 151 | // |
| 152 | // Description: initializes the first instance |
| 153 | // |
| 154 | // |
| 155 | // |
| 156 | // Parameters: EPL_MCO_DECL_PTR_INSTANCE_PTR = Instance pointer |
| 157 | // uiNodeId_p = Node Id of the lokal node |
| 158 | // |
| 159 | // |
| 160 | // Returns: tEplKernel = Errorcode |
| 161 | // |
| 162 | // |
| 163 | // State: |
| 164 | // |
| 165 | //--------------------------------------------------------------------------- |
| 166 | EPLDLLEXPORT tEplKernel PUBLIC EplNmtkInit(EPL_MCO_DECL_PTR_INSTANCE_PTR) |
| 167 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 168 | tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 169 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 170 | Ret = EplNmtkAddInstance(EPL_MCO_PTR_INSTANCE_PTR); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 171 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 172 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 175 | //--------------------------------------------------------------------------- |
| 176 | // |
| 177 | // Function: EplNmtkAddInstance |
| 178 | // |
| 179 | // Description: adds a new instance |
| 180 | // |
| 181 | // |
| 182 | // |
| 183 | // Parameters: EPL_MCO_DECL_PTR_INSTANCE_PTR = Instance pointer |
| 184 | // |
| 185 | // |
| 186 | // Returns: tEplKernel = Errorcode |
| 187 | // |
| 188 | // |
| 189 | // State: |
| 190 | // |
| 191 | //--------------------------------------------------------------------------- |
| 192 | EPLDLLEXPORT tEplKernel PUBLIC EplNmtkAddInstance(EPL_MCO_DECL_PTR_INSTANCE_PTR) |
| 193 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 194 | EPL_MCO_DECL_INSTANCE_PTR_LOCAL tEplKernel Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 195 | //tEplEvent Event; |
| 196 | //tEplEventNmtStateChange NmtStateChange; |
| 197 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 198 | // check if pointer to instance pointer valid |
| 199 | // get free instance and set the globale instance pointer |
| 200 | // set also the instance addr to parameterlist |
| 201 | EPL_MCO_CHECK_PTR_INSTANCE_PTR(); |
| 202 | EPL_MCO_GET_FREE_INSTANCE_PTR(); |
| 203 | EPL_MCO_SET_PTR_INSTANCE_PTR(); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 204 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 205 | // sign instance as used |
| 206 | EPL_MCO_WRITE_INSTANCE_STATE(kStateUsed); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 207 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 208 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 209 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 210 | // initialize intern vaiables |
| 211 | // 2006/07/31 d.k.: set NMT-State to kEplNmtGsOff |
| 212 | EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtGsOff; |
| 213 | // set NMT-State to kEplNmtGsInitialising |
| 214 | //EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtGsInitialising; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 215 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 216 | // set flags to FALSE |
| 217 | EPL_MCO_GLB_VAR(m_fEnableReadyToOperate) = FALSE; |
| 218 | EPL_MCO_GLB_VAR(m_fAppReadyToOperate) = FALSE; |
| 219 | EPL_MCO_GLB_VAR(m_fTimerMsPreOp2) = FALSE; |
| 220 | EPL_MCO_GLB_VAR(m_fAllMandatoryCNIdent) = FALSE; |
| 221 | EPL_MCO_GLB_VAR(m_fFrozen) = FALSE; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 222 | |
| 223 | // EPL_MCO_GLB_VAR(m_TimerHdl) = 0; |
| 224 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 225 | // inform higher layer about state change |
| 226 | // 2006/07/31 d.k.: The EPL API layer/application has to start NMT state |
| 227 | // machine via NmtEventSwReset after initialisation of |
| 228 | // all modules has been completed. DLL has to be initialised |
| 229 | // after NMTk because NMT state shall not be uninitialised |
| 230 | // at that time. |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 231 | /* NmtStateChange.m_NewNmtState = EPL_MCO_GLB_VAR(m_NmtState); |
| 232 | NmtStateChange.m_NmtEvent = kEplNmtEventNoEvent; |
| 233 | Event.m_EventSink = kEplEventSinkNmtu; |
| 234 | Event.m_EventType = kEplEventTypeNmtStateChange; |
| 235 | EPL_MEMSET(&Event.m_NetTime, 0x00, sizeof(Event.m_NetTime)); |
| 236 | Event.m_pArg = &NmtStateChange; |
| 237 | Event.m_uiSize = sizeof(NmtStateChange); |
| 238 | Ret = EplEventkPost(&Event); |
| 239 | */ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 240 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 241 | } |
| 242 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 243 | //--------------------------------------------------------------------------- |
| 244 | // |
| 245 | // Function: EplNmtkDelInstance |
| 246 | // |
| 247 | // Description: delete instance |
| 248 | // |
| 249 | // |
| 250 | // |
| 251 | // Parameters: EPL_MCO_DECL_PTR_INSTANCE_PTR = Instance pointer |
| 252 | // |
| 253 | // |
| 254 | // Returns: tEplKernel = Errorcode |
| 255 | // |
| 256 | // |
| 257 | // State: |
| 258 | // |
| 259 | //--------------------------------------------------------------------------- |
| 260 | #if (EPL_USE_DELETEINST_FUNC != FALSE) |
| 261 | EPLDLLEXPORT tEplKernel PUBLIC EplNmtkDelInstance(EPL_MCO_DECL_PTR_INSTANCE_PTR) |
| 262 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 263 | tEplKernel Ret = kEplSuccessful; |
| 264 | // check for all API function if instance is valid |
| 265 | EPL_MCO_CHECK_INSTANCE_STATE(); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 266 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 267 | // set NMT-State to kEplNmtGsOff |
| 268 | EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtGsOff; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 269 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 270 | // sign instance as unused |
| 271 | EPL_MCO_WRITE_INSTANCE_STATE(kStateUnused); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 272 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 273 | // delete timer |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 274 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
| 275 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 276 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 277 | } |
| 278 | #endif // (EPL_USE_DELETEINST_FUNC != FALSE) |
| 279 | |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 280 | //--------------------------------------------------------------------------- |
| 281 | // |
| 282 | // Function: EplNmtkProcess |
| 283 | // |
| 284 | // Description: main process function |
| 285 | // -> process NMT-State-Maschine und read NMT-Events from Queue |
| 286 | // |
| 287 | // |
| 288 | // |
| 289 | // Parameters: EPL_MCO_DECL_PTR_INSTANCE_PTR_ = Instance pointer |
| 290 | // pEvent_p = Epl-Event with NMT-event to process |
| 291 | // |
| 292 | // |
| 293 | // Returns: tEplKernel = Errorcode |
| 294 | // |
| 295 | // |
| 296 | // State: |
| 297 | // |
| 298 | //--------------------------------------------------------------------------- |
| 299 | EPLDLLEXPORT tEplKernel PUBLIC EplNmtkProcess(EPL_MCO_DECL_PTR_INSTANCE_PTR_ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 300 | tEplEvent * pEvent_p) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 301 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 302 | tEplKernel Ret; |
| 303 | tEplNmtState OldNmtState; |
| 304 | tEplNmtEvent NmtEvent; |
| 305 | tEplEvent Event; |
| 306 | tEplEventNmtStateChange NmtStateChange; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 307 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 308 | // check for all API function if instance is valid |
| 309 | EPL_MCO_CHECK_INSTANCE_STATE(); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 310 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 311 | Ret = kEplSuccessful; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 312 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 313 | switch (pEvent_p->m_EventType) { |
| 314 | case kEplEventTypeNmtEvent: |
| 315 | { |
| 316 | NmtEvent = *((tEplNmtEvent *) pEvent_p->m_pArg); |
| 317 | break; |
| 318 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 319 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 320 | case kEplEventTypeTimer: |
| 321 | { |
| 322 | NmtEvent = |
| 323 | (tEplNmtEvent) ((tEplTimerEventArg *) pEvent_p-> |
| 324 | m_pArg)->m_ulArg; |
| 325 | break; |
| 326 | } |
| 327 | default: |
| 328 | { |
| 329 | Ret = kEplNmtInvalidEvent; |
| 330 | goto Exit; |
| 331 | } |
| 332 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 333 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 334 | // save NMT-State |
| 335 | // needed for later comparison to |
| 336 | // inform hgher layer about state change |
| 337 | OldNmtState = EPL_MCO_GLB_VAR(m_NmtState); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 338 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 339 | // NMT-State-Maschine |
| 340 | switch (EPL_MCO_GLB_VAR(m_NmtState)) { |
| 341 | //----------------------------------------------------------- |
| 342 | // general part of the statemaschine |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 343 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 344 | // first init of the hardware |
| 345 | case kEplNmtGsOff: |
| 346 | { |
| 347 | // leave this state only if higher layer says so |
| 348 | if (NmtEvent == kEplNmtEventSwReset) { // new state kEplNmtGsInitialising |
| 349 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 350 | kEplNmtGsInitialising; |
| 351 | } |
| 352 | break; |
| 353 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 354 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 355 | // first init of the hardware |
| 356 | case kEplNmtGsInitialising: |
| 357 | { |
| 358 | // leave this state only if higher layer says so |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 359 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 360 | // check events |
| 361 | switch (NmtEvent) { |
| 362 | // 2006/07/31 d.k.: react also on NMT reset commands in ResetApp state |
| 363 | // NMT Command SwitchOff |
| 364 | case kEplNmtEventCriticalError: |
| 365 | case kEplNmtEventSwitchOff: |
| 366 | { |
| 367 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 368 | kEplNmtGsOff; |
| 369 | break; |
| 370 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 371 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 372 | // new state kEplNmtGsResetApplication |
| 373 | case kEplNmtEventEnterResetApp: |
| 374 | { |
| 375 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 376 | kEplNmtGsResetApplication; |
| 377 | break; |
| 378 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 379 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 380 | default: |
| 381 | { |
| 382 | break; |
| 383 | } |
| 384 | } |
| 385 | break; |
| 386 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 387 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 388 | // init of the manufacturer-specific profile area and the |
| 389 | // standardised device profile area |
| 390 | case kEplNmtGsResetApplication: |
| 391 | { |
| 392 | // check events |
| 393 | switch (NmtEvent) { |
| 394 | // 2006/07/31 d.k.: react also on NMT reset commands in ResetApp state |
| 395 | // NMT Command SwitchOff |
| 396 | case kEplNmtEventCriticalError: |
| 397 | case kEplNmtEventSwitchOff: |
| 398 | { |
| 399 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 400 | kEplNmtGsOff; |
| 401 | break; |
| 402 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 403 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 404 | // NMT Command SwReset |
| 405 | case kEplNmtEventSwReset: |
| 406 | { |
| 407 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 408 | kEplNmtGsInitialising; |
| 409 | break; |
| 410 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 411 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 412 | // leave this state only if higher layer |
| 413 | // say so |
| 414 | case kEplNmtEventEnterResetCom: |
| 415 | { |
| 416 | // new state kEplNmtGsResetCommunication |
| 417 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 418 | kEplNmtGsResetCommunication; |
| 419 | break; |
| 420 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 421 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 422 | default: |
| 423 | { |
| 424 | break; |
| 425 | } |
| 426 | } |
| 427 | break; |
| 428 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 429 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 430 | // init of the communication profile area |
| 431 | case kEplNmtGsResetCommunication: |
| 432 | { |
| 433 | // check events |
| 434 | switch (NmtEvent) { |
| 435 | // 2006/07/31 d.k.: react also on NMT reset commands in ResetComm state |
| 436 | // NMT Command SwitchOff |
| 437 | case kEplNmtEventCriticalError: |
| 438 | case kEplNmtEventSwitchOff: |
| 439 | { |
| 440 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 441 | kEplNmtGsOff; |
| 442 | break; |
| 443 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 444 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 445 | // NMT Command SwReset |
| 446 | case kEplNmtEventSwReset: |
| 447 | { |
| 448 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 449 | kEplNmtGsInitialising; |
| 450 | break; |
| 451 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 452 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 453 | // NMT Command ResetNode |
| 454 | case kEplNmtEventResetNode: |
| 455 | { |
| 456 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 457 | kEplNmtGsResetApplication; |
| 458 | break; |
| 459 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 460 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 461 | // leave this state only if higher layer |
| 462 | // say so |
| 463 | case kEplNmtEventEnterResetConfig: |
| 464 | { |
| 465 | // new state kEplNmtGsResetCommunication |
| 466 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 467 | kEplNmtGsResetConfiguration; |
| 468 | break; |
| 469 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 470 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 471 | default: |
| 472 | { |
| 473 | break; |
| 474 | } |
| 475 | } |
| 476 | break; |
| 477 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 478 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 479 | // build the configuration with infos from OD |
| 480 | case kEplNmtGsResetConfiguration: |
| 481 | { |
| 482 | // reset flags |
| 483 | EPL_MCO_GLB_VAR(m_fEnableReadyToOperate) = FALSE; |
| 484 | EPL_MCO_GLB_VAR(m_fAppReadyToOperate) = FALSE; |
| 485 | EPL_MCO_GLB_VAR(m_fFrozen) = FALSE; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 486 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 487 | // check events |
| 488 | switch (NmtEvent) { |
| 489 | // 2006/07/31 d.k.: react also on NMT reset commands in ResetConf state |
| 490 | // NMT Command SwitchOff |
| 491 | case kEplNmtEventCriticalError: |
| 492 | case kEplNmtEventSwitchOff: |
| 493 | { |
| 494 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 495 | kEplNmtGsOff; |
| 496 | break; |
| 497 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 498 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 499 | // NMT Command SwReset |
| 500 | case kEplNmtEventSwReset: |
| 501 | { |
| 502 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 503 | kEplNmtGsInitialising; |
| 504 | break; |
| 505 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 506 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 507 | // NMT Command ResetNode |
| 508 | case kEplNmtEventResetNode: |
| 509 | { |
| 510 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 511 | kEplNmtGsResetApplication; |
| 512 | break; |
| 513 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 514 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 515 | // NMT Command ResetCommunication |
| 516 | case kEplNmtEventResetCom: |
| 517 | { |
| 518 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 519 | kEplNmtGsResetCommunication; |
| 520 | break; |
| 521 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 522 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 523 | // leave this state only if higher layer says so |
| 524 | case kEplNmtEventEnterCsNotActive: |
| 525 | { // Node should be CN |
| 526 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 527 | kEplNmtCsNotActive; |
| 528 | break; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 529 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 530 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 531 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 532 | case kEplNmtEventEnterMsNotActive: |
| 533 | { // Node should be CN |
| 534 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) == 0) |
| 535 | // no MN functionality |
| 536 | // TODO: -create error E_NMT_BA1_NO_MN_SUPPORT |
| 537 | EPL_MCO_GLB_VAR(m_fFrozen) = TRUE; |
| 538 | #else |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 539 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 540 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 541 | kEplNmtMsNotActive; |
| 542 | #endif |
| 543 | break; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 544 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 545 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 546 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 547 | default: |
| 548 | { |
| 549 | break; |
| 550 | } |
| 551 | } |
| 552 | break; |
| 553 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 554 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 555 | //----------------------------------------------------------- |
| 556 | // CN part of the statemaschine |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 557 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 558 | // node liste for EPL-Frames and check timeout |
| 559 | case kEplNmtCsNotActive: |
| 560 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 561 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 562 | // check events |
| 563 | switch (NmtEvent) { |
| 564 | // 2006/07/31 d.k.: react also on NMT reset commands in NotActive state |
| 565 | // NMT Command SwitchOff |
| 566 | case kEplNmtEventCriticalError: |
| 567 | case kEplNmtEventSwitchOff: |
| 568 | { |
| 569 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 570 | kEplNmtGsOff; |
| 571 | break; |
| 572 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 573 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 574 | // NMT Command SwReset |
| 575 | case kEplNmtEventSwReset: |
| 576 | { |
| 577 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 578 | kEplNmtGsInitialising; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 579 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 580 | break; |
| 581 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 582 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 583 | // NMT Command ResetNode |
| 584 | case kEplNmtEventResetNode: |
| 585 | { |
| 586 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 587 | kEplNmtGsResetApplication; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 588 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 589 | break; |
| 590 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 591 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 592 | // NMT Command ResetCommunication |
| 593 | // or internal Communication error |
| 594 | case kEplNmtEventResetCom: |
| 595 | case kEplNmtEventInternComError: |
| 596 | { |
| 597 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 598 | kEplNmtGsResetCommunication; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 599 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 600 | break; |
| 601 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 602 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 603 | // NMT Command Reset Configuration |
| 604 | case kEplNmtEventResetConfig: |
| 605 | { |
| 606 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 607 | kEplNmtGsResetConfiguration; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 608 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 609 | break; |
| 610 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 611 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 612 | // see if SoA or SoC received |
| 613 | // k.t. 20.07.2006: only SoA forces change of state |
| 614 | // see EPL V2 DS 1.0.0 p.267 |
| 615 | // case kEplNmtEventDllCeSoc: |
| 616 | case kEplNmtEventDllCeSoa: |
| 617 | { // new state PRE_OPERATIONAL1 |
| 618 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 619 | kEplNmtCsPreOperational1; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 620 | // Ret = EplTimerkDeleteTimer(&EPL_MCO_GLB_VAR(m_TimerHdl)); |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 621 | break; |
| 622 | } |
| 623 | // timeout for SoA and Soc |
| 624 | case kEplNmtEventTimerBasicEthernet: |
| 625 | { |
| 626 | // new state BASIC_ETHERNET |
| 627 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 628 | kEplNmtCsBasicEthernet; |
| 629 | break; |
| 630 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 631 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 632 | default: |
| 633 | { |
| 634 | break; |
| 635 | } |
| 636 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 637 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 638 | break; |
| 639 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 640 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 641 | // node processes only async frames |
| 642 | case kEplNmtCsPreOperational1: |
| 643 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 644 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 645 | // check events |
| 646 | switch (NmtEvent) { |
| 647 | // NMT Command SwitchOff |
| 648 | case kEplNmtEventCriticalError: |
| 649 | case kEplNmtEventSwitchOff: |
| 650 | { |
| 651 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 652 | kEplNmtGsOff; |
| 653 | break; |
| 654 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 655 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 656 | // NMT Command SwReset |
| 657 | case kEplNmtEventSwReset: |
| 658 | { |
| 659 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 660 | kEplNmtGsInitialising; |
| 661 | break; |
| 662 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 663 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 664 | // NMT Command ResetNode |
| 665 | case kEplNmtEventResetNode: |
| 666 | { |
| 667 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 668 | kEplNmtGsResetApplication; |
| 669 | break; |
| 670 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 671 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 672 | // NMT Command ResetCommunication |
| 673 | // or internal Communication error |
| 674 | case kEplNmtEventResetCom: |
| 675 | case kEplNmtEventInternComError: |
| 676 | { |
| 677 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 678 | kEplNmtGsResetCommunication; |
| 679 | break; |
| 680 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 681 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 682 | // NMT Command Reset Configuration |
| 683 | case kEplNmtEventResetConfig: |
| 684 | { |
| 685 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 686 | kEplNmtGsResetConfiguration; |
| 687 | break; |
| 688 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 689 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 690 | // NMT Command StopNode |
| 691 | case kEplNmtEventStopNode: |
| 692 | { |
| 693 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 694 | kEplNmtCsStopped; |
| 695 | break; |
| 696 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 697 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 698 | // check if SoC received |
| 699 | case kEplNmtEventDllCeSoc: |
| 700 | { |
| 701 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 702 | kEplNmtCsPreOperational2; |
| 703 | break; |
| 704 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 705 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 706 | default: |
| 707 | { |
| 708 | break; |
| 709 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 710 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 711 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 712 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 713 | break; |
| 714 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 715 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 716 | // node processes isochronous and asynchronous frames |
| 717 | case kEplNmtCsPreOperational2: |
| 718 | { |
| 719 | // check events |
| 720 | switch (NmtEvent) { |
| 721 | // NMT Command SwitchOff |
| 722 | case kEplNmtEventCriticalError: |
| 723 | case kEplNmtEventSwitchOff: |
| 724 | { |
| 725 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 726 | kEplNmtGsOff; |
| 727 | break; |
| 728 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 729 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 730 | // NMT Command SwReset |
| 731 | case kEplNmtEventSwReset: |
| 732 | { |
| 733 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 734 | kEplNmtGsInitialising; |
| 735 | break; |
| 736 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 737 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 738 | // NMT Command ResetNode |
| 739 | case kEplNmtEventResetNode: |
| 740 | { |
| 741 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 742 | kEplNmtGsResetApplication; |
| 743 | break; |
| 744 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 745 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 746 | // NMT Command ResetCommunication |
| 747 | // or internal Communication error |
| 748 | case kEplNmtEventResetCom: |
| 749 | case kEplNmtEventInternComError: |
| 750 | { |
| 751 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 752 | kEplNmtGsResetCommunication; |
| 753 | break; |
| 754 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 755 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 756 | // NMT Command Reset Configuration |
| 757 | case kEplNmtEventResetConfig: |
| 758 | { |
| 759 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 760 | kEplNmtGsResetConfiguration; |
| 761 | break; |
| 762 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 763 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 764 | // NMT Command StopNode |
| 765 | case kEplNmtEventStopNode: |
| 766 | { |
| 767 | // reset flags |
| 768 | EPL_MCO_GLB_VAR(m_fEnableReadyToOperate) |
| 769 | = FALSE; |
| 770 | EPL_MCO_GLB_VAR(m_fAppReadyToOperate) = |
| 771 | FALSE; |
| 772 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 773 | kEplNmtCsStopped; |
| 774 | break; |
| 775 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 776 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 777 | // error occured |
| 778 | case kEplNmtEventNmtCycleError: |
| 779 | { |
| 780 | // reset flags |
| 781 | EPL_MCO_GLB_VAR(m_fEnableReadyToOperate) |
| 782 | = FALSE; |
| 783 | EPL_MCO_GLB_VAR(m_fAppReadyToOperate) = |
| 784 | FALSE; |
| 785 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 786 | kEplNmtCsPreOperational1; |
| 787 | break; |
| 788 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 789 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 790 | // check if application is ready to operate |
| 791 | case kEplNmtEventEnterReadyToOperate: |
| 792 | { |
| 793 | // check if command NMTEnableReadyToOperate from MN was received |
| 794 | if (EPL_MCO_GLB_VAR(m_fEnableReadyToOperate) == TRUE) { // reset flags |
| 795 | EPL_MCO_GLB_VAR |
| 796 | (m_fEnableReadyToOperate) = |
| 797 | FALSE; |
| 798 | EPL_MCO_GLB_VAR |
| 799 | (m_fAppReadyToOperate) = |
| 800 | FALSE; |
| 801 | // change state |
| 802 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 803 | kEplNmtCsReadyToOperate; |
| 804 | } else { // set Flag |
| 805 | EPL_MCO_GLB_VAR |
| 806 | (m_fAppReadyToOperate) = |
| 807 | TRUE; |
| 808 | } |
| 809 | break; |
| 810 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 811 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 812 | // NMT Commando EnableReadyToOperate |
| 813 | case kEplNmtEventEnableReadyToOperate: |
| 814 | { |
| 815 | // check if application is ready |
| 816 | if (EPL_MCO_GLB_VAR(m_fAppReadyToOperate) == TRUE) { // reset flags |
| 817 | EPL_MCO_GLB_VAR |
| 818 | (m_fEnableReadyToOperate) = |
| 819 | FALSE; |
| 820 | EPL_MCO_GLB_VAR |
| 821 | (m_fAppReadyToOperate) = |
| 822 | FALSE; |
| 823 | // change state |
| 824 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 825 | kEplNmtCsReadyToOperate; |
| 826 | } else { // set Flag |
| 827 | EPL_MCO_GLB_VAR |
| 828 | (m_fEnableReadyToOperate) = |
| 829 | TRUE; |
| 830 | } |
| 831 | break; |
| 832 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 833 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 834 | default: |
| 835 | { |
| 836 | break; |
| 837 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 838 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 839 | } // end of switch(NmtEvent) |
| 840 | break; |
| 841 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 842 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 843 | // node should be configured und application is ready |
| 844 | case kEplNmtCsReadyToOperate: |
| 845 | { |
| 846 | // check events |
| 847 | switch (NmtEvent) { |
| 848 | // NMT Command SwitchOff |
| 849 | case kEplNmtEventCriticalError: |
| 850 | case kEplNmtEventSwitchOff: |
| 851 | { |
| 852 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 853 | kEplNmtGsOff; |
| 854 | break; |
| 855 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 856 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 857 | // NMT Command SwReset |
| 858 | case kEplNmtEventSwReset: |
| 859 | { |
| 860 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 861 | kEplNmtGsInitialising; |
| 862 | break; |
| 863 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 864 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 865 | // NMT Command ResetNode |
| 866 | case kEplNmtEventResetNode: |
| 867 | { |
| 868 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 869 | kEplNmtGsResetApplication; |
| 870 | break; |
| 871 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 872 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 873 | // NMT Command ResetCommunication |
| 874 | // or internal Communication error |
| 875 | case kEplNmtEventResetCom: |
| 876 | case kEplNmtEventInternComError: |
| 877 | { |
| 878 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 879 | kEplNmtGsResetCommunication; |
| 880 | break; |
| 881 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 882 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 883 | // NMT Command ResetConfiguration |
| 884 | case kEplNmtEventResetConfig: |
| 885 | { |
| 886 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 887 | kEplNmtGsResetConfiguration; |
| 888 | break; |
| 889 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 890 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 891 | // NMT Command StopNode |
| 892 | case kEplNmtEventStopNode: |
| 893 | { |
| 894 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 895 | kEplNmtCsStopped; |
| 896 | break; |
| 897 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 898 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 899 | // error occured |
| 900 | case kEplNmtEventNmtCycleError: |
| 901 | { |
| 902 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 903 | kEplNmtCsPreOperational1; |
| 904 | break; |
| 905 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 906 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 907 | // NMT Command StartNode |
| 908 | case kEplNmtEventStartNode: |
| 909 | { |
| 910 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 911 | kEplNmtCsOperational; |
| 912 | break; |
| 913 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 914 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 915 | default: |
| 916 | { |
| 917 | break; |
| 918 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 919 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 920 | } // end of switch(NmtEvent) |
| 921 | break; |
| 922 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 923 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 924 | // normal work state |
| 925 | case kEplNmtCsOperational: |
| 926 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 927 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 928 | // check events |
| 929 | switch (NmtEvent) { |
| 930 | // NMT Command SwitchOff |
| 931 | case kEplNmtEventCriticalError: |
| 932 | case kEplNmtEventSwitchOff: |
| 933 | { |
| 934 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 935 | kEplNmtGsOff; |
| 936 | break; |
| 937 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 938 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 939 | // NMT Command SwReset |
| 940 | case kEplNmtEventSwReset: |
| 941 | { |
| 942 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 943 | kEplNmtGsInitialising; |
| 944 | break; |
| 945 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 946 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 947 | // NMT Command ResetNode |
| 948 | case kEplNmtEventResetNode: |
| 949 | { |
| 950 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 951 | kEplNmtGsResetApplication; |
| 952 | break; |
| 953 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 954 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 955 | // NMT Command ResetCommunication |
| 956 | // or internal Communication error |
| 957 | case kEplNmtEventResetCom: |
| 958 | case kEplNmtEventInternComError: |
| 959 | { |
| 960 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 961 | kEplNmtGsResetCommunication; |
| 962 | break; |
| 963 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 964 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 965 | // NMT Command ResetConfiguration |
| 966 | case kEplNmtEventResetConfig: |
| 967 | { |
| 968 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 969 | kEplNmtGsResetConfiguration; |
| 970 | break; |
| 971 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 972 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 973 | // NMT Command StopNode |
| 974 | case kEplNmtEventStopNode: |
| 975 | { |
| 976 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 977 | kEplNmtCsStopped; |
| 978 | break; |
| 979 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 980 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 981 | // NMT Command EnterPreOperational2 |
| 982 | case kEplNmtEventEnterPreOperational2: |
| 983 | { |
| 984 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 985 | kEplNmtCsPreOperational2; |
| 986 | break; |
| 987 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 988 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 989 | // error occured |
| 990 | case kEplNmtEventNmtCycleError: |
| 991 | { |
| 992 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 993 | kEplNmtCsPreOperational1; |
| 994 | break; |
| 995 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 996 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 997 | default: |
| 998 | { |
| 999 | break; |
| 1000 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1001 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1002 | } // end of switch(NmtEvent) |
| 1003 | break; |
| 1004 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1005 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1006 | // node stopped by MN |
| 1007 | // -> only process asynchronous frames |
| 1008 | case kEplNmtCsStopped: |
| 1009 | { |
| 1010 | // check events |
| 1011 | switch (NmtEvent) { |
| 1012 | // NMT Command SwitchOff |
| 1013 | case kEplNmtEventCriticalError: |
| 1014 | case kEplNmtEventSwitchOff: |
| 1015 | { |
| 1016 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1017 | kEplNmtGsOff; |
| 1018 | break; |
| 1019 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1020 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1021 | // NMT Command SwReset |
| 1022 | case kEplNmtEventSwReset: |
| 1023 | { |
| 1024 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1025 | kEplNmtGsInitialising; |
| 1026 | break; |
| 1027 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1028 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1029 | // NMT Command ResetNode |
| 1030 | case kEplNmtEventResetNode: |
| 1031 | { |
| 1032 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1033 | kEplNmtGsResetApplication; |
| 1034 | break; |
| 1035 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1036 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1037 | // NMT Command ResetCommunication |
| 1038 | // or internal Communication error |
| 1039 | case kEplNmtEventResetCom: |
| 1040 | case kEplNmtEventInternComError: |
| 1041 | { |
| 1042 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1043 | kEplNmtGsResetCommunication; |
| 1044 | break; |
| 1045 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1046 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1047 | // NMT Command ResetConfiguration |
| 1048 | case kEplNmtEventResetConfig: |
| 1049 | { |
| 1050 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1051 | kEplNmtGsResetConfiguration; |
| 1052 | break; |
| 1053 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1054 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1055 | // NMT Command EnterPreOperational2 |
| 1056 | case kEplNmtEventEnterPreOperational2: |
| 1057 | { |
| 1058 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1059 | kEplNmtCsPreOperational2; |
| 1060 | break; |
| 1061 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1062 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1063 | // error occured |
| 1064 | case kEplNmtEventNmtCycleError: |
| 1065 | { |
| 1066 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1067 | kEplNmtCsPreOperational1; |
| 1068 | break; |
| 1069 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1070 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1071 | default: |
| 1072 | { |
| 1073 | break; |
| 1074 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1075 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1076 | } // end of switch(NmtEvent) |
| 1077 | break; |
| 1078 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1079 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1080 | // no epl cycle |
| 1081 | // -> normal ethernet communication |
| 1082 | case kEplNmtCsBasicEthernet: |
| 1083 | { |
| 1084 | // check events |
| 1085 | switch (NmtEvent) { |
| 1086 | // NMT Command SwitchOff |
| 1087 | case kEplNmtEventCriticalError: |
| 1088 | case kEplNmtEventSwitchOff: |
| 1089 | { |
| 1090 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1091 | kEplNmtGsOff; |
| 1092 | break; |
| 1093 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1094 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1095 | // NMT Command SwReset |
| 1096 | case kEplNmtEventSwReset: |
| 1097 | { |
| 1098 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1099 | kEplNmtGsInitialising; |
| 1100 | break; |
| 1101 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1102 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1103 | // NMT Command ResetNode |
| 1104 | case kEplNmtEventResetNode: |
| 1105 | { |
| 1106 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1107 | kEplNmtGsResetApplication; |
| 1108 | break; |
| 1109 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1110 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1111 | // NMT Command ResetCommunication |
| 1112 | // or internal Communication error |
| 1113 | case kEplNmtEventResetCom: |
| 1114 | case kEplNmtEventInternComError: |
| 1115 | { |
| 1116 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1117 | kEplNmtGsResetCommunication; |
| 1118 | break; |
| 1119 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1120 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1121 | // NMT Command ResetConfiguration |
| 1122 | case kEplNmtEventResetConfig: |
| 1123 | { |
| 1124 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1125 | kEplNmtGsResetConfiguration; |
| 1126 | break; |
| 1127 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1128 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1129 | // error occured |
| 1130 | // d.k.: how does this error occur? on CRC errors |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1131 | /* case kEplNmtEventNmtCycleError: |
| 1132 | { |
| 1133 | EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtCsPreOperational1; |
| 1134 | break; |
| 1135 | } |
| 1136 | */ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1137 | case kEplNmtEventDllCeSoc: |
| 1138 | case kEplNmtEventDllCePreq: |
| 1139 | case kEplNmtEventDllCePres: |
| 1140 | case kEplNmtEventDllCeSoa: |
| 1141 | { // Epl-Frame on net -> stop any communication |
| 1142 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1143 | kEplNmtCsPreOperational1; |
| 1144 | break; |
| 1145 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1146 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1147 | default: |
| 1148 | { |
| 1149 | break; |
| 1150 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1151 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1152 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1153 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1154 | break; |
| 1155 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1156 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1157 | //----------------------------------------------------------- |
| 1158 | // MN part of the statemaschine |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1159 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1160 | // MN listen to network |
| 1161 | // -> if no EPL traffic go to next state |
| 1162 | case kEplNmtMsNotActive: |
| 1163 | { |
| 1164 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) == 0) |
| 1165 | // no MN functionality |
| 1166 | // TODO: -create error E_NMT_BA1_NO_MN_SUPPORT |
| 1167 | EPL_MCO_GLB_VAR(m_fFrozen) = TRUE; |
| 1168 | #else |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1169 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1170 | // check events |
| 1171 | switch (NmtEvent) { |
| 1172 | // NMT Command SwitchOff |
| 1173 | case kEplNmtEventCriticalError: |
| 1174 | case kEplNmtEventSwitchOff: |
| 1175 | { |
| 1176 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1177 | kEplNmtGsOff; |
| 1178 | break; |
| 1179 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1180 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1181 | // NMT Command SwReset |
| 1182 | case kEplNmtEventSwReset: |
| 1183 | { |
| 1184 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1185 | kEplNmtGsInitialising; |
| 1186 | break; |
| 1187 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1188 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1189 | // NMT Command ResetNode |
| 1190 | case kEplNmtEventResetNode: |
| 1191 | { |
| 1192 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1193 | kEplNmtGsResetApplication; |
| 1194 | break; |
| 1195 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1196 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1197 | // NMT Command ResetCommunication |
| 1198 | // or internal Communication error |
| 1199 | case kEplNmtEventResetCom: |
| 1200 | case kEplNmtEventInternComError: |
| 1201 | { |
| 1202 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1203 | kEplNmtGsResetCommunication; |
| 1204 | break; |
| 1205 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1206 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1207 | // NMT Command ResetConfiguration |
| 1208 | case kEplNmtEventResetConfig: |
| 1209 | { |
| 1210 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1211 | kEplNmtGsResetConfiguration; |
| 1212 | break; |
| 1213 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1214 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1215 | // EPL frames received |
| 1216 | case kEplNmtEventDllCeSoc: |
| 1217 | case kEplNmtEventDllCeSoa: |
| 1218 | { // other MN in network |
| 1219 | // $$$ d.k.: generate error history entry |
| 1220 | EPL_MCO_GLB_VAR(m_fFrozen) = TRUE; |
| 1221 | break; |
| 1222 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1223 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1224 | // timeout event |
| 1225 | case kEplNmtEventTimerBasicEthernet: |
| 1226 | { |
| 1227 | if (EPL_MCO_GLB_VAR(m_fFrozen) == FALSE) { // new state BasicEthernet |
| 1228 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1229 | kEplNmtMsBasicEthernet; |
| 1230 | } |
| 1231 | break; |
| 1232 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1233 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1234 | // timeout event |
| 1235 | case kEplNmtEventTimerMsPreOp1: |
| 1236 | { |
| 1237 | if (EPL_MCO_GLB_VAR(m_fFrozen) == FALSE) { // new state PreOp1 |
| 1238 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1239 | kEplNmtMsPreOperational1; |
| 1240 | EPL_MCO_GLB_VAR |
| 1241 | (m_fTimerMsPreOp2) = FALSE; |
| 1242 | EPL_MCO_GLB_VAR |
| 1243 | (m_fAllMandatoryCNIdent) = |
| 1244 | FALSE; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1245 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1246 | } |
| 1247 | break; |
| 1248 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1249 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1250 | default: |
| 1251 | { |
| 1252 | break; |
| 1253 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1254 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1255 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1256 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1257 | #endif // ((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) == 0) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1258 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1259 | break; |
| 1260 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1261 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1262 | // MN process reduces epl cycle |
| 1263 | case kEplNmtMsPreOperational1: |
| 1264 | { |
| 1265 | // check events |
| 1266 | switch (NmtEvent) { |
| 1267 | // NMT Command SwitchOff |
| 1268 | case kEplNmtEventCriticalError: |
| 1269 | case kEplNmtEventSwitchOff: |
| 1270 | { |
| 1271 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1272 | kEplNmtGsOff; |
| 1273 | break; |
| 1274 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1275 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1276 | // NMT Command SwReset |
| 1277 | case kEplNmtEventSwReset: |
| 1278 | { |
| 1279 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1280 | kEplNmtGsInitialising; |
| 1281 | break; |
| 1282 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1283 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1284 | // NMT Command ResetNode |
| 1285 | case kEplNmtEventResetNode: |
| 1286 | { |
| 1287 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1288 | kEplNmtGsResetApplication; |
| 1289 | break; |
| 1290 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1291 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1292 | // NMT Command ResetCommunication |
| 1293 | // or internal Communication error |
| 1294 | case kEplNmtEventResetCom: |
| 1295 | case kEplNmtEventInternComError: |
| 1296 | { |
| 1297 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1298 | kEplNmtGsResetCommunication; |
| 1299 | break; |
| 1300 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1301 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1302 | // NMT Command ResetConfiguration |
| 1303 | case kEplNmtEventResetConfig: |
| 1304 | { |
| 1305 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1306 | kEplNmtGsResetConfiguration; |
| 1307 | break; |
| 1308 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1309 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1310 | // EPL frames received |
| 1311 | case kEplNmtEventDllCeSoc: |
| 1312 | case kEplNmtEventDllCeSoa: |
| 1313 | { // other MN in network |
| 1314 | // $$$ d.k.: generate error history entry |
| 1315 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1316 | kEplNmtGsResetCommunication; |
| 1317 | break; |
| 1318 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1319 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1320 | // error occured |
| 1321 | // d.k. MSPreOp1->CSPreOp1: nonsense -> keep state |
| 1322 | /* |
| 1323 | case kEplNmtEventNmtCycleError: |
| 1324 | { |
| 1325 | EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtCsPreOperational1; |
| 1326 | break; |
| 1327 | } |
| 1328 | */ |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1329 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1330 | case kEplNmtEventAllMandatoryCNIdent: |
| 1331 | { // all mandatory CN identified |
| 1332 | if (EPL_MCO_GLB_VAR(m_fTimerMsPreOp2) != |
| 1333 | FALSE) { |
| 1334 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1335 | kEplNmtMsPreOperational2; |
| 1336 | } else { |
| 1337 | EPL_MCO_GLB_VAR |
| 1338 | (m_fAllMandatoryCNIdent) = |
| 1339 | TRUE; |
| 1340 | } |
| 1341 | break; |
| 1342 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1343 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1344 | case kEplNmtEventTimerMsPreOp2: |
| 1345 | { // residence time for PreOp1 is elapsed |
| 1346 | if (EPL_MCO_GLB_VAR |
| 1347 | (m_fAllMandatoryCNIdent) != FALSE) { |
| 1348 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1349 | kEplNmtMsPreOperational2; |
| 1350 | } else { |
| 1351 | EPL_MCO_GLB_VAR |
| 1352 | (m_fTimerMsPreOp2) = TRUE; |
| 1353 | } |
| 1354 | break; |
| 1355 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1356 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1357 | default: |
| 1358 | { |
| 1359 | break; |
| 1360 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1361 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1362 | } // end of switch(NmtEvent) |
| 1363 | break; |
| 1364 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1365 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1366 | // MN process full epl cycle |
| 1367 | case kEplNmtMsPreOperational2: |
| 1368 | { |
| 1369 | // check events |
| 1370 | switch (NmtEvent) { |
| 1371 | // NMT Command SwitchOff |
| 1372 | case kEplNmtEventCriticalError: |
| 1373 | case kEplNmtEventSwitchOff: |
| 1374 | { |
| 1375 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1376 | kEplNmtGsOff; |
| 1377 | break; |
| 1378 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1379 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1380 | // NMT Command SwReset |
| 1381 | case kEplNmtEventSwReset: |
| 1382 | { |
| 1383 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1384 | kEplNmtGsInitialising; |
| 1385 | break; |
| 1386 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1387 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1388 | // NMT Command ResetNode |
| 1389 | case kEplNmtEventResetNode: |
| 1390 | { |
| 1391 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1392 | kEplNmtGsResetApplication; |
| 1393 | break; |
| 1394 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1395 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1396 | // NMT Command ResetCommunication |
| 1397 | // or internal Communication error |
| 1398 | case kEplNmtEventResetCom: |
| 1399 | case kEplNmtEventInternComError: |
| 1400 | { |
| 1401 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1402 | kEplNmtGsResetCommunication; |
| 1403 | break; |
| 1404 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1405 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1406 | // NMT Command ResetConfiguration |
| 1407 | case kEplNmtEventResetConfig: |
| 1408 | { |
| 1409 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1410 | kEplNmtGsResetConfiguration; |
| 1411 | break; |
| 1412 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1413 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1414 | // EPL frames received |
| 1415 | case kEplNmtEventDllCeSoc: |
| 1416 | case kEplNmtEventDllCeSoa: |
| 1417 | { // other MN in network |
| 1418 | // $$$ d.k.: generate error history entry |
| 1419 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1420 | kEplNmtGsResetCommunication; |
| 1421 | break; |
| 1422 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1423 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1424 | // error occured |
| 1425 | case kEplNmtEventNmtCycleError: |
| 1426 | { |
| 1427 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1428 | kEplNmtMsPreOperational1; |
| 1429 | break; |
| 1430 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1431 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1432 | case kEplNmtEventEnterReadyToOperate: |
| 1433 | { |
| 1434 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1435 | kEplNmtMsReadyToOperate; |
| 1436 | break; |
| 1437 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1438 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1439 | default: |
| 1440 | { |
| 1441 | break; |
| 1442 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1443 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1444 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1445 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1446 | break; |
| 1447 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1448 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1449 | // all madatory nodes ready to operate |
| 1450 | // -> MN process full epl cycle |
| 1451 | case kEplNmtMsReadyToOperate: |
| 1452 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1453 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1454 | // check events |
| 1455 | switch (NmtEvent) { |
| 1456 | // NMT Command SwitchOff |
| 1457 | case kEplNmtEventCriticalError: |
| 1458 | case kEplNmtEventSwitchOff: |
| 1459 | { |
| 1460 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1461 | kEplNmtGsOff; |
| 1462 | break; |
| 1463 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1464 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1465 | // NMT Command SwReset |
| 1466 | case kEplNmtEventSwReset: |
| 1467 | { |
| 1468 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1469 | kEplNmtGsInitialising; |
| 1470 | break; |
| 1471 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1472 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1473 | // NMT Command ResetNode |
| 1474 | case kEplNmtEventResetNode: |
| 1475 | { |
| 1476 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1477 | kEplNmtGsResetApplication; |
| 1478 | break; |
| 1479 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1480 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1481 | // NMT Command ResetCommunication |
| 1482 | // or internal Communication error |
| 1483 | case kEplNmtEventResetCom: |
| 1484 | case kEplNmtEventInternComError: |
| 1485 | { |
| 1486 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1487 | kEplNmtGsResetCommunication; |
| 1488 | break; |
| 1489 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1490 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1491 | // NMT Command ResetConfiguration |
| 1492 | case kEplNmtEventResetConfig: |
| 1493 | { |
| 1494 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1495 | kEplNmtGsResetConfiguration; |
| 1496 | break; |
| 1497 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1498 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1499 | // EPL frames received |
| 1500 | case kEplNmtEventDllCeSoc: |
| 1501 | case kEplNmtEventDllCeSoa: |
| 1502 | { // other MN in network |
| 1503 | // $$$ d.k.: generate error history entry |
| 1504 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1505 | kEplNmtGsResetCommunication; |
| 1506 | break; |
| 1507 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1508 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1509 | // error occured |
| 1510 | case kEplNmtEventNmtCycleError: |
| 1511 | { |
| 1512 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1513 | kEplNmtMsPreOperational1; |
| 1514 | break; |
| 1515 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1516 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1517 | case kEplNmtEventEnterMsOperational: |
| 1518 | { |
| 1519 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1520 | kEplNmtMsOperational; |
| 1521 | break; |
| 1522 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1523 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1524 | default: |
| 1525 | { |
| 1526 | break; |
| 1527 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1528 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1529 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1530 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1531 | break; |
| 1532 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1533 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1534 | // normal eplcycle processing |
| 1535 | case kEplNmtMsOperational: |
| 1536 | { |
| 1537 | // check events |
| 1538 | switch (NmtEvent) { |
| 1539 | // NMT Command SwitchOff |
| 1540 | case kEplNmtEventCriticalError: |
| 1541 | case kEplNmtEventSwitchOff: |
| 1542 | { |
| 1543 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1544 | kEplNmtGsOff; |
| 1545 | break; |
| 1546 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1547 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1548 | // NMT Command SwReset |
| 1549 | case kEplNmtEventSwReset: |
| 1550 | { |
| 1551 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1552 | kEplNmtGsInitialising; |
| 1553 | break; |
| 1554 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1555 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1556 | // NMT Command ResetNode |
| 1557 | case kEplNmtEventResetNode: |
| 1558 | { |
| 1559 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1560 | kEplNmtGsResetApplication; |
| 1561 | break; |
| 1562 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1563 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1564 | // NMT Command ResetCommunication |
| 1565 | // or internal Communication error |
| 1566 | case kEplNmtEventResetCom: |
| 1567 | case kEplNmtEventInternComError: |
| 1568 | { |
| 1569 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1570 | kEplNmtGsResetCommunication; |
| 1571 | break; |
| 1572 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1573 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1574 | // NMT Command ResetConfiguration |
| 1575 | case kEplNmtEventResetConfig: |
| 1576 | { |
| 1577 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1578 | kEplNmtGsResetConfiguration; |
| 1579 | break; |
| 1580 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1581 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1582 | // EPL frames received |
| 1583 | case kEplNmtEventDllCeSoc: |
| 1584 | case kEplNmtEventDllCeSoa: |
| 1585 | { // other MN in network |
| 1586 | // $$$ d.k.: generate error history entry |
| 1587 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1588 | kEplNmtGsResetCommunication; |
| 1589 | break; |
| 1590 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1591 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1592 | // error occured |
| 1593 | case kEplNmtEventNmtCycleError: |
| 1594 | { |
| 1595 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1596 | kEplNmtMsPreOperational1; |
| 1597 | break; |
| 1598 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1599 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1600 | default: |
| 1601 | { |
| 1602 | break; |
| 1603 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1604 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1605 | } // end of switch(NmtEvent) |
| 1606 | break; |
| 1607 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1608 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1609 | // normal ethernet traffic |
| 1610 | case kEplNmtMsBasicEthernet: |
| 1611 | { |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1612 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1613 | // check events |
| 1614 | switch (NmtEvent) { |
| 1615 | // NMT Command SwitchOff |
| 1616 | case kEplNmtEventCriticalError: |
| 1617 | case kEplNmtEventSwitchOff: |
| 1618 | { |
| 1619 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1620 | kEplNmtGsOff; |
| 1621 | break; |
| 1622 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1623 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1624 | // NMT Command SwReset |
| 1625 | case kEplNmtEventSwReset: |
| 1626 | { |
| 1627 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1628 | kEplNmtGsInitialising; |
| 1629 | break; |
| 1630 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1631 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1632 | // NMT Command ResetNode |
| 1633 | case kEplNmtEventResetNode: |
| 1634 | { |
| 1635 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1636 | kEplNmtGsResetApplication; |
| 1637 | break; |
| 1638 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1639 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1640 | // NMT Command ResetCommunication |
| 1641 | // or internal Communication error |
| 1642 | case kEplNmtEventResetCom: |
| 1643 | case kEplNmtEventInternComError: |
| 1644 | { |
| 1645 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1646 | kEplNmtGsResetCommunication; |
| 1647 | break; |
| 1648 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1649 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1650 | // NMT Command ResetConfiguration |
| 1651 | case kEplNmtEventResetConfig: |
| 1652 | { |
| 1653 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1654 | kEplNmtGsResetConfiguration; |
| 1655 | break; |
| 1656 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1657 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1658 | // EPL frames received |
| 1659 | case kEplNmtEventDllCeSoc: |
| 1660 | case kEplNmtEventDllCeSoa: |
| 1661 | { // other MN in network |
| 1662 | // $$$ d.k.: generate error history entry |
| 1663 | EPL_MCO_GLB_VAR(m_NmtState) = |
| 1664 | kEplNmtGsResetCommunication; |
| 1665 | break; |
| 1666 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1667 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1668 | // error occured |
| 1669 | // d.k. BE->PreOp1 on cycle error? No |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1670 | /* case kEplNmtEventNmtCycleError: |
| 1671 | { |
| 1672 | EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtCsPreOperational1; |
| 1673 | break; |
| 1674 | } |
| 1675 | */ |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1676 | default: |
| 1677 | { |
| 1678 | break; |
| 1679 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1680 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1681 | } // end of switch(NmtEvent) |
| 1682 | break; |
| 1683 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1684 | #endif //#if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) |
| 1685 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1686 | default: |
| 1687 | { |
| 1688 | //DEBUG_EPL_DBGLVL_NMTK_TRACE0(EPL_DBGLVL_NMT ,"Error in EplNmtProcess: Unknown NMT-State"); |
| 1689 | //EPL_MCO_GLB_VAR(m_NmtState) = kEplNmtGsResetApplication; |
| 1690 | Ret = kEplNmtInvalidState; |
| 1691 | goto Exit; |
| 1692 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1693 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1694 | } // end of switch(NmtEvent) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1695 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1696 | // inform higher layer about State-Change if needed |
| 1697 | if (OldNmtState != EPL_MCO_GLB_VAR(m_NmtState)) { |
| 1698 | EPL_NMTK_DBG_POST_TRACE_VALUE(NmtEvent, OldNmtState, |
| 1699 | EPL_MCO_GLB_VAR(m_NmtState)); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1700 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1701 | // d.k.: memorize NMT state before posting any events |
| 1702 | NmtStateChange.m_NewNmtState = EPL_MCO_GLB_VAR(m_NmtState); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1703 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1704 | // inform DLL |
| 1705 | if ((OldNmtState > kEplNmtGsResetConfiguration) |
| 1706 | && (EPL_MCO_GLB_VAR(m_NmtState) <= |
| 1707 | kEplNmtGsResetConfiguration)) { |
| 1708 | // send DLL DEINIT |
| 1709 | Event.m_EventSink = kEplEventSinkDllk; |
| 1710 | Event.m_EventType = kEplEventTypeDllkDestroy; |
| 1711 | EPL_MEMSET(&Event.m_NetTime, 0x00, |
| 1712 | sizeof(Event.m_NetTime)); |
| 1713 | Event.m_pArg = &OldNmtState; |
| 1714 | Event.m_uiSize = sizeof(OldNmtState); |
| 1715 | // d.k.: directly call DLLk process function, because |
| 1716 | // 1. execution of process function is still synchonized and serialized, |
| 1717 | // 2. it is the same as without event queues (i.e. well tested), |
| 1718 | // 3. DLLk will get those necessary events even if event queue is full, |
| 1719 | // 4. event queue is very inefficient |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1720 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1721 | Ret = EplDllkProcess(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1722 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1723 | Ret = EplEventkPost(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1724 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1725 | } else if ((OldNmtState <= kEplNmtGsResetConfiguration) |
| 1726 | && (EPL_MCO_GLB_VAR(m_NmtState) > |
| 1727 | kEplNmtGsResetConfiguration)) { |
| 1728 | // send DLL INIT |
| 1729 | Event.m_EventSink = kEplEventSinkDllk; |
| 1730 | Event.m_EventType = kEplEventTypeDllkCreate; |
| 1731 | EPL_MEMSET(&Event.m_NetTime, 0x00, |
| 1732 | sizeof(Event.m_NetTime)); |
| 1733 | Event.m_pArg = &NmtStateChange.m_NewNmtState; |
| 1734 | Event.m_uiSize = sizeof(NmtStateChange.m_NewNmtState); |
| 1735 | // d.k.: directly call DLLk process function, because |
| 1736 | // 1. execution of process function is still synchonized and serialized, |
| 1737 | // 2. it is the same as without event queues (i.e. well tested), |
| 1738 | // 3. DLLk will get those necessary events even if event queue is full |
| 1739 | // 4. event queue is very inefficient |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1740 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1741 | Ret = EplDllkProcess(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1742 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1743 | Ret = EplEventkPost(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1744 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1745 | } else |
| 1746 | if ((EPL_MCO_GLB_VAR(m_NmtState) == kEplNmtCsBasicEthernet) |
| 1747 | || (EPL_MCO_GLB_VAR(m_NmtState) == |
| 1748 | kEplNmtMsBasicEthernet)) { |
| 1749 | tEplDllAsyncReqPriority AsyncReqPriority; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1750 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1751 | // send DLL Fill Async Tx Buffer, because state BasicEthernet was entered |
| 1752 | Event.m_EventSink = kEplEventSinkDllk; |
| 1753 | Event.m_EventType = kEplEventTypeDllkFillTx; |
| 1754 | EPL_MEMSET(&Event.m_NetTime, 0x00, |
| 1755 | sizeof(Event.m_NetTime)); |
| 1756 | AsyncReqPriority = kEplDllAsyncReqPrioGeneric; |
| 1757 | Event.m_pArg = &AsyncReqPriority; |
| 1758 | Event.m_uiSize = sizeof(AsyncReqPriority); |
| 1759 | // d.k.: directly call DLLk process function, because |
| 1760 | // 1. execution of process function is still synchonized and serialized, |
| 1761 | // 2. it is the same as without event queues (i.e. well tested), |
| 1762 | // 3. DLLk will get those necessary events even if event queue is full |
| 1763 | // 4. event queue is very inefficient |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1764 | #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLK)) != 0) |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1765 | Ret = EplDllkProcess(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1766 | #else |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1767 | Ret = EplEventkPost(&Event); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1768 | #endif |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1769 | } |
| 1770 | // inform higher layer about state change |
| 1771 | NmtStateChange.m_NmtEvent = NmtEvent; |
| 1772 | Event.m_EventSink = kEplEventSinkNmtu; |
| 1773 | Event.m_EventType = kEplEventTypeNmtStateChange; |
| 1774 | EPL_MEMSET(&Event.m_NetTime, 0x00, sizeof(Event.m_NetTime)); |
| 1775 | Event.m_pArg = &NmtStateChange; |
| 1776 | Event.m_uiSize = sizeof(NmtStateChange); |
| 1777 | Ret = EplEventkPost(&Event); |
| 1778 | EPL_DBGLVL_NMTK_TRACE2 |
| 1779 | ("EplNmtkProcess(NMT-Event = 0x%04X): New NMT-State = 0x%03X\n", |
| 1780 | NmtEvent, NmtStateChange.m_NewNmtState); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1781 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1782 | } |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1783 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1784 | Exit: |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1785 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1786 | return Ret; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1787 | } |
| 1788 | |
| 1789 | //--------------------------------------------------------------------------- |
| 1790 | // |
| 1791 | // Function: EplNmtkGetNmtState |
| 1792 | // |
| 1793 | // Description: return the actuell NMT-State and the bits |
| 1794 | // to for MN- or CN-mode |
| 1795 | // |
| 1796 | // |
| 1797 | // |
| 1798 | // Parameters: EPL_MCO_DECL_PTR_INSTANCE_PTR_ = Instancepointer |
| 1799 | // |
| 1800 | // |
| 1801 | // Returns: tEplNmtState = NMT-State |
| 1802 | // |
| 1803 | // |
| 1804 | // State: |
| 1805 | // |
| 1806 | //--------------------------------------------------------------------------- |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1807 | EPLDLLEXPORT tEplNmtState PUBLIC |
| 1808 | EplNmtkGetNmtState(EPL_MCO_DECL_PTR_INSTANCE_PTR) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1809 | { |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1810 | tEplNmtState NmtState; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1811 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1812 | NmtState = EPL_MCO_GLB_VAR(m_NmtState); |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1813 | |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1814 | return NmtState; |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1815 | |
| 1816 | } |
| 1817 | |
| 1818 | //=========================================================================// |
| 1819 | // // |
| 1820 | // P R I V A T E D E F I N I T I O N S // |
| 1821 | // // |
| 1822 | //=========================================================================// |
Greg Kroah-Hartman | 833dfbe | 2008-12-19 17:11:52 -0800 | [diff] [blame] | 1823 | EPL_MCO_DECL_INSTANCE_FCT() |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1824 | //--------------------------------------------------------------------------- |
| 1825 | // |
| 1826 | // Function: |
| 1827 | // |
| 1828 | // Description: |
| 1829 | // |
| 1830 | // |
| 1831 | // |
| 1832 | // Parameters: |
| 1833 | // |
| 1834 | // |
| 1835 | // Returns: |
| 1836 | // |
| 1837 | // |
| 1838 | // State: |
| 1839 | // |
| 1840 | //--------------------------------------------------------------------------- |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1841 | #endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTK)) != 0) |
Daniel Krueger | 9d7164c | 2008-12-19 11:41:57 -0800 | [diff] [blame] | 1842 | // EOF |