xref: /freebsd/share/man/man9/own.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1ae1f3df4SWarner Losh.\"
2a339dcccSWarner Losh.\" Copyright (c) 2015 M. Warner Losh <imp@FreeBSD.org>
3ae1f3df4SWarner Losh.\"
4ae1f3df4SWarner Losh.\" Redistribution and use in source and binary forms, with or without
5ae1f3df4SWarner Losh.\" modification, are permitted provided that the following conditions
6ae1f3df4SWarner Losh.\" are met:
7ae1f3df4SWarner Losh.\" 1. Redistributions of source code must retain the above copyright
8ae1f3df4SWarner Losh.\"    notice, this list of conditions and the following disclaimer.
9ae1f3df4SWarner Losh.\" 2. The name of the author may not be used to endorse or promote products
10ae1f3df4SWarner Losh.\"    derived from this software without specific prior written permission.
11ae1f3df4SWarner Losh.\"
12ae1f3df4SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13ae1f3df4SWarner Losh.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14ae1f3df4SWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15ae1f3df4SWarner Losh.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16ae1f3df4SWarner Losh.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17ae1f3df4SWarner Losh.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18ae1f3df4SWarner Losh.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19ae1f3df4SWarner Losh.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20ae1f3df4SWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21ae1f3df4SWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22ae1f3df4SWarner Losh.\" SUCH DAMAGE.
23ae1f3df4SWarner Losh.\"
24ae1f3df4SWarner Losh.Dd July 20, 2015
25ae1f3df4SWarner Losh.Dt OWN 9
26ae1f3df4SWarner Losh.Os
27ae1f3df4SWarner Losh.Sh NAME
28ae1f3df4SWarner Losh.Nm own ,
29ae1f3df4SWarner Losh.Nm own_send_command ,
30*a95850f1SGordon Bergling.Nm own_command_wait ,
31ae1f3df4SWarner Losh.Nm own_self_command ,
32ae1f3df4SWarner Losh.Nm own_acquire_bus ,
33ae1f3df4SWarner Losh.Nm own crc ,
34ae1f3df4SWarner Losh.Nm own_release_bus ,
35ae1f3df4SWarner Losh.Nm OWN_ACQUIRE_BUS ,
36ae1f3df4SWarner Losh.Nm OWN_CRC ,
37ae1f3df4SWarner Losh.Nm OWN_RELEASE_BUS ,
38ae1f3df4SWarner Losh.Nm OWN_SEND_COMMAND
39ae1f3df4SWarner Losh.Nd Dallas Semiconductor 1-Wire Network and Transport Interface
40ae1f3df4SWarner Losh.Sh SYNOPSIS
41ae1f3df4SWarner Losh.In sys/bus.h
42ae1f3df4SWarner Losh.In dev/ow/own.h
43ae1f3df4SWarner Losh.Ft int
44ae1f3df4SWarner Losh.Fn own_send_command "device_t pdev" "struct ow_cmd *cmd"
45ae1f3df4SWarner Losh.Ft int
46ae1f3df4SWarner Losh.Fn own_command_wait "device_t pdev" "struct ow_cmd *cmd"
47ae1f3df4SWarner Losh.Ft int
48ae1f3df4SWarner Losh.Fn own_self_command "device_t pdev" "struct ow_cmd *cmd" "uint8_t xpt_cmd"
49ae1f3df4SWarner Losh.Ft int
50ae1f3df4SWarner Losh.Fn own_acquire_bus "device_t pdev" "int how"
51ae1f3df4SWarner Losh.Ft int
52ae1f3df4SWarner Losh.Fn own_release_bus "device_t pdev"
53ae1f3df4SWarner Losh.Ft int
54ae1f3df4SWarner Losh.Fn own_crc "device_t pdev" "uint8_t *buffer" "size_t len"
55ae1f3df4SWarner Losh.Ft int
56ae1f3df4SWarner Losh.Fn OWN_SEND_COMMAND "device_t ndev" "device_t pdev" "struct ow_cmd *cmd"
57ae1f3df4SWarner Losh.Ft int
58ae1f3df4SWarner Losh.Fn OWN_ACQUIRE_BUS "device_t ndev" "device_t pdev" "int how"
59ae1f3df4SWarner Losh.Ft void
60ae1f3df4SWarner Losh.Fn OWN_RELEASE_BUS "device_t ndev" "device_t pdev"
61ae1f3df4SWarner Losh.Ft uint8_t
62ae1f3df4SWarner Losh.Fn OWN_CRC "device_t ndev" "device_t pdev" "uint8_t *buffer" "size_t len"
63ae1f3df4SWarner Losh.Sh DESCRIPTION
64ae1f3df4SWarner LoshThe
65ae1f3df4SWarner Losh.Nm
66ae1f3df4SWarner Loshinterface defines three sets of functions for interacting with 1-Wire
67ae1f3df4SWarner Loshdevices:
68ae1f3df4SWarner Loshsending commands,
69ae1f3df4SWarner Loshreserving the bus,
70ae1f3df4SWarner Loshand
71ae1f3df4SWarner Loshensuring data integrity.
72ae1f3df4SWarner LoshWrappers are provided for the raw
73ae1f3df4SWarner Losh.Nm OWN
74ae1f3df4SWarner Losh.Xr kobj 9
75ae1f3df4SWarner Loshinterfaces and should be used for improved safety over the
76ae1f3df4SWarner Losh.Xr kobj 9
77ae1f3df4SWarner Loshones.
78ae1f3df4SWarner Losh.Ss Bus Commands
79ae1f3df4SWarner LoshThe 1-Wire bus defines different layers of access to the devices on
80ae1f3df4SWarner Loshthe bus.
81ae1f3df4SWarner LoshThe
82ae1f3df4SWarner Losh.Nm
83ae1f3df4SWarner Loshfunctions provide access to the network and transport layers.
84ae1f3df4SWarner LoshThe network layer designates the next command as being either for all
85ae1f3df4SWarner Loshdevices on the bus, or for a specific device.
86ae1f3df4SWarner LoshThe network layer also specifies the speed used by the link layer.
87ae1f3df4SWarner Losh.Pp
88ae1f3df4SWarner Losh.Vt "struct ow_cmd"
89ae1f3df4SWarner Loshencapsulates network access, speed, and timing information.
90ae1f3df4SWarner LoshIt specifies the commands to send and whether or not to read data.
91ae1f3df4SWarner LoshIts members are:
92ae1f3df4SWarner Losh.Bl -tag -width ".Va xxxx"
93ae1f3df4SWarner Losh.It Va flags
94ae1f3df4SWarner LoshFlags controlling the interpretation of the structure.
95ae1f3df4SWarner LoshThese flags are defined in
96ae1f3df4SWarner Losh.In dev/ow/ow.h :
97ae1f3df4SWarner Losh.Bl -tag -width indent
98ae1f3df4SWarner Losh.It OW_FLAG_OVERDRIVE
99ae1f3df4SWarner LoshSend
100ae1f3df4SWarner Losh.Va xpt_cmd
101ae1f3df4SWarner Loshbytes and read
102ae1f3df4SWarner Losh.Va xpt_read
103ae1f3df4SWarner Loshbytes at overdrive speed.
104ae1f3df4SWarner Losh.It OW_FLAG_READ_BIT
105ae1f3df4SWarner LoshInterpret
106ae1f3df4SWarner Losh.Va xpt_read_len
107ae1f3df4SWarner Loshto be in bits to be read after
108ae1f3df4SWarner Losh.Va xpt_cmd
109ae1f3df4SWarner Loshrather than bytes.
110ae1f3df4SWarner Losh.El
111ae1f3df4SWarner Losh.It Va rom_cmd
112ae1f3df4SWarner LoshROM command bytes to send.
113ae1f3df4SWarner Losh.It Va rom_len
114ae1f3df4SWarner LoshNumber of ROM command bytes to send.
115ae1f3df4SWarner Losh.It Va rom_read_len
116ae1f3df4SWarner LoshNumber of bytes to read after sending the ROM command.
117ae1f3df4SWarner Losh.It Va rom_read
118ae1f3df4SWarner LoshBuffer for bytes read after the ROM command.
119ae1f3df4SWarner Losh.It Va xpt_cmd
120ae1f3df4SWarner LoshTransport command to send.
121ae1f3df4SWarner Losh.It Va xpt_len
122ae1f3df4SWarner LoshLength of the transport command bytes to send.
123ae1f3df4SWarner LoshSpecify 0 for no transport command.
124ae1f3df4SWarner Losh.It Va xpt_read_len
125ae1f3df4SWarner LoshNumber of bytes to read after
126ae1f3df4SWarner Losh.Va xpt_cmd
127ae1f3df4SWarner Loshbytes are sent.
128ae1f3df4SWarner LoshIf the
129ae1f3df4SWarner Losh.Dv OW_FLAG_READ_BIT
130ae1f3df4SWarner Loshbit is set in
131ae1f3df4SWarner Losh.Va flags ,
132ae1f3df4SWarner Loshthen it is the number of bits to read.
133ae1f3df4SWarner LoshBits read are packed into bytes.
134ae1f3df4SWarner Losh.It Va xpt_read
135ae1f3df4SWarner LoshBuffer for data read.
136ae1f3df4SWarner Losh.El
137ae1f3df4SWarner Losh.Pp
138ae1f3df4SWarner Losh.Fn own_command_wait
139ae1f3df4SWarner Loshacquires the 1-Wire bus, waiting if necessary,
140ae1f3df4SWarner Loshsends the command,
141ae1f3df4SWarner Loshand
142ae1f3df4SWarner Loshthen releases the bus.
143ae1f3df4SWarner Losh.Fn own_send_command
144ae1f3df4SWarner Loshsends the command without bus reservation.
145ae1f3df4SWarner Losh.Fa pdev
146ae1f3df4SWarner Loshis the client device (the presentation layer device) sending the command.
147ae1f3df4SWarner LoshThe
148ae1f3df4SWarner Losh.Fa cmd
149ae1f3df4SWarner Loshargument describes the transaction to send to the 1-Wire bus.
150ae1f3df4SWarner Losh.Pp
151ae1f3df4SWarner Losh.Fn own_self_command
152ae1f3df4SWarner Loshfills in
153ae1f3df4SWarner Losh.Fa cmd
154ae1f3df4SWarner Loshwith a MATCH_ROM ROM command, the ROM address of
155ae1f3df4SWarner Losh.Fa pdev
156ae1f3df4SWarner Loshand the
157ae1f3df4SWarner Losh.Fa xpt_cmd
158ae1f3df4SWarner Loshas a convenient way to create directed commands.
159ae1f3df4SWarner Losh.Ss Bus Reservation
160ae1f3df4SWarner LoshThe 1-Wire system includes an advisory lock for the bus that
161ae1f3df4SWarner Loshpresentation layer devices can use to coordinate access.
162ae1f3df4SWarner LoshLocking is purely advisory at this time.
163ae1f3df4SWarner Losh.Pp
164ae1f3df4SWarner Losh.Fn own_acquire_bus
165ae1f3df4SWarner Loshreserves the bus.
166ae1f3df4SWarner LoshIt waits indefinitely if the
167ae1f3df4SWarner Losh.Fa how
168ae1f3df4SWarner Loshargument is
169ae1f3df4SWarner Losh.Dv OWN_WAIT
170ae1f3df4SWarner Loshand returns the error
171ae1f3df4SWarner Losh.Dv EWOULDBLOCK
172ae1f3df4SWarner Loshif passed
173ae1f3df4SWarner Losh.Dv OWN_DONTWAIT
174ae1f3df4SWarner Loshwhen the bus is owned by another client.
175ae1f3df4SWarner Losh.Pp
176ae1f3df4SWarner Losh.Fn own_release_bus
177ae1f3df4SWarner Loshreleases the bus.
178ae1f3df4SWarner Losh.Ss Data Integrity
179ae1f3df4SWarner Losh.Fn own_crc
180ae1f3df4SWarner Loshcomputes the 1-Wire standard CRC function over the data
181ae1f3df4SWarner Loshpassed in
182ae1f3df4SWarner Losh.Fa buffer
183ae1f3df4SWarner Loshand
184ae1f3df4SWarner Losh.Fa len
185ae1f3df4SWarner Loshand returns the result.
186ae1f3df4SWarner Losh.Ss Notes
187ae1f3df4SWarner LoshThe 1-Wire standard (Maxim AN937) defines layers that are akin to ISO
188ae1f3df4SWarner Loshnetworking layers.
189ae1f3df4SWarner LoshThe lowest relevant layer, the link layer, defines the polling windows
190ae1f3df4SWarner Loshand the timing of the signaling of different modes.
191ae1f3df4SWarner LoshThe network layer is built on top of the link layer
192ae1f3df4SWarner Loshand is used to address devices in a unicast or multicast manner.
193ae1f3df4SWarner LoshThe transport layer defines commands and responses from the devices.
194ae1f3df4SWarner LoshThe presentation layer is composed of the device specific commands and
195ae1f3df4SWarner Loshactions used to control the specific 1-Wire devices on bus.
196ae1f3df4SWarner Losh.Pp
197ae1f3df4SWarner LoshThese interfaces are implemented by the
198ae1f3df4SWarner Losh.Xr ow 4
199ae1f3df4SWarner Loshdevice.
200ae1f3df4SWarner LoshPresentation layer devices (children of the newbus
201ae1f3df4SWarner Losh.Xr ow 4
202ae1f3df4SWarner Loshdevice) should only call the functions described here.
203ae1f3df4SWarner LoshThe functionality provided by the
204ae1f3df4SWarner Losh.Xr owc 4
205ae1f3df4SWarner Loshdevice (specifically the
206ae1f3df4SWarner Losh.Xr owll 9
207ae1f3df4SWarner Loshinterface) should only be called by the
208ae1f3df4SWarner Losh.Xr ow 4
209ae1f3df4SWarner Loshdriver.
210ae1f3df4SWarner Losh.Sh SEE ALSO
211ae1f3df4SWarner Losh.Xr ow 4 ,
212ae1f3df4SWarner Losh.Xr owc 4 ,
213ae1f3df4SWarner Losh.Xr owll 9
214a2aef24aSEitan Adler.Pa  https://pdfserv.maximintegrated.com/en/an/AN937.pdf
215ae1f3df4SWarner Losh.Sh LEGAL
216ae1f3df4SWarner Losh.Tn 1-Wire
217ae1f3df4SWarner Loshis a registered trademark of Maxim Integrated Products, Inc.
218ae1f3df4SWarner Losh.Sh HISTORY
219ae1f3df4SWarner LoshThe
220ae1f3df4SWarner Losh.Nm
221ae1f3df4SWarner Loshdriver first appeared in
222ae1f3df4SWarner Losh.Fx 11.0 .
223ae1f3df4SWarner Losh.Sh AUTHORS
224ae1f3df4SWarner LoshThe
225ae1f3df4SWarner Losh.Nm
226ae1f3df4SWarner Loshdevice driver and this manual page were written by
227ae1f3df4SWarner Losh.An Warner Losh .
228