1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>struct spi_message</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="spi.html" title="Chapter 9. Serial Peripheral Interface (SPI)"><link rel="prev" href="API-struct-spi-transfer.html" title="struct spi_transfer"><link rel="next" href="API-spi-message-init-with-transfers.html" title="spi_message_init_with_transfers"></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 spi_message</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-spi-transfer.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Serial Peripheral Interface (SPI)</th><td width="20%" align="right"> <a accesskey="n" href="API-spi-message-init-with-transfers.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-spi-message"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct spi_message — 2 one multi-segment SPI transaction 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting"> 4struct spi_message { 5 struct list_head transfers; 6 struct spi_device * spi; 7 unsigned is_dma_mapped:1; 8 void (* complete) (void *context); 9 void * context; 10 unsigned frame_length; 11 unsigned actual_length; 12 int status; 13 struct list_head queue; 14 void * state; 15}; </pre></div><div class="refsect1"><a name="idp1114928556"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">transfers</span></dt><dd><p> 16 list of transfer segments in this transaction 17 </p></dd><dt><span class="term">spi</span></dt><dd><p> 18 SPI device to which the transaction is queued 19 </p></dd><dt><span class="term">is_dma_mapped</span></dt><dd><p> 20 if true, the caller provided both dma and cpu virtual 21 addresses for each transfer buffer 22 </p></dd><dt><span class="term">complete</span></dt><dd><p> 23 called to report transaction completions 24 </p></dd><dt><span class="term">context</span></dt><dd><p> 25 the argument to <code class="function">complete</code> when it's called 26 </p></dd><dt><span class="term">frame_length</span></dt><dd><p> 27 the total number of bytes in the message 28 </p></dd><dt><span class="term">actual_length</span></dt><dd><p> 29 the total number of bytes that were transferred in all 30 successful segments 31 </p></dd><dt><span class="term">status</span></dt><dd><p> 32 zero for success, else negative errno 33 </p></dd><dt><span class="term">queue</span></dt><dd><p> 34 for use by whichever driver currently owns the message 35 </p></dd><dt><span class="term">state</span></dt><dd><p> 36 for use by whichever driver currently owns the message 37 </p></dd></dl></div></div><div class="refsect1"><a name="idp1114936772"></a><h2>Description</h2><p> 38 A <em class="parameter"><code>spi_message</code></em> is used to execute an atomic sequence of data transfers, 39 each represented by a struct spi_transfer. The sequence is <span class="quote">“<span class="quote">atomic</span>”</span> 40 in the sense that no other spi_message may use that SPI bus until that 41 sequence completes. On some systems, many such sequences can execute as 42 as single programmed DMA transfer. On all systems, these messages are 43 queued, and might complete after transactions to other devices. Messages 44 sent to a given spi_device are always executed in FIFO order. 45 </p><p> 46 47 The code that submits an spi_message (and its spi_transfers) 48 to the lower layers is responsible for managing its memory. 49 Zero-initialize every field you don't set up explicitly, to 50 insulate against future API updates. After you submit a message 51 and its transfers, ignore them until its completion callback. 52</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-spi-transfer.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spi.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-spi-message-init-with-transfers.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct spi_transfer</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">spi_message_init_with_transfers</span></td></tr></table></div></body></html> 53