AlwaysOncycle.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef ALWAYSONCYCLE_H_
  2. #define ALWAYSONCYCLE_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'AlwaysOncycle'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. AlwaysOncycle_main_region_StateA,
  13. AlwaysOncycle_main_region_StateB,
  14. AlwaysOncycle_last_state
  15. } AlwaysOncycleStates;
  16. /*! Type definition of the data structure for the AlwaysOncycleIface interface scope. */
  17. typedef struct
  18. {
  19. sc_integer value;
  20. sc_boolean v2;
  21. } AlwaysOncycleIface;
  22. /*! Define dimension of the state configuration vector for orthogonal states. */
  23. #define ALWAYSONCYCLE_MAX_ORTHOGONAL_STATES 1
  24. /*!
  25. * Type definition of the data structure for the AlwaysOncycle state machine.
  26. * This data structure has to be allocated by the client code.
  27. */
  28. typedef struct
  29. {
  30. AlwaysOncycleStates stateConfVector[ALWAYSONCYCLE_MAX_ORTHOGONAL_STATES];
  31. sc_ushort stateConfVectorPosition;
  32. AlwaysOncycleIface iface;
  33. } AlwaysOncycle;
  34. /*! Initializes the AlwaysOncycle state machine data structures. Must be called before first usage.*/
  35. extern void alwaysOncycle_init(AlwaysOncycle* handle);
  36. /*! Activates the state machine */
  37. extern void alwaysOncycle_enter(AlwaysOncycle* handle);
  38. /*! Deactivates the state machine */
  39. extern void alwaysOncycle_exit(AlwaysOncycle* handle);
  40. /*! Performs a 'run to completion' step. */
  41. extern void alwaysOncycle_runCycle(AlwaysOncycle* handle);
  42. /*! Gets the value of the variable 'value' that is defined in the default interface scope. */
  43. extern sc_integer alwaysOncycleIface_get_value(const AlwaysOncycle* handle);
  44. /*! Sets the value of the variable 'value' that is defined in the default interface scope. */
  45. extern void alwaysOncycleIface_set_value(AlwaysOncycle* handle, sc_integer value);
  46. /*! Gets the value of the variable 'v2' that is defined in the default interface scope. */
  47. extern sc_boolean alwaysOncycleIface_get_v2(const AlwaysOncycle* handle);
  48. /*! Sets the value of the variable 'v2' that is defined in the default interface scope. */
  49. extern void alwaysOncycleIface_set_v2(AlwaysOncycle* handle, sc_boolean value);
  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 alwaysOncycle_isActive(const AlwaysOncycle* 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 alwaysOncycle_isFinal(const AlwaysOncycle* 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 alwaysOncycle_isStateActive(const AlwaysOncycle* handle, AlwaysOncycleStates state);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* ALWAYSONCYCLE_H_ */