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