summaryrefslogtreecommitdiff
path: root/static/freebsd/man4/smb.4 3.html
blob: de9aba1ef3336d5b24336de97247862ae5bd9295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<table class="head">
  <tr>
    <td class="head-ltitle">SMB(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">SMB(4)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">smb</code> &#x2014; <span class="Nd">System
    Management Bus (SMBus) generic I/O device driver</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="Cd">device smb</code></p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The
    <a class="permalink" href="#smb"><i class="Em" id="smb">smb</i></a>
    character device driver provides generic I/O to any
    <a class="Xr">smbus(4)</a> instance. To control SMB devices, use
    <span class="Pa">/dev/smb?</span> with the ioctls described below. Any of
    these ioctl commands takes a pointer to <var class="Vt">struct smbcmd</var>
    as its argument.</p>
<div class="Bd Pp Li">
<pre>#include &lt;sys/types.h&gt;

struct smbcmd {
	u_char cmd;
	u_char reserved;
	u_short op;
	union {
		char    byte;
		char    buf[2];
		short   word;
	} wdata;
	union {
		char    byte;
		char    buf[2];
		short   word;
	} rdata;
	int  slave;
	char *wbuf;     /* use wdata if NULL */
	int  wcount;
	char *rbuf;     /* use rdata if NULL */
	int  rcount;
};</pre>
</div>
<p class="Pp">The <var class="Fa">slave</var> field is always used, and provides
    the address of the SMBus slave device. The slave address is specified in the
    seven most significant bits (i.e., &#x201C;left-justified&#x201D;). The
    least significant bit of the slave address must be zero.</p>
<p class="Pp"></p>
<table class="Bl-column Bl-compact">
  <tr id="Ioctl">
    <td><a class="permalink" href="#Ioctl"><i class="Em">Ioctl</i></a></td>
    <td><a class="permalink" href="#Description"><i class="Em" id="Description">Description</i></a>
    <p class="Pp"></p>
    </td>
  </tr>
  <tr id="SMB_QUICK_WRITE">
    <td><a class="permalink" href="#SMB_QUICK_WRITE"><code class="Dv">SMB_QUICK_WRITE</code></a></td>
    <td><a class="permalink" href="#QuickWrite"><i class="Em" id="QuickWrite">QuickWrite</i></a>
      does not transfer any data. It just issues the device address with write
      intent to the bus.</td>
  </tr>
  <tr id="SMB_QUICK_READ">
    <td><a class="permalink" href="#SMB_QUICK_READ"><code class="Dv">SMB_QUICK_READ</code></a></td>
    <td><a class="permalink" href="#QuickRead"><i class="Em" id="QuickRead">QuickRead</i></a>
      does not transfer any data. It just issues the device address with read
      intent to the bus.</td>
  </tr>
  <tr id="SMB_SENDB">
    <td><a class="permalink" href="#SMB_SENDB"><code class="Dv">SMB_SENDB</code></a></td>
    <td><a class="permalink" href="#SendByte"><i class="Em" id="SendByte">SendByte</i></a>
      sends the byte provided in <var class="Fa">cmd</var> to the device.</td>
  </tr>
  <tr id="SMB_RECVB">
    <td><a class="permalink" href="#SMB_RECVB"><code class="Dv">SMB_RECVB</code></a></td>
    <td><a class="permalink" href="#ReceiveByte"><i class="Em" id="ReceiveByte">ReceiveByte</i></a>
      reads a single byte from the device which is returned in
      <var class="Fa">cmd</var>.</td>
  </tr>
  <tr id="SMB_WRITEB">
    <td><a class="permalink" href="#SMB_WRITEB"><code class="Dv">SMB_WRITEB</code></a></td>
    <td><a class="permalink" href="#WriteByte"><i class="Em" id="WriteByte">WriteByte</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device,
      followed by the byte given in <var class="Fa">wdata.byte</var>.</td>
  </tr>
  <tr id="SMB_WRITEW">
    <td><a class="permalink" href="#SMB_WRITEW"><code class="Dv">SMB_WRITEW</code></a></td>
    <td><a class="permalink" href="#WriteWord"><i class="Em" id="WriteWord">WriteWord</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device,
      followed by the word given in <var class="Fa">wdata.word</var>. Note that
      the SMBus byte-order is little-endian by definition.</td>
  </tr>
  <tr id="SMB_READB">
    <td><a class="permalink" href="#SMB_READB"><code class="Dv">SMB_READB</code></a></td>
    <td><a class="permalink" href="#ReadByte"><i class="Em" id="ReadByte">ReadByte</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device, then
      reads one byte of data from the device. Returned data is stored in
      <var class="Fa">rdata.byte</var>.</td>
  </tr>
  <tr id="SMB_READW">
    <td><a class="permalink" href="#SMB_READW"><code class="Dv">SMB_READW</code></a></td>
    <td><a class="permalink" href="#ReadWord"><i class="Em" id="ReadWord">ReadWord</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device, then
      reads one word of data from the device. Returned data is stored in
      <var class="Fa">rdata.word</var>.</td>
  </tr>
  <tr id="SMB_PCALL">
    <td><a class="permalink" href="#SMB_PCALL"><code class="Dv">SMB_PCALL</code></a></td>
    <td><a class="permalink" href="#ProcedureCall"><i class="Em" id="ProcedureCall">ProcedureCall</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device,
      followed by the word provided in <var class="Fa">wdata.word</var>. It then
      reads one word of data from the device and returns it in
      <var class="Fa">rdata.word</var>.</td>
  </tr>
  <tr id="SMB_BWRITE">
    <td><a class="permalink" href="#SMB_BWRITE"><code class="Dv">SMB_BWRITE</code></a></td>
    <td><a class="permalink" href="#BlockWrite"><i class="Em" id="BlockWrite">BlockWrite</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device, then
      the byte from <var class="Fa">wcount</var> followed by
      <var class="Fa">wcount</var> bytes of data that are taken from the buffer
      pointed to by <var class="Fa">wbuf</var>. The SMBus specification mandates
      that no more than 32 bytes of data can be transferred in a single block
      read or write command. This value can be read from the constant
      <code class="Dv">SMB_MAXBLOCKSIZE</code>.</td>
  </tr>
  <tr id="SMB_BREAD">
    <td><a class="permalink" href="#SMB_BREAD"><code class="Dv">SMB_BREAD</code></a></td>
    <td><a class="permalink" href="#BlockRead"><i class="Em" id="BlockRead">BlockRead</i></a>
      first sends the byte from <var class="Fa">cmd</var> to the device, then
      reads a count of data bytes that the device is going to provide and then
      reads that many bytes. The count is returned in
      <var class="Fa">rcount</var>. The data is returned in the buffer pointed
      to by <var class="Fa">rbuf</var>.</td>
  </tr>
</table>
<p class="Pp">The <a class="Xr">read(2)</a> and <a class="Xr">write(2)</a>
    system calls are not implemented by this driver.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">The <a class="Xr">ioctl(2)</a> commands can cause the following
    driver-specific errors:</p>
<dl class="Bl-tag">
  <dt id="ENXIO">[<a class="permalink" href="#ENXIO"><code class="Er">ENXIO</code></a>]</dt>
  <dd>Device did not respond to selection.</dd>
  <dt id="EBUSY">[<a class="permalink" href="#EBUSY"><code class="Er">EBUSY</code></a>]</dt>
  <dd>Device still in use.</dd>
  <dt id="ENODEV">[<a class="permalink" href="#ENODEV"><code class="Er">ENODEV</code></a>]</dt>
  <dd>Operation not supported by device (not supposed to happen).</dd>
  <dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
  <dd>General argument error.</dd>
  <dt id="EWOULDBLOCK">[<a class="permalink" href="#EWOULDBLOCK"><code class="Er">EWOULDBLOCK</code></a>]</dt>
  <dd>SMBus transaction timed out.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr">ioctl(2)</a>, <a class="Xr">smbus(4)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">smb</code> manual page first appeared in
    <span class="Ux">FreeBSD 3.0</span>.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Nicolas
    Souchu</span> and extended by
  <br/>
  <span class="An">Michael Gmelin</span> &#x27E8;freebsd@grem.de&#x27E9;.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">April 25, 2015</td>
    <td class="foot-os">FreeBSD 15.0</td>
  </tr>
</table>