h/w watchdog timer



Hello,
I want to use hardware watchdog.
I have sample code, but how implement this under WinCE5.0?
Should I write device driver?
Will this work if I use function: (READ/WRITE)_PORT_(UCHAR/ULONG) instead
(in/out)_port_(8/32)?
Will function pci_write_8 from sample code work?

Thanks,
Fizyq.

Fragment of sample code:
/* for 32-bit platforms: */
typedef unsigned char u8; /* unsigned 8-bit */
typedef unsigned short u16; /* unsigned 16-bit */
typedef unsigned long u32; /* unsigned 32-bit */
/* 8-bit input cycle from a port on x86 platform */
u8 in_port_8( u16 port )
{
u8 val;
_asm {
push dx
push ax
mov dx,
in al, dx
mov val, al
pop ax
pop dx
}
return val;
}
....
/* 8-bit write cycle to a PCI device */
void pci_write_8( u32 bus, u32 device, u32 function, u32 reg_index, u8 val )
{
out_port_32( 0xCF8, 0x80000000 | (bus << 16) | (device << 11) |
(function << 8) | (reg_index & 0xFC) );
out_port_8( 0xCFC | (reg_index & 0x3), val );
}
....
void enable_watchdog( u8 seconds )
{
u16 base;
disable_watchdog();
/* this sets up the watchdog timer reload value */
pci_write_8( 0, 0x7, 4, 0x5A, seconds );
/* */
base = pci_read_8( 0, 0x7, 4, 0x48 ) | (pci_read_8( 0, 0x7, 4, 0x49 ) *
256);
base &= 0xFFFC;
/* this enables the reset upon timer timeout */
out_port_8( base + 0x2B, in_port_8( base + 0x2B ) | 0x20 );
/* this starts the timer */
pci_write_8( 0, 0x7, 4, 0x58, (pci_read_8( 0, 0x7, 4, 0x58 ) & 0xF) | 0xA0
);
}
....
.



Relevant Pages

  • WapSend Push
    ... Does anyone know or have any sample code as to how to set up a 'push' ... message using Microsoft's Wap functions? ... There documentation is pretty ...
    (microsoft.public.pocketpc.developer)
  • Re: Looking for pdf docs for programming Apple Pascal
    ... Device and Interrupt Support Tools Manual. ... Attaching a Device Driver ... Sample Code for an Interrupt-Based Driver ...
    (comp.sys.apple2)
  • Re: Looking for pdf docs for programming Apple Pascal
    ... Device and Interrupt Support Tools Manual. ... Attaching a Device Driver ... Sample Code for an Interrupt-Based Driver ... I have the Attach Tools disk, or at least a disk which ...
    (comp.sys.apple2)