smbus_if.m revision 59093
125184Sjkh#
2113674Smtm# Copyright (c) 1998 Nicolas Souchu
3113674Smtm# All rights reserved.
4113674Smtm#
5113674Smtm# Redistribution and use in source and binary forms, with or without
6113674Smtm# modification, are permitted provided that the following conditions
7113674Smtm# are met:
8113674Smtm# 1. Redistributions of source code must retain the above copyright
9113674Smtm#    notice, this list of conditions and the following disclaimer.
10113674Smtm# 2. Redistributions in binary form must reproduce the above copyright
11113674Smtm#    notice, this list of conditions and the following disclaimer in the
12113674Smtm#    documentation and/or other materials provided with the distribution.
13113674Smtm#
14113674Smtm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15113674Smtm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16113674Smtm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17113674Smtm# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18113674Smtm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19113674Smtm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20113674Smtm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21113674Smtm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22113674Smtm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23113674Smtm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24113674Smtm# SUCH DAMAGE.
2550472Speter#
2666830Sobrien# $FreeBSD: head/sys/dev/smbus/smbus_if.m 59093 2000-04-08 14:17:18Z dfr $
2725184Sjkh#
28113674Smtm
29113674Smtm#include <sys/bus.h>
30113674Smtm
31113674SmtmINTERFACE smbus;
3225184Sjkh
33178356Ssam#
34197147Shrs# Interpret interrupt
35197147Shrs#
36178356SsamMETHOD void intr {
37178356Ssam	device_t dev;
38178356Ssam	u_char devaddr;
39178356Ssam	char low;
40178356Ssam	char high;
41178356Ssam	int error;
42178356Ssam};
43178356Ssam
44178356Ssam#
45178356Ssam# smbus callback
46178356Ssam#
47222515SbzMETHOD int callback {
48222515Sbz	device_t dev;
49222515Sbz	int index;
50197139Shrs	caddr_t data;
51178356Ssam};
52178356Ssam
53178356Ssam#
54178356Ssam# Quick command
55197139Shrs#
56197147ShrsMETHOD int quick {
57197147Shrs	device_t dev;
58178356Ssam	u_char slave;
59178356Ssam	int how;
60178356Ssam};
61178356Ssam
62178356Ssam#
63178356Ssam# Send Byte command
64178356Ssam#
65197139ShrsMETHOD int sendb {
66178356Ssam	device_t dev;
67222515Sbz	u_char slave;
68222515Sbz	char byte;
69222515Sbz};
70178356Ssam
71178356Ssam#
72197139Shrs# Receive Byte command
73178356Ssam#
74178356SsamMETHOD int recvb {
75178356Ssam	device_t dev;
76178356Ssam	u_char slave;
77113674Smtm	char *byte;
78113674Smtm};
79113674Smtm
80113674Smtm#
81147088Sbrooks# Write Byte command
82147088Sbrooks#
83113674SmtmMETHOD int writeb {
84113674Smtm	device_t dev;
85113674Smtm	u_char slave;
86197139Shrs	char cmd;
87147088Sbrooks	char byte;
88147088Sbrooks};
89222515Sbz
90222515Sbz#
91222515Sbz# Write Word command
92222515Sbz#
93222515SbzMETHOD int writew {
94197139Shrs	device_t dev;
95147088Sbrooks	u_char slave;
96113674Smtm	char cmd;
97223506Spluknet	short word;
98147088Sbrooks};
99113674Smtm
100147088Sbrooks#
101197139Shrs# Read Byte command
102197139Shrs#
103222733ShrsMETHOD int readb {
104222733Shrs	device_t dev;
105222746Shrs	u_char slave;
106222733Shrs	char cmd;
107212574Shrs	char *byte;
108197139Shrs};
109222733Shrs
110222733Shrs#
111222733Shrs# Read Word command
112222733Shrs#
113222733ShrsMETHOD int readw {
114222733Shrs	device_t dev;
115222733Shrs	u_char slave;
116225521Shrs	char cmd;
117225521Shrs	short *word;
118225521Shrs};
119225521Shrs
120225521Shrs#
121225521Shrs# Process Call command
122212574Shrs#
123212574ShrsMETHOD int pcall {
124197526Shrs	device_t dev;
125212574Shrs	u_char slave;
126212574Shrs	char cmd;
127212574Shrs	short sdata;
128212574Shrs	short *rdata;
129212574Shrs};
130212574Shrs
131212574Shrs#
132212574Shrs# Block Write command
133212574Shrs#
134212574ShrsMETHOD int bwrite {
135212574Shrs	device_t dev;
136212574Shrs	u_char slave;
137212574Shrs	char cmd;
138212574Shrs	u_char count;
139212574Shrs	char *buf;
140212574Shrs};
141212574Shrs
142212574Shrs#
143197139Shrs# Block Read command
144197139Shrs#
145197139ShrsMETHOD int bread {
146197139Shrs	device_t dev;
147197139Shrs	u_char slave;
148197139Shrs	char cmd;
149147088Sbrooks	u_char count;
150147682Sbrooks	char *buf;
151147088Sbrooks};
152147088Sbrooks