DeepEntry.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef DEEPENTRY_H_
  2. #define DEEPENTRY_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'DeepEntry'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. DeepEntry_last_state,
  13. DeepEntry_r_A,
  14. DeepEntry_r_A_r_B,
  15. DeepEntry_r2_B,
  16. DeepEntry_r2_B_r_BA,
  17. DeepEntry_r2_B_r_BA_r_BAA,
  18. DeepEntry_r2_B_r_BB,
  19. DeepEntry_r2_C,
  20. DeepEntry_r3_D,
  21. DeepEntry_r3_D_r_DA,
  22. DeepEntry_r3_D_r_DA_r_DAA
  23. } DeepEntryStates;
  24. /*! Type definition of the data structure for the DeepEntryIface interface scope. */
  25. typedef struct
  26. {
  27. sc_integer x;
  28. sc_integer y;
  29. sc_integer z;
  30. sc_boolean e_raised;
  31. sc_boolean f_raised;
  32. } DeepEntryIface;
  33. /*! Define dimension of the state configuration vector for orthogonal states. */
  34. #define DEEPENTRY_MAX_ORTHOGONAL_STATES 3
  35. /*! Define dimension of the state configuration vector for history states. */
  36. #define DEEPENTRY_MAX_HISTORY_STATES 4
  37. /*! Define indices of states in the StateConfVector */
  38. #define SCVI_DEEPENTRY_R_A 0
  39. #define SCVI_DEEPENTRY_R_A_R_B 0
  40. #define SCVI_DEEPENTRY_R2_B 1
  41. #define SCVI_DEEPENTRY_R2_B_R_BA 1
  42. #define SCVI_DEEPENTRY_R2_B_R_BA_R_BAA 1
  43. #define SCVI_DEEPENTRY_R2_B_R_BB 1
  44. #define SCVI_DEEPENTRY_R2_C 1
  45. #define SCVI_DEEPENTRY_R3_D 2
  46. #define SCVI_DEEPENTRY_R3_D_R_DA 2
  47. #define SCVI_DEEPENTRY_R3_D_R_DA_R_DAA 2
  48. /*!
  49. * Type definition of the data structure for the DeepEntry state machine.
  50. * This data structure has to be allocated by the client code.
  51. */
  52. typedef struct
  53. {
  54. DeepEntryStates stateConfVector[DEEPENTRY_MAX_ORTHOGONAL_STATES];
  55. DeepEntryStates historyVector[DEEPENTRY_MAX_HISTORY_STATES];
  56. sc_ushort stateConfVectorPosition;
  57. DeepEntryIface iface;
  58. } DeepEntry;
  59. /*! Initializes the DeepEntry state machine data structures. Must be called before first usage.*/
  60. extern void deepEntry_init(DeepEntry* handle);
  61. /*! Activates the state machine */
  62. extern void deepEntry_enter(DeepEntry* handle);
  63. /*! Deactivates the state machine */
  64. extern void deepEntry_exit(DeepEntry* handle);
  65. /*! Performs a 'run to completion' step. */
  66. extern void deepEntry_runCycle(DeepEntry* handle);
  67. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  68. extern sc_integer deepEntryIface_get_x(const DeepEntry* handle);
  69. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  70. extern void deepEntryIface_set_x(DeepEntry* handle, sc_integer value);
  71. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  72. extern sc_integer deepEntryIface_get_y(const DeepEntry* handle);
  73. /*! Sets the value of the variable 'y' that is defined in the default interface scope. */
  74. extern void deepEntryIface_set_y(DeepEntry* handle, sc_integer value);
  75. /*! Gets the value of the variable 'z' that is defined in the default interface scope. */
  76. extern sc_integer deepEntryIface_get_z(const DeepEntry* handle);
  77. /*! Sets the value of the variable 'z' that is defined in the default interface scope. */
  78. extern void deepEntryIface_set_z(DeepEntry* handle, sc_integer value);
  79. /*! Raises the in event 'e' that is defined in the default interface scope. */
  80. extern void deepEntryIface_raise_e(DeepEntry* handle);
  81. /*! Raises the in event 'f' that is defined in the default interface scope. */
  82. extern void deepEntryIface_raise_f(DeepEntry* handle);
  83. /*!
  84. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  85. * 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.
  86. */
  87. extern sc_boolean deepEntry_isActive(const DeepEntry* handle);
  88. /*!
  89. * Checks if all active states are final.
  90. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  91. */
  92. extern sc_boolean deepEntry_isFinal(const DeepEntry* handle);
  93. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  94. extern sc_boolean deepEntry_isStateActive(const DeepEntry* handle, DeepEntryStates state);
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* DEEPENTRY_H_ */