TriggerGuardExpressions.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef TRIGGERGUARDEXPRESSIONS_H_
  2. #define TRIGGERGUARDEXPRESSIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'TriggerGuardExpressions'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. TriggerGuardExpressions_last_state,
  13. TriggerGuardExpressions_main_region_A,
  14. TriggerGuardExpressions_main_region_B
  15. } TriggerGuardExpressionsStates;
  16. /*! Type definition of the data structure for the TriggerGuardExpressionsIface interface scope. */
  17. typedef struct
  18. {
  19. sc_boolean e1_raised;
  20. sc_boolean e2_raised;
  21. sc_boolean b;
  22. } TriggerGuardExpressionsIface;
  23. /*! Define dimension of the state configuration vector for orthogonal states. */
  24. #define TRIGGERGUARDEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
  25. /*! Define indices of states in the StateConfVector */
  26. #define SCVI_TRIGGERGUARDEXPRESSIONS_MAIN_REGION_A 0
  27. #define SCVI_TRIGGERGUARDEXPRESSIONS_MAIN_REGION_B 0
  28. /*!
  29. * Type definition of the data structure for the TriggerGuardExpressions state machine.
  30. * This data structure has to be allocated by the client code.
  31. */
  32. typedef struct
  33. {
  34. TriggerGuardExpressionsStates stateConfVector[TRIGGERGUARDEXPRESSIONS_MAX_ORTHOGONAL_STATES];
  35. sc_ushort stateConfVectorPosition;
  36. TriggerGuardExpressionsIface iface;
  37. } TriggerGuardExpressions;
  38. /*! Initializes the TriggerGuardExpressions state machine data structures. Must be called before first usage.*/
  39. extern void triggerGuardExpressions_init(TriggerGuardExpressions* handle);
  40. /*! Activates the state machine */
  41. extern void triggerGuardExpressions_enter(TriggerGuardExpressions* handle);
  42. /*! Deactivates the state machine */
  43. extern void triggerGuardExpressions_exit(TriggerGuardExpressions* handle);
  44. /*! Performs a 'run to completion' step. */
  45. extern void triggerGuardExpressions_runCycle(TriggerGuardExpressions* handle);
  46. /*! Raises the in event 'e1' that is defined in the default interface scope. */
  47. extern void triggerGuardExpressionsIface_raise_e1(TriggerGuardExpressions* handle);
  48. /*! Raises the in event 'e2' that is defined in the default interface scope. */
  49. extern void triggerGuardExpressionsIface_raise_e2(TriggerGuardExpressions* handle);
  50. /*! Gets the value of the variable 'b' that is defined in the default interface scope. */
  51. extern sc_boolean triggerGuardExpressionsIface_get_b(const TriggerGuardExpressions* handle);
  52. /*! Sets the value of the variable 'b' that is defined in the default interface scope. */
  53. extern void triggerGuardExpressionsIface_set_b(TriggerGuardExpressions* handle, sc_boolean value);
  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 triggerGuardExpressions_isActive(const TriggerGuardExpressions* 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 triggerGuardExpressions_isFinal(const TriggerGuardExpressions* 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 triggerGuardExpressions_isStateActive(const TriggerGuardExpressions* handle, TriggerGuardExpressionsStates state);
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* TRIGGERGUARDEXPRESSIONS_H_ */