# HG changeset patch # User Thinker K.F. Li # Date 1215508201 -28800 # Node ID a28764b2a28ed491ebb316bca77c3f31212aac44 # Parent 5a281ce7453cc5c9e63fb40f8049ae4a788d3b9c modify selection of timeout for 2^n nanoseconds diff -r 5a281ce7453c -r a28764b2a28e vordog.c --- 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;