smb.h revision 256281
1243730Srwatson/*-
2243730Srwatson * Copyright (c) 1998 Nicolas Souchu
3243730Srwatson * All rights reserved.
4243730Srwatson *
5243730Srwatson * Redistribution and use in source and binary forms, with or without
6243730Srwatson * modification, are permitted provided that the following conditions
7243730Srwatson * are met:
8243730Srwatson * 1. Redistributions of source code must retain the above copyright
9243730Srwatson *    notice, this list of conditions and the following disclaimer.
10243730Srwatson * 2. Redistributions in binary form must reproduce the above copyright
11243730Srwatson *    notice, this list of conditions and the following disclaimer in the
12243730Srwatson *    documentation and/or other materials provided with the distribution.
13243730Srwatson *
14243730Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15243730Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16243730Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17243730Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18243730Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19243730Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20243730Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21243730Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22243730Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23243730Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24243730Srwatson * SUCH DAMAGE.
25243730Srwatson *
26243730Srwatson * $FreeBSD: stable/10/sys/dev/smbus/smb.h 162234 2006-09-11 20:52:41Z jhb $
27243730Srwatson *
28243730Srwatson */
29243730Srwatson#ifndef __SMB_H
30243730Srwatson#define __SMB_H
31243730Srwatson
32243730Srwatson#include <sys/ioccom.h>
33243730Srwatson
34243730Srwatsonstruct smbcmd {
35243730Srwatson	char cmd;
36243730Srwatson	int count;
37243730Srwatson	u_char slave;
38243730Srwatson	union {
39243730Srwatson		char byte;
40243730Srwatson		short word;
41243730Srwatson
42243730Srwatson		char *byte_ptr;
43243730Srwatson		short *word_ptr;
44243730Srwatson
45243730Srwatson		struct {
46243730Srwatson			short sdata;
47243730Srwatson			short *rdata;
48243730Srwatson		} process;
49243730Srwatson	} data;
50243730Srwatson};
51243730Srwatson
52243730Srwatson/*
53243730Srwatson * SMBus spec 2.0 says block transfers may be at most 32 bytes.
54243730Srwatson */
55243730Srwatson#define SMB_MAXBLOCKSIZE	32
56243730Srwatson
57243730Srwatson#define SMB_QUICK_WRITE	_IOW('i', 1, struct smbcmd)
58243730Srwatson#define SMB_QUICK_READ	_IOW('i', 2, struct smbcmd)
59243730Srwatson#define SMB_SENDB	_IOW('i', 3, struct smbcmd)
60243730Srwatson#define SMB_RECVB	_IOWR('i', 4, struct smbcmd)
61243730Srwatson#define SMB_WRITEB	_IOW('i', 5, struct smbcmd)
62243730Srwatson#define SMB_WRITEW	_IOW('i', 6, struct smbcmd)
63243730Srwatson#define SMB_READB	_IOW('i', 7, struct smbcmd)
64243730Srwatson#define SMB_READW	_IOW('i', 8, struct smbcmd)
65243730Srwatson#define SMB_PCALL	_IOW('i', 9, struct smbcmd)
66243730Srwatson#define SMB_BWRITE	_IOW('i', 10, struct smbcmd)
67243730Srwatson#define SMB_OLD_BREAD	_IOW('i', 11, struct smbcmd)
68243730Srwatson#define SMB_BREAD	_IOWR('i', 11, struct smbcmd)
69243730Srwatson
70243730Srwatson#endif
71243730Srwatson