staticvoid wdt_disable(void)
{ /* disable the watchdog */ if (test_and_clear_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) {
inb_p(SBC7240_DISABLE_PORT);
pr_info("Watchdog timer is now disabled\n");
}
}
staticvoid wdt_enable(void)
{ /* enable the watchdog */ if (!test_and_set_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) {
inb_p(SBC7240_ENABLE_PORT);
pr_info("Watchdog timer is now enabled\n");
}
}
staticint wdt_set_timeout(int t)
{ if (t < 1 || t > SBC7240_MAX_TIMEOUT) {
pr_err("timeout value must be 1<=x<=%d\n", SBC7240_MAX_TIMEOUT); return -1;
} /* set the timeout */
outb_p((unsigned)t, SBC7240_SET_TIMEOUT_PORT);
timeout = t;
pr_info("timeout set to %d seconds\n", t); return 0;
}
/* Whack the dog */ staticinlinevoid wdt_keepalive(void)
{ if (test_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status))
inb_p(SBC7240_ENABLE_PORT);
}
if (count) { if (!nowayout) {
clear_bit(SBC7240_EXPECT_CLOSE_STATUS_BIT,
&wdt_status);
/* is there a magic char ? */ for (i = 0; i != count; i++) { if (get_user(c, buf + i)) return -EFAULT; if (c == SBC7240_MAGIC_CHAR) {
set_bit(SBC7240_EXPECT_CLOSE_STATUS_BIT,
&wdt_status); break;
}
}
}
staticint __init sbc7240_wdt_init(void)
{ int rc = -EBUSY;
if (!request_region(SBC7240_ENABLE_PORT, 1, "SBC7240 WDT")) {
pr_err("I/O address 0x%04x already in use\n",
SBC7240_ENABLE_PORT);
rc = -EIO; goto err_out;
}
/* The IO port 0x043 used to disable the watchdog * is already claimed by the system timer, so we
* can't request_region() it ...*/
if (timeout < 1 || timeout > SBC7240_MAX_TIMEOUT) {
timeout = SBC7240_TIMEOUT;
pr_info("timeout value must be 1<=x<=%d, using %d\n",
SBC7240_MAX_TIMEOUT, timeout);
}
wdt_set_timeout(timeout);
wdt_disable();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.