PriorityValues.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef PRIORITYVALUES_H_
  2. #define PRIORITYVALUES_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'PriorityValues'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. PriorityValues_someRegion_A,
  13. PriorityValues_someRegion_B,
  14. PriorityValues_main_region_A,
  15. PriorityValues_main_region_B,
  16. PriorityValues_main_region_C,
  17. PriorityValues_main_region_D,
  18. PriorityValues_main_region_E,
  19. PriorityValues_last_state
  20. } PriorityValuesStates;
  21. /*! Type definition of the data structure for the PriorityValuesIface interface scope. */
  22. typedef struct
  23. {
  24. sc_boolean event1_raised;
  25. sc_boolean event2_raised;
  26. } PriorityValuesIface;
  27. /*! Define dimension of the state configuration vector for orthogonal states. */
  28. #define PRIORITYVALUES_MAX_ORTHOGONAL_STATES 2
  29. /*!
  30. * Type definition of the data structure for the PriorityValues state machine.
  31. * This data structure has to be allocated by the client code.
  32. */
  33. typedef struct
  34. {
  35. PriorityValuesStates stateConfVector[PRIORITYVALUES_MAX_ORTHOGONAL_STATES];
  36. sc_ushort stateConfVectorPosition;
  37. PriorityValuesIface iface;
  38. } PriorityValues;
  39. /*! Initializes the PriorityValues state machine data structures. Must be called before first usage.*/
  40. extern void priorityValues_init(PriorityValues* handle);
  41. /*! Activates the state machine */
  42. extern void priorityValues_enter(PriorityValues* handle);
  43. /*! Deactivates the state machine */
  44. extern void priorityValues_exit(PriorityValues* handle);
  45. /*! Performs a 'run to completion' step. */
  46. extern void priorityValues_runCycle(PriorityValues* handle);
  47. /*! Raises the in event 'event1' that is defined in the default interface scope. */
  48. extern void priorityValuesIface_raise_event1(PriorityValues* handle);
  49. /*! Raises the in event 'event2' that is defined in the default interface scope. */
  50. extern void priorityValuesIface_raise_event2(PriorityValues* handle);
  51. /*!
  52. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  53. * 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.
  54. */
  55. extern sc_boolean priorityValues_isActive(const PriorityValues* handle);
  56. /*!
  57. * Checks if all active states are final.
  58. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  59. */
  60. extern sc_boolean priorityValues_isFinal(const PriorityValues* handle);
  61. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  62. extern sc_boolean priorityValues_isStateActive(const PriorityValues* handle, PriorityValuesStates state);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* PRIORITYVALUES_H_ */