ShallowHistory.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef SHALLOWHISTORY_H_
  2. #define SHALLOWHISTORY_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'ShallowHistory'.
  8. */
  9. //! enumeration of all states
  10. typedef enum {
  11. ShallowHistory_mainRegion_State1 ,
  12. ShallowHistory_mainRegion_State2 ,
  13. ShallowHistory_mainRegion_State2__region0_State3 ,
  14. ShallowHistory_mainRegion_State2__region0_State4 ,
  15. ShallowHistory_mainRegion_State2__region0_State4__region0_State6 ,
  16. ShallowHistory_mainRegion_State2__region0_State4__region0_State7 ,
  17. ShallowHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8 ,
  18. ShallowHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9 ,
  19. ShallowHistory_mainRegion_State2__region0_State5 ,
  20. ShallowHistory_last_state
  21. } ShallowHistoryStates;
  22. //! Type definition of the data structure for the ShallowHistoryIface interface scope.
  23. typedef struct {
  24. sc_boolean event1_raised;
  25. sc_boolean event2_raised;
  26. sc_boolean event3_raised;
  27. sc_boolean event4_raised;
  28. sc_boolean event5_raised;
  29. sc_boolean event6_raised;
  30. sc_boolean event7_raised;
  31. sc_boolean event8_raised;
  32. } ShallowHistoryIface;
  33. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  34. #define SHALLOWHISTORY_MAX_ORTHOGONAL_STATES 1
  35. //! dimension of the state configuration vector for history states
  36. #define SHALLOWHISTORY_MAX_HISTORY_STATES 2
  37. /*! Type definition of the data structure for the ShallowHistory state machine.
  38. This data structure has to be allocated by the client code. */
  39. typedef struct {
  40. ShallowHistoryStates stateConfVector[SHALLOWHISTORY_MAX_ORTHOGONAL_STATES];
  41. ShallowHistoryStates historyVector[SHALLOWHISTORY_MAX_HISTORY_STATES];
  42. sc_ushort stateConfVectorPosition;
  43. ShallowHistoryIface iface;
  44. } ShallowHistory;
  45. /*! Initializes the ShallowHistory state machine data structures. Must be called before first usage.*/
  46. extern void shallowHistory_init(ShallowHistory* handle);
  47. /*! Activates the state machine */
  48. extern void shallowHistory_enter(ShallowHistory* handle);
  49. /*! Deactivates the state machine */
  50. extern void shallowHistory_exit(ShallowHistory* handle);
  51. /*! Performs a 'run to completion' step. */
  52. extern void shallowHistory_runCycle(ShallowHistory* handle);
  53. /*! Raises the in event 'event1' that is defined in the default interface scope. */
  54. extern void shallowHistoryIface_raise_event1(ShallowHistory* handle);
  55. /*! Raises the in event 'event2' that is defined in the default interface scope. */
  56. extern void shallowHistoryIface_raise_event2(ShallowHistory* handle);
  57. /*! Raises the in event 'event3' that is defined in the default interface scope. */
  58. extern void shallowHistoryIface_raise_event3(ShallowHistory* handle);
  59. /*! Raises the in event 'event4' that is defined in the default interface scope. */
  60. extern void shallowHistoryIface_raise_event4(ShallowHistory* handle);
  61. /*! Raises the in event 'event5' that is defined in the default interface scope. */
  62. extern void shallowHistoryIface_raise_event5(ShallowHistory* handle);
  63. /*! Raises the in event 'event6' that is defined in the default interface scope. */
  64. extern void shallowHistoryIface_raise_event6(ShallowHistory* handle);
  65. /*! Raises the in event 'event7' that is defined in the default interface scope. */
  66. extern void shallowHistoryIface_raise_event7(ShallowHistory* handle);
  67. /*! Raises the in event 'event8' that is defined in the default interface scope. */
  68. extern void shallowHistoryIface_raise_event8(ShallowHistory* handle);
  69. /*! Checks if the specified state is active. */
  70. extern sc_boolean shallowHistory_isActive(ShallowHistory* handle, ShallowHistoryStates state);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #endif /* SHALLOWHISTORY_H_ */