summaryrefslogtreecommitdiff
path: root/static/netbsd/man4/spi.4 4.html
blob: 81db598978f1d79b6ce1ec2fd8a49868e35217bc (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
<table class="head">
  <tr>
    <td class="head-ltitle">SPI(4)</td>
    <td class="head-vol">Device Drivers Manual</td>
    <td class="head-rtitle">SPI(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">spi</code> &#x2014; <span class="Nd">introduction
    to machine-independent SPI bus support and drivers</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">spi* at mainbus?</code>
  <br/>
  <code class="Cd">spi* at umcpmio?</code></p>
<p class="Pp">Other attachments are machine-dependent and will depend on the bus
    topology of your system. See <a class="Xr">intro(4)</a> for your system for
    more information.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp"><span class="Ux">NetBSD</span> includes a machine dependent SPI
    (Serial Peripheral Interface) bus subsystem, and several different
    machine-independent SPI device drivers.</p>
<p class="Pp">Your system may support additional machine-dependent SPI devices.
    Consult your system's <a class="Xr">intro(4)</a> for additional
  information.</p>
<p class="Pp">SPI is a 4-wire synchronous full-duplex serial bus. Some systems
    provide support for Microwire, which is Philips' name for a strict subset of
    SPI, with more rigidly defined signaling. Therefore, Microwire devices are
    also supported by the SPI framework.</p>
<p class="Pp">Note that when referencing SPI devices in a
    <a class="Xr">config(1)</a> file, the &#x2018;slave&#x2019; must be
    provided, as SPI lacks any way to automatically probe devices.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="IOCTLS"><a class="permalink" href="#IOCTLS">IOCTLS</a></h1>
<p class="Pp">The following <a class="Xr">ioctl(2)</a> calls apply to
    <a class="permalink" href="#SPI"><i class="Em" id="SPI">SPI</i></a> devices.
    They are defined in the header file
    <code class="In">&lt;<a class="In">dev/spi/spi_io.h</a>&gt;</code>:</p>
<dl class="Bl-tag">
  <dt id="SPI_IOCTL_CONFIGURE"><a class="permalink" href="#SPI_IOCTL_CONFIGURE"><code class="Dv">SPI_IOCTL_CONFIGURE
    (spi_ioctl_configure_t)</code></a></dt>
  <dd>Used to choose the operational mode and clock. The
      <code class="Li">sic_mode</code> defines polarity and phase of the clock.
      <code class="Li">sic_speed</code> is the clock speed in Hz, a value of 0
      means to keep the default speed of the device.
    <div class="Bd Pp Li">
    <pre>typedef struct spi_ioctl_configure {
	int sic_addr;
	int sic_mode;
	int sic_speed;
} spi_ioctl_configure_t;</pre>
    </div>
  </dd>
  <dt id="SPI_IOCTL_TRANSFER"><a class="permalink" href="#SPI_IOCTL_TRANSFER"><code class="Dv">SPI_IOCTL_TRANSFER
    (spi_ioctl_transfer_t)</code></a></dt>
  <dd>Used to handle an I/O transaction.
    <div class="Bd Pp Li">
    <pre>typedef struct spi_ioctl_transfer {
	int sit_addr;
	const void *sit_send;
	size_t sit_sendlen;
	void *sit_recv;
	size_t sit_recvlen;
} spi_ioctl_transfer_t;</pre>
    </div>
  </dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="HARDWARE"><a class="permalink" href="#HARDWARE">HARDWARE</a></h1>
<p class="Pp"><span class="Ux">NetBSD</span> includes the following
    machine-independent SPI drivers:</p>
<div class="Bd-indent">
<dl class="Bl-tag">
  <dt><a class="Xr">bmx280thp(4)</a></dt>
  <dd>Bosch BMP280 / BME280 sensor.</dd>
  <dt><a class="Xr">m25p(4)</a></dt>
  <dd>STMicroelectronics M25P family of NOR flash devices.</dd>
  <dt><a class="Xr">mcp23s17gpio(4)</a></dt>
  <dd>Microchip MCP23S17 16-bit GPIO chip.</dd>
  <dt><a class="Xr">mcp3kadc(4)</a></dt>
  <dd>Microchip MCP3x0x SAR analog to digital converter.</dd>
  <dt><a class="Xr">mcp48x1dac(4)</a></dt>
  <dd>Microchip MCP4801/MCP4811/MCP4821 digital to analog converter.</dd>
  <dt><a class="Xr">sc16is7xx(4)</a></dt>
  <dd>NXP 16C450 like UART bridge</dd>
  <dt><a class="Xr">scmdspi(4)</a></dt>
  <dd>SPI frontend for the Sparkfun Serial Controlled Motor Driver.</dd>
  <dt><a class="Xr">ssdfb(4)</a></dt>
  <dd>OLED/PLED framebuffer modules.</dd>
  <dt><a class="Xr">tm121temp(4)</a></dt>
  <dd>Texas Instruments TMP121 temperature sensor.</dd>
</dl>
</div>
</section>
<section class="Sh">
<h1 class="Sh" id="FILES"><a class="permalink" href="#FILES">FILES</a></h1>
<dl class="Bl-tag Bl-compact">
  <dt>/dev/spi<var class="Ar">u</var></dt>
  <dd>SPI device unit <var class="Ar">u</var> file.</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">spi(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The machine-independent SPI framework was written by
    <span class="An">Garrett D'Amore</span> for the Champaign-Urbana Community
    Wireless Network Project (CUWiN), and appeared in <span class="Ux">NetBSD
    4.0</span>. The <a class="Xr">ioctl(2)</a> interface allowing configuration
    from userspace appeared in <span class="Ux">NetBSD 9.0</span>.</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">February 27, 2021</td>
    <td class="foot-os">NetBSD 10.1</td>
  </tr>
</table>