For DOS Protected Mode version of sensor core software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

102 lines
1.9 KiB

//----------------------------------------------------------------------------
// Laser Guard Ltd.
// Copyright © 2000-2002. All Rights Reserved.
// Version 1.0 01/01/2000
// Last modification: 08/10/2003
// PROJECT:
// SUBSYSTEM:
// FILE: watchdog.cpp
// AUTHOR: Sergey Chizhevskiy
// OVERVIEW
// ~~~~~~~~
// Source file of watchdog.cpp
//----------------------------------------------------------------------------
#include "stdafx.h"
#include "WatchDog.h"
#ifdef WATCHDOG_ENABLED
void CWatchDog::Update( DWORD dwTime )
{
#ifdef WATCHDOG_TEST_BY_REBOOT
return;
#endif
if( !m_bInitiated )
return;
if( (dwTime - m_dwTime) < 18 )
return;
m_dwTime = dwTime;
switch( m_eType )
{
default:
case WT_UNKNOWN:
break;
case WT_COREMODULE_4DXE:
// update watchdog counter
asm
{
mov ah, 0xC3
mov al, 1 // enable
mov bx, 60 // 60 sec
int 0x15
}
break;
case WT_TRI_M:
// enabled only watchdog timer 1 and reload it
asm
{
mov AL,0x10
mov DX,ZFLINDEX
out DX,AL
mov DX,ZFLDATA8 // read port 0x10
in AL,DX
and AL,0xEF // clear WD1 reload bit
out DX,AL
or AL,0x10 // set WD1 reload bit
out DX,AL
}
break;
case WT_VORTEX_SX:
case WT_VORTEX_DX:
case WT_VORTEX_MX:
unsigned char valb;
unsigned long lTime;
outp(0x22, 0x13); // lock register
outp(0x23, 0xc5); // unlock config
lTime=0x20L*60000L; // 60 sec
outp(0x22,0x3b);
outp(0x23,(lTime>>16)&0xff); // counter msb
outp(0x22,0x3a);
outp(0x23,(lTime>>8)&0xff);
outp(0x22,0x39);
outp(0x33,lTime & 0xff ); // counter lsb
outp(0x22,0x38);
valb = inp(0x23);
outp(0x22,0x38);
outp( 0x23, (valb & 0x0f) | 0xD0); //sys reset
outp(0x22,0x37);
valb = inp(0x23);
outp(0x22,0x37);
outp( 0x23, valb | 0x40); // enable wdt
outp(0x22,0x13); //Lock reg
outp(0x22,0x00); // Lock config
break;
}
// Destroy();
}
#endif // WATCHDOG_ENABLED