123 static void assignExecCnt(
FwSmDesc_t smDesc) {
139 return (smData->
flag_1 == 1);
149 return (smData->
flag_2 == 1);
159 return (smData->
flag_3 == 1);
217 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
252 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
281 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
305 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
330 smDesc =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
383 actions[1] = &incrCnt1By1;
384 actions[2] = &incrCnt1By2;
385 actions[3] = &incrCnt1By4;
386 actions[4] = &incrCnt2By1;
390 guards[1] = &retFlag1;
391 guards[2] = &retFlag2;
451 smBase.pStates = pStates;
452 smBase.cStates = cStates;
453 smBase.trans = trans;
454 smBase.nOfPStates = 2;
455 smBase.nOfCStates = 1;
488 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
513 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
536 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
557 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
596 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
618 actions[1] = &incrCnt2By1;
631 smBase.cStates = NULL;
632 smBase.trans = trans;
633 smBase.nOfPStates = 0;
634 smBase.nOfCStates = 0;
661 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
688 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
713 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
741 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
801 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
832 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
863 p_sm =
FwSmCreate(nOfPStates, nOfCStates, nOfTrans, nOfActions, nOfGuards);
FwSmBool_t SmDummyGuard(FwSmDesc_t smDesc)
Dummy guard which always returns true.
FwSmCounterS1_t curState
the current state of the state machine
FwSmCounterS1_t outTransIndex
index of first out-going transition in transition array of SmBaseDesc_t
void FwSmAddTransStaToSta(FwSmDesc_t smDesc, FwSmCounterU2_t transId, FwSmCounterS1_t srcId, FwSmCounterS1_t destId, FwSmAction_t trAction, FwSmGuard_t trGuard)
Create a transition from a proper state to a proper state and add it to a state machine.
FwSmDesc_t FwSmMakeTestSM16_1(struct TestSmData *smData)
Operation to create and configure a state machine to verify the order of evaluation of guards...
#define FW_TR_EXECUTE
Identifier of "Execute" transition in a state machine.
void * FwSmGetData(FwSmDesc_t smDesc)
Get the pointer to the state machine data in the state machine descriptor.
FwSmCounterS1_t dest
the index of the destination of the transition
FwSmCounterS1_t nOfOutTrans
number of outgoing transitions from the choice pseudo-state
FwSmCounterS1_t iTrGuard
the index of the guard associated to the transition
#define LOG_ARRAY_SIZE
Size of the log arrays.
FwSmDesc_t FwSmMakeTestSM5(struct TestSmData *smData)
Operation to create and configure the state machine SM5.
#define TR1
A transition identifier.
Declaration of the dynamical creation interface for a FW State Machine.
void FwSmInit(FwSmDesc_t smDesc)
Initialize a state machine descriptor to represent an unconfigured state machine with no transitions...
Declaration of the execution interface for a FW State Machine.
FwSmCounterS1_t nOfActions
the number of actions (state actions + transition actions) in the state machine
#define CPS2
A choice pseudo-state identifier.
int flag_1
Flag checked by the transition guards.
FwSmDesc_t FwSmMakeTestSMDer1Static(FwSmDesc_t smDescBase, struct TestSmData *smData)
Create a derived state machine and override one of its actions and one of its guards.
Type for the state machine data for the test state machines.
FwSmAction_t * smActions
the state machine actions (state and transition actions)
FwSmCounterS1_t iDoAction
the do action for the state
FwSmDesc_t FwSmMakeTestSM12(struct TestSmData *smData)
Operation to create and configure a state machine where a transition has a choice pseudo-state as bot...
#define FW_SM_INST(SM_DESC, NS, NCPS, NTRANS, NA, NG)
Instantiate a state machine descriptor and its internal data structure.
FwSmCounterU3_t FwSmGetExecCnt(FwSmDesc_t smDesc)
Return the State Machine Execution Counter.
#define FW_SM_INST_DER(SM_DESC, NS, NA, NG)
Instantiate a descriptor for a derived state machine.
struct TestSmData * GetTestSmData(FwSmDesc_t smDesc)
Get the pointer to the state machine data of a test state machine.
FwSmCounterU3_t FwSmGetStateExecCnt(FwSmDesc_t smDesc)
Return the State Execution Counter.
int logBase
Offset for markers written to log array.
#define TR2
A transition identifier.
Declaration of the configuration interface for a FW State Machine.
int flag_2
Flag checked by the transition guards.
FwSmDesc_t FwSmCreate(FwSmCounterS1_t nOfStates, FwSmCounterS1_t nOfChoicePseudoStates, FwSmCounterS1_t nOfTrans, FwSmCounterS1_t nOfActions, FwSmCounterS1_t nOfGuards)
Create a new state machine descriptor.
void FwSmAddTransStaToCps(FwSmDesc_t smDesc, FwSmCounterU2_t transId, FwSmCounterS1_t srcId, FwSmCounterS1_t destId, FwSmAction_t trAction, FwSmGuard_t trGuard)
Create a transition from a proper state to a choice pseudo-state and add it to a state machine...
Declaration of functions to create and configure test state machines.
FwSmDesc_t FwSmMakeTestSM7(struct TestSmData *smData)
Operation to create and configure the state machine SM7.
#define STATE_S4
A state identifier.
int fwSm_logMarker[LOG_ARRAY_SIZE]
Log array where the actions of the test state machines write their markers.
int flag_3
Flag checked by the transition guards.
FwSmCounterU2_t id
the identifier (the "name") of the transition
void FwSmOverrideGuard(FwSmDesc_t smDesc, FwSmGuard_t oldGuard, FwSmGuard_t newGuard)
Override a guard in a derived state machine.
FwSmErrCode_t errCode
either 'success' or the code of the last error encountered by the state machine
#define FW_SM_INST_NOCPS(SM_DESC, NS, NTRANS, NA, NG)
Instantiate a state machine descriptor and its internal data structure.
FwSmDesc_t FwSmMakeTestSM6(struct TestSmData *smData, struct TestSmData *esmData)
Operation to create and configure the state machine SM6.
void FwSmInitDer(FwSmDesc_t smDesc, FwSmDesc_t smDescBase)
Initialize a state machine descriptor to extend another state machine (the base state machine)...
#define TR4
A transition identifier.
FwSmCounterS1_t outTransIndex
index of first out-going transition in the transition array of SmBaseDesc_t
void FwSmAddChoicePseudoState(FwSmDesc_t smDesc, FwSmCounterS1_t choiceId, FwSmCounterS1_t nOfOutTrans)
Create a choice pseudo-state with the given characteristics and add it to a state machine...
void FwSmOverrideAction(FwSmDesc_t smDesc, FwSmAction_t oldAction, FwSmAction_t newAction)
Override an action (either a state action or a transition action) in a derived state machine...
FwSmCounterS1_t transCnt
the counter for the number of transitions added to the state machine
struct FwSmDesc ** esmDesc
the state machines embedded in the state machine
FwSmDesc_t FwSmMakeTestSM1(struct TestSmData *smData)
Operation to create and configure the state machine SM1.
FwSmBool_t(* FwSmGuard_t)(FwSmDesc_t)
Type for a pointer to a state machine guard.
int FwSmBool_t
Type used for booleans (0 is "false" and 1 is "true").
FwSmDesc_t FwSmCreateDer(FwSmDesc_t smDesc)
Create the descriptor of a derived state machine.
FwSmCounterU3_t smExecCnt
the state machine execution counter
FwSmCounterS1_t nOfOutTrans
number of outgoing transitions
int fwSm_logIndex
Location in the log array where the next entry is written.
FwSmDesc_t FwSmMakeTestSM11(struct TestSmData *smData)
Operation to create and configure a degenerate state machine with neither states nor choice pseudo-st...
FwSmDesc_t FwSmMakeTestSM5Dir(struct TestSmData *smData)
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5 and figure below) by dir...
FwSmDesc_t FwSmMakeTestSMDer1(FwSmDesc_t smDescBase, struct TestSmData *smData)
Create a derived state machine and override one of its actions and one of its guards.
FwSmDesc_t FwSmMakeTestSM15(struct TestSmData *smData)
Operation to create and configure a state machine which uses the execution counters.
FwSmDesc_t FwSmMakeTestSM1Static(struct TestSmData *smData)
Operation to create and configure the state machine SM1 (see FwSmMakeTestSM1 and figure below) static...
void * smData
the pointer to the data manipulated by the state machine actions and guards
#define CPS1
A choice pseudo-state identifier.
void(* FwSmAction_t)(FwSmDesc_t)
Type for a pointer to a state machine action.
int fwSm_logState[LOG_ARRAY_SIZE]
Log array where the actions of the test state machines write the state of their state machine...
#define STATE_S2
A state identifier.
#define STATE_S1
A state identifier.
Structure representing a transition.
FwSmDesc_t FwSmMakeTestSM5Static(struct TestSmData *smData)
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5 and figure below) static...
Structure representing a state machine descriptor.
FwSmDesc_t FwSmMakeTestSM8(struct TestSmData *smData)
Operation to create and configure a degenerate state machine with no states.
FwSmDesc_t FwSmMakeTestSM10(struct TestSmData *smData, struct TestSmData *esmData)
Operation to create and configure the state machine SM10.
FwSmDesc_t FwSmMakeTestSM3(struct TestSmData *smData, struct TestSmData *esmData)
Operation to create and configure the state machine SM3.
void FwSmAddTransIpsToCps(FwSmDesc_t smDesc, FwSmCounterS1_t destId, FwSmAction_t trAction)
Create a transition from the initial pseudo-state to a choice pseudo-state and add it to a state mach...
void FwSmAddTransCpsToFps(FwSmDesc_t smDesc, FwSmCounterS1_t srcId, FwSmAction_t trAction, FwSmGuard_t trGuard)
Create a transition from a choice pseudo-state to the final pseudo-state and add it to a state machin...
FwSmCounterS1_t FwSmGetCurState(FwSmDesc_t smDesc)
Return the identifier of the current state in a state machine (or zero if the state machine is stoppe...
FwSmCounterU3_t stateExecCnt
the state execution counter
FwSmDesc_t FwSmMakeTestSM4(struct TestSmData *smData)
Operation to create and configure the state machine SM4.
FwSmDesc_t FwSmMakeTestSM14(struct TestSmData *smData)
Operation to create and configure a state machine where the choice pseudo-state is used both to split...
FwSmDesc_t FwSmMakeTestSM16_2(struct TestSmData *smData)
Operation to create and configure a state machine to verify the order of evaluation of guards...
void FwSmSetData(FwSmDesc_t smDesc, void *smData)
Set the pointer to the state machine data in the state machine descriptor.
void FwSmAddTransStaToFps(FwSmDesc_t smDesc, FwSmCounterU2_t transId, FwSmCounterS1_t srcId, FwSmAction_t trAction, FwSmGuard_t trGuard)
Create a transition from a proper state to the final pseudo-state and add it to a state machine...
#define TR_S1_FPS
A transition identifier.
FwSmDesc_t FwSmMakeTestSM16_3(struct TestSmData *smData)
Operation to create and configure a state machine to verify the order of evaluation of guards...
FwSmCounterS1_t iExitAction
the exit action for the state
FwSmCounterS1_t iTrAction
the index of the action associated to the transition
#define TR6
A transition identifier.
Structure representing the base descriptor of a state machine.
#define TR5
A transition identifier.
int counter_2
Counter incremented by the transition actions.
FwSmCounterS1_t nOfGuards
the number of guards in the state machine
#define STATE_S3
A state identifier.
FwSmDesc_t FwSmMakeTestSM9Static(struct TestSmData *smData)
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM9 and figure below) static...
FwSmGuard_t * smGuards
the transition guards in the state machine
void SmDummyAction(FwSmDesc_t smDesc)
Dummy action which returns without doing anything.
SmPState_t * pStates
array holding the proper states in the state machine
#define TR3
A transition identifier.
SmBaseDesc_t * smBase
pointer to the base descriptor
FwSmDesc_t FwSmMakeTestSM9(struct TestSmData *smData)
Operation to create and configure a degenerate state machine with no transitions other than the initi...
Structure representing a choice pseudo state in a state machine.
int counter_1
Counter incremented by the state actions.
void FwSmAddState(FwSmDesc_t smDesc, FwSmCounterS1_t stateId, FwSmCounterS1_t nOfOutTrans, FwSmAction_t entryAction, FwSmAction_t exitAction, FwSmAction_t doAction, FwSmDesc_t esmDesc)
Create a state with the given characteristics and add it to a state machine.
Declaration of the static creation interface for a FW State Machine.
Structure representing a proper state in state machine.
void FwSmAddTransIpsToSta(FwSmDesc_t smDesc, FwSmCounterS1_t destId, FwSmAction_t trAction)
Create a transition from the initial pseudo-state to a proper state and add it to a state machine...
void FwSmAddTransCpsToSta(FwSmDesc_t smDesc, FwSmCounterS1_t srcId, FwSmCounterS1_t destId, FwSmAction_t trAction, FwSmGuard_t trGuard)
Create a transition from a choice pseudo-state to a proper state and add it to a state machine...
Return codes of a function which has completed execution without errors.
signed char FwSmCounterS1_t
Type used for signed counters with a "short" range.
FwSmDesc_t FwSmMakeTestSM13(struct TestSmData *smData)
Operation to create and configure a state machine where the 'execute' transition has a choice pseudo-...
FwSmCounterS1_t iEntryAction
the entry action for the state
Declaration of the internal data structures of the FW State Machine Module.
FwSmDesc_t FwSmMakeTestSM2(struct TestSmData *smData)
Operation to create and configure the state machine SM2.
SmTrans_t * trans
array holding the transitions in the state machine