DeepEntry.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_r_A,
  13. DeepEntry_r_A_r_B,
  14. DeepEntry_r2_B,
  15. DeepEntry_r2_B_r_BA,
  16. DeepEntry_r2_B_r_BA_r_BAA,
  17. DeepEntry_r2_B_r_BB,
  18. DeepEntry_r2_C,
  19. DeepEntry_r3_D,
  20. DeepEntry_r3_D_r_DA,
  21. DeepEntry_r3_D_r_DA_r_DAA,
  22. DeepEntry_last_state
  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. /*!
  38. * Type definition of the data structure for the DeepEntry state machine.
  39. * This data structure has to be allocated by the client code.
  40. */
  41. typedef struct
  42. {
  43. DeepEntryStates stateConfVector[DEEPENTRY_MAX_ORTHOGONAL_STATES];
  44. DeepEntryStates historyVector[DEEPENTRY_MAX_HISTORY_STATES];
  45. sc_ushort stateConfVectorPosition;
  46. DeepEntryIface iface;
  47. } DeepEntry;
  48. /*! Initializes the DeepEntry state machine data structures. Must be called before first usage.*/
  49. extern void deepEntry_init(DeepEntry* handle);
  50. /*! Activates the state machine */
  51. extern void deepEntry_enter(DeepEntry* handle);
  52. /*! Deactivates the state machine */
  53. extern void deepEntry_exit(DeepEntry* handle);
  54. /*! Performs a 'run to completion' step. */
  55. extern void deepEntry_runCycle(DeepEntry* handle);
  56. /*! Gets the value of the variable 'x' that is defined in the default interface scope. */
  57. extern sc_integer deepEntryIface_get_x(const DeepEntry* handle);
  58. /*! Sets the value of the variable 'x' that is defined in the default interface scope. */
  59. extern void deepEntryIface_set_x(DeepEntry* handle, sc_integer value);
  60. /*! Gets the value of the variable 'y' that is defined in the default interface scope. */
  61. extern sc_integer deepEntryIface_get_y(const DeepEntry* handle);
  62. /*! Sets the value of the variable 'y' that is defined in the default interface scope. */
  63. extern void deepEntryIface_set_y(DeepEntry* handle, sc_integer value);
  64. /*! Gets the value of the variable 'z' that is defined in the default interface scope. */
  65. extern sc_integer deepEntryIface_get_z(const DeepEntry* handle);
  66. /*! Sets the value of the variable 'z' that is defined in the default interface scope. */
  67. extern void deepEntryIface_set_z(DeepEntry* handle, sc_integer value);
  68. /*! Raises the in event 'e' that is defined in the default interface scope. */
  69. extern void deepEntryIface_raise_e(DeepEntry* handle);
  70. /*! Raises the in event 'f' that is defined in the default interface scope. */
  71. extern void deepEntryIface_raise_f(DeepEntry* handle);
  72. /*!
  73. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  74. * 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.
  75. */
  76. extern sc_boolean deepEntry_isActive(const DeepEntry* handle);
  77. /*!
  78. * Checks if all active states are final.
  79. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  80. */
  81. extern sc_boolean deepEntry_isFinal(const DeepEntry* handle);
  82. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  83. extern sc_boolean deepEntry_isStateActive(const DeepEntry* handle, DeepEntryStates state);
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif /* DEEPENTRY_H_ */