__sc1200wdt_read_data(WDCF, ®); /* assert WDO when any of the following interrupts are triggered too */
reg |= (KBC_IRQ | MSE_IRQ | UART1_IRQ | UART2_IRQ);
__sc1200wdt_write_data(WDCF, reg); /* set the timeout and get the ball rolling */
__sc1200wdt_write_data(WDTO, timeout);
/* This returns the status of the WDO signal, inactive high. */ staticinlineint sc1200wdt_status(void)
{ unsignedchar ret;
sc1200wdt_read_data(WDST, &ret); /* If the bit is inactive, the watchdog is enabled, so return *KEEPALIVEPINGwhichisabitofakludgebecausethere'snothing *elseforenabled/disabledstatus
*/ return (ret & 0x01) ? 0 : WDIOF_KEEPALIVEPING;
}
staticint sc1200wdt_open(struct inode *inode, struct file *file)
{ /* allow one at a time */ if (test_and_set_bit(0, &open_flag)) return -EBUSY;
switch (cmd) { case WDIOC_GETSUPPORT: if (copy_to_user(argp, &ident, sizeof(ident))) return -EFAULT; return0;
case WDIOC_GETSTATUS: return put_user(sc1200wdt_status(), p);
case WDIOC_GETBOOTSTATUS: return put_user(0, p);
case WDIOC_SETOPTIONS:
{ int options, retval = -EINVAL;
if (get_user(options, p)) return -EFAULT;
if (options & WDIOS_DISABLECARD) {
sc1200wdt_stop();
retval = 0;
}
if (options & WDIOS_ENABLECARD) {
sc1200wdt_start();
retval = 0;
}
return retval;
} case WDIOC_KEEPALIVE:
sc1200wdt_write_data(WDTO, timeout); return0;
case WDIOC_SETTIMEOUT: if (get_user(new_timeout, p)) return -EFAULT; /* the API states this is given in secs */
new_timeout /= 60; if (new_timeout < 0 || new_timeout > MAX_TIMEOUT) return -EINVAL;
timeout = new_timeout;
sc1200wdt_write_data(WDTO, timeout);
fallthrough; /* and return the new timeout */
case WDIOC_GETTIMEOUT: return put_user(timeout * 60, p);
staticint __init sc1200wdt_probe(void)
{ /* The probe works by reading the PMC3 register's default value of 0x0e *thereisonecaveat,ifthedevicedisablestheparallelportorany *oftheUARTswewon'tbeabletodetectit. *NB.ThiscouldbedonewithaccuracybyreadingtheSIDregisters, *butwedon'thaveaccesstothoseioregions.
*/
staticint scl200wdt_pnp_probe(struct pnp_dev *dev, conststruct pnp_device_id *dev_id)
{ /* this driver only supports one card at a time */ if (wdt_dev || !isapnp) return -EBUSY;
#ifdefined CONFIG_PNP if (isapnp) {
ret = pnp_register_driver(&scl200wdt_pnp_driver); if (ret) goto out_clean;
} #endif
if (io == -1) {
pr_err("io parameter must be specified\n");
ret = -EINVAL; goto out_pnp;
}
#ifdefined CONFIG_PNP /* now that the user has specified an IO port and we haven't detected
* any devices, disable pnp support */ if (isapnp)
pnp_unregister_driver(&scl200wdt_pnp_driver);
isapnp = 0; #endif
if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
pr_err("Unable to register IO port %#x\n", io);
ret = -EBUSY; goto out_pnp;
}
ret = sc1200wdt_probe(); if (ret) goto out_io;
ret = register_reboot_notifier(&sc1200wdt_notifier); if (ret) {
pr_err("Unable to register reboot notifier err = %d\n", ret); goto out_io;
}
ret = misc_register(&sc1200wdt_miscdev); if (ret) {
pr_err("Unable to register miscdev on minor %d\n",
WATCHDOG_MINOR); goto out_rbt;
}
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.