States_And_Modes_MDD
Module --
High-Level Description
This module handles the EPS system state transitions and is used to determine the operating system state based on knowledge of customer and internal inputs. The System State is used in turn by the Scheduler to determine the task list to be executed in a particular state.
Figures
Component Diagram
None, files are generated by Configurator.
Variable Data Dictionary
| Module Inputs | Module Outputs |
|---|---|
| CTerm_Cnt_lgc | CloseCheck_Cnt_u32 |
| ATerm_Cnt_lgc | TypeHData_Cnt_u08[D_TYPEHDATASIZE_CNT_U16] |
| FTerm_Cnt_lgc | |
| RampStatusComplete_Cnt_lgc | |
| ControlledDampStatusComplete_Cnt_lgc | |
| TMFTestComplete_Cnt_lgc |
Module Internal Variables
| Variable Name | DataType | Resolution | Legal Range (min) | Legal Range (max) | Multiplicity | Software Segment |
|---|---|---|---|---|---|---|
| StTrnsVctr_Cnt_D_b08 | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_8 |
| WarmInitMilestoneRqst_Cnt_M_u32 | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_32 |
| WarmInitMilestoneRqst#_Cnt_M_u32 | Refer * | Refer * | Refer * | Refer * | 0:n | STAMD#_START_SEC_VAR_CLEARED_32 |
| EcuResetActive_Cnt_M_lgc | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_BOOLEAN |
| FinalNvMWriteInProgress_Cnt_M_lgc | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_BOOLEAN |
| StopTODPerOperation_Cnt_M_lgc | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_BOOLEAN |
| TODState_Cnt_M_lgc | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_BOOLEAN |
| TransitionComplete_Cnt_M_lgc | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_CLEARED_BOOLEAN |
| SystemState_Cnt_M_enum | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_INIT_UNSPECIFIED |
| SystemState#_Cnt_M_enum | Refer * | Refer * | Refer * | Refer * | 0:n | STAMD#_START_SEC_VAR_INIT_UNSPECIFIED |
| SysCSystemState_Cnt_M_enum | Refer * | Refer * | Refer * | Refer * | 1:1 | STAMD#_START_SEC_VAR_INIT_UNSPECIFIED |
| Lnk_TypeH#_Start | Refer * | Refer * | Refer * | Refer * | 0:n | AP_STAMD_CONST |
| Lnk_TypeH#_Size | Refer * | Refer * | Refer * | Refer * | 0:n | AP_STAMD_CONST |
Note: “ Refer *” - Refer to States_And_Modes_GeneratedCfg_MDD
Note “#” denotes application number(1 to n) which varies across projects. Check project configuration files Under UTP/ Contract folder for number of applications
User defined typedef definition/declaration
| Typedef Name | Element Name | User Defined Type | Legal Range (min) | Legal Range (max) |
|---|---|---|---|---|
| TypeHInfoType_Str | Start | Const uint8 pointer | 0 | Full |
| Size | Uint32 | 0 | Full | |
| Rte_ModeType_StaMd_Mode | RTE_MODE_StaMd_Mode_DISABLE RTE_MODE_StaMd_Mode_OFF RTE_MODE_StaMd_Mode_OPERATE RTE_MODE_StaMd_Mode_WARMINIT RTE_TRANSITION_StaMd_Mode | N/A | N/A | N/A |
Constant Data Dictionary
Calibration Constants
| Constant Name |
|---|
| k_StaMdsSysCDiag_Cnt_str |
Program(fixed) Constants
Embedded Constants
Local
| Constant Name | Resolution | Units | Value |
|---|---|---|---|
| D_STATELKPVCTRS_CNT_U16 | 1 | Counts | 16 |
| D_STATELKPSTATES_CNT_U16 | 1 | Counts | 4 |
| D_TVBITF_CNT_U16 | 1 | Counts | 0x01 |
| D_TVBITC_CNT_U16 | 1 | Counts | 0x02 |
| D_TVBITM_CNT_U16 | 1 | Counts | 0x04 |
| D_TVBITA_CNT_U16 | 1 | Counts | 0x08 |
| D_CLOSECHECKVALUE_CNT_U32 | 1 | Counts | 0 x00FF00FF |
| D_CLOSECHECKGARBAGE_CNT_U32 | 1 | Counts | 0x5555AAAA |
Global
| Constant Name |
|---|
| *D_STAMD_DIAGMGR_CLIENTSERVER_CALL |
| *D_TYPEHDATASIZE_CNT_U16 |
| *D_DIAGMGR_SHUTDOWN_TASK |
| *BC_STAMD_TODSTEADYSTATE |
| *BC_STAMD_TOD2MSTOGGLE |
| *BC_STAMD_SYSCHKINCOREAPP |
Note: * Values of these Global data constants tend to change based on project configuration. Check Project configuration files under UTP/Contract folder
Module specific Lookup Tables Constants
| Constant Name | Resolution | Value | Software Segment |
|---|---|---|---|
| Rte_ModeType_StaMd_Mode t_StateLkpTbl_Cnt_u8 [D_STATELKPSTATES_CNT_U16] [D_STATELKPVCTRS_CNT_U16] | N/A | { {RTE_MODE_StaMd_Mode_OFF,
{RTE_MODE_StaMd_Mode_OFF,
{RTE_MODE_StaMd_Mode_OPERATE,
{RTE_MODE_StaMd_Mode_DISABLE,
} | CONST_UNSPECIFIED |
| T_CurrentSystemState_Ptr_enum[ *SIZE] | N/A | Refer * | AP_STAMD_CONST |
| T_TypeHInfo_Cnt_Str[ *SIZE] | TypeHInfoType_Str | Refer * | AP_STAMD_CONST |
| T_WarmInitMilestoneRqst_Ptr_enum[*SIZE] | N/A | Refer * | AP_STAMD_CONST |
Note: The entries in the state lookup table rely on the fact that generated values for the system state are maintained. If the generated values are changed then the entries have to re arranged.
Note: * SIZE for above tables varies across projects.Check Project configuration files for size and elements of tables..
Note: Refer * : Refer to States_And_Modes_GeneratedCfg_MDD
Functions/Macros used by the Sub-Modules
Library Functions / Macros
The library functions / Macros that are called by the various sub modules are identified below,
Data Hiding Functions
None
Global Functions/Macros Defined by this Module
Process WarmInit Milestone Complete
| Function Name | MilestoneRqst_WarmInitMilestoneComplete | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | user | StaMd_Users | 0 | 31 |
| Return Value | None | |||
Description
Process WarmInit Milestone Not Complete
| Function Name | MilestoneRqst_WarmInitMilestoneNotComplete | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | user | StaMd_Users | 0 | 31 |
| Return Value | None | |||
Description
States and Modes ECU Reset
| Function Name | StaMd_SCom_EcuReset | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | none | |||
| Return Value | None | |||
Description
EcuResetActive_Cnt_M_lgc = TRUE
States and Modes Transition Function
| Function Name | StaMd_Trns1 | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | none | |||
| Return Value | None | |||
Description
WriteTypeH()
#if(D_STAMD_DIAGMGR_CLIENTSERVER_CALL == STD_ON)
Rte_Call_DiagMgr_StaCtrl_Shutdown();
#else
ActivateTask(D_DIAGMGR_SHUTDOWN_TASK);
#endif
NVMWRITEALLFUNC()
FinalNvMWriteInProgress_Cnt_M_lgc = TRUE
Note: D_STAMD_DIAGMGR_CLIENTSERVER_CALL is generated as STD_ON or STD_OFF based on the configuration of the program.
States and Modes Initialization
| Function Name | StaMd_Init1 | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | none | |||
| Return Value | None | |||
Description
States and Modes Periodic
| Function Name | StaMd_Per1 | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | none | |||
| Return Value | None | |||
Description
System State Check
| Function Name | SystemStateCheck | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | FTermActive_Cnt_T_lgc | boolean | FALSE | TRUE |
| CTermActive_Cnt_T_lgc | boolean | FALSE | TRUE | |
| ATermActive_Cnt_T_lgc | boolean | FALSE | TRUE | |
| RampStatusCmp_Cnt_T_lgc | boolean | FALSE | TRUE | |
| CtrldDmpStsCmp_Cnt_T_lgc | boolean | FALSE | TRUE | |
| TMFTestComplete_Cnt_T_lgc | boolean | FALSE | TRUE | |
| SysCFltCntr_Ptr_T_u16 | uint16 * | 0 | 255 | |
| Return Value | FaultStatus_Cnt_T_enum | NxtrDiagMgrStatus | NTC_STATUS_PASSED NTC_STATUS_FAILED NTC_STATUS_PREPASSED NTC_STATUS_PREFAILED | |
Description
Local Functions/Macros Used by this MDD only
Macro Function #1
SetBits_m(var, mask) : var = var | mask
Macro Function #2
ClrBits_m(var, mask) : var = var & mask
Local Function #1
| Function Name | BldTranVctr | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | SysState_Cnt_T_Enum | Rte_ModeType_StaMd_Mode | RTE_MODE_StaMd_Mode_DISABLE RTE_MODE_StaMd_Mode_OFF RTE_MODE_StaMd_Mode_OPERATE RTE_MODE_StaMd_Mode_WARMINIT RTE_TRANSITION_StaMd_Mode | |
| FTermActive_Cnt_T_lgc | boolean | FALSE | TRUE | |
| CTermActive_Cnt_T_lgc | boolean | FALSE | TRUE | |
| ATermActive_Cnt_T_lgc | boolean | FALSE | TRUE | |
| RampStatusCmp_Cnt_T_lgc | boolean | FALSE | TRUE | |
| CtrldDmpStsCmp_Cnt_T_lgc | boolean | FALSE | TRUE | |
| Return Value | TransVec_Cnt_T_u8 | uint8 | FULL | FULL |
Design Rationale
NvM_GetErrorStatus has been used instead of an RTE_Call_GetErrorStatus in order to specify the blockID and also to prevent the integrator map it to a wrong port interface.
Description
Local Function #2
| Function Name | ReadTypeH | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | None | |||
| Return Value | none | |||
Design Rationale
ReadTypeH functions call has been added to this module although the FDD doesn’t call them out as this module performs the system NvH memory read after system power up.
Description
Local Function #3
| Function Name | WriteTypeH | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | none | |||
| Return Value | none | |||
Design Rationale
WriteTypeH functions call has been added to this module although the FDD doesn’t call them out as this module performs the system NvH memory write before system shutdown.
Description
Local Function #4
| Function Name | CheckWarmInitComplete | Type | Min | Max |
|---|---|---|---|---|
| Arguments Passed | None | |||
| Return Value | WarmInitMilestoneComp_Cnt_T_lgc | Boolean | FALSE | TRUE |
Description

Software Module Implementation
Initial Data Values
| Data | Value |
|---|---|
| CTerm_Cnt_lgc | D_FALSE_CNT_LGC |
| ATerm_Cnt_lgc | D_TRUE_CNT_LGC |
| FTerm_Cnt_lgc | D_FALSE_CNT_LGC |
Initialization Functions
Init:
Periodic Functions
Fault Recovery Functions
None
Shutdown Functions
None
Interrupt Functions
None
Serial Communication Functions
Execution Requirements
Execution Sequence of the Module
_Init1 needs to RUN prior to any function that requires the use of TypeH data.Execution Rates for sub-modules called by the Scheduler
| Function Name | Calling Frequency | System State(s) in which the function is called |
|---|---|---|
Execution Requirements for Serial Communication Functions
| Function Name | Sub-Module called by (Serial Comm Function Name) |
|---|---|
Memory Map Definition Requirements
Sub Modules (Functions)
This table identifies the software segments for functions identified in this module.
| Name of Sub Module | Software Segment |
|---|---|
Global and Local Functions
This table identifies the software segments for global and local functions identified in this module.
| Name of Sub Module | Software Segment |
|---|---|
| BldTranVctr | RTE_AP_STAMD_APPL_CODE |
| MilestoneRqst_WarmInitMilestoneComplete | RTE_AP_STAMD_APPL_CODE |
| MilestoneRqst_WarmInitMilestoneNotComplete | RTE_AP_STAMD_APPL_CODE |
| ReadTypeH | RTE_AP_STAMD_APPL_CODE |
| WriteTypeH | RTE_AP_STAMD_APPL_CODE |
| CheckWarmInitComplete | RTE_AP_STAMD_APPL_CODE |
| SystemStateCheck | RTE_AP_STAMD_APPL_CODE |
| StaMd_SCom_EcuReset | RTE_AP_STAMD_APPL_CODE |
| StaMd_Trns1 | RTE_AP_STAMD_APPL_CODE |
| StaMd_Per1 | RTE_AP_STAMD_APPL_CODE |
| StaMd_Init1 | RTE_AP_STAMD_APPL_CODE |
Known Issues / Limitations With Design
.FDD does not currently support “Transition” state required for RTE runnables triggered on state transitions. Current design simply does nothing if in “Transition” state.
FDD requirement state that an off state milestone is considered as complete when all the NVM writes are complete. This milestone is currently performed internally by querying the NVM write status in this module.
FDD calls out for the F Term input to this module as a Boolean type diagnostic flag that is used to indicate a fault requesting removal of assist and currently there is no requirement for a component to send out this flag(according to FDD data dictionary version 86 dated 16th Mar 2012). However, it has been implemented in Diagnostic manager version FDD37B_001.6
Revision Control Log
| Item # | Rev # | Change Description | Date | Author Initials |
|---|---|---|---|---|
| 1 | 1 | Initial EA3.0 version. | 11-Apr-11 | LWW |
| 2 | 2 | Updated range errors found during UTP | 13-Apr-11 | LWW |
| 3 | 3 | Added RampStatusCmp_Cnt_T_lgc | 05-Jan-12 | M. Story |
| 4 | 4 | Updated for issues found at Unit Test | 30-Jan-12 | M. Story |
| 5 | 5 | Updates to meet FDD 10C v006 | 20-Mar-12 | VK |
| 6 | 6 | Updates to fix anomaly 3143 | 09-Apr-12 | VK |
| 7 | 7 | Added SCom function and logic to perform ECU Reset | 26-Apr-12 | LWW |
| 8 | 8 | Updated to fix Anom 3158 for LookUpTable | 7-May-12 | NRAR |
| 9 | 9 | Added EEPROM Failed to Close check | 27-Jul-12 | OT |
| 10 | 10 | Changed write complete check on Close Check diagnostic | 03-Aug-12 | LWW |
| 11 | 11 | Added checkpoints, removed call to end operation cycle, added a MemMap section for const table | 21-Sep-12 | LWW |
| 12 | 12 | Updated to the latest src(v16) | 15-Feb-13 | VK |
| 13 | 13 | Moved state transition complete logic ahead of the switch case statement to always be performed | 05-Jun-13 | KJS |
| 14 | 14 | Applied final changes to A5108 correction in Per1 | 05-Jun-13 | KJS |
| 15 | 15 | Changes made to MDD to be more generic for all projects | 18-June-13 | NRAR |
| 16 | 16 | MDD version updated to match synergy version | 27-June-13 | NRAR |
| 17 | 17 | Fixed anomaly 5205, added logic to force TOD low in toggle mode during powerdown. | 27-June-13 | LWW |