Watchdog driver is intended for DataLab PC hardware watchdog circuit control. The driver
contains several interfaces, which enable users to choose the right
interface according to software they use.
Watchdog driver can work as standard Control Web driver for applications developed in this process
control software package.
It also exports standard ActiveX interface so it can be used with any program
created in COM-aware development system (Visual Basic, Delphi, C#,
etc.). Driver ActiveX interface is
described in another document.
It is also possible to load the driver DLL from any C/C++
code, obtain addresses of its interface functions and call them
directly.
List of sections: - Driver functions
- Control Web driver
- DLL procedural interface
Driver functions
The DataLab PC computers are equipped
with hardware watchdog, which helps to increase reliability in
demanding applications. If the control program hangs (be it due to
critical error, infinite loop etc.), watchdog resets the computer
and restores the initial state.
It is necessary to activate the watchdog first. Then it checks
for periodical signaling from running application. If the
application fails for some reason, watchdog resets the computer.
The period can be set with the step 0.1s up to approx.
6,500s. Application
deactivates the watchdog again upon its termination.
Control Web driver
It is possible to control the watchdog circuit from
Control Web application simply by writing to
output channel or by invoking driver procedure. Controlling the
watchdog is very simple.
Driver channels
The driver offers only one channel (No.1), through which it
is possible to activate and deactivate the watchdog as well as
refresh (signal) it to prevent the computer reboot. The value
written to the channel defines the time (in seconds), after
which the computer should be rebooted. It is then necessary to
write the value again before the time interval expires. Time
resolution (and also the shortest period) is
0.1s. First
write to the watchdog channel also activates the watchdog,
writing the value 0 deactivates it.
Driver procedures
Control Web application can invoke
so-called driver procedures to perform various
driver-specific tasks. Invoking is performed through system
OCL procedure:
system.DriverQueryProc( DriverName : string; Param1 : any; &Param2 : any )
Parameters have the following meaning: Parameter | Meaning |
---|
DriverName | symbolic driver name as defined in
application | Param1 | passed the driver procedure name | Param2 | any value used as driver procedure parameter (it can
also return value back to application) |
DriverName and Param1 are passed
as text strings. Param2 type depends on the
particular procedure.
Overview and meaning of driver procedures (Param1 parameter)
- SetTimeout
-
This procedure works similarly to channel
No.1 — its calling works the same way like
writing to the driver channel. Param2
should pass time (in seconds), after which the computer
should be rebooted. It is then necessary to invoke the
procedure again before the time interval expires. Time
resolution (and also the shortest period) is
0.1s.
First invoke of the driver procedure with non-zero
parameter also activates the watchdog, passing the value
0 deactivates it.
Driver map file and data types
The map file contains types and directions of data channels
and its contents should not be modified:
begin
1 real output
end.
DLL procedural interface
Procedural interface enables watchdog control from any program
written in C/C++, Basic, Pascal etc. The language should support
explicit loading of DLL (Dynamic Link Library) and calling of
functions exported by the DLL.
The watchdog driver is implemented in dynamic link
library 'dlwdd.dll'. This DLL exports the following
functions: Connect | Function for connecting to the watchdog circuit. If the
watchdog hardware is not present (or properly configured), this
function returns False. If the connection to
watchdog succeeded it returns True. | Disconnect | Function for disconnecting from the watchdog
circuit. | IsConnected | Function return current connection state. Returned value
True means the driver is currently connected to the
hardware. | SetTime | Function activates, refreshes and also deactivates the
watchdog (depending on the passed value). Function parameter
should pass time (in seconds), after which the computer should
be rebooted. It is then necessary to call the function again
before the time interval expires. Time resolution (and also the
shortest period) is 0.1s. First function call with non-zero
parameter also activates the watchdog, passing the value 0
deactivates it. |
Function prototypes in C/C++:
BOOL __stdcall Connect()
void __stdcall Disconnect()
BOOL __stdcall IsConnected()
BOOL __stdcall SetTime(float wt)
Example of function declarations in Visual Basic:
Public Declare Function Connect Lib "dlwdd.dll" () As Long
Public Declare Sub Disconnect Lib "dlwdd.dll" ()
Public Declare Function IsConnected Lib "dlwdd.dll" () As Long
Public Declare Function SetTime Lib "dlwdd.dll" (ByVal Time As Single) As Long
|