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