1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3	"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
4
5<book id="w1id">
6  <bookinfo>
7    <title>W1: Dallas' 1-wire bus</title>
8
9    <authorgroup>
10      <author>
11        <firstname>David</firstname>
12        <surname>Fries</surname>
13        <affiliation>
14          <address>
15            <email>David@Fries.net</email>
16          </address>
17        </affiliation>
18      </author>
19
20    </authorgroup>
21
22    <copyright>
23      <year>2013</year>
24      <!--
25      <holder></holder>
26      -->
27    </copyright>
28
29    <legalnotice>
30      <para>
31        This documentation is free software; you can redistribute
32        it and/or modify it under the terms of the GNU General Public
33        License version 2.
34      </para>
35
36      <para>
37        This program is distributed in the hope that it will be
38        useful, but WITHOUT ANY WARRANTY; without even the implied
39        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
40        For more details see the file COPYING in the source
41        distribution of Linux.
42      </para>
43    </legalnotice>
44  </bookinfo>
45
46  <toc></toc>
47
48  <chapter id="w1_internal">
49    <title>W1 API internal to the kernel</title>
50
51    <sect1 id="w1_internal_api">
52      <title>W1 API internal to the kernel</title>
53      <sect2 id="w1.h">
54        <title>drivers/w1/w1.h</title>
55        <para>W1 core functions.</para>
56<!-- drivers/w1/w1.h -->
57<refentry id="API-struct-w1-reg-num">
58<refentryinfo>
59 <title>LINUX</title>
60 <productname>Kernel Hackers Manual</productname>
61 <date>July 2017</date>
62</refentryinfo>
63<refmeta>
64 <refentrytitle><phrase>struct w1_reg_num</phrase></refentrytitle>
65 <manvolnum>9</manvolnum>
66 <refmiscinfo class="version">4.1.27</refmiscinfo>
67</refmeta>
68<refnamediv>
69 <refname>struct w1_reg_num</refname>
70 <refpurpose>
71  broken out slave device id
72 </refpurpose>
73</refnamediv>
74<refsynopsisdiv>
75 <title>Synopsis</title>
76  <programlisting>
77struct w1_reg_num {
78#if defined(__LITTLE_ENDIAN_BITFIELD)
79  __u64 family:8;
80  __u64 id:48;
81  __u64 crc:8;
82#elif defined(__BIG_ENDIAN_BITFIELD)
83  __u64 crc:8;
84  __u64 id:48;
85  __u64 family:8;
86#else
87#error "Please fix &lt;asm/byteorder.h&gt;"
88#endif
89};  </programlisting>
90</refsynopsisdiv>
91 <refsect1>
92  <title>Members</title>
93  <variablelist>
94    <varlistentry>      <term>family</term>
95      <listitem><para>
96identifies the type of device
97      </para></listitem>
98    </varlistentry>
99    <varlistentry>      <term>id</term>
100      <listitem><para>
101along with family is the unique device id
102      </para></listitem>
103    </varlistentry>
104    <varlistentry>      <term>crc</term>
105      <listitem><para>
106checksum of the other bytes
107      </para></listitem>
108    </varlistentry>
109    <varlistentry>      <term>crc</term>
110      <listitem><para>
111checksum of the other bytes
112      </para></listitem>
113    </varlistentry>
114    <varlistentry>      <term>id</term>
115      <listitem><para>
116along with family is the unique device id
117      </para></listitem>
118    </varlistentry>
119    <varlistentry>      <term>family</term>
120      <listitem><para>
121identifies the type of device
122      </para></listitem>
123    </varlistentry>
124  </variablelist>
125 </refsect1>
126</refentry>
127
128<refentry id="API-struct-w1-slave">
129<refentryinfo>
130 <title>LINUX</title>
131 <productname>Kernel Hackers Manual</productname>
132 <date>July 2017</date>
133</refentryinfo>
134<refmeta>
135 <refentrytitle><phrase>struct w1_slave</phrase></refentrytitle>
136 <manvolnum>9</manvolnum>
137 <refmiscinfo class="version">4.1.27</refmiscinfo>
138</refmeta>
139<refnamediv>
140 <refname>struct w1_slave</refname>
141 <refpurpose>
142     holds a single slave device on the bus
143 </refpurpose>
144</refnamediv>
145<refsynopsisdiv>
146 <title>Synopsis</title>
147  <programlisting>
148struct w1_slave {
149  struct module * owner;
150  unsigned char name[W1_MAXNAMELEN];
151  struct list_head w1_slave_entry;
152  struct w1_reg_num reg_num;
153  atomic_t refcnt;
154  int ttl;
155  unsigned long flags;
156  struct w1_master * master;
157  struct w1_family * family;
158  void * family_data;
159  struct device dev;
160};  </programlisting>
161</refsynopsisdiv>
162 <refsect1>
163  <title>Members</title>
164  <variablelist>
165    <varlistentry>      <term>owner</term>
166      <listitem><para>
167   Points to the one wire <quote>wire</quote> kernel module.
168      </para></listitem>
169    </varlistentry>
170    <varlistentry>      <term>name[W1_MAXNAMELEN]</term>
171      <listitem><para>
172   Device id is ascii.
173      </para></listitem>
174    </varlistentry>
175    <varlistentry>      <term>w1_slave_entry</term>
176      <listitem><para>
177   data for the linked list
178      </para></listitem>
179    </varlistentry>
180    <varlistentry>      <term>reg_num</term>
181      <listitem><para>
182   the slave id in binary
183      </para></listitem>
184    </varlistentry>
185    <varlistentry>      <term>refcnt</term>
186      <listitem><para>
187   reference count, delete when 0
188      </para></listitem>
189    </varlistentry>
190    <varlistentry>      <term>ttl</term>
191      <listitem><para>
192   decrement per search this slave isn't found, deatch at 0
193      </para></listitem>
194    </varlistentry>
195    <varlistentry>      <term>flags</term>
196      <listitem><para>
197   bit flags for W1_SLAVE_ACTIVE W1_SLAVE_DETACH
198      </para></listitem>
199    </varlistentry>
200    <varlistentry>      <term>master</term>
201      <listitem><para>
202   bus which this slave is on
203      </para></listitem>
204    </varlistentry>
205    <varlistentry>      <term>family</term>
206      <listitem><para>
207   module for device family type
208      </para></listitem>
209    </varlistentry>
210    <varlistentry>      <term>family_data</term>
211      <listitem><para>
212   pointer for use by the family module
213      </para></listitem>
214    </varlistentry>
215    <varlistentry>      <term>dev</term>
216      <listitem><para>
217   kernel device identifier
218      </para></listitem>
219    </varlistentry>
220  </variablelist>
221 </refsect1>
222</refentry>
223
224<refentry id="API-struct-w1-bus-master">
225<refentryinfo>
226 <title>LINUX</title>
227 <productname>Kernel Hackers Manual</productname>
228 <date>July 2017</date>
229</refentryinfo>
230<refmeta>
231 <refentrytitle><phrase>struct w1_bus_master</phrase></refentrytitle>
232 <manvolnum>9</manvolnum>
233 <refmiscinfo class="version">4.1.27</refmiscinfo>
234</refmeta>
235<refnamediv>
236 <refname>struct w1_bus_master</refname>
237 <refpurpose>
238     operations available on a bus master
239 </refpurpose>
240</refnamediv>
241<refsynopsisdiv>
242 <title>Synopsis</title>
243  <programlisting>
244struct w1_bus_master {
245  void * data;
246  u8 (* read_bit) (void *);
247  void (* write_bit) (void *, u8);
248  u8 (* touch_bit) (void *, u8);
249  u8 (* read_byte) (void *);
250  void (* write_byte) (void *, u8);
251  u8 (* read_block) (void *, u8 *, int);
252  void (* write_block) (void *, const u8 *, int);
253  u8 (* triplet) (void *, u8);
254  u8 (* reset_bus) (void *);
255  u8 (* set_pullup) (void *, int);
256  void (* search) (void *, struct w1_master *,u8, w1_slave_found_callback);
257};  </programlisting>
258</refsynopsisdiv>
259 <refsect1>
260  <title>Members</title>
261  <variablelist>
262    <varlistentry>      <term>data</term>
263      <listitem><para>
264   the first parameter in all the functions below
265      </para></listitem>
266    </varlistentry>
267    <varlistentry>      <term>read_bit</term>
268      <listitem><para>
269   Sample the line level <parameter>return</parameter> the level read (0 or 1)
270      </para></listitem>
271    </varlistentry>
272    <varlistentry>      <term>write_bit</term>
273      <listitem><para>
274   Sets the line level
275      </para></listitem>
276    </varlistentry>
277    <varlistentry>      <term>touch_bit</term>
278      <listitem><para>
279   the lowest-level function for devices that really support the
280   1-wire protocol.
281   touch_bit(0) = write-0 cycle
282   touch_bit(1) = write-1 / read cycle
283   <parameter>return</parameter> the bit read (0 or 1)
284      </para></listitem>
285    </varlistentry>
286    <varlistentry>      <term>read_byte</term>
287      <listitem><para>
288   Reads a bytes. Same as 8 touch_bit(1) calls.
289   <parameter>return</parameter> the byte read
290      </para></listitem>
291    </varlistentry>
292    <varlistentry>      <term>write_byte</term>
293      <listitem><para>
294   Writes a byte. Same as 8 touch_bit(x) calls.
295      </para></listitem>
296    </varlistentry>
297    <varlistentry>      <term>read_block</term>
298      <listitem><para>
299   Same as a series of <function>read_byte</function> calls
300   <parameter>return</parameter> the number of bytes read
301      </para></listitem>
302    </varlistentry>
303    <varlistentry>      <term>write_block</term>
304      <listitem><para>
305   Same as a series of <function>write_byte</function> calls
306      </para></listitem>
307    </varlistentry>
308    <varlistentry>      <term>triplet</term>
309      <listitem><para>
310   Combines two reads and a smart write for ROM searches
311   <parameter>return</parameter> bit0=Id bit1=comp_id bit2=dir_taken
312      </para></listitem>
313    </varlistentry>
314    <varlistentry>      <term>reset_bus</term>
315      <listitem><para>
316   long write-0 with a read for the presence pulse detection
317   <parameter>return</parameter> -1=Error, 0=Device present, 1=No device present
318      </para></listitem>
319    </varlistentry>
320    <varlistentry>      <term>set_pullup</term>
321      <listitem><para>
322   Put out a strong pull-up pulse of the specified duration.
323   <parameter>return</parameter> -1=Error, 0=completed
324      </para></listitem>
325    </varlistentry>
326    <varlistentry>      <term>search</term>
327      <listitem><para>
328   Really nice hardware can handles the different types of ROM search
329   w1_master* is passed to the slave found callback.
330   u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
331      </para></listitem>
332    </varlistentry>
333  </variablelist>
334 </refsect1>
335<refsect1>
336<title>Note</title>
337<para>
338   read_bit and write_bit are very low level functions and should only
339   be used with hardware that doesn't really support 1-wire operations,
340   like a parallel/serial port.
341   Either define read_bit and write_bit OR define, at minimum, touch_bit and
342   reset_bus.
343</para>
344</refsect1>
345</refentry>
346
347<refentry id="API-enum-w1-master-flags">
348<refentryinfo>
349 <title>LINUX</title>
350 <productname>Kernel Hackers Manual</productname>
351 <date>July 2017</date>
352</refentryinfo>
353<refmeta>
354 <refentrytitle><phrase>enum w1_master_flags</phrase></refentrytitle>
355 <manvolnum>9</manvolnum>
356 <refmiscinfo class="version">4.1.27</refmiscinfo>
357</refmeta>
358<refnamediv>
359 <refname>enum w1_master_flags</refname>
360 <refpurpose>
361     bitfields used in w1_master.flags
362 </refpurpose>
363</refnamediv>
364<refsynopsisdiv>
365 <title>Synopsis</title>
366  <programlisting>
367enum w1_master_flags {
368  W1_ABORT_SEARCH,
369  W1_WARN_MAX_COUNT
370};  </programlisting>
371</refsynopsisdiv>
372<refsect1>
373 <title>Constants</title>
374  <variablelist>
375    <varlistentry>      <term>W1_ABORT_SEARCH</term>
376      <listitem><para>
377   abort searching early on shutdown
378      </para></listitem>
379    </varlistentry>
380    <varlistentry>      <term>W1_WARN_MAX_COUNT</term>
381      <listitem><para>
382   limit warning when the maximum count is reached
383      </para></listitem>
384    </varlistentry>
385  </variablelist>
386</refsect1>
387</refentry>
388
389<refentry id="API-struct-w1-master">
390<refentryinfo>
391 <title>LINUX</title>
392 <productname>Kernel Hackers Manual</productname>
393 <date>July 2017</date>
394</refentryinfo>
395<refmeta>
396 <refentrytitle><phrase>struct w1_master</phrase></refentrytitle>
397 <manvolnum>9</manvolnum>
398 <refmiscinfo class="version">4.1.27</refmiscinfo>
399</refmeta>
400<refnamediv>
401 <refname>struct w1_master</refname>
402 <refpurpose>
403     one per bus master
404 </refpurpose>
405</refnamediv>
406<refsynopsisdiv>
407 <title>Synopsis</title>
408  <programlisting>
409struct w1_master {
410  struct list_head w1_master_entry;
411  struct module * owner;
412  unsigned char name[W1_MAXNAMELEN];
413  struct mutex list_mutex;
414  struct list_head slist;
415  struct list_head async_list;
416  int max_slave_count;
417  int slave_count;
418  unsigned long attempts;
419  int slave_ttl;
420  int initialized;
421  u32 id;
422  int search_count;
423  u64 search_id;
424  atomic_t refcnt;
425  void * priv;
426  int enable_pullup;
427  int pullup_duration;
428  long flags;
429  struct task_struct * thread;
430  struct mutex mutex;
431  struct mutex bus_mutex;
432  struct device_driver * driver;
433  struct device dev;
434  struct w1_bus_master * bus_master;
435  u32 seq;
436};  </programlisting>
437</refsynopsisdiv>
438 <refsect1>
439  <title>Members</title>
440  <variablelist>
441    <varlistentry>      <term>w1_master_entry</term>
442      <listitem><para>
443   master linked list
444      </para></listitem>
445    </varlistentry>
446    <varlistentry>      <term>owner</term>
447      <listitem><para>
448   module owner
449      </para></listitem>
450    </varlistentry>
451    <varlistentry>      <term>name[W1_MAXNAMELEN]</term>
452      <listitem><para>
453   dynamically allocate bus name
454      </para></listitem>
455    </varlistentry>
456    <varlistentry>      <term>list_mutex</term>
457      <listitem><para>
458   protect slist and async_list
459      </para></listitem>
460    </varlistentry>
461    <varlistentry>      <term>slist</term>
462      <listitem><para>
463   linked list of slaves
464      </para></listitem>
465    </varlistentry>
466    <varlistentry>      <term>async_list</term>
467      <listitem><para>
468   linked list of netlink commands to execute
469      </para></listitem>
470    </varlistentry>
471    <varlistentry>      <term>max_slave_count</term>
472      <listitem><para>
473   maximum number of slaves to search for at a time
474      </para></listitem>
475    </varlistentry>
476    <varlistentry>      <term>slave_count</term>
477      <listitem><para>
478   current number of slaves known
479      </para></listitem>
480    </varlistentry>
481    <varlistentry>      <term>attempts</term>
482      <listitem><para>
483   number of searches ran
484      </para></listitem>
485    </varlistentry>
486    <varlistentry>      <term>slave_ttl</term>
487      <listitem><para>
488   number of searches before a slave is timed out
489      </para></listitem>
490    </varlistentry>
491    <varlistentry>      <term>initialized</term>
492      <listitem><para>
493   prevent init/removal race conditions
494      </para></listitem>
495    </varlistentry>
496    <varlistentry>      <term>id</term>
497      <listitem><para>
498   w1 bus number
499      </para></listitem>
500    </varlistentry>
501    <varlistentry>      <term>search_count</term>
502      <listitem><para>
503   number of automatic searches to run, -1 unlimited
504      </para></listitem>
505    </varlistentry>
506    <varlistentry>      <term>search_id</term>
507      <listitem><para>
508   allows continuing a search
509      </para></listitem>
510    </varlistentry>
511    <varlistentry>      <term>refcnt</term>
512      <listitem><para>
513   reference count
514      </para></listitem>
515    </varlistentry>
516    <varlistentry>      <term>priv</term>
517      <listitem><para>
518   private data storage
519      </para></listitem>
520    </varlistentry>
521    <varlistentry>      <term>enable_pullup</term>
522      <listitem><para>
523   allows a strong pullup
524      </para></listitem>
525    </varlistentry>
526    <varlistentry>      <term>pullup_duration</term>
527      <listitem><para>
528   time for the next strong pullup
529      </para></listitem>
530    </varlistentry>
531    <varlistentry>      <term>flags</term>
532      <listitem><para>
533   one of w1_master_flags
534      </para></listitem>
535    </varlistentry>
536    <varlistentry>      <term>thread</term>
537      <listitem><para>
538   thread for bus search and netlink commands
539      </para></listitem>
540    </varlistentry>
541    <varlistentry>      <term>mutex</term>
542      <listitem><para>
543   protect most of w1_master
544      </para></listitem>
545    </varlistentry>
546    <varlistentry>      <term>bus_mutex</term>
547      <listitem><para>
548   pretect concurrent bus access
549      </para></listitem>
550    </varlistentry>
551    <varlistentry>      <term>driver</term>
552      <listitem><para>
553   sysfs driver
554      </para></listitem>
555    </varlistentry>
556    <varlistentry>      <term>dev</term>
557      <listitem><para>
558   sysfs device
559      </para></listitem>
560    </varlistentry>
561    <varlistentry>      <term>bus_master</term>
562      <listitem><para>
563   io operations available
564      </para></listitem>
565    </varlistentry>
566    <varlistentry>      <term>seq</term>
567      <listitem><para>
568   sequence number used for netlink broadcasts
569      </para></listitem>
570    </varlistentry>
571  </variablelist>
572 </refsect1>
573</refentry>
574
575<refentry id="API-struct-w1-async-cmd">
576<refentryinfo>
577 <title>LINUX</title>
578 <productname>Kernel Hackers Manual</productname>
579 <date>July 2017</date>
580</refentryinfo>
581<refmeta>
582 <refentrytitle><phrase>struct w1_async_cmd</phrase></refentrytitle>
583 <manvolnum>9</manvolnum>
584 <refmiscinfo class="version">4.1.27</refmiscinfo>
585</refmeta>
586<refnamediv>
587 <refname>struct w1_async_cmd</refname>
588 <refpurpose>
589     execute callback from the w1_process kthread
590 </refpurpose>
591</refnamediv>
592<refsynopsisdiv>
593 <title>Synopsis</title>
594  <programlisting>
595struct w1_async_cmd {
596  struct list_head async_entry;
597  void (* cb) (struct w1_master *dev, struct w1_async_cmd *async_cmd);
598};  </programlisting>
599</refsynopsisdiv>
600 <refsect1>
601  <title>Members</title>
602  <variablelist>
603    <varlistentry>      <term>async_entry</term>
604      <listitem><para>
605   link entry
606      </para></listitem>
607    </varlistentry>
608    <varlistentry>      <term>cb</term>
609      <listitem><para>
610   callback function, must list_del and destroy this list before
611   returning
612      </para></listitem>
613    </varlistentry>
614  </variablelist>
615 </refsect1>
616<refsect1>
617<title>Description</title>
618<para>
619   When inserted into the w1_master async_list, w1_process will execute
620   the callback.  Embed this into the structure with the command details.
621</para>
622</refsect1>
623</refentry>
624
625      </sect2>
626
627      <sect2 id="w1.c">
628        <title>drivers/w1/w1.c</title>
629        <para>W1 core functions.</para>
630<!-- drivers/w1/w1.c -->
631<refentry id="API-w1-search">
632<refentryinfo>
633 <title>LINUX</title>
634 <productname>Kernel Hackers Manual</productname>
635 <date>July 2017</date>
636</refentryinfo>
637<refmeta>
638 <refentrytitle><phrase>w1_search</phrase></refentrytitle>
639 <manvolnum>9</manvolnum>
640 <refmiscinfo class="version">4.1.27</refmiscinfo>
641</refmeta>
642<refnamediv>
643 <refname>w1_search</refname>
644 <refpurpose>
645  Performs a ROM Search &amp; registers any devices found.
646 </refpurpose>
647</refnamediv>
648<refsynopsisdiv>
649 <title>Synopsis</title>
650  <funcsynopsis><funcprototype>
651   <funcdef>void <function>w1_search </function></funcdef>
652   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
653   <paramdef>u8 <parameter>search_type</parameter></paramdef>
654   <paramdef>w1_slave_found_callback <parameter>cb</parameter></paramdef>
655  </funcprototype></funcsynopsis>
656</refsynopsisdiv>
657<refsect1>
658 <title>Arguments</title>
659 <variablelist>
660  <varlistentry>
661   <term><parameter>dev</parameter></term>
662   <listitem>
663    <para>
664     The master device to search
665    </para>
666   </listitem>
667  </varlistentry>
668  <varlistentry>
669   <term><parameter>search_type</parameter></term>
670   <listitem>
671    <para>
672     W1_SEARCH to search all devices, or W1_ALARM_SEARCH
673     to return only devices in the alarmed state
674    </para>
675   </listitem>
676  </varlistentry>
677  <varlistentry>
678   <term><parameter>cb</parameter></term>
679   <listitem>
680    <para>
681     Function to call when a device is found
682    </para>
683   </listitem>
684  </varlistentry>
685 </variablelist>
686</refsect1>
687<refsect1>
688<title>Description</title>
689<para>
690   The 1-wire search is a simple binary tree search.
691   For each bit of the address, we read two bits and write one bit.
692   The bit written will put to sleep all devies that don't match that bit.
693   When the two reads differ, the direction choice is obvious.
694   When both bits are 0, we must choose a path to take.
695   When we can scan all 64 bits without having to choose a path, we are done.
696   </para><para>
697
698   See <quote>Application note 187 1-wire search algorithm</quote> at www.maxim-ic.com
699</para>
700</refsect1>
701</refentry>
702
703<refentry id="API-w1-process-callbacks">
704<refentryinfo>
705 <title>LINUX</title>
706 <productname>Kernel Hackers Manual</productname>
707 <date>July 2017</date>
708</refentryinfo>
709<refmeta>
710 <refentrytitle><phrase>w1_process_callbacks</phrase></refentrytitle>
711 <manvolnum>9</manvolnum>
712 <refmiscinfo class="version">4.1.27</refmiscinfo>
713</refmeta>
714<refnamediv>
715 <refname>w1_process_callbacks</refname>
716 <refpurpose>
717     execute each dev-&gt;async_list callback entry
718 </refpurpose>
719</refnamediv>
720<refsynopsisdiv>
721 <title>Synopsis</title>
722  <funcsynopsis><funcprototype>
723   <funcdef>int <function>w1_process_callbacks </function></funcdef>
724   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
725  </funcprototype></funcsynopsis>
726</refsynopsisdiv>
727<refsect1>
728 <title>Arguments</title>
729 <variablelist>
730  <varlistentry>
731   <term><parameter>dev</parameter></term>
732   <listitem>
733    <para>
734     w1_master device
735    </para>
736   </listitem>
737  </varlistentry>
738 </variablelist>
739</refsect1>
740<refsect1>
741<title>Description</title>
742<para>
743   The w1 master list_mutex must be held.
744</para>
745</refsect1>
746<refsect1>
747<title>Return</title>
748<para>
749   1 if there were commands to executed 0 otherwise
750</para>
751</refsect1>
752</refentry>
753
754      </sect2>
755
756      <sect2 id="w1_family.h">
757        <title>drivers/w1/w1_family.h</title>
758        <para>Allows registering device family operations.</para>
759<!-- drivers/w1/w1_family.h -->
760<refentry id="API-struct-w1-family-ops">
761<refentryinfo>
762 <title>LINUX</title>
763 <productname>Kernel Hackers Manual</productname>
764 <date>July 2017</date>
765</refentryinfo>
766<refmeta>
767 <refentrytitle><phrase>struct w1_family_ops</phrase></refentrytitle>
768 <manvolnum>9</manvolnum>
769 <refmiscinfo class="version">4.1.27</refmiscinfo>
770</refmeta>
771<refnamediv>
772 <refname>struct w1_family_ops</refname>
773 <refpurpose>
774  operations for a family type
775 </refpurpose>
776</refnamediv>
777<refsynopsisdiv>
778 <title>Synopsis</title>
779  <programlisting>
780struct w1_family_ops {
781  int (* add_slave) (struct w1_slave *);
782  void (* remove_slave) (struct w1_slave *);
783  const struct attribute_group ** groups;
784};  </programlisting>
785</refsynopsisdiv>
786 <refsect1>
787  <title>Members</title>
788  <variablelist>
789    <varlistentry>      <term>add_slave</term>
790      <listitem><para>
791add_slave
792      </para></listitem>
793    </varlistentry>
794    <varlistentry>      <term>remove_slave</term>
795      <listitem><para>
796remove_slave
797      </para></listitem>
798    </varlistentry>
799    <varlistentry>      <term>groups</term>
800      <listitem><para>
801sysfs group
802      </para></listitem>
803    </varlistentry>
804  </variablelist>
805 </refsect1>
806</refentry>
807
808<refentry id="API-struct-w1-family">
809<refentryinfo>
810 <title>LINUX</title>
811 <productname>Kernel Hackers Manual</productname>
812 <date>July 2017</date>
813</refentryinfo>
814<refmeta>
815 <refentrytitle><phrase>struct w1_family</phrase></refentrytitle>
816 <manvolnum>9</manvolnum>
817 <refmiscinfo class="version">4.1.27</refmiscinfo>
818</refmeta>
819<refnamediv>
820 <refname>struct w1_family</refname>
821 <refpurpose>
822     reference counted family structure.
823 </refpurpose>
824</refnamediv>
825<refsynopsisdiv>
826 <title>Synopsis</title>
827  <programlisting>
828struct w1_family {
829  struct list_head family_entry;
830  u8 fid;
831  struct w1_family_ops * fops;
832  atomic_t refcnt;
833};  </programlisting>
834</refsynopsisdiv>
835 <refsect1>
836  <title>Members</title>
837  <variablelist>
838    <varlistentry>      <term>family_entry</term>
839      <listitem><para>
840   family linked list
841      </para></listitem>
842    </varlistentry>
843    <varlistentry>      <term>fid</term>
844      <listitem><para>
845   8 bit family identifier
846      </para></listitem>
847    </varlistentry>
848    <varlistentry>      <term>fops</term>
849      <listitem><para>
850   operations for this family
851      </para></listitem>
852    </varlistentry>
853    <varlistentry>      <term>refcnt</term>
854      <listitem><para>
855   reference counter
856      </para></listitem>
857    </varlistentry>
858  </variablelist>
859 </refsect1>
860</refentry>
861
862      </sect2>
863
864      <sect2 id="w1_family.c">
865        <title>drivers/w1/w1_family.c</title>
866        <para>Allows registering device family operations.</para>
867<!-- drivers/w1/w1_family.c -->
868<refentry id="API-w1-register-family">
869<refentryinfo>
870 <title>LINUX</title>
871 <productname>Kernel Hackers Manual</productname>
872 <date>July 2017</date>
873</refentryinfo>
874<refmeta>
875 <refentrytitle><phrase>w1_register_family</phrase></refentrytitle>
876 <manvolnum>9</manvolnum>
877 <refmiscinfo class="version">4.1.27</refmiscinfo>
878</refmeta>
879<refnamediv>
880 <refname>w1_register_family</refname>
881 <refpurpose>
882  register a device family driver
883 </refpurpose>
884</refnamediv>
885<refsynopsisdiv>
886 <title>Synopsis</title>
887  <funcsynopsis><funcprototype>
888   <funcdef>int <function>w1_register_family </function></funcdef>
889   <paramdef>struct w1_family * <parameter>newf</parameter></paramdef>
890  </funcprototype></funcsynopsis>
891</refsynopsisdiv>
892<refsect1>
893 <title>Arguments</title>
894 <variablelist>
895  <varlistentry>
896   <term><parameter>newf</parameter></term>
897   <listitem>
898    <para>
899     family to register
900    </para>
901   </listitem>
902  </varlistentry>
903 </variablelist>
904</refsect1>
905</refentry>
906
907<refentry id="API-w1-unregister-family">
908<refentryinfo>
909 <title>LINUX</title>
910 <productname>Kernel Hackers Manual</productname>
911 <date>July 2017</date>
912</refentryinfo>
913<refmeta>
914 <refentrytitle><phrase>w1_unregister_family</phrase></refentrytitle>
915 <manvolnum>9</manvolnum>
916 <refmiscinfo class="version">4.1.27</refmiscinfo>
917</refmeta>
918<refnamediv>
919 <refname>w1_unregister_family</refname>
920 <refpurpose>
921     unregister a device family driver
922 </refpurpose>
923</refnamediv>
924<refsynopsisdiv>
925 <title>Synopsis</title>
926  <funcsynopsis><funcprototype>
927   <funcdef>void <function>w1_unregister_family </function></funcdef>
928   <paramdef>struct w1_family * <parameter>fent</parameter></paramdef>
929  </funcprototype></funcsynopsis>
930</refsynopsisdiv>
931<refsect1>
932 <title>Arguments</title>
933 <variablelist>
934  <varlistentry>
935   <term><parameter>fent</parameter></term>
936   <listitem>
937    <para>
938     family to unregister
939    </para>
940   </listitem>
941  </varlistentry>
942 </variablelist>
943</refsect1>
944</refentry>
945
946      </sect2>
947
948      <sect2 id="w1_int.c">
949        <title>drivers/w1/w1_int.c</title>
950        <para>W1 internal initialization for master devices.</para>
951<!-- drivers/w1/w1_int.c -->
952<refentry id="API-w1-add-master-device">
953<refentryinfo>
954 <title>LINUX</title>
955 <productname>Kernel Hackers Manual</productname>
956 <date>July 2017</date>
957</refentryinfo>
958<refmeta>
959 <refentrytitle><phrase>w1_add_master_device</phrase></refentrytitle>
960 <manvolnum>9</manvolnum>
961 <refmiscinfo class="version">4.1.27</refmiscinfo>
962</refmeta>
963<refnamediv>
964 <refname>w1_add_master_device</refname>
965 <refpurpose>
966  registers a new master device
967 </refpurpose>
968</refnamediv>
969<refsynopsisdiv>
970 <title>Synopsis</title>
971  <funcsynopsis><funcprototype>
972   <funcdef>int <function>w1_add_master_device </function></funcdef>
973   <paramdef>struct w1_bus_master * <parameter>master</parameter></paramdef>
974  </funcprototype></funcsynopsis>
975</refsynopsisdiv>
976<refsect1>
977 <title>Arguments</title>
978 <variablelist>
979  <varlistentry>
980   <term><parameter>master</parameter></term>
981   <listitem>
982    <para>
983     master bus device to register
984    </para>
985   </listitem>
986  </varlistentry>
987 </variablelist>
988</refsect1>
989</refentry>
990
991<refentry id="API-w1-remove-master-device">
992<refentryinfo>
993 <title>LINUX</title>
994 <productname>Kernel Hackers Manual</productname>
995 <date>July 2017</date>
996</refentryinfo>
997<refmeta>
998 <refentrytitle><phrase>w1_remove_master_device</phrase></refentrytitle>
999 <manvolnum>9</manvolnum>
1000 <refmiscinfo class="version">4.1.27</refmiscinfo>
1001</refmeta>
1002<refnamediv>
1003 <refname>w1_remove_master_device</refname>
1004 <refpurpose>
1005     unregister a master device
1006 </refpurpose>
1007</refnamediv>
1008<refsynopsisdiv>
1009 <title>Synopsis</title>
1010  <funcsynopsis><funcprototype>
1011   <funcdef>void <function>w1_remove_master_device </function></funcdef>
1012   <paramdef>struct w1_bus_master * <parameter>bm</parameter></paramdef>
1013  </funcprototype></funcsynopsis>
1014</refsynopsisdiv>
1015<refsect1>
1016 <title>Arguments</title>
1017 <variablelist>
1018  <varlistentry>
1019   <term><parameter>bm</parameter></term>
1020   <listitem>
1021    <para>
1022     master bus device to remove
1023    </para>
1024   </listitem>
1025  </varlistentry>
1026 </variablelist>
1027</refsect1>
1028</refentry>
1029
1030      </sect2>
1031
1032      <sect2 id="w1_netlink.h">
1033        <title>drivers/w1/w1_netlink.h</title>
1034        <para>W1 external netlink API structures and commands.</para>
1035<!-- drivers/w1/w1_netlink.h -->
1036<refentry id="API-enum-w1-cn-msg-flags">
1037<refentryinfo>
1038 <title>LINUX</title>
1039 <productname>Kernel Hackers Manual</productname>
1040 <date>July 2017</date>
1041</refentryinfo>
1042<refmeta>
1043 <refentrytitle><phrase>enum w1_cn_msg_flags</phrase></refentrytitle>
1044 <manvolnum>9</manvolnum>
1045 <refmiscinfo class="version">4.1.27</refmiscinfo>
1046</refmeta>
1047<refnamediv>
1048 <refname>enum w1_cn_msg_flags</refname>
1049 <refpurpose>
1050  bitfield flags for struct cn_msg.flags
1051 </refpurpose>
1052</refnamediv>
1053<refsynopsisdiv>
1054 <title>Synopsis</title>
1055  <programlisting>
1056enum w1_cn_msg_flags {
1057  W1_CN_BUNDLE
1058};  </programlisting>
1059</refsynopsisdiv>
1060<refsect1>
1061 <title>Constants</title>
1062  <variablelist>
1063    <varlistentry>      <term>W1_CN_BUNDLE</term>
1064      <listitem><para>
1065Request bundling replies into fewer messagse.  Be prepared
1066to handle multiple struct cn_msg, struct w1_netlink_msg, and
1067struct w1_netlink_cmd in one packet.
1068      </para></listitem>
1069    </varlistentry>
1070  </variablelist>
1071</refsect1>
1072</refentry>
1073
1074<refentry id="API-enum-w1-netlink-message-types">
1075<refentryinfo>
1076 <title>LINUX</title>
1077 <productname>Kernel Hackers Manual</productname>
1078 <date>July 2017</date>
1079</refentryinfo>
1080<refmeta>
1081 <refentrytitle><phrase>enum w1_netlink_message_types</phrase></refentrytitle>
1082 <manvolnum>9</manvolnum>
1083 <refmiscinfo class="version">4.1.27</refmiscinfo>
1084</refmeta>
1085<refnamediv>
1086 <refname>enum w1_netlink_message_types</refname>
1087 <refpurpose>
1088     message type
1089 </refpurpose>
1090</refnamediv>
1091<refsynopsisdiv>
1092 <title>Synopsis</title>
1093  <programlisting>
1094enum w1_netlink_message_types {
1095  W1_SLAVE_ADD,
1096  W1_SLAVE_REMOVE,
1097  W1_MASTER_ADD,
1098  W1_MASTER_REMOVE,
1099  W1_MASTER_CMD,
1100  W1_SLAVE_CMD,
1101  W1_LIST_MASTERS
1102};  </programlisting>
1103</refsynopsisdiv>
1104<refsect1>
1105 <title>Constants</title>
1106  <variablelist>
1107    <varlistentry>      <term>W1_SLAVE_ADD</term>
1108      <listitem><para>
1109   notification that a slave device was added
1110      </para></listitem>
1111    </varlistentry>
1112    <varlistentry>      <term>W1_SLAVE_REMOVE</term>
1113      <listitem><para>
1114   notification that a slave device was removed
1115      </para></listitem>
1116    </varlistentry>
1117    <varlistentry>      <term>W1_MASTER_ADD</term>
1118      <listitem><para>
1119   notification that a new bus master was added
1120      </para></listitem>
1121    </varlistentry>
1122    <varlistentry>      <term>W1_MASTER_REMOVE</term>
1123      <listitem><para>
1124   notification that a bus masterwas removed
1125      </para></listitem>
1126    </varlistentry>
1127    <varlistentry>      <term>W1_MASTER_CMD</term>
1128      <listitem><para>
1129   initiate operations on a specific master
1130      </para></listitem>
1131    </varlistentry>
1132    <varlistentry>      <term>W1_SLAVE_CMD</term>
1133      <listitem><para>
1134   sends reset, selects the slave, then does a read/write/touch
1135   operation
1136      </para></listitem>
1137    </varlistentry>
1138    <varlistentry>      <term>W1_LIST_MASTERS</term>
1139      <listitem><para>
1140   used to determine the bus master identifiers
1141      </para></listitem>
1142    </varlistentry>
1143  </variablelist>
1144</refsect1>
1145</refentry>
1146
1147<refentry id="API-struct-w1-netlink-msg">
1148<refentryinfo>
1149 <title>LINUX</title>
1150 <productname>Kernel Hackers Manual</productname>
1151 <date>July 2017</date>
1152</refentryinfo>
1153<refmeta>
1154 <refentrytitle><phrase>struct w1_netlink_msg</phrase></refentrytitle>
1155 <manvolnum>9</manvolnum>
1156 <refmiscinfo class="version">4.1.27</refmiscinfo>
1157</refmeta>
1158<refnamediv>
1159 <refname>struct w1_netlink_msg</refname>
1160 <refpurpose>
1161     holds w1 message type, id, and result
1162 </refpurpose>
1163</refnamediv>
1164<refsynopsisdiv>
1165 <title>Synopsis</title>
1166  <programlisting>
1167struct w1_netlink_msg {
1168  __u8 type;
1169  __u8 status;
1170  __u16 len;
1171  union id;
1172  __u8 data[0];
1173};  </programlisting>
1174</refsynopsisdiv>
1175 <refsect1>
1176  <title>Members</title>
1177  <variablelist>
1178    <varlistentry>      <term>type</term>
1179      <listitem><para>
1180   one of enum w1_netlink_message_types
1181      </para></listitem>
1182    </varlistentry>
1183    <varlistentry>      <term>status</term>
1184      <listitem><para>
1185   kernel feedback for success 0 or errno failure value
1186      </para></listitem>
1187    </varlistentry>
1188    <varlistentry>      <term>len</term>
1189      <listitem><para>
1190   length of data following w1_netlink_msg
1191      </para></listitem>
1192    </varlistentry>
1193    <varlistentry>      <term>id</term>
1194      <listitem><para>
1195   union holding master bus id (msg.id) and slave device id (id[8]).
1196      </para></listitem>
1197    </varlistentry>
1198    <varlistentry>      <term>data[0]</term>
1199      <listitem><para>
1200   start address of any following data
1201      </para></listitem>
1202    </varlistentry>
1203  </variablelist>
1204 </refsect1>
1205<refsect1>
1206<title>Description</title>
1207<para>
1208   The base message structure for w1 messages over netlink.
1209   The netlink connector data sequence is, struct nlmsghdr, struct cn_msg,
1210   then one or more struct w1_netlink_msg (each with optional data).
1211</para>
1212</refsect1>
1213</refentry>
1214
1215<refentry id="API-enum-w1-commands">
1216<refentryinfo>
1217 <title>LINUX</title>
1218 <productname>Kernel Hackers Manual</productname>
1219 <date>July 2017</date>
1220</refentryinfo>
1221<refmeta>
1222 <refentrytitle><phrase>enum w1_commands</phrase></refentrytitle>
1223 <manvolnum>9</manvolnum>
1224 <refmiscinfo class="version">4.1.27</refmiscinfo>
1225</refmeta>
1226<refnamediv>
1227 <refname>enum w1_commands</refname>
1228 <refpurpose>
1229     commands available for master or slave operations
1230 </refpurpose>
1231</refnamediv>
1232<refsynopsisdiv>
1233 <title>Synopsis</title>
1234  <programlisting>
1235enum w1_commands {
1236  W1_CMD_READ,
1237  W1_CMD_WRITE,
1238  W1_CMD_SEARCH,
1239  W1_CMD_ALARM_SEARCH,
1240  W1_CMD_TOUCH,
1241  W1_CMD_RESET,
1242  W1_CMD_SLAVE_ADD,
1243  W1_CMD_SLAVE_REMOVE,
1244  W1_CMD_LIST_SLAVES,
1245  W1_CMD_MAX
1246};  </programlisting>
1247</refsynopsisdiv>
1248<refsect1>
1249 <title>Constants</title>
1250  <variablelist>
1251    <varlistentry>      <term>W1_CMD_READ</term>
1252      <listitem><para>
1253   read len bytes
1254      </para></listitem>
1255    </varlistentry>
1256    <varlistentry>      <term>W1_CMD_WRITE</term>
1257      <listitem><para>
1258   write len bytes
1259      </para></listitem>
1260    </varlistentry>
1261    <varlistentry>      <term>W1_CMD_SEARCH</term>
1262      <listitem><para>
1263   initiate a standard search, returns only the slave
1264   devices found during that search
1265      </para></listitem>
1266    </varlistentry>
1267    <varlistentry>      <term>W1_CMD_ALARM_SEARCH</term>
1268      <listitem><para>
1269   search for devices that are currently alarming
1270      </para></listitem>
1271    </varlistentry>
1272    <varlistentry>      <term>W1_CMD_TOUCH</term>
1273      <listitem><para>
1274   Touches a series of bytes.
1275      </para></listitem>
1276    </varlistentry>
1277    <varlistentry>      <term>W1_CMD_RESET</term>
1278      <listitem><para>
1279   sends a bus reset on the given master
1280      </para></listitem>
1281    </varlistentry>
1282    <varlistentry>      <term>W1_CMD_SLAVE_ADD</term>
1283      <listitem><para>
1284   adds a slave to the given master,
1285   8 byte slave id at data[0]
1286      </para></listitem>
1287    </varlistentry>
1288    <varlistentry>      <term>W1_CMD_SLAVE_REMOVE</term>
1289      <listitem><para>
1290   removes a slave to the given master,
1291   8 byte slave id at data[0]
1292      </para></listitem>
1293    </varlistentry>
1294    <varlistentry>      <term>W1_CMD_LIST_SLAVES</term>
1295      <listitem><para>
1296   list of slaves registered on this master
1297      </para></listitem>
1298    </varlistentry>
1299    <varlistentry>      <term>W1_CMD_MAX</term>
1300      <listitem><para>
1301   number of available commands
1302      </para></listitem>
1303    </varlistentry>
1304  </variablelist>
1305</refsect1>
1306</refentry>
1307
1308<refentry id="API-struct-w1-netlink-cmd">
1309<refentryinfo>
1310 <title>LINUX</title>
1311 <productname>Kernel Hackers Manual</productname>
1312 <date>July 2017</date>
1313</refentryinfo>
1314<refmeta>
1315 <refentrytitle><phrase>struct w1_netlink_cmd</phrase></refentrytitle>
1316 <manvolnum>9</manvolnum>
1317 <refmiscinfo class="version">4.1.27</refmiscinfo>
1318</refmeta>
1319<refnamediv>
1320 <refname>struct w1_netlink_cmd</refname>
1321 <refpurpose>
1322     holds the command and data
1323 </refpurpose>
1324</refnamediv>
1325<refsynopsisdiv>
1326 <title>Synopsis</title>
1327  <programlisting>
1328struct w1_netlink_cmd {
1329  __u8 cmd;
1330  __u8 res;
1331  __u16 len;
1332  __u8 data[0];
1333};  </programlisting>
1334</refsynopsisdiv>
1335 <refsect1>
1336  <title>Members</title>
1337  <variablelist>
1338    <varlistentry>      <term>cmd</term>
1339      <listitem><para>
1340   one of enum w1_commands
1341      </para></listitem>
1342    </varlistentry>
1343    <varlistentry>      <term>res</term>
1344      <listitem><para>
1345   reserved
1346      </para></listitem>
1347    </varlistentry>
1348    <varlistentry>      <term>len</term>
1349      <listitem><para>
1350   length of data following w1_netlink_cmd
1351      </para></listitem>
1352    </varlistentry>
1353    <varlistentry>      <term>data[0]</term>
1354      <listitem><para>
1355   start address of any following data
1356      </para></listitem>
1357    </varlistentry>
1358  </variablelist>
1359 </refsect1>
1360<refsect1>
1361<title>Description</title>
1362<para>
1363   One or more struct w1_netlink_cmd is placed starting at w1_netlink_msg.data
1364   each with optional data.
1365</para>
1366</refsect1>
1367</refentry>
1368
1369      </sect2>
1370
1371      <sect2 id="w1_io.c">
1372        <title>drivers/w1/w1_io.c</title>
1373        <para>W1 input/output.</para>
1374<!-- drivers/w1/w1_io.c -->
1375<refentry id="API-w1-write-8">
1376<refentryinfo>
1377 <title>LINUX</title>
1378 <productname>Kernel Hackers Manual</productname>
1379 <date>July 2017</date>
1380</refentryinfo>
1381<refmeta>
1382 <refentrytitle><phrase>w1_write_8</phrase></refentrytitle>
1383 <manvolnum>9</manvolnum>
1384 <refmiscinfo class="version">4.1.27</refmiscinfo>
1385</refmeta>
1386<refnamediv>
1387 <refname>w1_write_8</refname>
1388 <refpurpose>
1389  Writes 8 bits.
1390 </refpurpose>
1391</refnamediv>
1392<refsynopsisdiv>
1393 <title>Synopsis</title>
1394  <funcsynopsis><funcprototype>
1395   <funcdef>void <function>w1_write_8 </function></funcdef>
1396   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1397   <paramdef>u8 <parameter>byte</parameter></paramdef>
1398  </funcprototype></funcsynopsis>
1399</refsynopsisdiv>
1400<refsect1>
1401 <title>Arguments</title>
1402 <variablelist>
1403  <varlistentry>
1404   <term><parameter>dev</parameter></term>
1405   <listitem>
1406    <para>
1407     the master device
1408    </para>
1409   </listitem>
1410  </varlistentry>
1411  <varlistentry>
1412   <term><parameter>byte</parameter></term>
1413   <listitem>
1414    <para>
1415     the byte to write
1416    </para>
1417   </listitem>
1418  </varlistentry>
1419 </variablelist>
1420</refsect1>
1421</refentry>
1422
1423<refentry id="API-w1-read-8">
1424<refentryinfo>
1425 <title>LINUX</title>
1426 <productname>Kernel Hackers Manual</productname>
1427 <date>July 2017</date>
1428</refentryinfo>
1429<refmeta>
1430 <refentrytitle><phrase>w1_read_8</phrase></refentrytitle>
1431 <manvolnum>9</manvolnum>
1432 <refmiscinfo class="version">4.1.27</refmiscinfo>
1433</refmeta>
1434<refnamediv>
1435 <refname>w1_read_8</refname>
1436 <refpurpose>
1437     Reads 8 bits.
1438 </refpurpose>
1439</refnamediv>
1440<refsynopsisdiv>
1441 <title>Synopsis</title>
1442  <funcsynopsis><funcprototype>
1443   <funcdef>u8 <function>w1_read_8 </function></funcdef>
1444   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1445  </funcprototype></funcsynopsis>
1446</refsynopsisdiv>
1447<refsect1>
1448 <title>Arguments</title>
1449 <variablelist>
1450  <varlistentry>
1451   <term><parameter>dev</parameter></term>
1452   <listitem>
1453    <para>
1454     the master device
1455    </para>
1456   </listitem>
1457  </varlistentry>
1458 </variablelist>
1459</refsect1>
1460<refsect1>
1461<title>Return</title>
1462<para>
1463   the byte read
1464</para>
1465</refsect1>
1466</refentry>
1467
1468<refentry id="API-w1-write-block">
1469<refentryinfo>
1470 <title>LINUX</title>
1471 <productname>Kernel Hackers Manual</productname>
1472 <date>July 2017</date>
1473</refentryinfo>
1474<refmeta>
1475 <refentrytitle><phrase>w1_write_block</phrase></refentrytitle>
1476 <manvolnum>9</manvolnum>
1477 <refmiscinfo class="version">4.1.27</refmiscinfo>
1478</refmeta>
1479<refnamediv>
1480 <refname>w1_write_block</refname>
1481 <refpurpose>
1482     Writes a series of bytes.
1483 </refpurpose>
1484</refnamediv>
1485<refsynopsisdiv>
1486 <title>Synopsis</title>
1487  <funcsynopsis><funcprototype>
1488   <funcdef>void <function>w1_write_block </function></funcdef>
1489   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1490   <paramdef>const u8 * <parameter>buf</parameter></paramdef>
1491   <paramdef>int <parameter>len</parameter></paramdef>
1492  </funcprototype></funcsynopsis>
1493</refsynopsisdiv>
1494<refsect1>
1495 <title>Arguments</title>
1496 <variablelist>
1497  <varlistentry>
1498   <term><parameter>dev</parameter></term>
1499   <listitem>
1500    <para>
1501     the master device
1502    </para>
1503   </listitem>
1504  </varlistentry>
1505  <varlistentry>
1506   <term><parameter>buf</parameter></term>
1507   <listitem>
1508    <para>
1509     pointer to the data to write
1510    </para>
1511   </listitem>
1512  </varlistentry>
1513  <varlistentry>
1514   <term><parameter>len</parameter></term>
1515   <listitem>
1516    <para>
1517     the number of bytes to write
1518    </para>
1519   </listitem>
1520  </varlistentry>
1521 </variablelist>
1522</refsect1>
1523</refentry>
1524
1525<refentry id="API-w1-touch-block">
1526<refentryinfo>
1527 <title>LINUX</title>
1528 <productname>Kernel Hackers Manual</productname>
1529 <date>July 2017</date>
1530</refentryinfo>
1531<refmeta>
1532 <refentrytitle><phrase>w1_touch_block</phrase></refentrytitle>
1533 <manvolnum>9</manvolnum>
1534 <refmiscinfo class="version">4.1.27</refmiscinfo>
1535</refmeta>
1536<refnamediv>
1537 <refname>w1_touch_block</refname>
1538 <refpurpose>
1539     Touches a series of bytes.
1540 </refpurpose>
1541</refnamediv>
1542<refsynopsisdiv>
1543 <title>Synopsis</title>
1544  <funcsynopsis><funcprototype>
1545   <funcdef>void <function>w1_touch_block </function></funcdef>
1546   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1547   <paramdef>u8 * <parameter>buf</parameter></paramdef>
1548   <paramdef>int <parameter>len</parameter></paramdef>
1549  </funcprototype></funcsynopsis>
1550</refsynopsisdiv>
1551<refsect1>
1552 <title>Arguments</title>
1553 <variablelist>
1554  <varlistentry>
1555   <term><parameter>dev</parameter></term>
1556   <listitem>
1557    <para>
1558     the master device
1559    </para>
1560   </listitem>
1561  </varlistentry>
1562  <varlistentry>
1563   <term><parameter>buf</parameter></term>
1564   <listitem>
1565    <para>
1566     pointer to the data to write
1567    </para>
1568   </listitem>
1569  </varlistentry>
1570  <varlistentry>
1571   <term><parameter>len</parameter></term>
1572   <listitem>
1573    <para>
1574     the number of bytes to write
1575    </para>
1576   </listitem>
1577  </varlistentry>
1578 </variablelist>
1579</refsect1>
1580</refentry>
1581
1582<refentry id="API-w1-read-block">
1583<refentryinfo>
1584 <title>LINUX</title>
1585 <productname>Kernel Hackers Manual</productname>
1586 <date>July 2017</date>
1587</refentryinfo>
1588<refmeta>
1589 <refentrytitle><phrase>w1_read_block</phrase></refentrytitle>
1590 <manvolnum>9</manvolnum>
1591 <refmiscinfo class="version">4.1.27</refmiscinfo>
1592</refmeta>
1593<refnamediv>
1594 <refname>w1_read_block</refname>
1595 <refpurpose>
1596     Reads a series of bytes.
1597 </refpurpose>
1598</refnamediv>
1599<refsynopsisdiv>
1600 <title>Synopsis</title>
1601  <funcsynopsis><funcprototype>
1602   <funcdef>u8 <function>w1_read_block </function></funcdef>
1603   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1604   <paramdef>u8 * <parameter>buf</parameter></paramdef>
1605   <paramdef>int <parameter>len</parameter></paramdef>
1606  </funcprototype></funcsynopsis>
1607</refsynopsisdiv>
1608<refsect1>
1609 <title>Arguments</title>
1610 <variablelist>
1611  <varlistentry>
1612   <term><parameter>dev</parameter></term>
1613   <listitem>
1614    <para>
1615     the master device
1616    </para>
1617   </listitem>
1618  </varlistentry>
1619  <varlistentry>
1620   <term><parameter>buf</parameter></term>
1621   <listitem>
1622    <para>
1623     pointer to the buffer to fill
1624    </para>
1625   </listitem>
1626  </varlistentry>
1627  <varlistentry>
1628   <term><parameter>len</parameter></term>
1629   <listitem>
1630    <para>
1631     the number of bytes to read
1632    </para>
1633   </listitem>
1634  </varlistentry>
1635 </variablelist>
1636</refsect1>
1637<refsect1>
1638<title>Return</title>
1639<para>
1640   the number of bytes read
1641</para>
1642</refsect1>
1643</refentry>
1644
1645<refentry id="API-w1-reset-bus">
1646<refentryinfo>
1647 <title>LINUX</title>
1648 <productname>Kernel Hackers Manual</productname>
1649 <date>July 2017</date>
1650</refentryinfo>
1651<refmeta>
1652 <refentrytitle><phrase>w1_reset_bus</phrase></refentrytitle>
1653 <manvolnum>9</manvolnum>
1654 <refmiscinfo class="version">4.1.27</refmiscinfo>
1655</refmeta>
1656<refnamediv>
1657 <refname>w1_reset_bus</refname>
1658 <refpurpose>
1659     Issues a reset bus sequence.
1660 </refpurpose>
1661</refnamediv>
1662<refsynopsisdiv>
1663 <title>Synopsis</title>
1664  <funcsynopsis><funcprototype>
1665   <funcdef>int <function>w1_reset_bus </function></funcdef>
1666   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1667  </funcprototype></funcsynopsis>
1668</refsynopsisdiv>
1669<refsect1>
1670 <title>Arguments</title>
1671 <variablelist>
1672  <varlistentry>
1673   <term><parameter>dev</parameter></term>
1674   <listitem>
1675    <para>
1676     the master device
1677    </para>
1678   </listitem>
1679  </varlistentry>
1680 </variablelist>
1681</refsect1>
1682<refsect1>
1683<title>Return</title>
1684<para>
1685   0=Device present, 1=No device present or error
1686</para>
1687</refsect1>
1688</refentry>
1689
1690<refentry id="API-w1-reset-select-slave">
1691<refentryinfo>
1692 <title>LINUX</title>
1693 <productname>Kernel Hackers Manual</productname>
1694 <date>July 2017</date>
1695</refentryinfo>
1696<refmeta>
1697 <refentrytitle><phrase>w1_reset_select_slave</phrase></refentrytitle>
1698 <manvolnum>9</manvolnum>
1699 <refmiscinfo class="version">4.1.27</refmiscinfo>
1700</refmeta>
1701<refnamediv>
1702 <refname>w1_reset_select_slave</refname>
1703 <refpurpose>
1704     reset and select a slave
1705 </refpurpose>
1706</refnamediv>
1707<refsynopsisdiv>
1708 <title>Synopsis</title>
1709  <funcsynopsis><funcprototype>
1710   <funcdef>int <function>w1_reset_select_slave </function></funcdef>
1711   <paramdef>struct w1_slave * <parameter>sl</parameter></paramdef>
1712  </funcprototype></funcsynopsis>
1713</refsynopsisdiv>
1714<refsect1>
1715 <title>Arguments</title>
1716 <variablelist>
1717  <varlistentry>
1718   <term><parameter>sl</parameter></term>
1719   <listitem>
1720    <para>
1721     the slave to select
1722    </para>
1723   </listitem>
1724  </varlistentry>
1725 </variablelist>
1726</refsect1>
1727<refsect1>
1728<title>Description</title>
1729<para>
1730   Resets the bus and then selects the slave by sending either a skip rom
1731   or a rom match.  A skip rom is issued if there is only one device
1732   registered on the bus.
1733   The w1 master lock must be held.
1734</para>
1735</refsect1>
1736<refsect1>
1737<title>Return</title>
1738<para>
1739   0=success, anything else=error
1740</para>
1741</refsect1>
1742</refentry>
1743
1744<refentry id="API-w1-reset-resume-command">
1745<refentryinfo>
1746 <title>LINUX</title>
1747 <productname>Kernel Hackers Manual</productname>
1748 <date>July 2017</date>
1749</refentryinfo>
1750<refmeta>
1751 <refentrytitle><phrase>w1_reset_resume_command</phrase></refentrytitle>
1752 <manvolnum>9</manvolnum>
1753 <refmiscinfo class="version">4.1.27</refmiscinfo>
1754</refmeta>
1755<refnamediv>
1756 <refname>w1_reset_resume_command</refname>
1757 <refpurpose>
1758     resume instead of another match ROM
1759 </refpurpose>
1760</refnamediv>
1761<refsynopsisdiv>
1762 <title>Synopsis</title>
1763  <funcsynopsis><funcprototype>
1764   <funcdef>int <function>w1_reset_resume_command </function></funcdef>
1765   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1766  </funcprototype></funcsynopsis>
1767</refsynopsisdiv>
1768<refsect1>
1769 <title>Arguments</title>
1770 <variablelist>
1771  <varlistentry>
1772   <term><parameter>dev</parameter></term>
1773   <listitem>
1774    <para>
1775     the master device
1776    </para>
1777   </listitem>
1778  </varlistentry>
1779 </variablelist>
1780</refsect1>
1781<refsect1>
1782<title>Description</title>
1783<para>
1784   When the workflow with a slave amongst many requires several
1785   successive commands a reset between each, this function is similar
1786   to doing a reset then a match ROM for the last matched ROM. The
1787   advantage being that the matched ROM step is skipped in favor of the
1788   resume command. The slave must support the command of course.
1789   </para><para>
1790
1791   If the bus has only one slave, traditionnaly the match ROM is skipped
1792   and a <quote>SKIP ROM</quote> is done for efficiency. On multi-slave busses, this
1793   doesn't work of course, but the resume command is the next best thing.
1794   </para><para>
1795
1796   The w1 master lock must be held.
1797</para>
1798</refsect1>
1799</refentry>
1800
1801<refentry id="API-w1-next-pullup">
1802<refentryinfo>
1803 <title>LINUX</title>
1804 <productname>Kernel Hackers Manual</productname>
1805 <date>July 2017</date>
1806</refentryinfo>
1807<refmeta>
1808 <refentrytitle><phrase>w1_next_pullup</phrase></refentrytitle>
1809 <manvolnum>9</manvolnum>
1810 <refmiscinfo class="version">4.1.27</refmiscinfo>
1811</refmeta>
1812<refnamediv>
1813 <refname>w1_next_pullup</refname>
1814 <refpurpose>
1815     register for a strong pullup
1816 </refpurpose>
1817</refnamediv>
1818<refsynopsisdiv>
1819 <title>Synopsis</title>
1820  <funcsynopsis><funcprototype>
1821   <funcdef>void <function>w1_next_pullup </function></funcdef>
1822   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1823   <paramdef>int <parameter>delay</parameter></paramdef>
1824  </funcprototype></funcsynopsis>
1825</refsynopsisdiv>
1826<refsect1>
1827 <title>Arguments</title>
1828 <variablelist>
1829  <varlistentry>
1830   <term><parameter>dev</parameter></term>
1831   <listitem>
1832    <para>
1833     the master device
1834    </para>
1835   </listitem>
1836  </varlistentry>
1837  <varlistentry>
1838   <term><parameter>delay</parameter></term>
1839   <listitem>
1840    <para>
1841     time in milliseconds
1842    </para>
1843   </listitem>
1844  </varlistentry>
1845 </variablelist>
1846</refsect1>
1847<refsect1>
1848<title>Description</title>
1849<para>
1850   Put out a strong pull-up of the specified duration after the next write
1851   operation.  Not all hardware supports strong pullups.  Hardware that
1852   doesn't support strong pullups will sleep for the given time after the
1853   write operation without a strong pullup.  This is a one shot request for
1854   the next write, specifying zero will clear a previous request.
1855   The w1 master lock must be held.
1856</para>
1857</refsect1>
1858<refsect1>
1859<title>Return</title>
1860<para>
1861   0=success, anything else=error
1862</para>
1863</refsect1>
1864</refentry>
1865
1866<!-- drivers/w1/w1_io.c -->
1867<refentry id="API-w1-touch-bit">
1868<refentryinfo>
1869 <title>LINUX</title>
1870 <productname>Kernel Hackers Manual</productname>
1871 <date>July 2017</date>
1872</refentryinfo>
1873<refmeta>
1874 <refentrytitle><phrase>w1_touch_bit</phrase></refentrytitle>
1875 <manvolnum>9</manvolnum>
1876 <refmiscinfo class="version">4.1.27</refmiscinfo>
1877</refmeta>
1878<refnamediv>
1879 <refname>w1_touch_bit</refname>
1880 <refpurpose>
1881  Generates a write-0 or write-1 cycle and samples the level.
1882 </refpurpose>
1883</refnamediv>
1884<refsynopsisdiv>
1885 <title>Synopsis</title>
1886  <funcsynopsis><funcprototype>
1887   <funcdef>u8 <function>w1_touch_bit </function></funcdef>
1888   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1889   <paramdef>int <parameter>bit</parameter></paramdef>
1890  </funcprototype></funcsynopsis>
1891</refsynopsisdiv>
1892<refsect1>
1893 <title>Arguments</title>
1894 <variablelist>
1895  <varlistentry>
1896   <term><parameter>dev</parameter></term>
1897   <listitem>
1898    <para>
1899     the master device
1900    </para>
1901   </listitem>
1902  </varlistentry>
1903  <varlistentry>
1904   <term><parameter>bit</parameter></term>
1905   <listitem>
1906    <para>
1907     0 - write a 0, 1 - write a 0 read the level
1908    </para>
1909   </listitem>
1910  </varlistentry>
1911 </variablelist>
1912</refsect1>
1913</refentry>
1914
1915<refentry id="API-w1-write-bit">
1916<refentryinfo>
1917 <title>LINUX</title>
1918 <productname>Kernel Hackers Manual</productname>
1919 <date>July 2017</date>
1920</refentryinfo>
1921<refmeta>
1922 <refentrytitle><phrase>w1_write_bit</phrase></refentrytitle>
1923 <manvolnum>9</manvolnum>
1924 <refmiscinfo class="version">4.1.27</refmiscinfo>
1925</refmeta>
1926<refnamediv>
1927 <refname>w1_write_bit</refname>
1928 <refpurpose>
1929     Generates a write-0 or write-1 cycle.
1930 </refpurpose>
1931</refnamediv>
1932<refsynopsisdiv>
1933 <title>Synopsis</title>
1934  <funcsynopsis><funcprototype>
1935   <funcdef>void <function>w1_write_bit </function></funcdef>
1936   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1937   <paramdef>int <parameter>bit</parameter></paramdef>
1938  </funcprototype></funcsynopsis>
1939</refsynopsisdiv>
1940<refsect1>
1941 <title>Arguments</title>
1942 <variablelist>
1943  <varlistentry>
1944   <term><parameter>dev</parameter></term>
1945   <listitem>
1946    <para>
1947     the master device
1948    </para>
1949   </listitem>
1950  </varlistentry>
1951  <varlistentry>
1952   <term><parameter>bit</parameter></term>
1953   <listitem>
1954    <para>
1955     bit to write
1956    </para>
1957   </listitem>
1958  </varlistentry>
1959 </variablelist>
1960</refsect1>
1961<refsect1>
1962<title>Description</title>
1963<para>
1964   Only call if dev-&gt;bus_master-&gt;touch_bit is NULL
1965</para>
1966</refsect1>
1967</refentry>
1968
1969<refentry id="API-w1-pre-write">
1970<refentryinfo>
1971 <title>LINUX</title>
1972 <productname>Kernel Hackers Manual</productname>
1973 <date>July 2017</date>
1974</refentryinfo>
1975<refmeta>
1976 <refentrytitle><phrase>w1_pre_write</phrase></refentrytitle>
1977 <manvolnum>9</manvolnum>
1978 <refmiscinfo class="version">4.1.27</refmiscinfo>
1979</refmeta>
1980<refnamediv>
1981 <refname>w1_pre_write</refname>
1982 <refpurpose>
1983     pre-write operations
1984 </refpurpose>
1985</refnamediv>
1986<refsynopsisdiv>
1987 <title>Synopsis</title>
1988  <funcsynopsis><funcprototype>
1989   <funcdef>void <function>w1_pre_write </function></funcdef>
1990   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
1991  </funcprototype></funcsynopsis>
1992</refsynopsisdiv>
1993<refsect1>
1994 <title>Arguments</title>
1995 <variablelist>
1996  <varlistentry>
1997   <term><parameter>dev</parameter></term>
1998   <listitem>
1999    <para>
2000     the master device
2001    </para>
2002   </listitem>
2003  </varlistentry>
2004 </variablelist>
2005</refsect1>
2006<refsect1>
2007<title>Description</title>
2008<para>
2009   Pre-write operation, currently only supporting strong pullups.
2010   Program the hardware for a strong pullup, if one has been requested and
2011   the hardware supports it.
2012</para>
2013</refsect1>
2014</refentry>
2015
2016<refentry id="API-w1-post-write">
2017<refentryinfo>
2018 <title>LINUX</title>
2019 <productname>Kernel Hackers Manual</productname>
2020 <date>July 2017</date>
2021</refentryinfo>
2022<refmeta>
2023 <refentrytitle><phrase>w1_post_write</phrase></refentrytitle>
2024 <manvolnum>9</manvolnum>
2025 <refmiscinfo class="version">4.1.27</refmiscinfo>
2026</refmeta>
2027<refnamediv>
2028 <refname>w1_post_write</refname>
2029 <refpurpose>
2030     post-write options
2031 </refpurpose>
2032</refnamediv>
2033<refsynopsisdiv>
2034 <title>Synopsis</title>
2035  <funcsynopsis><funcprototype>
2036   <funcdef>void <function>w1_post_write </function></funcdef>
2037   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
2038  </funcprototype></funcsynopsis>
2039</refsynopsisdiv>
2040<refsect1>
2041 <title>Arguments</title>
2042 <variablelist>
2043  <varlistentry>
2044   <term><parameter>dev</parameter></term>
2045   <listitem>
2046    <para>
2047     the master device
2048    </para>
2049   </listitem>
2050  </varlistentry>
2051 </variablelist>
2052</refsect1>
2053<refsect1>
2054<title>Description</title>
2055<para>
2056   Post-write operation, currently only supporting strong pullups.
2057   If a strong pullup was requested, clear it if the hardware supports
2058   them, or execute the delay otherwise, in either case clear the request.
2059</para>
2060</refsect1>
2061</refentry>
2062
2063<refentry id="API-w1-read-bit">
2064<refentryinfo>
2065 <title>LINUX</title>
2066 <productname>Kernel Hackers Manual</productname>
2067 <date>July 2017</date>
2068</refentryinfo>
2069<refmeta>
2070 <refentrytitle><phrase>w1_read_bit</phrase></refentrytitle>
2071 <manvolnum>9</manvolnum>
2072 <refmiscinfo class="version">4.1.27</refmiscinfo>
2073</refmeta>
2074<refnamediv>
2075 <refname>w1_read_bit</refname>
2076 <refpurpose>
2077     Generates a write-1 cycle and samples the level.
2078 </refpurpose>
2079</refnamediv>
2080<refsynopsisdiv>
2081 <title>Synopsis</title>
2082  <funcsynopsis><funcprototype>
2083   <funcdef>u8 <function>w1_read_bit </function></funcdef>
2084   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
2085  </funcprototype></funcsynopsis>
2086</refsynopsisdiv>
2087<refsect1>
2088 <title>Arguments</title>
2089 <variablelist>
2090  <varlistentry>
2091   <term><parameter>dev</parameter></term>
2092   <listitem>
2093    <para>
2094     the master device
2095    </para>
2096   </listitem>
2097  </varlistentry>
2098 </variablelist>
2099</refsect1>
2100<refsect1>
2101<title>Description</title>
2102<para>
2103   Only call if dev-&gt;bus_master-&gt;touch_bit is NULL
2104</para>
2105</refsect1>
2106</refentry>
2107
2108<refentry id="API-w1-triplet">
2109<refentryinfo>
2110 <title>LINUX</title>
2111 <productname>Kernel Hackers Manual</productname>
2112 <date>July 2017</date>
2113</refentryinfo>
2114<refmeta>
2115 <refentrytitle><phrase>w1_triplet</phrase></refentrytitle>
2116 <manvolnum>9</manvolnum>
2117 <refmiscinfo class="version">4.1.27</refmiscinfo>
2118</refmeta>
2119<refnamediv>
2120 <refname>w1_triplet</refname>
2121 <refpurpose>
2122     * Does a triplet - used for searching ROM addresses.
2123 </refpurpose>
2124</refnamediv>
2125<refsynopsisdiv>
2126 <title>Synopsis</title>
2127  <funcsynopsis><funcprototype>
2128   <funcdef>u8 <function>w1_triplet </function></funcdef>
2129   <paramdef>struct w1_master * <parameter>dev</parameter></paramdef>
2130   <paramdef>int <parameter>bdir</parameter></paramdef>
2131  </funcprototype></funcsynopsis>
2132</refsynopsisdiv>
2133<refsect1>
2134 <title>Arguments</title>
2135 <variablelist>
2136  <varlistentry>
2137   <term><parameter>dev</parameter></term>
2138   <listitem>
2139    <para>
2140     the master device
2141    </para>
2142   </listitem>
2143  </varlistentry>
2144  <varlistentry>
2145   <term><parameter>bdir</parameter></term>
2146   <listitem>
2147    <para>
2148     the bit to write if both id_bit and comp_bit are 0
2149    </para>
2150   </listitem>
2151  </varlistentry>
2152 </variablelist>
2153</refsect1>
2154<refsect1>
2155<title>Return bits</title>
2156<para>
2157   bit 0 = id_bit
2158   bit 1 = comp_bit
2159   bit 2 = dir_taken
2160   If both bits 0 &amp; 1 are set, the search should be restarted.
2161</para>
2162</refsect1>
2163<refsect1>
2164<title>Return</title>
2165<para>
2166   bit fields - see above
2167</para>
2168</refsect1>
2169</refentry>
2170
2171      </sect2>
2172
2173    </sect1>
2174
2175
2176  </chapter>
2177
2178</book>
2179