smbus_if.m revision 139749
1139749Simp#- 238776Snsouch# Copyright (c) 1998 Nicolas Souchu 338776Snsouch# All rights reserved. 438776Snsouch# 538776Snsouch# Redistribution and use in source and binary forms, with or without 638776Snsouch# modification, are permitted provided that the following conditions 738776Snsouch# are met: 838776Snsouch# 1. Redistributions of source code must retain the above copyright 938776Snsouch# notice, this list of conditions and the following disclaimer. 1038776Snsouch# 2. Redistributions in binary form must reproduce the above copyright 1138776Snsouch# notice, this list of conditions and the following disclaimer in the 1238776Snsouch# documentation and/or other materials provided with the distribution. 1338776Snsouch# 1438776Snsouch# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1538776Snsouch# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1638776Snsouch# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1738776Snsouch# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1838776Snsouch# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1938776Snsouch# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2038776Snsouch# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2138776Snsouch# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2238776Snsouch# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2338776Snsouch# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2438776Snsouch# SUCH DAMAGE. 2538776Snsouch# 2650477Speter# $FreeBSD: head/sys/dev/smbus/smbus_if.m 139749 2005-01-06 01:43:34Z imp $ 2738776Snsouch# 2838776Snsouch 2959093Sdfr#include <sys/bus.h> 3059093Sdfr 3141012SnsouchINTERFACE smbus; 3238776Snsouch 3338776Snsouch# 3440785Snsouch# Interpret interrupt 3538776Snsouch# 3638776SnsouchMETHOD void intr { 3738776Snsouch device_t dev; 3838776Snsouch u_char devaddr; 3938776Snsouch char low; 4038776Snsouch char high; 4138776Snsouch int error; 4238776Snsouch}; 4338776Snsouch 4438776Snsouch# 4540785Snsouch# smbus callback 4640785Snsouch# 4740785SnsouchMETHOD int callback { 4840785Snsouch device_t dev; 4940785Snsouch int index; 5040785Snsouch caddr_t data; 5140785Snsouch}; 5240785Snsouch 5340785Snsouch# 5438776Snsouch# Quick command 5538776Snsouch# 5638776SnsouchMETHOD int quick { 5738776Snsouch device_t dev; 5838776Snsouch u_char slave; 5938776Snsouch int how; 6038776Snsouch}; 6138776Snsouch 6238776Snsouch# 6338776Snsouch# Send Byte command 6438776Snsouch# 6538776SnsouchMETHOD int sendb { 6638776Snsouch device_t dev; 6738776Snsouch u_char slave; 6838776Snsouch char byte; 6938776Snsouch}; 7038776Snsouch 7138776Snsouch# 7238776Snsouch# Receive Byte command 7338776Snsouch# 7438776SnsouchMETHOD int recvb { 7538776Snsouch device_t dev; 7638776Snsouch u_char slave; 7738776Snsouch char *byte; 7838776Snsouch}; 7938776Snsouch 8038776Snsouch# 8138776Snsouch# Write Byte command 8238776Snsouch# 8338776SnsouchMETHOD int writeb { 8438776Snsouch device_t dev; 8538776Snsouch u_char slave; 8638776Snsouch char cmd; 8738776Snsouch char byte; 8838776Snsouch}; 8938776Snsouch 9038776Snsouch# 9138776Snsouch# Write Word command 9238776Snsouch# 9338776SnsouchMETHOD int writew { 9438776Snsouch device_t dev; 9538776Snsouch u_char slave; 9638776Snsouch char cmd; 9738776Snsouch short word; 9838776Snsouch}; 9938776Snsouch 10038776Snsouch# 10138776Snsouch# Read Byte command 10238776Snsouch# 10338776SnsouchMETHOD int readb { 10438776Snsouch device_t dev; 10538776Snsouch u_char slave; 10638776Snsouch char cmd; 10738776Snsouch char *byte; 10838776Snsouch}; 10938776Snsouch 11038776Snsouch# 11138776Snsouch# Read Word command 11238776Snsouch# 11338776SnsouchMETHOD int readw { 11438776Snsouch device_t dev; 11538776Snsouch u_char slave; 11638776Snsouch char cmd; 11738776Snsouch short *word; 11838776Snsouch}; 11938776Snsouch 12038776Snsouch# 12138776Snsouch# Process Call command 12238776Snsouch# 12338776SnsouchMETHOD int pcall { 12438776Snsouch device_t dev; 12538776Snsouch u_char slave; 12638776Snsouch char cmd; 12738776Snsouch short sdata; 12838776Snsouch short *rdata; 12938776Snsouch}; 13038776Snsouch 13138776Snsouch# 13238776Snsouch# Block Write command 13338776Snsouch# 13440994SnsouchMETHOD int bwrite { 13538776Snsouch device_t dev; 13638776Snsouch u_char slave; 13738776Snsouch char cmd; 13838776Snsouch u_char count; 13938776Snsouch char *buf; 14038776Snsouch}; 14138776Snsouch 14238776Snsouch# 14338776Snsouch# Block Read command 14438776Snsouch# 14540994SnsouchMETHOD int bread { 14638776Snsouch device_t dev; 14738776Snsouch u_char slave; 14838776Snsouch char cmd; 14938776Snsouch u_char count; 15038776Snsouch char *buf; 15138776Snsouch}; 152