Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r79e0b1152e278a3b09d7d93c83a27f8998a2f3b6 -r19056bcb960b73405326d038abcea63b6862e344 --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 79e0b1152e278a3b09d7d93c83a27f8998a2f3b6) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision 19056bcb960b73405326d038abcea63b6862e344) @@ -887,6 +887,34 @@ /*********************************************************************//** * @brief + * The execFPGAClockSpeedTest function verifies the processor clock speed + * against the FPGA clock. + * @details Inputs: fpgaHeader + * @details Outputs: none + * @return passed, or failed + *************************************************************************/ +void execFPGAClockSpeedTest( void ) +{ +#ifndef DEBUG_ENABLED + U16 const newFPGATimerCount_ms = getFPGATimerCount(); + U32 const newTimerCount_ms = getMSTimerCount(); + U32 const diffFPGATimerCount = (U32)u16DiffWithWrap( currentFPGATimerCount_ms, newFPGATimerCount_ms ); + U32 const diffTimerCount = u32DiffWithWrap( currentTimerCount_ms, newTimerCount_ms ); + + if ( getCurrentOperationMode() > MODE_INIT ) + { + if ( abs( diffFPGATimerCount - diffTimerCount ) > PROCESSOR_FPGA_CLOCK_DIFF_TOLERANCE ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_FPGA_CLOCK_SPEED_CHECK_FAILURE, diffFPGATimerCount, diffTimerCount ); + } + } + + currentFPGATimerCount_ms = newFPGATimerCount_ms; + currentTimerCount_ms = newTimerCount_ms; +#endif +} +/*********************************************************************//** + * @brief * The setupDMAForWriteCmd function sets the byte count for the next DMA * write command to the FPGA. * @details Inputs: none