DeepHistory.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #ifndef DEEPHISTORY_H_
  2. #define DEEPHISTORY_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'DeepHistory'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. DeepHistory_last_state,
  13. DeepHistory_mainRegion_State1,
  14. DeepHistory_mainRegion_State2,
  15. DeepHistory_mainRegion_State2__region0_a,
  16. DeepHistory_mainRegion_State2__region0_State4,
  17. DeepHistory_mainRegion_State2__region0_State4__region0_State6,
  18. DeepHistory_mainRegion_State2__region0_State4__region0_State7,
  19. DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8,
  20. DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9,
  21. DeepHistory_mainRegion_State2__region0_State5
  22. } DeepHistoryStates;
  23. /*! Type definition of the data structure for the DeepHistoryIface interface scope. */
  24. typedef struct
  25. {
  26. sc_boolean event1_raised;
  27. sc_boolean event2_raised;
  28. sc_boolean event3_raised;
  29. sc_boolean event4_raised;
  30. sc_boolean event5_raised;
  31. sc_boolean event6_raised;
  32. sc_boolean event7_raised;
  33. sc_boolean event8_raised;
  34. sc_boolean event9_raised;
  35. } DeepHistoryIface;
  36. /*! Define dimension of the state configuration vector for orthogonal states. */
  37. #define DEEPHISTORY_MAX_ORTHOGONAL_STATES 1
  38. /*! Define dimension of the state configuration vector for history states. */
  39. #define DEEPHISTORY_MAX_HISTORY_STATES 3
  40. /*! Define indices of states in the StateConfVector */
  41. #define SCVI_DEEPHISTORY_MAINREGION_STATE1 0
  42. #define SCVI_DEEPHISTORY_MAINREGION_STATE2 0
  43. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_A 0
  44. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4 0
  45. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE6 0
  46. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7 0
  47. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE8 0
  48. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE9 0
  49. #define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE5 0
  50. /*!
  51. * Type definition of the data structure for the DeepHistory state machine.
  52. * This data structure has to be allocated by the client code.
  53. */
  54. typedef struct
  55. {
  56. DeepHistoryStates stateConfVector[DEEPHISTORY_MAX_ORTHOGONAL_STATES];
  57. DeepHistoryStates historyVector[DEEPHISTORY_MAX_HISTORY_STATES];
  58. sc_ushort stateConfVectorPosition;
  59. DeepHistoryIface iface;
  60. } DeepHistory;
  61. /*! Initializes the DeepHistory state machine data structures. Must be called before first usage.*/
  62. extern void deepHistory_init(DeepHistory* handle);
  63. /*! Activates the state machine */
  64. extern void deepHistory_enter(DeepHistory* handle);
  65. /*! Deactivates the state machine */
  66. extern void deepHistory_exit(DeepHistory* handle);
  67. /*! Performs a 'run to completion' step. */
  68. extern void deepHistory_runCycle(DeepHistory* handle);
  69. /*! Raises the in event 'event1' that is defined in the default interface scope. */
  70. extern void deepHistoryIface_raise_event1(DeepHistory* handle);
  71. /*! Raises the in event 'event2' that is defined in the default interface scope. */
  72. extern void deepHistoryIface_raise_event2(DeepHistory* handle);
  73. /*! Raises the in event 'event3' that is defined in the default interface scope. */
  74. extern void deepHistoryIface_raise_event3(DeepHistory* handle);
  75. /*! Raises the in event 'event4' that is defined in the default interface scope. */
  76. extern void deepHistoryIface_raise_event4(DeepHistory* handle);
  77. /*! Raises the in event 'event5' that is defined in the default interface scope. */
  78. extern void deepHistoryIface_raise_event5(DeepHistory* handle);
  79. /*! Raises the in event 'event6' that is defined in the default interface scope. */
  80. extern void deepHistoryIface_raise_event6(DeepHistory* handle);
  81. /*! Raises the in event 'event7' that is defined in the default interface scope. */
  82. extern void deepHistoryIface_raise_event7(DeepHistory* handle);
  83. /*! Raises the in event 'event8' that is defined in the default interface scope. */
  84. extern void deepHistoryIface_raise_event8(DeepHistory* handle);
  85. /*! Raises the in event 'event9' that is defined in the default interface scope. */
  86. extern void deepHistoryIface_raise_event9(DeepHistory* handle);
  87. /*!
  88. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  89. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  90. */
  91. extern sc_boolean deepHistory_isActive(const DeepHistory* handle);
  92. /*!
  93. * Checks if all active states are final.
  94. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  95. */
  96. extern sc_boolean deepHistory_isFinal(const DeepHistory* handle);
  97. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  98. extern sc_boolean deepHistory_isStateActive(const DeepHistory* handle, DeepHistoryStates state);
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102. #endif /* DEEPHISTORY_H_ */