Lines Matching +full:low +full:- +full:to +full:- +full:high
1 /*-
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 {"w1-gpio", true},
56 #define OWC_GPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx)
57 #define OWC_GPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
59 mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \
61 #define OWC_GPIOBUS_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
80 * By default we only bid to attach if specifically added by our parent in owc_gpiobus_probe()
88 ofw_bus_search_compatible(dev, compat_data)->ocd_data) in owc_gpiobus_probe()
92 device_set_desc(dev, "GPIO one-wire bus"); in owc_gpiobus_probe()
104 sc->sc_dev = dev; in owc_gpiobus_attach()
107 /* Try to configure our pin from fdt data on fdt-based systems. */ in owc_gpiobus_attach()
109 &sc->sc_pin); in owc_gpiobus_attach()
116 * on fdt-based systems). in owc_gpiobus_attach()
120 err = gpio_pin_get_by_child_index(dev, OW_PIN, &sc->sc_pin); in owc_gpiobus_attach()
124 device_printf(sc->sc_dev, in owc_gpiobus_attach()
136 device_add_child(sc->sc_dev, "ow", DEVICE_UNIT_ANY); in owc_gpiobus_attach()
152 gpio_pin_release(sc->sc_pin); in owc_gpiobus_detach()
165 * below, and let the how be confined to here.
167 #define OUTPIN(sc) gpio_pin_setflags((sc)->sc_pin, GPIO_PIN_OUTPUT)
168 #define INPIN(sc) gpio_pin_setflags((sc)->sc_pin, GPIO_PIN_INPUT)
169 #define GETPIN(sc, bp) gpio_pin_is_active((sc)->sc_pin, (bp))
170 #define LOW(sc) gpio_pin_set_active((sc)->sc_pin, false) macro
173 * WRITE-ONE (see owll_if.m for timings) From Figure 4-1 AN-937
175 * |<---------tSLOT---->|<-tREC->|
176 * High RRRRM | RRRRRRRRRRRR|RRRRRRRRM
179 * Low MMMMMMM | | | MMMMMM...
180 * |<-tLOW1->| | |
181 * |<------15us--->| |
182 * |<--------60us---->|
193 /* Force low */ in owc_gpiobus_write_one()
195 LOW(sc); in owc_gpiobus_write_one()
196 DELAY(t->t_low1); in owc_gpiobus_write_one()
198 /* Allow resistor to float line high */ in owc_gpiobus_write_one()
200 DELAY(t->t_slot - t->t_low1 + t->t_rec); in owc_gpiobus_write_one()
208 * WRITE-ZERO (see owll_if.m for timings) From Figure 4-2 AN-937
210 * |<---------tSLOT------>|<-tREC->|
211 * High RRRRM | | |RRRRRRRM
214 * Low MMMMMMMMMMMMMMMMMMMMMR MMMMMM...
215 * |<--15us->| | |
216 * |<------60us--->| |
217 * |<-------tLOW0------>|
228 /* Force low */ in owc_gpiobus_write_zero()
230 LOW(sc); in owc_gpiobus_write_zero()
231 DELAY(t->t_low0); in owc_gpiobus_write_zero()
233 /* Allow resistor to float line high */ in owc_gpiobus_write_zero()
235 DELAY(t->t_slot - t->t_low0 + t->t_rec); in owc_gpiobus_write_zero()
243 * READ-DATA (see owll_if.m for timings) From Figure 4-3 AN-937
245 * |<---------tSLOT------>|<-tREC->|
246 * High RRRRM | rrrrrrrrrrrrrrrRRRRRRRM
249 * Low MMMMMMMSSSSSSSSSSSSSSR MMMMMM...
251 * |<------tRDV---->| |
252 * ->| |<-tRELEASE
254 * r -- allowed to pull high via the resitor when slave writes a 1-bit
268 /* Force low for t_lowr microseconds */ in owc_gpiobus_read_data()
271 LOW(sc); in owc_gpiobus_read_data()
272 DELAY(t->t_lowr); in owc_gpiobus_read_data()
275 * Slave is supposed to hold the line low for t_rdv microseconds for 0 in owc_gpiobus_read_data()
276 * and immediately float it high for a 1. This is measured from the in owc_gpiobus_read_data()
277 * master's pushing the line low. in owc_gpiobus_read_data()
283 } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == false); in owc_gpiobus_read_data()
286 if (now - then < t->t_rdv * SBT_1US) in owc_gpiobus_read_data()
294 } while (now - then < (t->t_slot + t->t_rec) * SBT_1US); in owc_gpiobus_read_data()
300 * RESET AND PRESENCE PULSE (see owll_if.m for timings) From Figure 4-4 AN-937
302 * |<---------tRSTH------------>|
303 * High RRRM | | RRRRRRRS | RRRR RRM
306 * Low MMMMMMMM MMMMMM| | | SSSSSSSSSS MMMMMM
307 * |<----tRSTL--->| | |<-tPDL---->|
308 * | ->| |<-tR | |
311 * Note: for Regular Speed operations, tRSTL + tR should be less than 960us to
315 * -1 = Bus wiring error (stuck low).
329 * high. Badly wired buses that are missing the required pull up, or in owc_gpiobus_reset_and_presence()
330 * that have a short circuit to ground cause all kinds of mischief when in owc_gpiobus_reset_and_presence()
331 * we try to read them later. Return EIO if the bus is currently low. in owc_gpiobus_reset_and_presence()
336 *bit = -1; in owc_gpiobus_reset_and_presence()
342 /* Force low */ in owc_gpiobus_reset_and_presence()
344 LOW(sc); in owc_gpiobus_reset_and_presence()
345 DELAY(t->t_rstl); in owc_gpiobus_reset_and_presence()
347 /* Allow resistor to float line high and then wait for reset pulse */ in owc_gpiobus_reset_and_presence()
349 DELAY(t->t_pdh + t->t_pdl / 2); in owc_gpiobus_reset_and_presence()
357 DELAY(t->t_rsth - (t->t_pdh + t->t_pdl / 2)); /* Timing not critical for this one */ in owc_gpiobus_reset_and_presence()
361 * window. It should return to high. If it is low, then we have some in owc_gpiobus_reset_and_presence()
366 *bit = -1; in owc_gpiobus_reset_and_presence()