TimeTrigger.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef TIMETRIGGER_H_
  2. #define TIMETRIGGER_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'TimeTrigger'.
  8. */
  9. //! enumeration of all states
  10. typedef enum {
  11. TimeTrigger_mainRegion_StateA ,
  12. TimeTrigger_mainRegion_StateB ,
  13. TimeTrigger_last_state
  14. } TimeTriggerStates;
  15. //! Type definition of the data structure for the TimeTriggerIface interface scope.
  16. typedef struct {
  17. sc_integer value;
  18. } TimeTriggerIface;
  19. //! Type definition of the data structure for the TimeTriggerTimeEvents interface scope.
  20. typedef struct {
  21. sc_boolean StateA_time_event_0_raised;
  22. sc_boolean StateB_time_event_0_raised;
  23. } TimeTriggerTimeEvents;
  24. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  25. #define TIMETRIGGER_MAX_ORTHOGONAL_STATES 1
  26. /*! Type definition of the data structure for the TimeTrigger state machine.
  27. This data structure has to be allocated by the client code. */
  28. typedef struct {
  29. TimeTriggerStates stateConfVector[TIMETRIGGER_MAX_ORTHOGONAL_STATES];
  30. sc_ushort stateConfVectorPosition;
  31. TimeTriggerIface iface;
  32. TimeTriggerTimeEvents timeEvents;
  33. } TimeTrigger;
  34. /*! Initializes the TimeTrigger state machine data structures. Must be called before first usage.*/
  35. extern void timeTrigger_init(TimeTrigger* handle);
  36. /*! Activates the state machine */
  37. extern void timeTrigger_enter(TimeTrigger* handle);
  38. /*! Deactivates the state machine */
  39. extern void timeTrigger_exit(TimeTrigger* handle);
  40. /*! Performs a 'run to completion' step. */
  41. extern void timeTrigger_runCycle(TimeTrigger* handle);
  42. /*! Raises a time event. */
  43. extern void timeTrigger_raiseTimeEvent(TimeTrigger* handle, sc_eventid evid);
  44. /*! Gets the value of the variable 'value' that is defined in the default interface scope. */
  45. extern sc_integer timeTriggerIface_get_value(TimeTrigger* handle);
  46. /*! Sets the value of the variable 'value' that is defined in the default interface scope. */
  47. extern void timeTriggerIface_set_value(TimeTrigger* handle, sc_integer value);
  48. /*! Checks if the specified state is active. */
  49. extern sc_boolean timeTrigger_isActive(TimeTrigger* handle, TimeTriggerStates state);
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53. #endif /* TIMETRIGGER_H_ */