summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2006-09-30 15:52:22 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2006-09-30 15:52:22 +0000
commit2acf996510d3ade5b4264df641852177b08779bf (patch)
tree3d6aa22484db1a8cf0f2564a92554f8a95c9ec67
parentc65858d09299e3aeefb135384468c13bbc19e7e6 (diff)
Allow to offload the match rom command to hardware.
-rw-r--r--sys/dev/onewire/onewire.c7
-rw-r--r--sys/dev/onewire/onewirevar.h4
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/onewire/onewire.c b/sys/dev/onewire/onewire.c
index 4d2f21b8fc4..573322e7eb4 100644
--- a/sys/dev/onewire/onewire.c
+++ b/sys/dev/onewire/onewire.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: onewire.c,v 1.4 2006/09/30 08:50:57 grange Exp $ */
+/* $OpenBSD: onewire.c,v 1.5 2006/09/30 15:52:21 grange Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -299,8 +299,13 @@ onewire_triplet(void *arg, int dir)
void
onewire_matchrom(void *arg, u_int64_t rom)
{
+ struct onewire_softc *sc = arg;
+ struct onewire_bus *bus = sc->sc_bus;
int i;
+ if (bus->bus_matchrom != NULL)
+ return (bus->bus_matchrom(bus->bus_cookie, rom));
+
onewire_write_byte(arg, ONEWIRE_CMD_MATCH_ROM);
for (i = 0; i < 8; i++)
onewire_write_byte(arg, (rom >> (i * 8)) & 0xff);
diff --git a/sys/dev/onewire/onewirevar.h b/sys/dev/onewire/onewirevar.h
index 9da8c335bff..ad75d929e4d 100644
--- a/sys/dev/onewire/onewirevar.h
+++ b/sys/dev/onewire/onewirevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: onewirevar.h,v 1.2 2006/09/29 19:38:52 grange Exp $ */
+/* $OpenBSD: onewirevar.h,v 1.3 2006/09/30 15:52:21 grange Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -34,11 +34,13 @@ struct onewire_bus {
void (*bus_read_block)(void *, void *, int);
void (*bus_write_block)(void *, const void *, int);
int (*bus_triplet)(void *, int);
+ void (*bus_matchrom)(void *, u_int64_t);
};
/* Bus methods */
int onewire_lock(void *, int);
void onewire_unlock(void *);
+
int onewire_reset(void *);
int onewire_bit(void *, int);
int onewire_read_byte(void *);