DeepHistory.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_mainRegion_State1,
  13. DeepHistory_mainRegion_State2,
  14. DeepHistory_mainRegion_State2__region0_a,
  15. DeepHistory_mainRegion_State2__region0_State4,
  16. DeepHistory_mainRegion_State2__region0_State4__region0_State6,
  17. DeepHistory_mainRegion_State2__region0_State4__region0_State7,
  18. DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8,
  19. DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9,
  20. DeepHistory_mainRegion_State2__region0_State5,
  21. DeepHistory_last_state
  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. /*!
  41. * Type definition of the data structure for the DeepHistory state machine.
  42. * This data structure has to be allocated by the client code.
  43. */
  44. typedef struct
  45. {
  46. DeepHistoryStates stateConfVector[DEEPHISTORY_MAX_ORTHOGONAL_STATES];
  47. DeepHistoryStates historyVector[DEEPHISTORY_MAX_HISTORY_STATES];
  48. sc_ushort stateConfVectorPosition;
  49. DeepHistoryIface iface;
  50. } DeepHistory;
  51. /*! Initializes the DeepHistory state machine data structures. Must be called before first usage.*/
  52. extern void deepHistory_init(DeepHistory* handle);
  53. /*! Activates the state machine */
  54. extern void deepHistory_enter(DeepHistory* handle);
  55. /*! Deactivates the state machine */
  56. extern void deepHistory_exit(DeepHistory* handle);
  57. /*! Performs a 'run to completion' step. */
  58. extern void deepHistory_runCycle(DeepHistory* handle);
  59. /*! Raises the in event 'event1' that is defined in the default interface scope. */
  60. extern void deepHistoryIface_raise_event1(DeepHistory* handle);
  61. /*! Raises the in event 'event2' that is defined in the default interface scope. */
  62. extern void deepHistoryIface_raise_event2(DeepHistory* handle);
  63. /*! Raises the in event 'event3' that is defined in the default interface scope. */
  64. extern void deepHistoryIface_raise_event3(DeepHistory* handle);
  65. /*! Raises the in event 'event4' that is defined in the default interface scope. */
  66. extern void deepHistoryIface_raise_event4(DeepHistory* handle);
  67. /*! Raises the in event 'event5' that is defined in the default interface scope. */
  68. extern void deepHistoryIface_raise_event5(DeepHistory* handle);
  69. /*! Raises the in event 'event6' that is defined in the default interface scope. */
  70. extern void deepHistoryIface_raise_event6(DeepHistory* handle);
  71. /*! Raises the in event 'event7' that is defined in the default interface scope. */
  72. extern void deepHistoryIface_raise_event7(DeepHistory* handle);
  73. /*! Raises the in event 'event8' that is defined in the default interface scope. */
  74. extern void deepHistoryIface_raise_event8(DeepHistory* handle);
  75. /*! Raises the in event 'event9' that is defined in the default interface scope. */
  76. extern void deepHistoryIface_raise_event9(DeepHistory* handle);
  77. /*!
  78. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  79. * 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.
  80. */
  81. extern sc_boolean deepHistory_isActive(const DeepHistory* handle);
  82. /*!
  83. * Checks if all active states are final.
  84. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  85. */
  86. extern sc_boolean deepHistory_isFinal(const DeepHistory* handle);
  87. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  88. extern sc_boolean deepHistory_isStateActive(const DeepHistory* handle, DeepHistoryStates state);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif /* DEEPHISTORY_H_ */