pcf8584var.h revision 1.4 1 1.4 martin /* $NetBSD: pcf8584var.h,v 1.4 2010/02/28 11:47:28 martin Exp $ */
2 1.4 martin /* $OpenBSD: pcf8584var.h,v 1.5 2007/10/20 18:46:21 kettenis Exp $ */
3 1.1 tnn
4 1.4 martin /*
5 1.4 martin * Copyright (c) 2006 David Gwynne <dlg (at) openbsd.org>
6 1.1 tnn *
7 1.4 martin * Permission to use, copy, modify, and distribute this software for any
8 1.4 martin * purpose with or without fee is hereby granted, provided that the above
9 1.4 martin * copyright notice and this permission notice appear in all copies.
10 1.1 tnn *
11 1.4 martin * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 1.4 martin * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 1.4 martin * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 1.4 martin * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 1.4 martin * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 1.4 martin * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 1.4 martin * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 1.1 tnn */
19 1.1 tnn
20 1.4 martin struct pcfiic_softc {
21 1.4 martin device_t sc_dev;
22 1.4 martin
23 1.4 martin bus_space_tag_t sc_iot;
24 1.4 martin bus_space_handle_t sc_ioh;
25 1.4 martin bus_space_handle_t sc_ioh2;
26 1.4 martin int sc_master;
27 1.4 martin u_int8_t sc_addr;
28 1.4 martin u_int8_t sc_clock;
29 1.4 martin u_int8_t sc_regmap[2];
30 1.4 martin
31 1.4 martin int sc_poll;
32 1.1 tnn
33 1.4 martin struct i2c_controller sc_i2c;
34 1.4 martin krwlock_t sc_lock;
35 1.1 tnn };
36 1.1 tnn
37 1.4 martin /* clock divisor settings */
38 1.4 martin #define PCF_CLOCK_3 0x00 /* 3 MHz */
39 1.4 martin #define PCF_CLOCK_4_43 0x10 /* 4.43 MHz */
40 1.4 martin #define PCF_CLOCK_6 0x14 /* 6 MHz */
41 1.4 martin #define PCF_CLOCK_8 0x18 /* 8 MHz */
42 1.4 martin #define PCF_CLOCK_12 0x1c /* 12 MHz */
43 1.4 martin
44 1.4 martin /* SCL frequency settings */
45 1.4 martin #define PCF_FREQ_90 0x00 /* 90 kHz */
46 1.4 martin #define PCF_FREQ_45 0x01 /* 45 kHz */
47 1.4 martin #define PCF_FREQ_11 0x02 /* 11 kHz */
48 1.4 martin #define PCF_FREQ_1_5 0x03 /* 1.5 kHz */
49 1.4 martin
50 1.4 martin void pcfiic_attach(struct pcfiic_softc *, i2c_addr_t, u_int8_t, int);
51 1.4 martin int pcfiic_intr(void *);
52