Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > 1a595394b241504ff370a8d12ebfcea7 > files > 1539

kernel-doc-3.11.10-100.fc18.noarch.rpm

<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>struct spi_master</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&#160;9.&#160;Serial Peripheral Interface (SPI)" /><link rel="prev" href="API-module-spi-driver.html" title="module_spi_driver" /><link rel="next" href="API-struct-spi-transfer.html" title="struct spi_transfer" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct spi_master</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-module-spi-driver.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;9.&#160;Serial Peripheral Interface (SPI)</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-struct-spi-transfer.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="API-struct-spi-master"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct spi_master &#8212; 
     interface to SPI master controller
 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
struct spi_master {
  struct device dev;
  struct list_head list;
  s16 bus_num;
  u16 num_chipselect;
  u16 dma_alignment;
  u16 mode_bits;
  u32 bits_per_word_mask;
#define SPI_BPW_MASK(bits) BIT((bits) - 1)
#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1))
#define SPI_BPW_RANGE_MASK(min# max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
  u16 flags;
#define SPI_MASTER_HALF_DUPLEX	BIT(0)
#define SPI_MASTER_NO_RX	BIT(1)
#define SPI_MASTER_NO_TX	BIT(2)
  spinlock_t bus_lock_spinlock;
  struct mutex bus_lock_mutex;
  bool bus_lock_flag;
  int (* setup) (struct spi_device *spi);
  int (* transfer) (struct spi_device *spi,struct spi_message *mesg);
  void (* cleanup) (struct spi_device *spi);
  bool queued;
  struct kthread_worker kworker;
  struct task_struct * kworker_task;
  struct kthread_work pump_messages;
  spinlock_t queue_lock;
  struct list_head queue;
  struct spi_message * cur_msg;
  bool busy;
  bool running;
  bool rt;
  int (* prepare_transfer_hardware) (struct spi_master *master);
  int (* transfer_one_message) (struct spi_master *master,struct spi_message *mesg);
  int (* unprepare_transfer_hardware) (struct spi_master *master);
  int * cs_gpios;
};  </pre></div><div class="refsect1"><a id="idm140404953502960"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">dev</span></dt><dd><p>
   device interface to this driver
      </p></dd><dt><span class="term">list</span></dt><dd><p>
   link with the global spi_master list
      </p></dd><dt><span class="term">bus_num</span></dt><dd><p>
   board-specific (and often SOC-specific) identifier for a
   given SPI controller.
      </p></dd><dt><span class="term">num_chipselect</span></dt><dd><p>
   chipselects are used to distinguish individual
   SPI slaves, and are numbered from zero to num_chipselects.
   each slave has a chipselect signal, but it's common that not
   every chipselect is connected to a slave.
      </p></dd><dt><span class="term">dma_alignment</span></dt><dd><p>
   SPI controller constraint on DMA buffers alignment.
      </p></dd><dt><span class="term">mode_bits</span></dt><dd><p>
   flags understood by this controller driver
      </p></dd><dt><span class="term">bits_per_word_mask</span></dt><dd><p>
   A mask indicating which values of bits_per_word are
   supported by the driver. Bit n indicates that a bits_per_word n+1 is
   suported. If set, the SPI core will reject any transfer with an
   unsupported bits_per_word. If not set, this value is simply ignored,
   and it's up to the individual driver to perform any validation.
      </p></dd><dt><span class="term">flags</span></dt><dd><p>
   other constraints relevant to this driver
      </p></dd><dt><span class="term">bus_lock_spinlock</span></dt><dd><p>
   spinlock for SPI bus locking
      </p></dd><dt><span class="term">bus_lock_mutex</span></dt><dd><p>
   mutex for SPI bus locking
      </p></dd><dt><span class="term">bus_lock_flag</span></dt><dd><p>
   indicates that the SPI bus is locked for exclusive use
      </p></dd><dt><span class="term">setup</span></dt><dd><p>
   updates the device mode and clocking records used by a
   device's SPI controller; protocol code may call this.  This
   must fail if an unrecognized or unsupported mode is requested.
   It's always safe to call this unless transfers are pending on
   the device whose settings are being modified.
      </p></dd><dt><span class="term">transfer</span></dt><dd><p>
   adds a message to the controller's transfer queue.
      </p></dd><dt><span class="term">cleanup</span></dt><dd><p>
   frees controller-specific state
      </p></dd><dt><span class="term">queued</span></dt><dd><p>
   whether this master is providing an internal message queue
      </p></dd><dt><span class="term">kworker</span></dt><dd><p>
   thread struct for message pump
      </p></dd><dt><span class="term">kworker_task</span></dt><dd><p>
   pointer to task for message pump kworker thread
      </p></dd><dt><span class="term">pump_messages</span></dt><dd><p>
   work struct for scheduling work to the message pump
      </p></dd><dt><span class="term">queue_lock</span></dt><dd><p>
   spinlock to syncronise access to message queue
      </p></dd><dt><span class="term">queue</span></dt><dd><p>
   message queue
      </p></dd><dt><span class="term">cur_msg</span></dt><dd><p>
   the currently in-flight message
      </p></dd><dt><span class="term">busy</span></dt><dd><p>
   message pump is busy
      </p></dd><dt><span class="term">running</span></dt><dd><p>
   message pump is running
      </p></dd><dt><span class="term">rt</span></dt><dd><p>
   whether this queue is set to run as a realtime task
      </p></dd><dt><span class="term">prepare_transfer_hardware</span></dt><dd><p>
   a message will soon arrive from the queue
   so the subsystem requests the driver to prepare the transfer hardware
   by issuing this call
      </p></dd><dt><span class="term">transfer_one_message</span></dt><dd><p>
   the subsystem calls the driver to transfer a single
   message while queuing transfers that arrive in the meantime. When the
   driver is finished with this message, it must call
   <code class="function">spi_finalize_current_message</code> so the subsystem can issue the next
   transfer
      </p></dd><dt><span class="term">unprepare_transfer_hardware</span></dt><dd><p>
   there are currently no more messages on the
   queue so the subsystem notifies the driver that it may relax the
   hardware by issuing this call
      </p></dd><dt><span class="term">cs_gpios</span></dt><dd><p>
   Array of GPIOs to use as chip select lines; one per CS
   number. Any individual value may be -ENOENT for CS lines that
   are not GPIOs (driven by the SPI controller itself).
      </p></dd></dl></div></div><div class="refsect1"><a id="idm140404953461152"></a><h2>Description</h2><p>
   Each SPI master controller can communicate with one or more <em class="parameter"><code>spi_device</code></em>
   children.  These make a small bus, sharing MOSI, MISO and SCK signals
   but not chip select signals.  Each device may be configured to use a
   different clock rate, since those shared signals are ignored unless
   the chip is selected.
   </p><p>

   The driver for an SPI controller manages access to those devices through
   a queue of spi_message transactions, copying data between CPU memory and
   an SPI slave device.  For each such message it queues, it calls the
   message's completion function when the transaction completes.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-module-spi-driver.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="spi.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-struct-spi-transfer.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">module_spi_driver</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">struct spi_transfer</span></td></tr></table></div></body></html>