StateIsActive.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef STATEISACTIVE_H_
  2. #define STATEISACTIVE_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'StateIsActive'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. StateIsActive_last_state,
  13. StateIsActive_R1_R1A,
  14. StateIsActive_R1_R1B,
  15. StateIsActive_R2_R2A,
  16. StateIsActive_R2_R2B
  17. } StateIsActiveStates;
  18. /*! Type definition of the data structure for the StateIsActiveIface interface scope. */
  19. typedef struct
  20. {
  21. sc_boolean Event1_raised;
  22. } StateIsActiveIface;
  23. /*! Define dimension of the state configuration vector for orthogonal states. */
  24. #define STATEISACTIVE_MAX_ORTHOGONAL_STATES 2
  25. /*! Define indices of states in the StateConfVector */
  26. #define SCVI_STATEISACTIVE_R1_R1A 0
  27. #define SCVI_STATEISACTIVE_R1_R1B 0
  28. #define SCVI_STATEISACTIVE_R2_R2A 1
  29. #define SCVI_STATEISACTIVE_R2_R2B 1
  30. /*!
  31. * Type definition of the data structure for the StateIsActive state machine.
  32. * This data structure has to be allocated by the client code.
  33. */
  34. typedef struct
  35. {
  36. StateIsActiveStates stateConfVector[STATEISACTIVE_MAX_ORTHOGONAL_STATES];
  37. sc_ushort stateConfVectorPosition;
  38. StateIsActiveIface iface;
  39. } StateIsActive;
  40. /*! Initializes the StateIsActive state machine data structures. Must be called before first usage.*/
  41. extern void stateIsActive_init(StateIsActive* handle);
  42. /*! Activates the state machine */
  43. extern void stateIsActive_enter(StateIsActive* handle);
  44. /*! Deactivates the state machine */
  45. extern void stateIsActive_exit(StateIsActive* handle);
  46. /*! Performs a 'run to completion' step. */
  47. extern void stateIsActive_runCycle(StateIsActive* handle);
  48. /*! Raises the in event 'Event1' that is defined in the default interface scope. */
  49. extern void stateIsActiveIface_raise_event1(StateIsActive* handle);
  50. /*!
  51. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  52. * 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.
  53. */
  54. extern sc_boolean stateIsActive_isActive(const StateIsActive* handle);
  55. /*!
  56. * Checks if all active states are final.
  57. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  58. */
  59. extern sc_boolean stateIsActive_isFinal(const StateIsActive* handle);
  60. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  61. extern sc_boolean stateIsActive_isStateActive(const StateIsActive* handle, StateIsActiveStates state);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* STATEISACTIVE_H_ */