staticunsignedint clear_wait = 100;
MODULE_PARM_DESC(clear_wait, "Maximum number of port reads when polling for signal clear," " zero turns clear edge capture off entirely");
module_param(clear_wait, uint, 0);
static DEFINE_IDA(pps_client_index);
/* internal per port structure */ struct pps_client_pp { struct pardevice *pardev; /* parport device */ struct pps_device *pps; /* PPS device */ unsignedint cw; /* port clear timeout */ unsignedint cw_err; /* number of timeouts */ int index; /* device number */
};
/* We have to disable interrupts here. The idea is to prevent * other interrupts on the same processor to introduce random * lags while polling the port. Reading from IO port is known * to take approximately 1us while other interrupt handlers can * take much more potentially. * * Interrupts won't be disabled for a long time because the * number of polls is limited by clear_wait parameter which is * kept rather low. So it should never be an issue.
*/
local_irq_save(flags); /* check the signal (no signal means the pulse is lost this time) */ if (!signal_is_set(port)) {
local_irq_restore(flags);
dev_err(&dev->pps->dev, "lost the signal\n"); goto out_assert;
}
/* poll the port until the signal is unset */ for (i = dev->cw; i; i--) if (!signal_is_set(port)) {
pps_get_ts(&ts_clear);
local_irq_restore(flags);
dev->cw_err = 0; goto out_both;
}
local_irq_restore(flags);
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.