2 * Copyright (c) 2015 M. Warner Losh <imp@FreeBSD.org>
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice unmodified, this list of conditions, and the following
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 enum ow_device_ivars {
36 #define OW_ACCESSOR(var, ivar, type) \
37 __BUS_ACCESSOR(ow, var, OW, ivar, type);
39 OW_ACCESSOR(family, FAMILY, uint8_t)
40 OW_ACCESSOR(romid, ROMID, uint8_t *)
45 * The following likely should be in the own.h file, but needs to be here to
46 * avoid recursive issues when defining the own_if.m interface.
50 * Generalized command structure for a 1wire bus transaction. Not all possible
51 * transactions on the 1wire bus can be represented here (a notable exception
52 * being both the search ROM commands), but most of them can be, allowing for
53 * general transactions from userland. A lower-level interface to the link
54 * layer is also provided.
61 uint32_t flags; /* Various flags */
62 #define OW_FLAG_OVERDRIVE 1 /* Send xpt stuff overdrive speed */
63 #define OW_FLAG_READ_BIT 2 /* Read a single bit after xpt_cmd */
64 uint8_t rom_len; /* Number of ROM bytes to send */
65 uint8_t rom_cmd[MAX_ROM]; /* Rom command to send */
66 uint8_t rom_read_len; /* Number of bytes to read */
67 uint8_t rom_read[MAX_ROM]; /* Extra bytes read */
68 uint8_t xpt_len; /* Total transport bytes to send */
69 uint8_t xpt_cmd[MAX_XPT]; /* Device specific command to send, if flagged */
70 uint8_t xpt_read_len; /* Number of bytes to read after */
71 uint8_t xpt_read[MAX_READ]; /* Buffer for read bytes */
74 typedef uint64_t romid_t;
76 #endif /* DEV_OW_OW_H */