Operations.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef OPERATIONS_H_
  2. #define OPERATIONS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'Operations'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. Operations_main_region_B,
  13. Operations_main_region_C,
  14. Operations_main_region_D,
  15. Operations_main_region_A,
  16. Operations_last_state
  17. } OperationsStates;
  18. /*! Type definition of the data structure for the OperationsInternal interface scope. */
  19. typedef struct
  20. {
  21. sc_boolean myBool;
  22. } OperationsInternal;
  23. /*! Type definition of the data structure for the OperationsIface interface scope. */
  24. typedef struct
  25. {
  26. sc_boolean ev_raised;
  27. } OperationsIface;
  28. /*! Define dimension of the state configuration vector for orthogonal states. */
  29. #define OPERATIONS_MAX_ORTHOGONAL_STATES 1
  30. /*!
  31. * Type definition of the data structure for the Operations state machine.
  32. * This data structure has to be allocated by the client code.
  33. */
  34. typedef struct
  35. {
  36. OperationsStates stateConfVector[OPERATIONS_MAX_ORTHOGONAL_STATES];
  37. sc_ushort stateConfVectorPosition;
  38. OperationsInternal internal;
  39. OperationsIface iface;
  40. } Operations;
  41. /*! Initializes the Operations state machine data structures. Must be called before first usage.*/
  42. extern void operations_init(Operations* handle);
  43. /*! Activates the state machine */
  44. extern void operations_enter(Operations* handle);
  45. /*! Deactivates the state machine */
  46. extern void operations_exit(Operations* handle);
  47. /*! Performs a 'run to completion' step. */
  48. extern void operations_runCycle(Operations* handle);
  49. /*! Raises the in event 'ev' that is defined in the default interface scope. */
  50. extern void operationsIface_raise_ev(Operations* 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 operations_isActive(const Operations* 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 operations_isFinal(const Operations* 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 operations_isStateActive(const Operations* handle, OperationsStates state);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif /* OPERATIONS_H_ */