2 /* $OpenBSD: onewire_bitbang.c,v 1.1 2006/03/04 16:27:03 grange Exp $ */
5 * Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include <sys/cdefs.h>
21 __KERNEL_RCSID(0, "$NetBSD$");
24 * 1-Wire bus bit-banging routines.
27 #include <sys/param.h>
28 #include <sys/systm.h>
29 #include <sys/device.h>
31 #include <dev/onewire/onewirevar.h>
34 onewire_bb_reset(const struct onewire_bbops
*ops
, void *arg
)
45 for (i
= 0; i
< 6; i
++) {
46 if ((rv
= ops
->bb_get(arg
)) == 0)
57 onewire_bb_bit(const struct onewire_bbops
*ops
, void *arg
, int value
)
68 for (i
= 0; i
< 15; i
++) {
69 if ((rv
= ops
->bb_get(arg
)) == 0)