<?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>IEC958 (S/PDIF)</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="ch10.html" title="Chapter 10. Miscellaneous Devices" /><link rel="prev" href="ch10s02.html" title="Hardware-Dependent Devices" /><link rel="next" href="ch11.html" title="Chapter 11. Buffer and Memory Management" /></head><body><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="ch10s02.html">Prev</a> </td><th width="60%" align="center">Chapter 10. Miscellaneous Devices</th><td width="20%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr></table><hr /></div><div class="section" title="IEC958 (S/PDIF)"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="misc-devices-IEC958"></a>IEC958 (S/PDIF)</h2></div></div></div><p> Usually the controls for IEC958 devices are implemented via the control interface. There is a macro to compose a name string for IEC958 controls, <code class="function">SNDRV_CTL_NAME_IEC958()</code> defined in <code class="filename"><include/asound.h></code>. </p><p> There are some standard controls for IEC958 status bits. These controls use the type <span class="type">SNDRV_CTL_ELEM_TYPE_IEC958</span>, and the size of element is fixed as 4 bytes array (value.iec958.status[x]). For the <em class="structfield"><code>info</code></em> callback, you don't specify the value field for this type (the count field must be set, though). </p><p> <span class="quote">“<span class="quote">IEC958 Playback Con Mask</span>”</span> is used to return the bit-mask for the IEC958 status bits of consumer mode. Similarly, <span class="quote">“<span class="quote">IEC958 Playback Pro Mask</span>”</span> returns the bitmask for professional mode. They are read-only controls, and are defined as MIXER controls (iface = <code class="constant">SNDRV_CTL_ELEM_IFACE_MIXER</code>). </p><p> Meanwhile, <span class="quote">“<span class="quote">IEC958 Playback Default</span>”</span> control is defined for getting and setting the current default IEC958 bits. Note that this one is usually defined as a PCM control (iface = <code class="constant">SNDRV_CTL_ELEM_IFACE_PCM</code>), although in some places it's defined as a MIXER control. </p><p> In addition, you can define the control switches to enable/disable or to set the raw bit mode. The implementation will depend on the chip, but the control should be named as <span class="quote">“<span class="quote">IEC958 xxx</span>”</span>, preferably using the <code class="function">SNDRV_CTL_NAME_IEC958()</code> macro. </p><p> You can find several cases, for example, <code class="filename">pci/emu10k1</code>, <code class="filename">pci/ice1712</code>, or <code class="filename">pci/cmipci.c</code>. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch10s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch10.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch11.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Hardware-Dependent Devices </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 11. Buffer and Memory Management</td></tr></table></div></body></html>