Remove an unused include file.
[dragonfly.git] / sys / bus / smbus / smbconf.h
blobb4b6b9bcdf85cd9c1f08efd564562a9a038bb2d1
1 /*-
2 * Copyright (c) 1998 Nicolas Souchu
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
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 AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
26 * $FreeBSD: src/sys/dev/smbus/smbconf.h,v 1.7.14.1 2006/09/22 19:19:16 jhb Exp $
27 * $DragonFly: src/sys/bus/smbus/smbconf.h,v 1.4 2003/11/14 21:46:18 daver Exp $
29 #ifndef __SMBONF_H
30 #define __SMBONF_H
32 #include <sys/queue.h>
34 #define SMBPRI (PZERO+8) /* XXX sleep/wakeup queue priority */
36 #define n(flags) (~(flags) & (flags))
39 * How tsleep() is called in smb_request_bus().
41 #define SMB_DONTWAIT 0
42 #define SMB_NOINTR 0
43 #define SMB_WAIT 0x1
44 #define SMB_INTR 0x2
47 * callback index
49 #define SMB_REQUEST_BUS 0x1
50 #define SMB_RELEASE_BUS 0x2
53 * SMB bus errors
55 #define SMB_ENOERR 0x0
56 #define SMB_EBUSERR 0x1
57 #define SMB_ENOTSUPP 0x2
58 #define SMB_ENOACK 0x4
59 #define SMB_ECOLLI 0x8
60 #define SMB_EABORT 0x10
61 #define SMB_ETIMEOUT 0x20
62 #define SMB_EBUSY 0x40
63 #define SMB_EINVAL 0x100
66 * How Quick command is executed
68 #define SMB_QWRITE 0x0
69 #define SMB_QREAD 0x1
72 * smbus transaction op with pass-thru capabilities
74 * This smbus function is capable of doing a smbus command transaction
75 * (read or write), and can be flagged to not issue the 'cmd' and/or
76 * issue or expect a count field as well as flagged for chaining (no STOP),
77 * which gives it an i2c pass-through capability.
79 * NOSTOP- Caller chaining transactions, do not issue STOP
80 * NOCMD- Do not transmit the command field
81 * NOCNT- Do not transmit (wr) or expect (rd) the count field
83 #define SMB_TRANS_NOSTOP 0x0001 /* do not send STOP at end */
84 #define SMB_TRANS_NOCMD 0x0002 /* ignore cmd field (do not tx) */
85 #define SMB_TRANS_NOCNT 0x0004 /* do not tx or rx count field */
86 #define SMB_TRANS_7BIT 0x0008 /* change address mode to 7-bit */
87 #define SMB_TRANS_10BIT 0x0010 /* change address mode to 10-bit */
88 #define SMB_TRANS_NOREPORT 0x0020 /* do not report errors */
91 * ivars codes
94 #ifdef _KERNEL
96 #define SMBUS_IVAR_ADDR 0x1 /* slave address of the device */
98 int smbus_request_bus(device_t, device_t, int);
99 int smbus_release_bus(device_t, device_t);
100 int smbus_error(int error);
102 void smbus_intr(device_t, u_char, char low, char high, int error);
104 u_char smbus_get_addr(device_t);
106 extern driver_t smbus_driver;
107 extern devclass_t smbus_devclass;
109 #define smbus_quick(bus,slave,how) \
110 (SMBUS_QUICK(device_get_parent(bus), slave, how))
111 #define smbus_sendb(bus,slave,byte) \
112 (SMBUS_SENDB(device_get_parent(bus), slave, byte))
113 #define smbus_recvb(bus,slave,byte) \
114 (SMBUS_RECVB(device_get_parent(bus), slave, byte))
115 #define smbus_writeb(bus,slave,cmd,byte) \
116 (SMBUS_WRITEB(device_get_parent(bus), slave, cmd, byte))
117 #define smbus_writew(bus,slave,cmd,word) \
118 (SMBUS_WRITEW(device_get_parent(bus), slave, cmd, word))
119 #define smbus_readb(bus,slave,cmd,byte) \
120 (SMBUS_READB(device_get_parent(bus), slave, cmd, byte))
121 #define smbus_readw(bus,slave,cmd,word) \
122 (SMBUS_READW(device_get_parent(bus), slave, cmd, word))
123 #define smbus_pcall(bus,slave,cmd,sdata,rdata) \
124 (SMBUS_PCALL(device_get_parent(bus), slave, cmd, sdata, rdata))
125 #define smbus_bwrite(bus,slave,cmd,count,buf) \
126 (SMBUS_BWRITE(device_get_parent(bus), slave, cmd, count, buf))
127 #define smbus_bread(bus,slave,cmd,count,buf) \
128 (SMBUS_BREAD(device_get_parent(bus), slave, cmd, count, buf))
129 #define smbus_trans(bus,slave,cmd,op,wbuf,wcount,rbuf,rcount,actualp) \
130 (SMBUS_TRANS(device_get_parent(bus), slave, cmd, op, \
131 wbuf, wcount, rbuf, rcount, actualp))
133 #define SMBUS_MODVER 1
134 #define SMBUS_MINVER 1
135 #define SMBUS_MAXVER 1
136 #define SMBUS_PREFVER SMBUS_MODVER
138 #endif
140 #endif