ds2482owvar.h revision 1.3 1 1.3 riastrad /* $NetBSD: ds2482owvar.h,v 1.3 2024/11/06 19:42:25 riastradh Exp $ */
2 1.1 brad
3 1.1 brad /*
4 1.1 brad * Copyright (c) 2024 Brad Spencer <brad (at) anduin.eldar.org>
5 1.1 brad *
6 1.1 brad * Permission to use, copy, modify, and distribute this software for any
7 1.1 brad * purpose with or without fee is hereby granted, provided that the above
8 1.1 brad * copyright notice and this permission notice appear in all copies.
9 1.1 brad *
10 1.1 brad * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 1.1 brad * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 1.1 brad * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 1.1 brad * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 1.1 brad * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 1.1 brad * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 1.1 brad * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1.1 brad */
18 1.1 brad
19 1.1 brad #ifndef _DEV_I2C_DS2482VAR_H_
20 1.1 brad #define _DEV_I2C_DS2482VAR_H_
21 1.1 brad
22 1.3 riastrad #include <sys/types.h>
23 1.3 riastrad
24 1.3 riastrad #include <sys/device_if.h>
25 1.3 riastrad #include <sys/mutex.h>
26 1.3 riastrad
27 1.3 riastrad #include <dev/i2c/i2cvar.h>
28 1.3 riastrad #include <dev/onewire/onewirevar.h>
29 1.3 riastrad
30 1.1 brad #define DS2482_NUM_INSTANCES 8
31 1.1 brad
32 1.1 brad struct ds2482ow_sc;
33 1.1 brad
34 1.1 brad struct ds2482_instance {
35 1.1 brad int sc_i_channel;
36 1.1 brad struct onewire_bus sc_i_ow_bus;
37 1.1 brad device_t sc_i_ow_dev;
38 1.1 brad struct ds2482ow_sc *sc;
39 1.1 brad };
40 1.1 brad
41 1.1 brad struct ds2482ow_sc {
42 1.1 brad int sc_ds2482debug;
43 1.1 brad device_t sc_dev;
44 1.1 brad i2c_tag_t sc_tag;
45 1.1 brad i2c_addr_t sc_addr;
46 1.1 brad kmutex_t sc_mutex;
47 1.1 brad struct sysctllog *sc_ds2482log;
48 1.1 brad bool sc_activepullup;
49 1.1 brad bool sc_strongpullup;
50 1.1 brad bool sc_is_800;
51 1.1 brad struct ds2482_instance sc_instances[DS2482_NUM_INSTANCES];
52 1.1 brad };
53 1.1 brad
54 1.2 riastrad #endif /* _DEV_I2C_DS2482VAR_H_ */
55