TimedTransitions.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef TIMEDTRANSITIONS_H_
  2. #define TIMEDTRANSITIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'TimedTransitions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. TimedTransitions_last_state,
  13. TimedTransitions_main_region_Start,
  14. TimedTransitions_main_region_End
  15. } TimedTransitionsStates;
  16. /*! Type definition of the data structure for the TimedTransitionsInternal interface scope. */
  17. typedef struct
  18. {
  19. sc_integer x;
  20. sc_integer y;
  21. } TimedTransitionsInternal;
  22. /*! Type definition of the data structure for the TimedTransitionsTimeEvents interface scope. */
  23. typedef struct
  24. {
  25. sc_boolean timedTransitions_main_region_Start_tev0_raised;
  26. sc_boolean timedTransitions_tev0_raised;
  27. } TimedTransitionsTimeEvents;
  28. /*! Define dimension of the state configuration vector for orthogonal states. */
  29. #define TIMEDTRANSITIONS_MAX_ORTHOGONAL_STATES 1
  30. /*! Define indices of states in the StateConfVector */
  31. #define SCVI_TIMEDTRANSITIONS_MAIN_REGION_START 0
  32. #define SCVI_TIMEDTRANSITIONS_MAIN_REGION_END 0
  33. /*!
  34. * Type definition of the data structure for the TimedTransitions state machine.
  35. * This data structure has to be allocated by the client code.
  36. */
  37. typedef struct
  38. {
  39. TimedTransitionsStates stateConfVector[TIMEDTRANSITIONS_MAX_ORTHOGONAL_STATES];
  40. sc_ushort stateConfVectorPosition;
  41. TimedTransitionsInternal internal;
  42. TimedTransitionsTimeEvents timeEvents;
  43. } TimedTransitions;
  44. /*! Initializes the TimedTransitions state machine data structures. Must be called before first usage.*/
  45. extern void timedTransitions_init(TimedTransitions* handle);
  46. /*! Activates the state machine */
  47. extern void timedTransitions_enter(TimedTransitions* handle);
  48. /*! Deactivates the state machine */
  49. extern void timedTransitions_exit(TimedTransitions* handle);
  50. /*! Performs a 'run to completion' step. */
  51. extern void timedTransitions_runCycle(TimedTransitions* handle);
  52. /*! Raises a time event. */
  53. extern void timedTransitions_raiseTimeEvent(const TimedTransitions* handle, sc_eventid evid);
  54. /*!
  55. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  56. * 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.
  57. */
  58. extern sc_boolean timedTransitions_isActive(const TimedTransitions* handle);
  59. /*!
  60. * Checks if all active states are final.
  61. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  62. */
  63. extern sc_boolean timedTransitions_isFinal(const TimedTransitions* handle);
  64. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  65. extern sc_boolean timedTransitions_isStateActive(const TimedTransitions* handle, TimedTransitionsStates state);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* TIMEDTRANSITIONS_H_ */