Mercurial > vordog
changeset 8:a28764b2a28e
modify selection of timeout for 2^n nanoseconds
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 08 Jul 2008 17:10:01 +0800 |
parents | 5a281ce7453c |
children | b4f4a69ea86a |
files | vordog.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/vordog.c Tue Jul 08 16:06:24 2008 +0800 +++ b/vordog.c Tue Jul 08 17:10:01 2008 +0800 @@ -201,21 +201,22 @@ * after 4 times of initial value. So, it only (i * 4) seconds in range * of 4 ~ (255 * 4), where i is one of positive integer, are supported. * - * The supported time intervals of watchdog(9) are 2^31~2^39 nanoseconds. + * The supported time intervals of watchdog(9) are 2^32~2^39 nanoseconds. * vordog used a (i * 4) seconds for 2^n seconds while i * 4 seconds is - * smallest one of intervals that bigger than 2^n seconds. + * closest to 2^n nanoseconds. The variances between i * 4 seconds and + * 2^n nanoseconds are less than 7% (6.8678%). */ static void vordog_wd9_evh(void *priv_data, u_int cmd, int *error) { vd_softc_t sc; u_int timeout, u; - /* 2^31, 2^32, ..., 2^39 nanoseconds */ - static const int timeouts[] = { 1, 2, 3, 5, 9, 18, 35, 69, 138}; + /* 2^32, 2^33, ..., 2^39 nanoseconds */ + static const int timeouts[] = { 1, 2, 4, 9, 17, 34, 69, 137}; sc = (vd_softc_t)priv_data; u = cmd & WD_INTERVAL; - if(u < 31 || u > 39) { + if(u < 32 || u > 39) { /* Out of range! Can not be configured. */ vordog_wd9_disable(); sc->init_val = 0;