Index: firmware/App/Modes/ModeUpdate.c =================================================================== diff -u -rfc99f47309c9d96f73a2d4696b42d6d302f334a7 -rc74c1d99a011dd0fb7f98f183faecda675221fce --- firmware/App/Modes/ModeUpdate.c (.../ModeUpdate.c) (revision fc99f47309c9d96f73a2d4696b42d6d302f334a7) +++ firmware/App/Modes/ModeUpdate.c (.../ModeUpdate.c) (revision c74c1d99a011dd0fb7f98f183faecda675221fce) @@ -1,9 +1,3 @@ -/* - * ModeUpdate.c - * - * Created on: Jul 31, 2024 - * Author: fw - */ #include "CommBuffers.h" #include "Download.h" @@ -12,17 +6,42 @@ #include "NVDataMgmt.h" #include "OperationModes.h" +/** + * @addtogroup UpdateMode + * @{ + */ + +// ********** private definitions ********** + +// ********** private data ********** + static MODE_SW_UPDATE_STATE_T updateCurrentState; +// ********** private function prototypes ********** + static MODE_SW_UPDATE_STATE_T handleUpdateModeUpdateState( void ); static MODE_SW_UPDATE_STATE_T handleUpdateModeVerifyState( void ); static MODE_SW_UPDATE_STATE_T handleUpdateModeAbortState( void ); +/*********************************************************************//** + * @brief + * The initUpdateMode function initializes the Update Mode Unit. + * @details \b Inputs: none + * @details \b Outputs: updateCurrentState + * @return none + *************************************************************************/ void initUpdateMode( void ) { updateCurrentState = SW_UPDATE_UPDATE_STATE; } +/*********************************************************************//** + * @brief + * The transitionToUpdateMode function prepares for transition to Update Mode. + * @details \b Inputs: none + * @details \b Outputs: Standby Mode unit re-initialized + * @return none + *************************************************************************/ U32 transitionToUpdateMode( void ) { initUpdateMode(); @@ -35,6 +54,13 @@ return 0; } +/*********************************************************************//** + * @brief + * The execUpdateMode function executes the Update Mode state machine. + * @details \b Inputs: updateCurrentState + * @details \b Outputs: updateCurrentState + * @return current state (sub-mode) + *************************************************************************/ U32 execUpdateMode( void ) { switch( updateCurrentState ) @@ -59,7 +85,14 @@ return 0; } - +/*********************************************************************//** + * @brief + * The handleUpdateModeUpdateState function handles the update mode update state. + * This state checks for the SW update command to transition to the proper state. + * @details \b Inputs: none + * @details \b Outputs: none + * @return next state of the update mode state machine + *************************************************************************/ static MODE_SW_UPDATE_STATE_T handleUpdateModeUpdateState( void ) { MODE_SW_UPDATE_STATE_T state = SW_UPDATE_UPDATE_STATE; @@ -82,6 +115,17 @@ return state; } +/*********************************************************************//** + * @brief + * The handleUpdateModeVerifyState function handles the update mode verify state. + * This state checks for the destination of the current update which can be + * either firmware or FPGA. If the update destination was FPGA it makes sure + * the FPGA update has been completed and then transitions to standby mode. + * If the update destination was firmware, it transitions to standby mode. + * @details \b Inputs: none + * @details \b Outputs: none + * @return next state of the update mode state machine + *************************************************************************/ static MODE_SW_UPDATE_STATE_T handleUpdateModeVerifyState( void ) { MODE_SW_UPDATE_STATE_T state = SW_UPDATE_VERIFY_STATE; @@ -107,6 +151,14 @@ return state; } +/*********************************************************************//** + * @brief + * The handleUpdateModeAbortState function handles the update mode abort state. + * This state transitions to standby mode upon requesting to abort the update. + * @details \b Inputs: none + * @details \b Outputs: none + * @return next state of the update mode state machine + *************************************************************************/ static MODE_SW_UPDATE_STATE_T handleUpdateModeAbortState( void ) { MODE_SW_UPDATE_STATE_T state = SW_UPDATE_ABORT_STATE; @@ -116,9 +168,4 @@ return state; } - - - - - - +/**@}*/