versadac  1
versadac - Scalable Recorder Firmware
mrp_protocolmachine.h
1 /***************************************************************************************
2  *********** Copyright 2005 Zurich University of Applied Sciences / InES **************
3  ***************************************************************************************
4  **
5  ** File : mrp_protocolmachine.h
6  **
7  ** Description : This file provides the MRP protocol machine
8  **
9  ***************************************************************************************
10  ** Department : Institute of Embedded Systems
11  ** Project : MRP
12  ** Modul : MRP_ProtocolMachine_T
13  ** Author : Christian Schaer
14  ** Contact : scc@zhwin.ch
15  ** Date : 10.04.2006
16  ****************************** Modifications ******************************************
17  **
18  ** Date : Who : Comment :
19  ** 10.05.06 scc initial release
20  **************************************************************************************/
21 /* $Workfile:: mrp_protocolmachine.h $*/
22 /* $Revision:: 2 $*/
23 /* $Date:: 16/12/10 14:44 $*/
24 
25 #ifndef MRP_PROTOCOLMACHINE_H
26 #define MRP_PROTOCOLMACHINE_H
27 
28 
29 /***********************************************************************/
30 /*** Header Files Includes ***/
31 /***********************************************************************/
32 
33 #include "mrp_pkg.h"
34 
35 
36 /***********************************************************************/
37 /*** Definitions ***/
38 /***********************************************************************/
39 
40 typedef enum MRPProtocolState
41 {
42  NOT_INITIALIZED,
43  POWER_ON, /* MRC and MRM */
44  AC_STAT1, /* MRC and MRM */
45  PRM_UP, /* MRM */
46  CHK_RO, /* MRM */
47  CHK_RC, /* MRM */
48  DE_IDLE, /* MRC */
49  PT, /* MRC */
50  DE, /* MRC */
51  PT_IDLE /* MRC */
52 } MRPProtocolState;
53 
54 #define NUMBER_OF_MRP_STATES 10
55 
56 
57 /**********************************************************************/
58 /*** class MRP_ProtocolMachine_T ***/
59 /**********************************************************************/
60 
62 {
63  MRP_Domain_T* mrp_domain_ptr_;
64  MRP_Environment_T* mrp_environment_ptr_; /* link MRP_Environment_T */
65  MRP_PDUFrames_T* mrp_pduframes_ptr_; /* link MRP_PDUFrames_T */
66 
67 
69  MRPProtocolState current_state_; /* Current state of protocol machine */
70  MRPRoleState real_role_state_;
71  UChar SA_Port1[6];
72  UChar SA_Port2[6];
73  Unsigned16 PRM_RPort;
74  Unsigned16 SEC_RPort;
75  Unsigned16 MRP_MRM_NRmax;
76  Unsigned16 MRP_MRM_NReturn;
77  MRPBoolean AddTest;
78  Unsigned16 TC_NReturn;
79  Unsigned16 MRP_LNKNReturn;
80 
82  Unsigned16 MRP_LNKdownT; /* Link Down Timer interval*/
83  Unsigned16 MRP_LNKupT; /* Link Up Timer interval*/
84  Unsigned16 MRP_LNKNRmax; /* Link Change (Up or Down) count*/
85  MRPBoolean blocked_state_supported_;
86 
87 };
88 
89 
90 /********************************************/
91 /*** Constructors and destructors ***/
92 /********************************************/
93 
94 void MRP_ProtocolMachine_T_Init( MRP_ProtocolMachine_T* const me,
95  MRP_Domain_T* const domain_ptr );
96 
97 void MRP_ProtocolMachine_T_Cleanup(MRP_ProtocolMachine_T* const me);
98 
99 
100 /********************************************/
101 /*** public Methods ***/
102 /********************************************/
103 
105 void MRP_ProtocolMachine_T_start( MRP_ProtocolMachine_T* const me );
106 
108 void MRP_ProtocolMachine_T_stop( MRP_ProtocolMachine_T* const me );
109 
111 void MRP_ProtocolMachine_T_run( MRP_ProtocolMachine_T* const me,
112  MRP_ProtocolEvent_T* event );
113 
114 
115 #endif
116 
117 
Definition: mrp_environment.h:44
MRPProtocolState current_state_
Definition: mrp_protocolmachine.h:69
Definition: mrp_pduframes.h:40
Definition: mrp_protocolmachine.h:61
Definition: mrp_domain.h:54
Definition: mrp_protocolevent.h:79
Unsigned16 MRP_LNKdownT
Definition: mrp_protocolmachine.h:94