FW Profile - C1 Implementation
|
Implements the static initialization functions for the FW State Machine Module. More...
Go to the source code of this file.
Functions | |
void | FwSmInit (FwSmDesc_t smDesc) |
Initialize a state machine descriptor to represent an unconfigured state machine with no transitions, no actions, no guards and no embedded state machines. More... | |
void | FwSmInitDer (FwSmDesc_t smDesc, FwSmDesc_t smDescBase) |
Initialize a state machine descriptor to extend another state machine (the base state machine). More... | |
Implements the static initialization functions for the FW State Machine Module.
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 FwSmSCreate.c.
void FwSmInit | ( | FwSmDesc_t | smDesc | ) |
Initialize a state machine descriptor to represent an unconfigured state machine with no transitions, no actions, no guards and no embedded state machines.
After this function has been executed, the argument state machine descriptor has the same content as a state machine descriptor which has been created by calling FwSmCreate
.
This function is primarily intended to be used to initialize a state machine descriptor which has been statically instantiated with macro FW_SM_INST
or FW_SM_INST_NOCPS
.
If the function is called upon a state machine descriptor that had already been initialized, the previous initialization values are lost. In such a case, a memory leak is possible due to the potential loss of the pointers to the arrays where the state machines states, choice pseudo-states, transitions and embedded state machines are stored.
smDesc | the state machine descriptor to be initialized. |
Definition at line 24 of file FwSmSCreate.c.
void FwSmInitDer | ( | FwSmDesc_t | smDesc, |
FwSmDesc_t | smDescBase | ||
) |
Initialize a state machine descriptor to extend another state machine (the base state machine).
This function checks that the descriptor to be initialized satisfies the following constraints:
If either constraint is not satisfied, the function reports an error by setting the error code of the descriptor to be initialized and then returns. If the first constraint is not satisfied, the function sets the error code to smWrongNOfActions
. If the second constraint is not satisfied, the function sets the error code to smWrongNOfGuards
.
If both constraints are satisfied, this function initializes a descriptor as follows:
transCnt
field to zero.Thus, if the base state machine has no embedded state machines, then this function initializes a descriptor to represent its derived state machine. In this case, the descriptor initialized by this function represents exactly the same state machine as the descriptor created by calling function FwSmCreateDer
. If, instead, the base state machine has one or more embedded state machines, then, in order to achieve the same effect as the FwSmCreateDer
function, the descriptor initialized by this function must be further configured as follows:
FW_SM_INST_DER
macro and the FwSmInitDer
function. Let ESM(i) be the extension of the state machine embedded in the i-th state of the base state machine.FwSmEmbed
function.This function is primarily intended to be used to initialize a state machine descriptor which has been statically instantiated with macro FW_SM_INST_DER
. If the function is called upon a state machine descriptor that had already been initialized, the previous initialization values are lost. In such a case, a memory leak is possible due to the potential loss of the pointers to the arrays where the state machines states, choice pseudo-states, transitions and embedded state machines are stored.
smDesc | the state machine descriptor to be initialized. |
smDescBase | the state machine descriptor of the base state machine. |
Definition at line 54 of file FwSmSCreate.c.