/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file ModeService.c * * @author (last) Vinayakam Mani * @date (last) 06-Aug-2024 * * @author (original) Vinayakam Mani * @date (original) 06-Aug-2024 * ***************************************************************************/ //#include "ConcentratePumps.h" #include "FpgaDD.h" #include "ModeService.h" #include "OperationModes.h" /** * @addtogroup DDServiceMode * @{ */ // ********** private definitions ********** // ********** private data ********** static DD_SERVICE_STATE_T serviceState = DD_SERVICE_STATE_START; ///< Currently active service state. // ********** private function prototypes ********** /*********************************************************************//** * @brief * The initServiceMode function initializes the service mode unit. * @details \b Inputs: none * @details \b Outputs: Service mode unit initialized * @return none *************************************************************************/ void initServiceMode( void ) { serviceState = DD_SERVICE_STATE_START; } /*********************************************************************//** * @brief * The transitionToServiceMode function prepares for transition to service mode. * @details \b Inputs: none * @details \b Outputs: none * @return initial state *************************************************************************/ U32 transitionToServiceMode( void ) { // Deenergize all the actuators // deenergizeActuators( NO_PARK_CONC_PUMPS ); initServiceMode(); setCurrentSubState( NO_SUB_STATE ); return serviceState; } /*********************************************************************//** * @brief * The execServiceMode function executes the service mode state machine. * @details \b Inputs: none * @details \b Outputs: Service mode state machine executed * @details \b Alarm: ALARM_ID_DD_SOFTWARE_FAULT when wrong service state invoked. * @return current state. *************************************************************************/ U32 execServiceMode( void ) { // execute current service state switch ( serviceState ) { case DD_SERVICE_STATE_START: break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_SOFTWARE_FAULT, SW_FAULT_ID_SERVICE_MODE_INVALID_EXEC_STATE, serviceState ) serviceState = DD_SERVICE_STATE_START; break; } return serviceState; } /*********************************************************************//** * @brief * The getCurrentServiceState function returns the current state of the service mode. * @details \b Inputs: serviceState * @details \b Outputs: none * @return the current state of service mode *************************************************************************/ DD_SERVICE_STATE_T getCurrentServiceState( void ) { return serviceState; } /**@}*/