Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / bus / smbus / smbus_if.m
1 #
2 # Copyright (c) 1998 Nicolas Souchu
3 # All rights reserved.
4 #
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.
13 #
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.
25 #
26 # $FreeBSD: src/sys/dev/smbus/smbus_if.m,v 1.5 1999/08/28 00:42:30 peter Exp $
27 #
28
29 INTERFACE smbus;
30
31 #
32 # Interpret interrupt
33 #
34 METHOD void intr {
35         device_t dev;
36         u_char devaddr;
37         char low;
38         char high;
39         int error;
40 };
41
42 #
43 # smbus callback
44 #
45 METHOD int callback {
46         device_t dev;
47         int index;
48         caddr_t data;
49 };
50
51 #
52 # Quick command
53 #
54 METHOD int quick {
55         device_t dev;
56         u_char slave;
57         int how;
58 };
59
60 #
61 # Send Byte command
62 #
63 METHOD int sendb {
64         device_t dev;
65         u_char slave;
66         char byte;
67 };
68
69 #
70 # Receive Byte command
71 #
72 METHOD int recvb {
73         device_t dev;
74         u_char slave;
75         char *byte;
76 };
77
78 #
79 # Write Byte command
80 #
81 METHOD int writeb {
82         device_t dev;
83         u_char slave;
84         char cmd;
85         char byte;
86 };
87
88 #
89 # Write Word command
90 #
91 METHOD int writew {
92         device_t dev;
93         u_char slave;
94         char cmd;
95         short word;
96 };
97
98 #
99 # Read Byte command
100 #
101 METHOD int readb {
102         device_t dev;
103         u_char slave;
104         char cmd;
105         char *byte;
106 };
107
108 #
109 # Read Word command
110 #
111 METHOD int readw {
112         device_t dev;
113         u_char slave;
114         char cmd;
115         short *word;
116 };
117
118 #
119 # Process Call command
120 #
121 METHOD int pcall {
122         device_t dev;
123         u_char slave;
124         char cmd;
125         short sdata;
126         short *rdata;
127 };
128
129 #
130 # Block Write command
131 #
132 METHOD int bwrite {
133         device_t dev;
134         u_char slave;
135         char cmd;
136         u_char count;
137         char *buf;
138 };
139
140 #
141 # Block Read command
142 #
143 METHOD int bread {
144         device_t dev;
145         u_char slave;
146         char cmd;
147         u_char count;
148         char *buf;
149 };