c - Writing/Accessing I/O port hardware watchdog register linux -
i trying access/write hardware watchdog on cpu linux. have never done before knowledge little. link rtd user manual http://www.rtd.com/new_manuals/hardware/cpumodules/cmv34m_bdm610000077a.pdf (see page 64 watchdog timer information) , small example program found on internet , edited. enabled watchdog setup register in bios, , ran attached program. program runs , doesn’t output errors, doesn’t seem system doesn’t reset(as should if don’t “kick dog”) though enabling watchdog writing 1s. hoping maybe have insight doing wrong.
#include <stdio.h> #include <unistd.h> #include <sys/io.h> #include <stdlib.h> #define baseport 0x985 int main() { /* access ports */ if (ioperm(baseport, 3, 1)) {perror("ioperm"); exit(1);} /* set data signals (d0-7) of port high (1) */ outb(1, baseport); /* sleep while (100 ms) */ usleep(100000); /* read status port (base+1) , display result */ printf("status: %d\n", inb(baseport + 1)); /* don't need ports anymore */ if (ioperm(baseport, 3, 0)) {perror("ioperm"); exit(1);} exit(0); }
try iopl(3) before outb() commands. iopl() not "nice" , portable command, used similar watchdog issue.
Comments
Post a Comment