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 
81 
83  MRPBoolean ReactMode;
84  Unsigned16 MRP_TOPchgT; /* Topology Change (Clear Address Table) request interval*/
85  Unsigned16 MRP_TOPNRmax; /* Topology Change (Clear Address Table) repeat count */
86  Unsigned16 MRP_TSTshortT; /* MRP_Test short interval*/
87  Unsigned16 MRP_TSTdefaultT; /* MRP_Test default interval */
88  Unsigned16 MRP_TSTNRmax; /* MRP_Test monitoring count */
89  Unsigned16 MRP_TSTExtNRmax; /* MRP_Test extended monitoring count*/
90  MRPBoolean blocked_supported_;
91 
92 
94  Unsigned16 MRP_LNKdownT; /* Link Down Timer interval*/
95  Unsigned16 MRP_LNKupT; /* Link Up Timer interval*/
96  Unsigned16 MRP_LNKNRmax; /* Link Change (Up or Down) count*/
97  MRPBoolean blocked_state_supported_;
98 
99 };
100 
101 
102 /********************************************/
103 /*** Constructors and destructors ***/
104 /********************************************/
105 
106 void MRP_ProtocolMachine_T_Init( MRP_ProtocolMachine_T* const me,
107  MRP_Domain_T* const domain_ptr );
108 
109 void MRP_ProtocolMachine_T_Cleanup(MRP_ProtocolMachine_T* const me);
110 
111 
112 /********************************************/
113 /*** public Methods ***/
114 /********************************************/
115 
117 void MRP_ProtocolMachine_T_start( MRP_ProtocolMachine_T* const me );
118 
120 void MRP_ProtocolMachine_T_stop( MRP_ProtocolMachine_T* const me );
121 
123 void MRP_ProtocolMachine_T_run( MRP_ProtocolMachine_T* const me,
124  MRP_ProtocolEvent_T* event );
125 
126 
127 #endif
128 
Definition: mrp_environment.h:44
MRPProtocolState current_state_
Definition: mrp_protocolmachine.h:69
Definition: mrp_pduframes.h:40
Definition: mrp_protocolmachine.h:61
MRPBoolean ReactMode
Definition: mrp_protocolmachine.h:83
Definition: mrp_domain.h:54
Definition: mrp_protocolevent.h:79
Unsigned16 MRP_LNKdownT
Definition: mrp_protocolmachine.h:94