72 #define IMD_FSM_SHORT_TIME (1u)
128 .information.isStatemachineInitialized =
false,
129 .information.switchImdDeviceOn =
false,
296 return multipleCalls;
308 bool earlyExit =
false;
310 pImdState->
timer = idleTime;
319 if (earlyExit ==
false) {
341 pImdState->
timer = idleTime;
454 return ranStateMachine;
461 bool lowResistanceDetected =
false;
467 lowResistanceDetected =
true;
476 lowResistanceDetected =
true;
486 if (lowResistanceDetected ==
true) {
525 bool earlyExit =
false;
534 if (earlyExit ==
false) {
544 if (earlyExit ==
false) {
IMD_FSM_STATES_e IMD_ProcessInitializationState(void)
Processes the initialization state.
IMD_FSM_STATES_e IMD_ProcessShutdownState(void)
Processes the shutdown state.
IMD_FSM_STATES_e IMD_ProcessEnableState(void)
Processes the IMD enable state.
IMD_FSM_STATES_e IMD_ProcessRunningState(DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring)
Processes the running state.
#define DATA_WRITE_DATA(...)
@ DATA_BLOCK_ID_INSULATION_MONITORING
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
@ DIAG_ID_INSULATION_MEASUREMENT_VALID
@ DIAG_ID_INSULATION_GROUND_ERROR
@ DIAG_ID_LOW_INSULATION_RESISTANCE_ERROR
@ DIAG_ID_LOW_INSULATION_RESISTANCE_WARNING
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
#define NULL_PTR
Null pointer.
IMD_RETURN_TYPE_e IMD_RequestInsulationMeasurement(void)
Request to activate the actual IMD measurement.
static void IMD_SetState(IMD_STATE_s *pImdState, IMD_FSM_STATES_e nextState, IMD_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next state, the next substate and the timer value of the state variable.
@ IMD_FSM_SUBSTATE_RUNNING_0
@ IMD_FSM_SUBSTATE_RUNNING_1
@ IMD_FSM_SUBSTATE_INITIALIZATION_EXIT
@ IMD_FSM_SUBSTATE_RUNNING_2
@ IMD_FSM_SUBSTATE_INITIALIZATION_1
@ IMD_FSM_SUBSTATE_INITIALIZATION_0
bool IMD_GetInitializationState(void)
Gets the initialization state.
static DATA_BLOCK_INSULATION_MONITORING_s imd_tableInsulationMonitoring
static STD_RETURN_TYPE_e IMD_EvaluateInsulationMeasurement(DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring)
Evaluates measurement perform by IMD driver.
STD_RETURN_TYPE_e IMD_Trigger(void)
trigger function for the IMD driver state machine.
static IMD_STATE_s imd_state
static IMD_RETURN_TYPE_e IMD_CheckStateRequest(IMD_STATE_s *pImdState, IMD_STATE_REQUEST_e stateRequest)
checks the state requests that are made.
IMD_CHECK_MULTIPLE_CALLS_e
#define IMD_FSM_SHORT_TIME
static IMD_CHECK_MULTIPLE_CALLS_e IMD_CheckMultipleCalls(IMD_STATE_s *pImdState)
check for multiple calls of state machine trigger function
static STD_RETURN_TYPE_e IMD_RunStateMachine(IMD_STATE_s *pImdState)
Defines the state transitions.
IMD_RETURN_TYPE_e IMD_RequestMeasurementStop(void)
Request to deactivate the actual IMD measurement.
IMD_RETURN_TYPE_e IMD_RequestInitialization(void)
Request initialization of IMD statemachine.
static IMD_STATE_REQUEST_e IMD_TransferStateRequest(IMD_STATE_s *pImdState)
transfers the current state request to the state machine.
static void IMD_SetSubstate(IMD_STATE_s *pImdState, IMD_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next substate and the timer value of the state variable.
static IMD_RETURN_TYPE_e IMD_SetStateRequest(IMD_STATE_s *pImdState, IMD_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable imd_state.
API header for the insulation monitoring device.
@ IMD_FSM_STATE_INITIALIZATION
@ IMD_FSM_STATE_HAS_NEVER_RUN
@ IMD_FSM_STATE_IMD_ENABLE
@ IMD_FSM_STATE_UNINITIALIZED
@ IMD_STATE_SWITCH_ON_REQUEST
@ IMD_STATE_SHUTDOWN_REQUEST
@ IMD_STATE_INITIALIZE_REQUEST
@ IMD_ALREADY_INITIALIZED
#define IMD_ERROR_THRESHOLD_INSULATION_RESISTANCE_kOhm
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
bool dfIsWarnableResistanceDetected
bool dfIsCriticalResistanceDetected
bool isInsulationMeasurementValid
uint32_t insulationResistance_kOhm
DATA_BLOCK_HEADER_s header
bool dfIsChassisFaultDetected
DATA_BLOCK_INSULATION_MONITORING_s * pTableImd
IMD_FSM_STATES_e previousState
IMD_INFORMATION_s information
IMD_FSM_SUBSTATES_e previousSubstate
IMD_FSM_STATES_e nextState
IMD_STATE_REQUEST_e stateRequest
IMD_FSM_SUBSTATES_e nextSubstate
IMD_FSM_SUBSTATES_e currentSubstate
IMD_FSM_STATES_e currentState