FW Profile - C1 Implementation
|
Declaration of functions to create and configure test state machines. More...
Go to the source code of this file.
Data Structures | |
struct | TestSmData |
Type for the state machine data for the test state machines. More... | |
Macros | |
#define | STATE_S1 1 |
A state identifier. | |
#define | STATE_S2 2 |
A state identifier. | |
#define | STATE_S3 3 |
A state identifier. | |
#define | STATE_S4 4 |
A state identifier. | |
#define | CPS1 1 |
A choice pseudo-state identifier. | |
#define | CPS2 2 |
A choice pseudo-state identifier. | |
#define | TR_S1_FPS 2 |
A transition identifier. | |
#define | TR_IPS_CPS1 1 |
A transition identifier. | |
#define | TR_CPS1_S1 2 |
A transition identifier. | |
#define | TR_CPS1_FPS 3 |
A transition identifier. | |
#define | TR1 30 |
A transition identifier. | |
#define | TR2 12 |
A transition identifier. | |
#define | TR3 13 |
A transition identifier. | |
#define | TR4 14 |
A transition identifier. | |
#define | TR5 15 |
A transition identifier. | |
#define | TR6 20 |
A transition identifier. | |
#define | TR_CPS_S1 1 |
A transition identifier. | |
#define | TR_CPS_S2 1 |
A transition identifier. | |
#define | LOG_ARRAY_SIZE 50 |
Define size of the log arrays. More... | |
Functions | |
FwSmDesc_t | FwSmMakeTestSM1 (struct TestSmData *smData) |
Operation to create and configure the state machine SM1. More... | |
FwSmDesc_t | FwSmMakeTestSM1Static (struct TestSmData *smData) |
Operation to create and configure the state machine SM1 (see FwSmMakeTestSM1 and figure below) statically using the interface defined in FwSmSCreate.h . More... | |
FwSmDesc_t | FwSmMakeTestSM2 (struct TestSmData *smData) |
Operation to create and configure the state machine SM2. More... | |
FwSmDesc_t | FwSmMakeTestSM3 (struct TestSmData *smData, struct TestSmData *esmData) |
Operation to create and configure the state machine SM3. More... | |
FwSmDesc_t | FwSmMakeTestSM4 (struct TestSmData *smData) |
Operation to create and configure the state machine SM4. More... | |
FwSmDesc_t | FwSmMakeTestSM5 (struct TestSmData *smData) |
Operation to create and configure the state machine SM5. More... | |
FwSmDesc_t | FwSmMakeTestSM5Static (struct TestSmData *smData) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5 and figure below) statically using the interface defined in FwSmSCreate.h . More... | |
FwSmDesc_t | FwSmMakeTestSM5Dir (struct TestSmData *smData) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5 and figure below) by directly instantiating and initializing the internal data structures in the state machine descriptor. More... | |
FwSmDesc_t | FwSmMakeTestSM6 (struct TestSmData *smData, struct TestSmData *esmData) |
Operation to create and configure the state machine SM6. More... | |
FwSmDesc_t | FwSmMakeTestSM7 (struct TestSmData *smData) |
Operation to create and configure the state machine SM7. More... | |
FwSmDesc_t | FwSmMakeTestSM8 (struct TestSmData *smData) |
Operation to create and configure a degenerate state machine with no states. More... | |
FwSmDesc_t | FwSmMakeTestSM9 (struct TestSmData *smData) |
Operation to create and configure a degenerate state machine with no transitions other than the initial transition. More... | |
FwSmDesc_t | FwSmMakeTestSM9Static (struct TestSmData *smData) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM9 and figure below) statically using the interface defined in FwSmSCreate.h . More... | |
FwSmDesc_t | FwSmMakeTestSM10 (struct TestSmData *smData, struct TestSmData *esmData) |
Operation to create and configure the state machine SM10. More... | |
FwSmDesc_t | FwSmMakeTestSM11 (struct TestSmData *smData) |
Operation to create and configure a degenerate state machine with neither states nor choice pseudo-states. More... | |
FwSmDesc_t | FwSmMakeTestSM12 (struct TestSmData *smData) |
Operation to create and configure a state machine where a transition has a choice pseudo-state as both source and destination. More... | |
FwSmDesc_t | FwSmMakeTestSM13 (struct TestSmData *smData) |
Operation to create and configure a state machine where the 'execute' transition has a choice pseudo-state and the final pseudo-state as destination. More... | |
FwSmDesc_t | FwSmMakeTestSM14 (struct TestSmData *smData) |
Operation to create and configure a state machine where the choice pseudo-state is used both to split a transition out of a state and to connect two transitions from two different states ("junction"). More... | |
FwSmDesc_t | FwSmMakeTestSM15 (struct TestSmData *smData) |
Operation to create and configure a state machine which uses the execution counters. More... | |
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. More... | |
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. More... | |
FwSmDesc_t | FwSmMakeTestSM16_1 (struct TestSmData *smData) |
Operation to create and configure a state machine to verify the order of evaluation of guards. More... | |
FwSmDesc_t | FwSmMakeTestSM16_2 (struct TestSmData *smData) |
Operation to create and configure a state machine to verify the order of evaluation of guards. More... | |
FwSmDesc_t | FwSmMakeTestSM16_3 (struct TestSmData *smData) |
Operation to create and configure a state machine to verify the order of evaluation of guards. More... | |
Declaration of functions to create and configure test state machines.
The test state machines are used in the test suite to verify the requirements of the FW State Machine Module.
The following acronyms are used in this file:
The data for the state machines defined in this file are instances of a data structure of type TestSmData
.
This file is part of the FW Profile.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
For information on alternative licensing, please contact P&P Software GmbH.
Definition in file FwSmMakeTest.h.
#define LOG_ARRAY_SIZE 50 |
Define size of the log arrays.
The log arrays are static arrays to which the actions of the test state machines write various outputs. They are used to check which actions have been executed and in which sequence.
Definition at line 78 of file FwSmMakeTest.h.
FwSmDesc_t FwSmMakeTestSM1 | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM1.
This state machine has the following characteristics (see also figure below):
counter_1
by 1.counter_1
by 2.counter_2
by 1.flag_1
.smData | the data structure upon which the state machine operates. |
Definition at line 208 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM10 | ( | struct TestSmData * | smData, |
struct TestSmData * | esmData | ||
) |
Operation to create and configure the state machine SM10.
This state machine has the following characteristics (see also figure below):
FwSmMakeTestSM1
) is embedded in S2.flag_1
as guard;flag_2
as guard;counter_1
by 1.counter_1
by 4.counter_2
by 1.smData | the data structure upon which the state machine operates |
esmData | the data structure upon which the embedded state machine operates |
Definition at line 581 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM11 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a degenerate state machine with neither states nor choice pseudo-states.
This state machine has the following characteristics (see also figure below):
counter_2
by 1.The state machine is created by directly instantiating its internal data structures.
smData | the data structure upon which the state machine operates |
Definition at line 611 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM12 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine where a transition has a choice pseudo-state as both source and destination.
Execution of the transition with a choice pseudo-state as both source and destination causes an error. This state machine has the following characteristics:
counter_1
by 1.counter_1
by 2.counter_1
by 4.counter_2
by 1.flag_1
.flag_2
.flag_2
.The transition from CPS1 to CPS1 is partly configured "by hand" by directly assigning values to the internal data structures of the state machine descriptor (this is an illegal transition and it is impossible to define it using the standard configuration operations of FwSmConfig.h
).
smData | the data structure upon which the state machine operates |
Definition at line 652 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM13 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine where the 'execute' transition has a choice pseudo-state and the final pseudo-state as destination.
This state machine has the following characteristics (see also figure below):
counter_1
by 1.counter_1
by 2.counter_1
by 4.flag_1
.flag_1
.flag_2
.flag_2
.smData | the data structure upon which the state machine operates |
Definition at line 679 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM14 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine where the choice pseudo-state is used both to split a transition out of a state and to connect two transitions from two different states ("junction").
This state machine has the following characteristics (see also figure below):
counter_2
by 4.flag_1
.flag_2
.smData | the data structure upon which the state machine operates |
Definition at line 704 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM15 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine which uses the execution counters.
The value of the execution counters is stored in the procedure data by the state machine actions and the value of the state execution counter is used as a guard to control state transitions.
This state machine has the following characteristics (see also figure below):
smData | the data structure upon which the state machine operates |
Definition at line 732 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM16_1 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine to verify the order of evaluation of guards.
This state machine has the following characteristics (see also figure below):
Transitions are added to the state machine during the configuration process in the order in which they are listed.
smData | the data structure upon which the state machine operates |
Definition at line 792 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM16_2 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine to verify the order of evaluation of guards.
This state machine has the following characteristics (see also figure below):
Transitions are added to the state machine during the configuration process in the order in which they are listed.
smData | the data structure upon which the state machine operates |
Definition at line 823 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM16_3 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a state machine to verify the order of evaluation of guards.
This state machine has the following characteristics (see also figure below):
Transitions are added to the state machine during the configuration process in the order in which they are listed.
smData | the data structure upon which the state machine operates |
Definition at line 854 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM1Static | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM1 (see FwSmMakeTestSM1
and figure below) statically using the interface defined in FwSmSCreate.h
.
smData | the data structure upon which the state machine operates. |
Definition at line 228 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM2 | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM2.
This state machine has the following characteristics:
counter_1
by 1.counter_1
by 2.counter_1
by 4.counter_2
by 1.flag_1
.flag_2
.flag_2
.smData | the data structure upon which the state machine operates |
Definition at line 243 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM3 | ( | struct TestSmData * | smData, |
struct TestSmData * | esmData | ||
) |
Operation to create and configure the state machine SM3.
This state machine is the same as SM1 (see FwSmMakeTestSM1
) but it has SM2 (see FwSmMakeTestSM2
) embedded within state S1 of SM1.
smData | the data structure upon which the embedding state machine operates |
esmData | the data structure upon which the embedded state machine operates |
Definition at line 266 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM4 | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM4.
This state machine has the following characteristics (see also figure below):
counter_1
by 1.counter_1
by 2.counter_1
by 4.counter_2
by 1.flag_1
.smData | the data structure upon which the state machine operates |
Definition at line 296 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM5 | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM5.
This state machine has the following characteristics:
flag_1
as guard;flag_2
as guard;counter_1
by 1.counter_1
by 2.counter_1
by 4.counter_2
by 1.flag_1
with the exception of the transition from S2 to CPS1 which has no guard and the transition from CPS1 to S2 which returns the value of flag_2
.smData | the data structure upon which the state machine operates |
Definition at line 321 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM5Dir | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5
and figure below) by directly instantiating and initializing the internal data structures in the state machine descriptor.
The data structures for the state machine are created as static
variables and are initialized directly (i.e. without using the creation functions offered by the FwSmDCreate.h
or FwSmSCreate
moduls and the configuration functions offered by FwSmConfig.h
).
The approach used in this function to initialize the state machine descriptor is non-nominal (normally the state machine descriptor is created and configured using the operations made available by the FW State Machine Module). Applications which use this approach to create and initialize their state machine descriptors will not need to link to the creation and configuration operations offered by the FW State Machine Module and will therefore reduce the memory footprint of their application.
smData | the data structure upon which the state machine operates |
Definition at line 370 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM5Static | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM5
and figure below) statically using the interface defined in FwSmSCreate.h
.
smData | the data structure upon which the state machine operates |
Definition at line 348 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM6 | ( | struct TestSmData * | smData, |
struct TestSmData * | esmData | ||
) |
Operation to create and configure the state machine SM6.
This state machine is the same as state machine SM4 (see FwSmMakeTestSM4
) with state machine SM5 (see FwSmMakeTestSM5
) embedded within its state S2.
smData | the data structure upon which the state machine operates |
esmData | the data structure upon which the embedded state machine operates |
Definition at line 475 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM7 | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM7.
This state machine has the following characteristics (see also figure below):
flag_1
as guard;flag_2
as guard;counter_1
by 2.counter_1
by 4.counter_2
by 1.flag_1
or flag_2
as stated above.smData | the data structure upon which the state machine operates |
Definition at line 504 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM8 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a degenerate state machine with no states.
This state machine has the following characteristics (see also figure below):
flag_1
as guard;flag_2
as guard;counter_2
by 1.smData | the data structure upon which the state machine operates |
Definition at line 527 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM9 | ( | struct TestSmData * | smData | ) |
Operation to create and configure a degenerate state machine with no transitions other than the initial transition.
This state machine has the following characteristics (see also figure below):
counter_1
by 1.counter_1
by 2.counter_1
by 4.counter_2
by 1.smData | the data structure upon which the state machine operates |
Definition at line 548 of file FwSmMakeTest.c.
FwSmDesc_t FwSmMakeTestSM9Static | ( | struct TestSmData * | smData | ) |
Operation to create and configure the state machine SM5 (see FwSmMakeTestSM9
and figure below) statically using the interface defined in FwSmSCreate.h
.
smData | the data structure upon which the state machine operates |
Definition at line 567 of file FwSmMakeTest.c.
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.
The base state machine is passed as an argument to the function. The function extends the base state machine and then it performs the following overrides on the derived state machine:
incrCnt1By1
(increment Counter_1 by 1) is overridden with action incrCnt1By8
(increment Counter_1 by 8).retFlag1
(return Flag_1) is overridden with guard retFlag2
(return Flag_2).The derived state machine is created using the dynamic creation interface of FwSmDCreate.h
.
smDescBase | the base state machine |
smData | the data structure for the newly created state machine |
Definition at line 758 of file FwSmMakeTest.c.
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.
The base state machine is passed as an argument to the function. This function assumes that the base state machine has 1 state, 3 actions, and 1 guard. The function extends the base state machine and then it performs the following overrides on the derived state machine:
incrCnt1By1
(increment Counter_1 by 1) is overridden with action incrCnt1By8
(increment Counter_1 by 8).retFlag1
(return Flag_1) is overridden with guard retFlag2
(return Flag_2).The derived state machine is created using the static creation interface of FwSmSCreate.h
.
smDescBase | the base state machine |
smData | the data structure for the newly created state machine |
Definition at line 771 of file FwSmMakeTest.c.