• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-CN-Userspace-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: EplNmtCnu.c,v $
53 
54                 $Author: D.Krueger $
55 
56                 $Revision: 1.6 $  $Date: 2008/10/17 15:32:32 $
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 "EplInc.h"
72 #include "user/EplNmtCnu.h"
73 #include "user/EplDlluCal.h"
74 
75 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
76 
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 //---------------------------------------------------------------------------
90 // local types
91 //---------------------------------------------------------------------------
92 
93 typedef struct {
94 	unsigned int m_uiNodeId;
95 	tEplNmtuCheckEventCallback m_pfnCheckEventCb;
96 
97 } tEplNmtCnuInstance;
98 
99 //---------------------------------------------------------------------------
100 // modul globale vars
101 //---------------------------------------------------------------------------
102 
103 static tEplNmtCnuInstance EplNmtCnuInstance_g;
104 
105 //---------------------------------------------------------------------------
106 // local function prototypes
107 //---------------------------------------------------------------------------
108 
109 static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p);
110 
111 static BOOL EplNmtCnuNodeIdList(BYTE * pbNmtCommandDate_p);
112 
113 static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p);
114 
115 //=========================================================================//
116 //                                                                         //
117 //          P U B L I C   F U N C T I O N S                                //
118 //                                                                         //
119 //=========================================================================//
120 
121 //---------------------------------------------------------------------------
122 //
123 // Function:    EplNmtCnuInit
124 //
125 // Description: init the first instance of the module
126 //
127 //
128 //
129 // Parameters:      uiNodeId_p = NodeId of the local node
130 //
131 //
132 // Returns:         tEplKernel = errorcode
133 //
134 //
135 // State:
136 //
137 //---------------------------------------------------------------------------
EplNmtCnuInit(unsigned int uiNodeId_p)138 EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuInit(unsigned int uiNodeId_p)
139 {
140 	tEplKernel Ret;
141 
142 	Ret = EplNmtCnuAddInstance(uiNodeId_p);
143 
144 	return Ret;
145 }
146 
147 //---------------------------------------------------------------------------
148 //
149 // Function:    EplNmtCnuAddInstance
150 //
151 // Description: init the add new instance of the module
152 //
153 //
154 //
155 // Parameters:      uiNodeId_p = NodeId of the local node
156 //
157 //
158 // Returns:         tEplKernel = errorcode
159 //
160 //
161 // State:
162 //
163 //---------------------------------------------------------------------------
EplNmtCnuAddInstance(unsigned int uiNodeId_p)164 EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuAddInstance(unsigned int uiNodeId_p)
165 {
166 	tEplKernel Ret;
167 
168 	Ret = kEplSuccessful;
169 
170 	// reset instance structure
171 	EPL_MEMSET(&EplNmtCnuInstance_g, 0, sizeof(EplNmtCnuInstance_g));
172 
173 	// save nodeid
174 	EplNmtCnuInstance_g.m_uiNodeId = uiNodeId_p;
175 
176 	// register callback-function for NMT-commands
177 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
178 	Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
179 				       EplNmtCnuCommandCb,
180 				       kEplDllAsndFilterLocal);
181 #endif
182 
183 	return Ret;
184 
185 }
186 
187 //---------------------------------------------------------------------------
188 //
189 // Function:    EplNmtCnuDelInstance
190 //
191 // Description: delte instance of the module
192 //
193 //
194 //
195 // Parameters:
196 //
197 //
198 // Returns:         tEplKernel = errorcode
199 //
200 //
201 // State:
202 //
203 //---------------------------------------------------------------------------
EplNmtCnuDelInstance()204 EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuDelInstance()
205 {
206 	tEplKernel Ret;
207 
208 	Ret = kEplSuccessful;
209 
210 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
211 	// deregister callback function from DLL
212 	Ret = EplDlluCalRegAsndService(kEplDllAsndNmtCommand,
213 				       NULL, kEplDllAsndFilterNone);
214 #endif
215 
216 	return Ret;
217 }
218 
219 //---------------------------------------------------------------------------
220 //
221 // Function:    EplNmtCnuSendNmtRequest
222 //
223 // Description: Send an NMT-Request to the MN
224 //
225 //
226 //
227 // Parameters:      uiNodeId_p = NodeId of the local node
228 //                  NmtCommand_p = requested NMT-Command
229 //
230 //
231 // Returns:         tEplKernel = errorcode
232 //
233 //
234 // State:
235 //
236 //---------------------------------------------------------------------------
EplNmtCnuSendNmtRequest(unsigned int uiNodeId_p,tEplNmtCommand NmtCommand_p)237 EPLDLLEXPORT tEplKernel PUBLIC EplNmtCnuSendNmtRequest(unsigned int uiNodeId_p,
238 						       tEplNmtCommand
239 						       NmtCommand_p)
240 {
241 	tEplKernel Ret;
242 	tEplFrameInfo NmtRequestFrameInfo;
243 	tEplFrame NmtRequestFrame;
244 
245 	Ret = kEplSuccessful;
246 
247 	// build frame
248 	EPL_MEMSET(&NmtRequestFrame.m_be_abDstMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abDstMac));	// set by DLL
249 	EPL_MEMSET(&NmtRequestFrame.m_be_abSrcMac[0], 0x00, sizeof(NmtRequestFrame.m_be_abSrcMac));	// set by DLL
250 	AmiSetWordToBe(&NmtRequestFrame.m_be_wEtherType,
251 		       EPL_C_DLL_ETHERTYPE_EPL);
252 	AmiSetByteToLe(&NmtRequestFrame.m_le_bDstNodeId, (BYTE) EPL_C_ADR_MN_DEF_NODE_ID);	// node id of the MN
253 	AmiSetByteToLe(&NmtRequestFrame.m_le_bMessageType,
254 		       (BYTE) kEplMsgTypeAsnd);
255 	AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_le_bServiceId,
256 		       (BYTE) kEplDllAsndNmtRequest);
257 	AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.
258 		       m_NmtRequestService.m_le_bNmtCommandId,
259 		       (BYTE) NmtCommand_p);
260 	AmiSetByteToLe(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.m_le_bTargetNodeId, (BYTE) uiNodeId_p);	// target for the nmt command
261 	EPL_MEMSET(&NmtRequestFrame.m_Data.m_Asnd.m_Payload.m_NmtRequestService.
262 		   m_le_abNmtCommandData[0], 0x00,
263 		   sizeof(NmtRequestFrame.m_Data.m_Asnd.m_Payload.
264 			  m_NmtRequestService.m_le_abNmtCommandData));
265 
266 	// build info-structure
267 	NmtRequestFrameInfo.m_NetTime.m_dwNanoSec = 0;
268 	NmtRequestFrameInfo.m_NetTime.m_dwSec = 0;
269 	NmtRequestFrameInfo.m_pFrame = &NmtRequestFrame;
270 	NmtRequestFrameInfo.m_uiFrameSize = EPL_C_DLL_MINSIZE_NMTREQ;	// sizeof(NmtRequestFrame);
271 
272 	// send NMT-Request
273 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_DLLU)) != 0)
274 	Ret = EplDlluCalAsyncSend(&NmtRequestFrameInfo,	// pointer to frameinfo
275 				  kEplDllAsyncReqPrioNmt);	// priority
276 #endif
277 
278 	return Ret;
279 }
280 
281 //---------------------------------------------------------------------------
282 //
283 // Function:    EplNmtCnuRegisterStateChangeCb
284 //
285 // Description: register Callback-function go get informed about a
286 //              NMT-Change-State-Event
287 //
288 //
289 //
290 // Parameters:  pfnEplNmtStateChangeCb_p = functionpointer
291 //
292 //
293 // Returns:     tEplKernel  = errorcode
294 //
295 //
296 // State:
297 //
298 //---------------------------------------------------------------------------
299 
300 EPLDLLEXPORT tEplKernel PUBLIC
EplNmtCnuRegisterCheckEventCb(tEplNmtuCheckEventCallback pfnEplNmtCheckEventCb_p)301 EplNmtCnuRegisterCheckEventCb(tEplNmtuCheckEventCallback
302 			      pfnEplNmtCheckEventCb_p)
303 {
304 	tEplKernel Ret;
305 
306 	Ret = kEplSuccessful;
307 
308 	// save callback-function in modul global var
309 	EplNmtCnuInstance_g.m_pfnCheckEventCb = pfnEplNmtCheckEventCb_p;
310 
311 	return Ret;
312 
313 }
314 
315 //=========================================================================//
316 //                                                                         //
317 //          P R I V A T E   F U N C T I O N S                              //
318 //                                                                         //
319 //=========================================================================//
320 
321 //---------------------------------------------------------------------------
322 //
323 // Function:    EplNmtCnuCommandCb
324 //
325 // Description: callback funktion for NMT-Commands
326 //
327 //
328 //
329 // Parameters:      pFrameInfo_p = Frame with the NMT-Commando
330 //
331 //
332 // Returns:         tEplKernel = errorcode
333 //
334 //
335 // State:
336 //
337 //---------------------------------------------------------------------------
EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p)338 static tEplKernel PUBLIC EplNmtCnuCommandCb(tEplFrameInfo * pFrameInfo_p)
339 {
340 	tEplKernel Ret = kEplSuccessful;
341 	tEplNmtCommand NmtCommand;
342 	BOOL fNodeIdInList;
343 	tEplNmtEvent NmtEvent = kEplNmtEventNoEvent;
344 
345 	if (pFrameInfo_p == NULL) {
346 		Ret = kEplNmtInvalidFramePointer;
347 		goto Exit;
348 	}
349 
350 	NmtCommand = EplNmtCnuGetNmtCommand(pFrameInfo_p);
351 
352 	// check NMT-Command
353 	switch (NmtCommand) {
354 
355 		//------------------------------------------------------------------------
356 		// plain NMT state commands
357 	case kEplNmtCmdStartNode:
358 		{		// send NMT-Event to state maschine kEplNmtEventStartNode
359 			NmtEvent = kEplNmtEventStartNode;
360 			break;
361 		}
362 
363 	case kEplNmtCmdStopNode:
364 		{		// send NMT-Event to state maschine kEplNmtEventStopNode
365 			NmtEvent = kEplNmtEventStopNode;
366 			break;
367 		}
368 
369 	case kEplNmtCmdEnterPreOperational2:
370 		{		// send NMT-Event to state maschine kEplNmtEventEnterPreOperational2
371 			NmtEvent = kEplNmtEventEnterPreOperational2;
372 			break;
373 		}
374 
375 	case kEplNmtCmdEnableReadyToOperate:
376 		{		// send NMT-Event to state maschine kEplNmtEventEnableReadyToOperate
377 			NmtEvent = kEplNmtEventEnableReadyToOperate;
378 			break;
379 		}
380 
381 	case kEplNmtCmdResetNode:
382 		{		// send NMT-Event to state maschine kEplNmtEventResetNode
383 			NmtEvent = kEplNmtEventResetNode;
384 			break;
385 		}
386 
387 	case kEplNmtCmdResetCommunication:
388 		{		// send NMT-Event to state maschine kEplNmtEventResetCom
389 			NmtEvent = kEplNmtEventResetCom;
390 			break;
391 		}
392 
393 	case kEplNmtCmdResetConfiguration:
394 		{		// send NMT-Event to state maschine kEplNmtEventResetConfig
395 			NmtEvent = kEplNmtEventResetConfig;
396 			break;
397 		}
398 
399 	case kEplNmtCmdSwReset:
400 		{		// send NMT-Event to state maschine kEplNmtEventSwReset
401 			NmtEvent = kEplNmtEventSwReset;
402 			break;
403 		}
404 
405 		//------------------------------------------------------------------------
406 		// extended NMT state commands
407 
408 	case kEplNmtCmdStartNodeEx:
409 		{
410 			// check if own nodeid is in EPL node list
411 			fNodeIdInList =
412 			    EplNmtCnuNodeIdList(&
413 						(pFrameInfo_p->m_pFrame->m_Data.
414 						 m_Asnd.m_Payload.
415 						 m_NmtCommandService.
416 						 m_le_abNmtCommandData[0]));
417 			if (fNodeIdInList != FALSE) {	// own nodeid in list
418 				// send event to process command
419 				NmtEvent = kEplNmtEventStartNode;
420 			}
421 			break;
422 		}
423 
424 	case kEplNmtCmdStopNodeEx:
425 		{		// check if own nodeid is in EPL node list
426 			fNodeIdInList =
427 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
428 						m_Asnd.m_Payload.
429 						m_NmtCommandService.
430 						m_le_abNmtCommandData[0]);
431 			if (fNodeIdInList != FALSE) {	// own nodeid in list
432 				// send event to process command
433 				NmtEvent = kEplNmtEventStopNode;
434 			}
435 			break;
436 		}
437 
438 	case kEplNmtCmdEnterPreOperational2Ex:
439 		{		// check if own nodeid is in EPL node list
440 			fNodeIdInList =
441 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
442 						m_Asnd.m_Payload.
443 						m_NmtCommandService.
444 						m_le_abNmtCommandData[0]);
445 			if (fNodeIdInList != FALSE) {	// own nodeid in list
446 				// send event to process command
447 				NmtEvent = kEplNmtEventEnterPreOperational2;
448 			}
449 			break;
450 		}
451 
452 	case kEplNmtCmdEnableReadyToOperateEx:
453 		{		// check if own nodeid is in EPL node list
454 			fNodeIdInList =
455 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
456 						m_Asnd.m_Payload.
457 						m_NmtCommandService.
458 						m_le_abNmtCommandData[0]);
459 			if (fNodeIdInList != FALSE) {	// own nodeid in list
460 				// send event to process command
461 				NmtEvent = kEplNmtEventEnableReadyToOperate;
462 			}
463 			break;
464 		}
465 
466 	case kEplNmtCmdResetNodeEx:
467 		{		// check if own nodeid is in EPL node list
468 			fNodeIdInList =
469 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
470 						m_Asnd.m_Payload.
471 						m_NmtCommandService.
472 						m_le_abNmtCommandData[0]);
473 			if (fNodeIdInList != FALSE) {	// own nodeid in list
474 				// send event to process command
475 				NmtEvent = kEplNmtEventResetNode;
476 			}
477 			break;
478 		}
479 
480 	case kEplNmtCmdResetCommunicationEx:
481 		{		// check if own nodeid is in EPL node list
482 			fNodeIdInList =
483 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
484 						m_Asnd.m_Payload.
485 						m_NmtCommandService.
486 						m_le_abNmtCommandData[0]);
487 			if (fNodeIdInList != FALSE) {	// own nodeid in list
488 				// send event to process command
489 				NmtEvent = kEplNmtEventResetCom;
490 			}
491 			break;
492 		}
493 
494 	case kEplNmtCmdResetConfigurationEx:
495 		{		// check if own nodeid is in EPL node list
496 			fNodeIdInList =
497 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
498 						m_Asnd.m_Payload.
499 						m_NmtCommandService.
500 						m_le_abNmtCommandData[0]);
501 			if (fNodeIdInList != FALSE) {	// own nodeid in list
502 				// send event to process command
503 				NmtEvent = kEplNmtEventResetConfig;
504 			}
505 			break;
506 		}
507 
508 	case kEplNmtCmdSwResetEx:
509 		{		// check if own nodeid is in EPL node list
510 			fNodeIdInList =
511 			    EplNmtCnuNodeIdList(&pFrameInfo_p->m_pFrame->m_Data.
512 						m_Asnd.m_Payload.
513 						m_NmtCommandService.
514 						m_le_abNmtCommandData[0]);
515 			if (fNodeIdInList != FALSE) {	// own nodeid in list
516 				// send event to process command
517 				NmtEvent = kEplNmtEventSwReset;
518 			}
519 			break;
520 		}
521 
522 		//------------------------------------------------------------------------
523 		// NMT managing commands
524 
525 		// TODO: add functions to process managing command (optional)
526 
527 	case kEplNmtCmdNetHostNameSet:
528 		{
529 			break;
530 		}
531 
532 	case kEplNmtCmdFlushArpEntry:
533 		{
534 			break;
535 		}
536 
537 		//------------------------------------------------------------------------
538 		// NMT info services
539 
540 		// TODO: forward event with infos to the application (optional)
541 
542 	case kEplNmtCmdPublishConfiguredCN:
543 		{
544 			break;
545 		}
546 
547 	case kEplNmtCmdPublishActiveCN:
548 		{
549 			break;
550 		}
551 
552 	case kEplNmtCmdPublishPreOperational1:
553 		{
554 			break;
555 		}
556 
557 	case kEplNmtCmdPublishPreOperational2:
558 		{
559 			break;
560 		}
561 
562 	case kEplNmtCmdPublishReadyToOperate:
563 		{
564 			break;
565 		}
566 
567 	case kEplNmtCmdPublishOperational:
568 		{
569 			break;
570 		}
571 
572 	case kEplNmtCmdPublishStopped:
573 		{
574 			break;
575 		}
576 
577 	case kEplNmtCmdPublishEmergencyNew:
578 		{
579 			break;
580 		}
581 
582 	case kEplNmtCmdPublishTime:
583 		{
584 			break;
585 		}
586 
587 		//-----------------------------------------------------------------------
588 		// error from MN
589 		// -> requested command not supported by MN
590 	case kEplNmtCmdInvalidService:
591 		{
592 
593 			// TODO: errorevent to application
594 			break;
595 		}
596 
597 		//------------------------------------------------------------------------
598 		// default
599 	default:
600 		{
601 			Ret = kEplNmtUnknownCommand;
602 			goto Exit;
603 		}
604 
605 	}			// end of switch(NmtCommand)
606 
607 	if (NmtEvent != kEplNmtEventNoEvent) {
608 		if (EplNmtCnuInstance_g.m_pfnCheckEventCb != NULL) {
609 			Ret = EplNmtCnuInstance_g.m_pfnCheckEventCb(NmtEvent);
610 			if (Ret == kEplReject) {
611 				Ret = kEplSuccessful;
612 				goto Exit;
613 			} else if (Ret != kEplSuccessful) {
614 				goto Exit;
615 			}
616 		}
617 #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMTU)) != 0)
618 		Ret = EplNmtuNmtEvent(NmtEvent);
619 #endif
620 	}
621 
622       Exit:
623 	return Ret;
624 
625 }
626 
627 //---------------------------------------------------------------------------
628 //
629 // Function:    EplNmtCnuGetNmtCommand()
630 //
631 // Description: returns the NMT-Command from the frame
632 //
633 //
634 //
635 // Parameters:      pFrameInfo_p = pointer to the Frame
636 //                                 with the NMT-Command
637 //
638 //
639 // Returns:         tEplNmtCommand = NMT-Command
640 //
641 //
642 // State:
643 //
644 //---------------------------------------------------------------------------
EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p)645 static tEplNmtCommand EplNmtCnuGetNmtCommand(tEplFrameInfo * pFrameInfo_p)
646 {
647 	tEplNmtCommand NmtCommand;
648 	tEplNmtCommandService *pNmtCommandService;
649 
650 	pNmtCommandService =
651 	    &pFrameInfo_p->m_pFrame->m_Data.m_Asnd.m_Payload.
652 	    m_NmtCommandService;
653 
654 	NmtCommand =
655 	    (tEplNmtCommand) AmiGetByteFromLe(&pNmtCommandService->
656 					      m_le_bNmtCommandId);
657 
658 	return NmtCommand;
659 }
660 
661 //---------------------------------------------------------------------------
662 //
663 // Function:    EplNmtCnuNodeIdList()
664 //
665 // Description: check if the own nodeid is set in EPL Node List
666 //
667 //
668 //
669 // Parameters:      pbNmtCommandDate_p = pointer to the data of the NMT Command
670 //
671 //
672 // Returns:         BOOL = TRUE if nodeid is set in EPL Node List
673 //                         FALSE if nodeid not set in EPL Node List
674 //
675 //
676 // State:
677 //
678 //---------------------------------------------------------------------------
EplNmtCnuNodeIdList(BYTE * pbNmtCommandDate_p)679 static BOOL EplNmtCnuNodeIdList(BYTE * pbNmtCommandDate_p)
680 {
681 	BOOL fNodeIdInList;
682 	unsigned int uiByteOffset;
683 	BYTE bBitOffset;
684 	BYTE bNodeListByte;
685 
686 	// get byte-offset of the own nodeid in NodeIdList
687 	// devide though 8
688 	uiByteOffset = (unsigned int)(EplNmtCnuInstance_g.m_uiNodeId >> 3);
689 	// get bitoffset
690 	bBitOffset = (BYTE) EplNmtCnuInstance_g.m_uiNodeId % 8;
691 
692 	bNodeListByte = AmiGetByteFromLe(&pbNmtCommandDate_p[uiByteOffset]);
693 	if ((bNodeListByte & bBitOffset) == 0) {
694 		fNodeIdInList = FALSE;
695 	} else {
696 		fNodeIdInList = TRUE;
697 	}
698 
699 	return fNodeIdInList;
700 }
701 
702 #endif // #if(((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_CN)) != 0)
703 
704 // EOF
705