Sophie

Sophie

distrib > CentOS > 6 > i386 > media > centosplus > by-pkgid > 6efc7723be230e5ae7ff07a43bc919ee > files > 4176

kernel-doc-2.6.32-131.0.15.el6.centos.plus.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>Chapter&#160;10.&#160;Miscellaneous Devices</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Writing an ALSA Driver" /><link rel="up" href="index.html" title="Writing an ALSA Driver" /><link rel="prev" href="ch09s03.html" title="Callbacks" /><link rel="next" href="ch10s02.html" title="Hardware-Dependent Devices" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter&#160;10.&#160;Miscellaneous Devices</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09s03.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch10s02.html">Next</a></td></tr></table><hr /></div><div class="chapter" title="Chapter&#160;10.&#160;Miscellaneous Devices"><div class="titlepage"><div><div><h2 class="title"><a id="misc-devices"></a>Chapter&#160;10.&#160;Miscellaneous Devices</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ch10.html#misc-devices-opl3">FM OPL3</a></span></dt><dt><span class="section"><a href="ch10s02.html">Hardware-Dependent Devices</a></span></dt><dt><span class="section"><a href="ch10s03.html">IEC958 (S/PDIF)</a></span></dt></dl></div><div class="section" title="FM OPL3"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="misc-devices-opl3"></a>FM OPL3</h2></div></div></div><p>
        The FM OPL3 is still used in many chips (mainly for backward
      compatibility). ALSA has a nice OPL3 FM control layer, too. The
      OPL3 API is defined in
      <code class="filename">&lt;sound/opl3.h&gt;</code>. 
      </p><p>
        FM registers can be directly accessed through the direct-FM API,
      defined in <code class="filename">&lt;sound/asound_fm.h&gt;</code>. In
      ALSA native mode, FM registers are accessed through
      the Hardware-Dependant Device direct-FM extension API, whereas in
      OSS compatible mode, FM registers can be accessed with the OSS
      direct-FM compatible API in <code class="filename">/dev/dmfmX</code> device. 
      </p><p>
        To create the OPL3 component, you have two functions to
        call. The first one is a constructor for the <span class="type">opl3_t</span>
        instance. 

        </p><div class="informalexample"><pre class="programlisting">

  struct snd_opl3 *opl3;
  snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX,
                  integrated, &amp;opl3);

          </pre></div><p>
      </p><p>
        The first argument is the card pointer, the second one is the
      left port address, and the third is the right port address. In
      most cases, the right port is placed at the left port + 2. 
      </p><p>
        The fourth argument is the hardware type.
      </p><p>
        When the left and right ports have been already allocated by
      the card driver, pass non-zero to the fifth argument
      (<em class="parameter"><code>integrated</code></em>). Otherwise, the opl3 module will
      allocate the specified ports by itself. 
      </p><p>
        When the accessing the hardware requires special method
        instead of the standard I/O access, you can create opl3 instance
        separately with <code class="function">snd_opl3_new()</code>.

        </p><div class="informalexample"><pre class="programlisting">

  struct snd_opl3 *opl3;
  snd_opl3_new(card, OPL3_HW_OPL3_XXX, &amp;opl3);

          </pre></div><p>
      </p><p>
	Then set <em class="structfield"><code>command</code></em>,
	<em class="structfield"><code>private_data</code></em> and
	<em class="structfield"><code>private_free</code></em> for the private
	access function, the private data and the destructor.
	The l_port and r_port are not necessarily set.  Only the
	command must be set properly.  You can retrieve the data
	from the opl3-&gt;private_data field.
      </p><p>
	After creating the opl3 instance via <code class="function">snd_opl3_new()</code>,
	call <code class="function">snd_opl3_init()</code> to initialize the chip to the
	proper state. Note that <code class="function">snd_opl3_create()</code> always
	calls it internally.
      </p><p>
        If the opl3 instance is created successfully, then create a
        hwdep device for this opl3. 

        </p><div class="informalexample"><pre class="programlisting">

  struct snd_hwdep *opl3hwdep;
  snd_opl3_hwdep_new(opl3, 0, 1, &amp;opl3hwdep);

          </pre></div><p>
      </p><p>
        The first argument is the <span class="type">opl3_t</span> instance you
      created, and the second is the index number, usually 0. 
      </p><p>
        The third argument is the index-offset for the sequencer
      client assigned to the OPL3 port. When there is an MPU401-UART,
      give 1 for here (UART always takes 0). 
      </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09s03.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ch10s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Callbacks&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Hardware-Dependent Devices</td></tr></table></div></body></html>