Operations.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_last_state,
  13. Operations_main_region_B,
  14. Operations_main_region_C,
  15. Operations_main_region_D,
  16. Operations_main_region_A
  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. /*! Define indices of states in the StateConfVector */
  31. #define SCVI_OPERATIONS_MAIN_REGION_B 0
  32. #define SCVI_OPERATIONS_MAIN_REGION_C 0
  33. #define SCVI_OPERATIONS_MAIN_REGION_D 0
  34. #define SCVI_OPERATIONS_MAIN_REGION_A 0
  35. /*!
  36. * Type definition of the data structure for the Operations state machine.
  37. * This data structure has to be allocated by the client code.
  38. */
  39. typedef struct
  40. {
  41. OperationsStates stateConfVector[OPERATIONS_MAX_ORTHOGONAL_STATES];
  42. sc_ushort stateConfVectorPosition;
  43. OperationsInternal internal;
  44. OperationsIface iface;
  45. } Operations;
  46. /*! Initializes the Operations state machine data structures. Must be called before first usage.*/
  47. extern void operations_init(Operations* handle);
  48. /*! Activates the state machine */
  49. extern void operations_enter(Operations* handle);
  50. /*! Deactivates the state machine */
  51. extern void operations_exit(Operations* handle);
  52. /*! Performs a 'run to completion' step. */
  53. extern void operations_runCycle(Operations* handle);
  54. /*! Raises the in event 'ev' that is defined in the default interface scope. */
  55. extern void operationsIface_raise_ev(Operations* handle);
  56. /*!
  57. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  58. * 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.
  59. */
  60. extern sc_boolean operations_isActive(const Operations* handle);
  61. /*!
  62. * Checks if all active states are final.
  63. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  64. */
  65. extern sc_boolean operations_isFinal(const Operations* handle);
  66. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  67. extern sc_boolean operations_isStateActive(const Operations* handle, OperationsStates state);
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif /* OPERATIONS_H_ */