diff options
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c')
-rw-r--r-- | software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c index 6e5694f..49de3f5 100644 --- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c +++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c @@ -23,9 +23,9 @@ You should have received a copy of the GNU General Public License along with the OCT6100 GPL API; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -$Octasic_Release: OCT612xAPI-01.02.01 $ +$Octasic_Release: OCT612xAPI-01.02.04 $ -$Octasic_Revision: 87 $ +$Octasic_Revision: 91 $ \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ @@ -1817,6 +1817,7 @@ UINT32 Oct6100ApiCheckProcessorState( UINT32 ulNlpTimestamp; UINT32 ulAfTimestamp; UINT32 ulTimestampDiff; + UINT32 ulMafWPnt; UINT32 ulResult; UINT32 i; @@ -1933,6 +1934,40 @@ UINT32 Oct6100ApiCheckProcessorState( /*-----------------------------------------------------------------------*/ + /* Reading the NLP number of MAF events. */ + + for ( i = 0; i < cOCT6100_MAX_LOOP; i++ ) + { + /* Read the timestamp. */ + ReadBurstParams.ulReadAddress = 0x08000004; + ReadBurstParams.ulReadLength = 2; + + mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + /* Read the high part again to make sure it didn't wrap. */ + ReadParams.ulReadAddress = 0x08000004; + + mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) + if ( ulResult != cOCT6100_ERR_OK ) + return ulResult; + + /* Check if the low part wrapped. */ + if ( ausReadData[ 0 ] == usReadData ) + break; + } + + if ( i == cOCT6100_MAX_LOOP ) + return cOCT6100_ERR_INTRPTS_NLP_TIMESTAMP_READ_TIMEOUT; + + /* save the Maf pointer */ + ulMafWPnt = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; + + /*-----------------------------------------------------------------------*/ + + + /*-----------------------------------------------------------------------*/ /* Check the validity of the timestamp. */ if ( ulAfTimestamp > ulNlpTimestamp ) @@ -1988,6 +2023,52 @@ UINT32 Oct6100ApiCheckProcessorState( /*-----------------------------------------------------------------------*/ + + /*-----------------------------------------------------------------------*/ + /* Check on number of MAF events since last ISR call. */ + + if ( pSharedInfo->MiscVars.fActiveChannelsChange == FALSE ) + { + UINT32 ulMafEventDelta; + UINT32 ulNlpTimestampDelta; + + ulNlpTimestampDelta = ulNlpTimestamp - pSharedInfo->MiscVars.aulNlpTimestamps[0]; + + if ( ulNlpTimestampDelta > 4200 ) + { + UINT32 ulExpected; + + pSharedInfo->MiscVars.aulNumMafEvents[1] = pSharedInfo->MiscVars.aulNumMafEvents[0]; + pSharedInfo->MiscVars.aulNumMafEvents[0] = ulMafWPnt; + + pSharedInfo->MiscVars.aulNlpTimestamps[1] = pSharedInfo->MiscVars.aulNlpTimestamps[0]; + pSharedInfo->MiscVars.aulNlpTimestamps[0] = ulNlpTimestamp; + + ulMafEventDelta = pSharedInfo->MiscVars.aulNumMafEvents[0] - pSharedInfo->MiscVars.aulNumMafEvents[1]; + ulNlpTimestampDelta = pSharedInfo->MiscVars.aulNlpTimestamps[0] - pSharedInfo->MiscVars.aulNlpTimestamps[1]; + + ulExpected = (ulNlpTimestampDelta * 2 * pSharedInfo->MiscVars.ulNumActiveChannels) / 6500; + if ( ulMafEventDelta < ulExpected ) + { + f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_10; + f_pIntFlags->fFatalGeneral = TRUE; + pSharedInfo->ErrorStats.fFatalChipError = TRUE; + } + } + } + else + { + pSharedInfo->MiscVars.aulNumMafEvents[1] = pSharedInfo->MiscVars.aulNumMafEvents[0]; + pSharedInfo->MiscVars.aulNumMafEvents[0] = ulMafWPnt; + + pSharedInfo->MiscVars.aulNlpTimestamps[1] = pSharedInfo->MiscVars.aulNlpTimestamps[0]; + pSharedInfo->MiscVars.aulNlpTimestamps[0] = ulNlpTimestamp; + + pSharedInfo->MiscVars.fActiveChannelsChange = FALSE; + } + + /*-----------------------------------------------------------------------*/ + |