/*
 * (c) Peter Mueller, 2008
 *
 * All rights reserved. Reproduction, modification,
 * use or disclosure to third parties without express
 * authority is forbidden.
 */

/* Command line options: -v -c -Trace -p ssc -o equivalent equivalent_sc.xml   */
/* This file is generated from equivalent_sc.xml - do not edit manually*/
/* Generated on: Sat Oct 28 20:04:43 CEST 2023 / Version 6.1.3706 */


#ifndef EQUIVALENT_H
#define EQUIVALENT_H


/* Header to define simple data types. See 'AdditionalMachineInclude' */
#include <stdint.h>
#include <stdbool.h>

/* State definitions */
typedef enum{
	Active,
	Error12,
	Error3,
	FromActiveWait,
	Idle,
	Init,
	SafetyOutEnabled,
	WaitChannelA,
	WaitChannelB,
	__EQUIVALENT_LAST_STATE__} EQUIVALENT_STATES_T;






/* Predefined types required by the codegen. You can provide your own  */
/* definitions by setting the following define somewhere in your built env. */
#ifndef PROVIDE_OWN_EQUIVALENT_STATEMACHINE_TYPES
	typedef uint8_t EQUIVALENT_ENTRY_FLAG_T;
	typedef EQUIVALENT_STATES_T EQUIVALENT_STATEVAR_T;
	typedef uint8_t EQUIVALENT_INST_ID_T;
	typedef uint8_t EQUIVALENT_EV_CONSUMED_FLAG_T ;
#endif

/* Instance data definition of state machine */
typedef struct {
	EQUIVALENT_ENTRY_FLAG_T idleEntry;
	EQUIVALENT_STATEVAR_T stateVar;
	EQUIVALENT_STATEVAR_T stateVarActive;

	/* Start of user defined attributes */
	/* End of user defined attributes */

	EQUIVALENT_INST_ID_T inst_id;
} EQUIVALENT_INSTANCEDATA_T ;

/* Helper to initialize the machine's instance data */
#define EQUIVALENT_INSTANCEDATA_INIT {\
	1,\
	(EQUIVALENT_STATEVAR_T) Idle /* set init state of top state */,\
	(EQUIVALENT_STATEVAR_T) Init /* set init state of Active */,\
	0 /* instance id */ } 



/* Init function of the state machine. Must be called once before using any other function. */
void equivalentInitMachine(EQUIVALENT_INSTANCEDATA_T * const instanceVar, EQUIVALENT_INST_ID_T instId);

/* Helper(s) to reset history */
#define EQUIVALENT_RESET_HISTORY_ACTIVE(instance) ((&(instance))->stateVarActive=Init)

/* Prototype of the state machine function */
void  equivalent(EQUIVALENT_INSTANCEDATA_T *instanceVar);


/* Prototoye of the reset machine function */
void equivalentResetMachine(EQUIVALENT_INSTANCEDATA_T * const instanceVar);

/* Helper(s) to reset history */
void equivalentResetHistoryActive(EQUIVALENT_INSTANCEDATA_T * const instanceVar);

/* Helper(s) to find out if the machine is in a certain state*/
uint8_t equivalentIsInActive(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInError12(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInError3(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInFromActiveWait(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInIdle(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInInit(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInSafetyOutEnabled(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInWaitChannelA(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);
uint8_t equivalentIsInWaitChannelB(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);


/* Macros to test if the machine is in a certain state. */
#define EQUIVALENT_IS_IN_ACTIVE(instance)((((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_ERROR12(instance)((((&instance)->stateVarActive==Error12)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_ERROR3(instance)((((&instance)->stateVarActive==Error3)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_FROMACTIVEWAIT(instance)((((&instance)->stateVarActive==FromActiveWait)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_IDLE(instance)((((&instance)->stateVar==Idle)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_INIT(instance)((((&instance)->stateVarActive==Init)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_SAFETYOUTENABLED(instance)((((&instance)->stateVarActive==SafetyOutEnabled)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_WAITCHANNELA(instance)((((&instance)->stateVarActive==WaitChannelA)&&((&instance)->stateVar==Active)) ? (1U) : (0U))
#define EQUIVALENT_IS_IN_WAITCHANNELB(instance)((((&instance)->stateVarActive==WaitChannelB)&&((&instance)->stateVar==Active)) ? (1U) : (0U))


/* Helper returning the innermost active state.*/
EQUIVALENT_STATES_T equivalentGetInnermostActiveState(const EQUIVALENT_INSTANCEDATA_T * const instanceVar);


#endif
