Lines Matching +full:- +full:273150
1 /*-
137 pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger in ow_temp_event_thread()
138 mtx_lock(&sc->temp_lock); in ow_temp_event_thread()
139 sc->flags |= OW_TEMP_RUNNING; in ow_temp_event_thread()
140 mtx_unlock(&sc->temp_lock); in ow_temp_event_thread()
141 ow_temp_read_power_supply(sc->dev, &sc->parasite); in ow_temp_event_thread()
142 if (sc->parasite) in ow_temp_event_thread()
143 device_printf(sc->dev, "Running in parasitic mode unsupported\n"); in ow_temp_event_thread()
144 mtx_lock(&sc->temp_lock); in ow_temp_event_thread()
145 while ((sc->flags & OW_TEMP_DONE) == 0) { in ow_temp_event_thread()
146 mtx_unlock(&sc->temp_lock); in ow_temp_event_thread()
147 ow_temp_convert_t(sc->dev); in ow_temp_event_thread()
148 mtx_lock(&sc->temp_lock); in ow_temp_event_thread()
149 msleep(sc, &sc->temp_lock, 0, "owtcvt", hz); in ow_temp_event_thread()
150 if (sc->flags & OW_TEMP_DONE) in ow_temp_event_thread()
152 mtx_unlock(&sc->temp_lock); in ow_temp_event_thread()
153 for (retries = 5; retries > 0; retries--) { in ow_temp_event_thread()
154 rv = ow_temp_read_scratchpad(sc->dev, scratch, sizeof(scratch)); in ow_temp_event_thread()
156 crc = own_crc(sc->dev, scratch, sizeof(scratch) - 1); in ow_temp_event_thread()
158 if (sc->type == OWT_DS1820) { in ow_temp_event_thread()
166 tmp += 16 - scratch[6] - 4; /* count_per_c == 16 */ in ow_temp_event_thread()
171 sc->temp = tmp * 1000 / 16 + 273150; in ow_temp_event_thread()
174 sc->bad_crc++; in ow_temp_event_thread()
176 sc->bad_reads++; in ow_temp_event_thread()
178 mtx_lock(&sc->temp_lock); in ow_temp_event_thread()
179 msleep(sc, &sc->temp_lock, 0, "owtcvt", sc->reading_interval); in ow_temp_event_thread()
181 sc->flags &= ~OW_TEMP_RUNNING; in ow_temp_event_thread()
182 mtx_unlock(&sc->temp_lock); in ow_temp_event_thread()
192 sc->dev = dev; in ow_temp_attach()
193 sc->type = ow_get_family(dev); in ow_temp_attach()
198 &sc->temp, 0, sysctl_handle_int, in ow_temp_attach()
203 &sc->bad_crc, 0, in ow_temp_attach()
208 &sc->bad_reads, 0, in ow_temp_attach()
213 &sc->reading_interval, 0, in ow_temp_attach()
218 &sc->parasite, 0, in ow_temp_attach()
225 sc->temp = -1; in ow_temp_attach()
226 sc->reading_interval = 10 * hz; in ow_temp_attach()
227 mtx_init(&sc->temp_lock, "lock for doing temperature", NULL, MTX_DEF); in ow_temp_attach()
229 if (kproc_create(ow_temp_event_thread, sc, &sc->event_thread, 0, 0, in ow_temp_attach()
253 mtx_lock(&sc->temp_lock); in ow_temp_detach()
254 sc->flags |= OW_TEMP_DONE; in ow_temp_detach()
255 while (sc->flags & OW_TEMP_RUNNING) { in ow_temp_detach()
257 msleep(sc->event_thread, &sc->temp_lock, PWAIT, "owtun", 0); in ow_temp_detach()
259 mtx_destroy(&sc->temp_lock); in ow_temp_detach()