SyncJoin.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef SYNCJOIN_H_
  2. #define SYNCJOIN_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'SyncJoin'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. SyncJoin_main_region_A,
  13. SyncJoin_main_region_B,
  14. SyncJoin_main_region_B_r1_C1,
  15. SyncJoin_main_region_B_r1_C2,
  16. SyncJoin_main_region_B_r2_D1,
  17. SyncJoin_main_region_B_r2_D2,
  18. SyncJoin_last_state
  19. } SyncJoinStates;
  20. /*! Type definition of the data structure for the SyncJoinIface interface scope. */
  21. typedef struct
  22. {
  23. sc_boolean e_raised;
  24. sc_boolean f_raised;
  25. sc_boolean jc_raised;
  26. sc_boolean jd_raised;
  27. sc_integer x;
  28. } SyncJoinIface;
  29. /*! Define dimension of the state configuration vector for orthogonal states. */
  30. #define SYNCJOIN_MAX_ORTHOGONAL_STATES 2
  31. /*!
  32. * Type definition of the data structure for the SyncJoin state machine.
  33. * This data structure has to be allocated by the client code.
  34. */
  35. typedef struct
  36. {
  37. SyncJoinStates stateConfVector[SYNCJOIN_MAX_ORTHOGONAL_STATES];
  38. sc_ushort stateConfVectorPosition;
  39. SyncJoinIface iface;
  40. } SyncJoin;
  41. /*! Initializes the SyncJoin state machine data structures. Must be called before first usage.*/
  42. extern void syncJoin_init(SyncJoin* handle);
  43. /*! Activates the state machine */
  44. extern void syncJoin_enter(SyncJoin* handle);
  45. /*! Deactivates the state machine */
  46. extern void syncJoin_exit(SyncJoin* handle);
  47. /*! Performs a 'run to completion' step. */
  48. extern void syncJoin_runCycle(SyncJoin* handle);
  49. /*! Raises the in event 'e' that is defined in the default interface scope. */
  50. extern void syncJoinIface_raise_e(SyncJoin* handle);
  51. /*! Raises the in event 'f' that is defined in the default interface scope. */
  52. extern void syncJoinIface_raise_f(SyncJoin* handle);
  53. /*! Raises the in event 'jc' that is defined in the default interface scope. */
  54. extern void syncJoinIface_raise_jc(SyncJoin* handle);
  55. /*! Raises the in event 'jd' that is defined in the default interface scope. */
  56. extern void syncJoinIface_raise_jd(SyncJoin* handle);
  57. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  58. extern sc_integer syncJoinIface_get_x(const SyncJoin* handle);
  59. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  60. extern void syncJoinIface_set_x(SyncJoin* handle, sc_integer value);
  61. /*!
  62. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  63. * 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.
  64. */
  65. extern sc_boolean syncJoin_isActive(const SyncJoin* handle);
  66. /*!
  67. * Checks if all active states are final.
  68. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  69. */
  70. extern sc_boolean syncJoin_isFinal(const SyncJoin* handle);
  71. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  72. extern sc_boolean syncJoin_isStateActive(const SyncJoin* handle, SyncJoinStates state);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif /* SYNCJOIN_H_ */