1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct w1_bus_master</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="W1: Dallas' 1-wire bus"><link rel="up" href="w1_internal.html#w1.h" title="drivers/w1/w1.h"><link rel="prev" href="API-struct-w1-slave.html" title="struct w1_slave"><link rel="next" href="API-enum-w1-master-flags.html" title="enum w1_master_flags"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct w1_bus_master</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-w1-slave.html">Prev</a>&#160;</td><th width="60%" align="center">drivers/w1/w1.h</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-enum-w1-master-flags.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-w1-bus-master"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct w1_bus_master &#8212; 
2     operations available on a bus master
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct w1_bus_master {
5  void * data;
6  u8 (* read_bit) (void *);
7  void (* write_bit) (void *, u8);
8  u8 (* touch_bit) (void *, u8);
9  u8 (* read_byte) (void *);
10  void (* write_byte) (void *, u8);
11  u8 (* read_block) (void *, u8 *, int);
12  void (* write_block) (void *, const u8 *, int);
13  u8 (* triplet) (void *, u8);
14  u8 (* reset_bus) (void *);
15  u8 (* set_pullup) (void *, int);
16  void (* search) (void *, struct w1_master *,u8, w1_slave_found_callback);
17};  </pre></div><div class="refsect1"><a name="idp1110877524"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">data</span></dt><dd><p>
18   the first parameter in all the functions below
19      </p></dd><dt><span class="term">read_bit</span></dt><dd><p>
20   Sample the line level <em class="parameter"><code>return</code></em> the level read (0 or 1)
21      </p></dd><dt><span class="term">write_bit</span></dt><dd><p>
22   Sets the line level
23      </p></dd><dt><span class="term">touch_bit</span></dt><dd><p>
24   the lowest-level function for devices that really support the
25   1-wire protocol.
26   touch_bit(0) = write-0 cycle
27   touch_bit(1) = write-1 / read cycle
28   <em class="parameter"><code>return</code></em> the bit read (0 or 1)
29      </p></dd><dt><span class="term">read_byte</span></dt><dd><p>
30   Reads a bytes. Same as 8 touch_bit(1) calls.
31   <em class="parameter"><code>return</code></em> the byte read
32      </p></dd><dt><span class="term">write_byte</span></dt><dd><p>
33   Writes a byte. Same as 8 touch_bit(x) calls.
34      </p></dd><dt><span class="term">read_block</span></dt><dd><p>
35   Same as a series of <code class="function">read_byte</code> calls
36   <em class="parameter"><code>return</code></em> the number of bytes read
37      </p></dd><dt><span class="term">write_block</span></dt><dd><p>
38   Same as a series of <code class="function">write_byte</code> calls
39      </p></dd><dt><span class="term">triplet</span></dt><dd><p>
40   Combines two reads and a smart write for ROM searches
41   <em class="parameter"><code>return</code></em> bit0=Id bit1=comp_id bit2=dir_taken
42      </p></dd><dt><span class="term">reset_bus</span></dt><dd><p>
43   long write-0 with a read for the presence pulse detection
44   <em class="parameter"><code>return</code></em> -1=Error, 0=Device present, 1=No device present
45      </p></dd><dt><span class="term">set_pullup</span></dt><dd><p>
46   Put out a strong pull-up pulse of the specified duration.
47   <em class="parameter"><code>return</code></em> -1=Error, 0=completed
48      </p></dd><dt><span class="term">search</span></dt><dd><p>
49   Really nice hardware can handles the different types of ROM search
50   w1_master* is passed to the slave found callback.
51   u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
52      </p></dd></dl></div></div><div class="refsect1"><a name="idp1110411396"></a><h2>Note</h2><p>
53   read_bit and write_bit are very low level functions and should only
54   be used with hardware that doesn't really support 1-wire operations,
55   like a parallel/serial port.
56   Either define read_bit and write_bit OR define, at minimum, touch_bit and
57   reset_bus.
58</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-w1-slave.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="w1_internal.html#w1.h">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-enum-w1-master-flags.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct w1_slave</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">enum w1_master_flags</span></td></tr></table></div></body></html>
59