1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>IEC958 (S/PDIF)</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Writing an ALSA Driver"><link rel="up" href="misc-devices.html" title="Chapter&#160;10.&#160;Miscellaneous Devices"><link rel="prev" href="misc-devices-hardware-dependent.html" title="Hardware-Dependent Devices"><link rel="next" href="buffer-and-memory.html" title="Chapter&#160;11.&#160;Buffer and Memory Management"></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">IEC958 (S/PDIF)</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="misc-devices-hardware-dependent.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;10.&#160;Miscellaneous Devices</th><td width="20%" align="right">&#160;<a accesskey="n" href="buffer-and-memory.html">Next</a></td></tr></table><hr></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="misc-devices-IEC958"></a>IEC958 (S/PDIF)</h2></div></div></div><p>
2        Usually the controls for IEC958 devices are implemented via
3      the control interface. There is a macro to compose a name string for
4      IEC958 controls, <code class="function">SNDRV_CTL_NAME_IEC958()</code>
5      defined in <code class="filename">&lt;include/asound.h&gt;</code>.  
6      </p><p>
7        There are some standard controls for IEC958 status bits. These
8      controls use the type <span class="type">SNDRV_CTL_ELEM_TYPE_IEC958</span>,
9      and the size of element is fixed as 4 bytes array
10      (value.iec958.status[x]). For the <em class="structfield"><code>info</code></em>
11      callback, you don't specify 
12      the value field for this type (the count field must be set,
13      though). 
14      </p><p>
15        <span class="quote">&#8220;<span class="quote">IEC958 Playback Con Mask</span>&#8221;</span> is used to return the
16      bit-mask for the IEC958 status bits of consumer mode. Similarly,
17      <span class="quote">&#8220;<span class="quote">IEC958 Playback Pro Mask</span>&#8221;</span> returns the bitmask for
18      professional mode. They are read-only controls, and are defined
19      as MIXER controls (iface =
20      <code class="constant">SNDRV_CTL_ELEM_IFACE_MIXER</code>).  
21      </p><p>
22        Meanwhile, <span class="quote">&#8220;<span class="quote">IEC958 Playback Default</span>&#8221;</span> control is
23      defined for getting and setting the current default IEC958
24      bits. Note that this one is usually defined as a PCM control
25      (iface = <code class="constant">SNDRV_CTL_ELEM_IFACE_PCM</code>),
26      although in some places it's defined as a MIXER control. 
27      </p><p>
28        In addition, you can define the control switches to
29      enable/disable or to set the raw bit mode. The implementation
30      will depend on the chip, but the control should be named as
31      <span class="quote">&#8220;<span class="quote">IEC958 xxx</span>&#8221;</span>, preferably using
32      the <code class="function">SNDRV_CTL_NAME_IEC958()</code> macro. 
33      </p><p>
34        You can find several cases, for example,
35      <code class="filename">pci/emu10k1</code>,
36      <code class="filename">pci/ice1712</code>, or
37      <code class="filename">pci/cmipci.c</code>.  
38      </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="misc-devices-hardware-dependent.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="misc-devices.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="buffer-and-memory.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Hardware-Dependent Devices&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Chapter&#160;11.&#160;Buffer and Memory Management</td></tr></table></div></body></html>
39