1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Chapter&#160;2.&#160;PCM API</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The ALSA Driver API"><link rel="up" href="index.html" title="The ALSA Driver API"><link rel="prev" href="API-snd-dma-free-pages.html" title="snd_dma_free_pages"><link rel="next" href="API-snd-pcm-format-name.html" title="snd_pcm_format_name"></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">Chapter&#160;2.&#160;PCM API</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-snd-dma-free-pages.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-snd-pcm-format-name.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="idp1093485068"></a>Chapter&#160;2.&#160;PCM API</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch02.html#idp1093485324">PCM Core</a></span></dt><dt><span class="sect1"><a href="ch02s02.html">PCM Format Helpers</a></span></dt><dt><span class="sect1"><a href="ch02s03.html">PCM Memory Management</a></span></dt><dt><span class="sect1"><a href="ch02s04.html">PCM DMA Engine API</a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp1093485324"></a>PCM Core</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="refentrytitle"><a href="API-snd-pcm-format-name.html"><span class="phrase">snd_pcm_format_name</span></a></span><span class="refpurpose"> &#8212; 
2  Return a name string for the given PCM format
3 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-new-stream.html"><span class="phrase">snd_pcm_new_stream</span></a></span><span class="refpurpose"> &#8212; 
4     create a new PCM stream
5 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-new.html"><span class="phrase">snd_pcm_new</span></a></span><span class="refpurpose"> &#8212; 
6     create a new PCM instance
7 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-new-internal.html"><span class="phrase">snd_pcm_new_internal</span></a></span><span class="refpurpose"> &#8212; 
8     create a new internal PCM instance
9 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-notify.html"><span class="phrase">snd_pcm_notify</span></a></span><span class="refpurpose"> &#8212; 
10     Add/remove the notify list
11 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-set-ops.html"><span class="phrase">snd_pcm_set_ops</span></a></span><span class="refpurpose"> &#8212; 
12  set the PCM operators
13 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-set-sync.html"><span class="phrase">snd_pcm_set_sync</span></a></span><span class="refpurpose"> &#8212; 
14     set the PCM sync id
15 </span></dt><dt><span class="refentrytitle"><a href="API-snd-interval-refine.html"><span class="phrase">snd_interval_refine</span></a></span><span class="refpurpose"> &#8212; 
16     refine the interval value of configurator
17 </span></dt><dt><span class="refentrytitle"><a href="API-snd-interval-ratnum.html"><span class="phrase">snd_interval_ratnum</span></a></span><span class="refpurpose"> &#8212; 
18     refine the interval value
19 </span></dt><dt><span class="refentrytitle"><a href="API-snd-interval-list.html"><span class="phrase">snd_interval_list</span></a></span><span class="refpurpose"> &#8212; 
20     refine the interval value from the list
21 </span></dt><dt><span class="refentrytitle"><a href="API-snd-interval-ranges.html"><span class="phrase">snd_interval_ranges</span></a></span><span class="refpurpose"> &#8212; 
22     refine the interval value from the list of ranges
23 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-rule-add.html"><span class="phrase">snd_pcm_hw_rule_add</span></a></span><span class="refpurpose"> &#8212; 
24     add the hw-constraint rule
25 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-mask64.html"><span class="phrase">snd_pcm_hw_constraint_mask64</span></a></span><span class="refpurpose"> &#8212; 
26     apply the given bitmap mask constraint
27 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-integer.html"><span class="phrase">snd_pcm_hw_constraint_integer</span></a></span><span class="refpurpose"> &#8212; 
28     apply an integer constraint to an interval
29 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-minmax.html"><span class="phrase">snd_pcm_hw_constraint_minmax</span></a></span><span class="refpurpose"> &#8212; 
30     apply a min/max range constraint to an interval
31 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-list.html"><span class="phrase">snd_pcm_hw_constraint_list</span></a></span><span class="refpurpose"> &#8212; 
32     apply a list of constraints to a parameter
33 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-ranges.html"><span class="phrase">snd_pcm_hw_constraint_ranges</span></a></span><span class="refpurpose"> &#8212; 
34     apply list of range constraints to a parameter
35 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-ratnums.html"><span class="phrase">snd_pcm_hw_constraint_ratnums</span></a></span><span class="refpurpose"> &#8212; 
36     apply ratnums constraint to a parameter
37 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-ratdens.html"><span class="phrase">snd_pcm_hw_constraint_ratdens</span></a></span><span class="refpurpose"> &#8212; 
38     apply ratdens constraint to a parameter
39 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-msbits.html"><span class="phrase">snd_pcm_hw_constraint_msbits</span></a></span><span class="refpurpose"> &#8212; 
40     add a hw constraint msbits rule
41 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-step.html"><span class="phrase">snd_pcm_hw_constraint_step</span></a></span><span class="refpurpose"> &#8212; 
42     add a hw constraint step rule
43 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-constraint-pow2.html"><span class="phrase">snd_pcm_hw_constraint_pow2</span></a></span><span class="refpurpose"> &#8212; 
44     add a hw constraint power-of-2 rule
45 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-rule-noresample.html"><span class="phrase">snd_pcm_hw_rule_noresample</span></a></span><span class="refpurpose"> &#8212; 
46     add a rule to allow disabling hw resampling
47 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-param-value.html"><span class="phrase">snd_pcm_hw_param_value</span></a></span><span class="refpurpose"> &#8212; 
48     return <em class="parameter"><code>params</code></em> field <em class="parameter"><code>var</code></em> value
49 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-param-first.html"><span class="phrase">snd_pcm_hw_param_first</span></a></span><span class="refpurpose"> &#8212; 
50     refine config space and return minimum value
51 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-hw-param-last.html"><span class="phrase">snd_pcm_hw_param_last</span></a></span><span class="refpurpose"> &#8212; 
52     refine config space and return maximum value
53 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-ioctl.html"><span class="phrase">snd_pcm_lib_ioctl</span></a></span><span class="refpurpose"> &#8212; 
54     a generic PCM ioctl callback
55 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-period-elapsed.html"><span class="phrase">snd_pcm_period_elapsed</span></a></span><span class="refpurpose"> &#8212; 
56     update the pcm status for the next period
57 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-add-chmap-ctls.html"><span class="phrase">snd_pcm_add_chmap_ctls</span></a></span><span class="refpurpose"> &#8212; 
58     create channel-mapping control elements
59 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-lock.html"><span class="phrase">snd_pcm_stream_lock</span></a></span><span class="refpurpose"> &#8212; 
60  Lock the PCM stream
61 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-unlock.html"><span class="phrase">snd_pcm_stream_unlock</span></a></span><span class="refpurpose"> &#8212; 
62     Unlock the PCM stream
63 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-lock-irq.html"><span class="phrase">snd_pcm_stream_lock_irq</span></a></span><span class="refpurpose"> &#8212; 
64     Lock the PCM stream
65 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-unlock-irq.html"><span class="phrase">snd_pcm_stream_unlock_irq</span></a></span><span class="refpurpose"> &#8212; 
66     Unlock the PCM stream
67 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-unlock-irqrestore.html"><span class="phrase">snd_pcm_stream_unlock_irqrestore</span></a></span><span class="refpurpose"> &#8212; 
68     Unlock the PCM stream
69 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stop.html"><span class="phrase">snd_pcm_stop</span></a></span><span class="refpurpose"> &#8212; 
70     try to stop all running streams in the substream group
71 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stop-xrun.html"><span class="phrase">snd_pcm_stop_xrun</span></a></span><span class="refpurpose"> &#8212; 
72     stop the running streams as XRUN
73 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-suspend.html"><span class="phrase">snd_pcm_suspend</span></a></span><span class="refpurpose"> &#8212; 
74     trigger SUSPEND to all linked streams
75 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-suspend-all.html"><span class="phrase">snd_pcm_suspend_all</span></a></span><span class="refpurpose"> &#8212; 
76     trigger SUSPEND to all substreams in the given pcm
77 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-default-mmap.html"><span class="phrase">snd_pcm_lib_default_mmap</span></a></span><span class="refpurpose"> &#8212; 
78     Default PCM data mmap function
79 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-mmap-iomem.html"><span class="phrase">snd_pcm_lib_mmap_iomem</span></a></span><span class="refpurpose"> &#8212; 
80     Default PCM data mmap function for I/O mem
81 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-linked.html"><span class="phrase">snd_pcm_stream_linked</span></a></span><span class="refpurpose"> &#8212; 
82  Check whether the substream is linked with others
83 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-lock-irqsave.html"><span class="phrase">snd_pcm_stream_lock_irqsave</span></a></span><span class="refpurpose"> &#8212; 
84     Lock the PCM stream
85 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-group-for-each-entry.html"><span class="phrase">snd_pcm_group_for_each_entry</span></a></span><span class="refpurpose"> &#8212; 
86     iterate over the linked substreams
87 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-running.html"><span class="phrase">snd_pcm_running</span></a></span><span class="refpurpose"> &#8212; 
88     Check whether the substream is in a running state
89 </span></dt><dt><span class="refentrytitle"><a href="API-bytes-to-samples.html"><span class="phrase">bytes_to_samples</span></a></span><span class="refpurpose"> &#8212; 
90     Unit conversion of the size from bytes to samples
91 </span></dt><dt><span class="refentrytitle"><a href="API-bytes-to-frames.html"><span class="phrase">bytes_to_frames</span></a></span><span class="refpurpose"> &#8212; 
92     Unit conversion of the size from bytes to frames
93 </span></dt><dt><span class="refentrytitle"><a href="API-samples-to-bytes.html"><span class="phrase">samples_to_bytes</span></a></span><span class="refpurpose"> &#8212; 
94     Unit conversion of the size from samples to bytes
95 </span></dt><dt><span class="refentrytitle"><a href="API-frames-to-bytes.html"><span class="phrase">frames_to_bytes</span></a></span><span class="refpurpose"> &#8212; 
96     Unit conversion of the size from frames to bytes
97 </span></dt><dt><span class="refentrytitle"><a href="API-frame-aligned.html"><span class="phrase">frame_aligned</span></a></span><span class="refpurpose"> &#8212; 
98     Check whether the byte size is aligned to frames
99 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-buffer-bytes.html"><span class="phrase">snd_pcm_lib_buffer_bytes</span></a></span><span class="refpurpose"> &#8212; 
100     Get the buffer size of the current PCM in bytes
101 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-period-bytes.html"><span class="phrase">snd_pcm_lib_period_bytes</span></a></span><span class="refpurpose"> &#8212; 
102     Get the period size of the current PCM in bytes
103 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-playback-avail.html"><span class="phrase">snd_pcm_playback_avail</span></a></span><span class="refpurpose"> &#8212; 
104     Get the available (writable) space for playback
105 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-capture-avail.html"><span class="phrase">snd_pcm_capture_avail</span></a></span><span class="refpurpose"> &#8212; 
106     Get the available (readable) space for capture
107 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-playback-hw-avail.html"><span class="phrase">snd_pcm_playback_hw_avail</span></a></span><span class="refpurpose"> &#8212; 
108     Get the queued space for playback
109 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-capture-hw-avail.html"><span class="phrase">snd_pcm_capture_hw_avail</span></a></span><span class="refpurpose"> &#8212; 
110     Get the free space for capture
111 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-playback-ready.html"><span class="phrase">snd_pcm_playback_ready</span></a></span><span class="refpurpose"> &#8212; 
112     check whether the playback buffer is available
113 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-capture-ready.html"><span class="phrase">snd_pcm_capture_ready</span></a></span><span class="refpurpose"> &#8212; 
114     check whether the capture buffer is available
115 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-playback-data.html"><span class="phrase">snd_pcm_playback_data</span></a></span><span class="refpurpose"> &#8212; 
116     check whether any data exists on the playback buffer
117 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-playback-empty.html"><span class="phrase">snd_pcm_playback_empty</span></a></span><span class="refpurpose"> &#8212; 
118     check whether the playback buffer is empty
119 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-capture-empty.html"><span class="phrase">snd_pcm_capture_empty</span></a></span><span class="refpurpose"> &#8212; 
120     check whether the capture buffer is empty
121 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-trigger-done.html"><span class="phrase">snd_pcm_trigger_done</span></a></span><span class="refpurpose"> &#8212; 
122     Mark the master substream
123 </span></dt><dt><span class="refentrytitle"><a href="API-params-channels.html"><span class="phrase">params_channels</span></a></span><span class="refpurpose"> &#8212; 
124     Get the number of channels from the hw params
125 </span></dt><dt><span class="refentrytitle"><a href="API-params-rate.html"><span class="phrase">params_rate</span></a></span><span class="refpurpose"> &#8212; 
126     Get the sample rate from the hw params
127 </span></dt><dt><span class="refentrytitle"><a href="API-params-period-size.html"><span class="phrase">params_period_size</span></a></span><span class="refpurpose"> &#8212; 
128     Get the period size (in frames) from the hw params
129 </span></dt><dt><span class="refentrytitle"><a href="API-params-periods.html"><span class="phrase">params_periods</span></a></span><span class="refpurpose"> &#8212; 
130     Get the number of periods from the hw params
131 </span></dt><dt><span class="refentrytitle"><a href="API-params-buffer-size.html"><span class="phrase">params_buffer_size</span></a></span><span class="refpurpose"> &#8212; 
132     Get the buffer size (in frames) from the hw params
133 </span></dt><dt><span class="refentrytitle"><a href="API-params-buffer-bytes.html"><span class="phrase">params_buffer_bytes</span></a></span><span class="refpurpose"> &#8212; 
134     Get the buffer size (in bytes) from the hw params
135 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-format-cpu-endian.html"><span class="phrase">snd_pcm_format_cpu_endian</span></a></span><span class="refpurpose"> &#8212; 
136     Check the PCM format is CPU-endian
137 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-set-runtime-buffer.html"><span class="phrase">snd_pcm_set_runtime_buffer</span></a></span><span class="refpurpose"> &#8212; 
138     Set the PCM runtime buffer
139 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-gettime.html"><span class="phrase">snd_pcm_gettime</span></a></span><span class="refpurpose"> &#8212; 
140     Fill the timespec depending on the timestamp mode
141 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-alloc-vmalloc-buffer.html"><span class="phrase">snd_pcm_lib_alloc_vmalloc_buffer</span></a></span><span class="refpurpose"> &#8212; 
142     allocate virtual DMA buffer
143 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-lib-alloc-vmalloc-32-buffer.html"><span class="phrase">snd_pcm_lib_alloc_vmalloc_32_buffer</span></a></span><span class="refpurpose"> &#8212; 
144     allocate 32-bit-addressable buffer
145 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-sgbuf-get-addr.html"><span class="phrase">snd_pcm_sgbuf_get_addr</span></a></span><span class="refpurpose"> &#8212; 
146     Get the DMA address at the corresponding offset
147 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-sgbuf-get-ptr.html"><span class="phrase">snd_pcm_sgbuf_get_ptr</span></a></span><span class="refpurpose"> &#8212; 
148     Get the virtual address at the corresponding offset
149 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-sgbuf-get-chunk-size.html"><span class="phrase">snd_pcm_sgbuf_get_chunk_size</span></a></span><span class="refpurpose"> &#8212; 
150     Compute the max size that fits within the contig. page from the given size
151 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-mmap-data-open.html"><span class="phrase">snd_pcm_mmap_data_open</span></a></span><span class="refpurpose"> &#8212; 
152     increase the mmap counter
153 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-mmap-data-close.html"><span class="phrase">snd_pcm_mmap_data_close</span></a></span><span class="refpurpose"> &#8212; 
154     decrease the mmap counter
155 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-limit-isa-dma-size.html"><span class="phrase">snd_pcm_limit_isa_dma_size</span></a></span><span class="refpurpose"> &#8212; 
156     Get the max size fitting with ISA DMA transfer
157 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-stream-str.html"><span class="phrase">snd_pcm_stream_str</span></a></span><span class="refpurpose"> &#8212; 
158     Get a string naming the direction of a stream
159 </span></dt><dt><span class="refentrytitle"><a href="API-snd-pcm-chmap-substream.html"><span class="phrase">snd_pcm_chmap_substream</span></a></span><span class="refpurpose"> &#8212; 
160     get the PCM substream assigned to the given chmap info
161 </span></dt><dt><span class="refentrytitle"><a href="API-pcm-format-to-bits.html"><span class="phrase">pcm_format_to_bits</span></a></span><span class="refpurpose"> &#8212; 
162     Strong-typed conversion of pcm_format to bitwise
163 </span></dt></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-snd-dma-free-pages.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="API-snd-pcm-format-name.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">snd_dma_free_pages</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">snd_pcm_format_name</span></td></tr></table></div></body></html>
164