/**********************************************************************//** * * Copyright (c) 2019-2020 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 ModeStandby.c * * @date 11-Dec-2019 * @author L. Baloa * * @brief Top-level state machine for the standby mode. * **************************************************************************/ #include "OperationModes.h" #include "ModeStandby.h" #include "CPLD.h" /** * @addtogroup StandbyMode * @{ */ // ********** private definitions ********** /// Enumeration of standby mode states. typedef enum Standby_Mode_States { STANDBY_MODE_STATE_START = 0, ///< Start standby mode state. STANDBY_MODE_STATE_IDLE, ///< Idle standby mode state. NUM_OF_STANDBY_MODE_STATES ///< Number of standby mode states. } STANDBY_MODE_STATE_T; // ********** private data ********** static STANDBY_MODE_STATE_T standbyState = STANDBY_MODE_STATE_START; ///< Currently active standby state. // ********** private function prototypes ********** STANDBY_MODE_STATE_T handleStandbyIdleState( void ); /*********************************************************************//** * @brief initStandbyMode * The initStandbyMode function initializes the Standby Mode module. * @details * Inputs : none * Outputs : Standby Mode module initialized. * @param none * @return none *************************************************************************/ void initStandbyMode( void ) { } /*********************************************************************//** * @brief transitionToStandbyMode * The transitionToStandbyMode function prepares for transition to standby mode. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void transitionToStandbyMode( void ) { // reset to start state each time we transition to standby mode standbyState = STANDBY_MODE_STATE_START; } /*********************************************************************//** * @brief execStandbyMode * The execStandbyMode function executes the Standby Mode state machine. * @details * Inputs : none * Outputs : * @param none * @return none *************************************************************************/ void execStandbyMode( void ) { // execute current Standby state switch ( standbyState ) { case STANDBY_MODE_STATE_START: standbyState = STANDBY_MODE_STATE_IDLE; break; case STANDBY_MODE_STATE_IDLE: standbyState = handleStandbyIdleState(); break; default: SET_ALARM_WITH_2_U32_DATA( ALARM_ID_SOFTWARE_FAULT, 0, standbyState ) // TODO - add s/w fault enum to 1st data param standbyState = STANDBY_MODE_STATE_START; break; } } /*********************************************************************//** * @brief * The handleStandbyIdleState function executes the Idle state of the \n * Standby Mode state machine. * @details * Inputs : none * Outputs : * @param none * @return the next state *************************************************************************/ STANDBY_MODE_STATE_T handleStandbyIdleState( void ) { STANDBY_MODE_STATE_T result = STANDBY_MODE_STATE_IDLE; // go to standby or standby solo mode depending on whether HD is connected // if ( FALSE == isHDCommunicating() ) // TODO - handle switching between standby and standby-solo modes // { // requestNewOperationMode( MODE_SOLO ); // } // TODO - what is DG supposed to be doing while in standby mode? return result; } /**@}*/