Blame view
include/sound/pcm.h
46.9 KB
1a59d1b8e treewide: Replace... |
1 |
/* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 |
#ifndef __SOUND_PCM_H #define __SOUND_PCM_H /* * Digital Audio (PCM) abstract layer |
c1017a4cd [ALSA] Changed Ja... |
7 |
* Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
1da177e4c Linux-2.6.12-rc2 |
8 |
* Abramo Bagnara <abramo@alsa-project.org> |
1da177e4c Linux-2.6.12-rc2 |
9 10 11 12 |
*/ #include <sound/asound.h> #include <sound/memalloc.h> |
f90c06a2b ALSA: Fix limit o... |
13 |
#include <sound/minors.h> |
1da177e4c Linux-2.6.12-rc2 |
14 |
#include <linux/poll.h> |
f23f6e08c [PATCH] severing ... |
15 |
#include <linux/mm.h> |
1da177e4c Linux-2.6.12-rc2 |
16 |
#include <linux/bitops.h> |
e8db0be12 PM QoS: Move and ... |
17 |
#include <linux/pm_qos.h> |
f57f3df03 ALSA: pcm: More f... |
18 |
#include <linux/refcount.h> |
1da177e4c Linux-2.6.12-rc2 |
19 |
|
1da177e4c Linux-2.6.12-rc2 |
20 21 |
#define snd_pcm_substream_chip(substream) ((substream)->private_data) #define snd_pcm_chip(pcm) ((pcm)->private_data) |
6d2412b80 ALSA: Use IS_ENAB... |
22 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
a1ce39288 UAPI: (Scripted) ... |
23 |
#include <sound/pcm_oss.h> |
1da177e4c Linux-2.6.12-rc2 |
24 25 26 27 28 |
#endif /* * Hardware (lowlevel) section */ |
877211f5e [ALSA] Remove xxx... |
29 |
struct snd_pcm_hardware { |
1da177e4c Linux-2.6.12-rc2 |
30 31 32 33 34 35 36 37 38 39 40 41 42 |
unsigned int info; /* SNDRV_PCM_INFO_* */ u64 formats; /* SNDRV_PCM_FMTBIT_* */ unsigned int rates; /* SNDRV_PCM_RATE_* */ unsigned int rate_min; /* min rate */ unsigned int rate_max; /* max rate */ unsigned int channels_min; /* min channels */ unsigned int channels_max; /* max channels */ size_t buffer_bytes_max; /* max buffer size */ size_t period_bytes_min; /* min period size */ size_t period_bytes_max; /* max period size */ unsigned int periods_min; /* min # of periods */ unsigned int periods_max; /* max # of periods */ size_t fifo_size; /* fifo size in bytes */ |
877211f5e [ALSA] Remove xxx... |
43 |
}; |
1da177e4c Linux-2.6.12-rc2 |
44 |
|
e0e6ce038 [ALSA] add struct... |
45 |
struct snd_pcm_substream; |
229d04309 ALSA: core: selec... |
46 47 |
struct snd_pcm_audio_tstamp_config; /* definitions further down */ struct snd_pcm_audio_tstamp_report; |
877211f5e [ALSA] Remove xxx... |
48 49 50 51 |
struct snd_pcm_ops { int (*open)(struct snd_pcm_substream *substream); int (*close)(struct snd_pcm_substream *substream); int (*ioctl)(struct snd_pcm_substream * substream, |
1da177e4c Linux-2.6.12-rc2 |
52 |
unsigned int cmd, void *arg); |
877211f5e [ALSA] Remove xxx... |
53 54 55 56 57 58 |
int (*hw_params)(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); int (*hw_free)(struct snd_pcm_substream *substream); int (*prepare)(struct snd_pcm_substream *substream); int (*trigger)(struct snd_pcm_substream *substream, int cmd); snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); |
3179f6200 ALSA: core: add .... |
59 60 61 62 |
int (*get_time_info)(struct snd_pcm_substream *substream, struct timespec *system_ts, struct timespec *audio_ts, struct snd_pcm_audio_tstamp_config *audio_tstamp_config, struct snd_pcm_audio_tstamp_report *audio_tstamp_report); |
29d1a873d ALSA: pcm: Introd... |
63 64 65 66 67 68 69 |
int (*fill_silence)(struct snd_pcm_substream *substream, int channel, unsigned long pos, unsigned long bytes); int (*copy_user)(struct snd_pcm_substream *substream, int channel, unsigned long pos, void __user *buf, unsigned long bytes); int (*copy_kernel)(struct snd_pcm_substream *substream, int channel, unsigned long pos, void *buf, unsigned long bytes); |
877211f5e [ALSA] Remove xxx... |
70 71 72 73 74 |
struct page *(*page)(struct snd_pcm_substream *substream, unsigned long offset); int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma); int (*ack)(struct snd_pcm_substream *substream); }; |
1da177e4c Linux-2.6.12-rc2 |
75 76 77 78 |
/* * */ |
f90c06a2b ALSA: Fix limit o... |
79 80 81 82 83 |
#if defined(CONFIG_SND_DYNAMIC_MINORS) #define SNDRV_PCM_DEVICES (SNDRV_OS_MINORS-2) #else #define SNDRV_PCM_DEVICES 8 #endif |
896e6cc20 sound: Revert "AL... |
84 |
|
1da177e4c Linux-2.6.12-rc2 |
85 |
#define SNDRV_PCM_IOCTL1_RESET 0 |
e11f0f90a ALSA: pcm: remove... |
86 |
/* 1 is absent slot. */ |
1da177e4c Linux-2.6.12-rc2 |
87 |
#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2 |
ba61faf0d ALSA: pcm: remove... |
88 |
/* 3 is absent slot. */ |
8bea869c5 ALSA: PCM midleve... |
89 |
#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4 |
1da177e4c Linux-2.6.12-rc2 |
90 91 92 93 94 95 96 |
#define SNDRV_PCM_TRIGGER_STOP 0 #define SNDRV_PCM_TRIGGER_START 1 #define SNDRV_PCM_TRIGGER_PAUSE_PUSH 3 #define SNDRV_PCM_TRIGGER_PAUSE_RELEASE 4 #define SNDRV_PCM_TRIGGER_SUSPEND 5 #define SNDRV_PCM_TRIGGER_RESUME 6 |
48d882978 ALSA: pcm: add SN... |
97 |
#define SNDRV_PCM_TRIGGER_DRAIN 7 |
1da177e4c Linux-2.6.12-rc2 |
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
#define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1) /* If you change this don't forget to change rates[] table in pcm_native.c */ #define SNDRV_PCM_RATE_5512 (1<<0) /* 5512Hz */ #define SNDRV_PCM_RATE_8000 (1<<1) /* 8000Hz */ #define SNDRV_PCM_RATE_11025 (1<<2) /* 11025Hz */ #define SNDRV_PCM_RATE_16000 (1<<3) /* 16000Hz */ #define SNDRV_PCM_RATE_22050 (1<<4) /* 22050Hz */ #define SNDRV_PCM_RATE_32000 (1<<5) /* 32000Hz */ #define SNDRV_PCM_RATE_44100 (1<<6) /* 44100Hz */ #define SNDRV_PCM_RATE_48000 (1<<7) /* 48000Hz */ #define SNDRV_PCM_RATE_64000 (1<<8) /* 64000Hz */ #define SNDRV_PCM_RATE_88200 (1<<9) /* 88200Hz */ #define SNDRV_PCM_RATE_96000 (1<<10) /* 96000Hz */ #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */ |
4cc4531c3 ALSA: pcm: add su... |
115 116 |
#define SNDRV_PCM_RATE_352800 (1<<13) /* 352800Hz */ #define SNDRV_PCM_RATE_384000 (1<<14) /* 384000Hz */ |
1da177e4c Linux-2.6.12-rc2 |
117 118 119 120 121 122 123 124 125 126 127 128 |
#define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ #define SNDRV_PCM_RATE_KNOT (1<<31) /* supports more non-continuos rates */ #define SNDRV_PCM_RATE_8000_44100 (SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_11025|\ SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_22050|\ SNDRV_PCM_RATE_32000|SNDRV_PCM_RATE_44100) #define SNDRV_PCM_RATE_8000_48000 (SNDRV_PCM_RATE_8000_44100|SNDRV_PCM_RATE_48000) #define SNDRV_PCM_RATE_8000_96000 (SNDRV_PCM_RATE_8000_48000|SNDRV_PCM_RATE_64000|\ SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ SNDRV_PCM_RATE_192000) |
4cc4531c3 ALSA: pcm: add su... |
129 130 131 |
#define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000|\ SNDRV_PCM_RATE_352800|\ SNDRV_PCM_RATE_384000) |
fea952e5c ALSA: core: spars... |
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) #define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE) #define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE) #define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE) #define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE) #define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE) #define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE) #define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE) #define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE) #define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE) #define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE) #define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE) #define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE) #define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE) #define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE) #define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE) #define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE) #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE) #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE) #define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW) #define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW) #define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM) #define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG) #define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM) |
823dbb6eb ALSA: pcm: add SN... |
158 159 160 161 |
#define SNDRV_PCM_FMTBIT_S20_LE _SNDRV_PCM_FMTBIT(S20_LE) #define SNDRV_PCM_FMTBIT_U20_LE _SNDRV_PCM_FMTBIT(U20_LE) #define SNDRV_PCM_FMTBIT_S20_BE _SNDRV_PCM_FMTBIT(S20_BE) #define SNDRV_PCM_FMTBIT_U20_BE _SNDRV_PCM_FMTBIT(U20_BE) |
fea952e5c ALSA: core: spars... |
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
#define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL) #define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE) #define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE) #define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE) #define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE) #define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE) #define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE) #define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE) #define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE) #define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE) #define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE) #define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE) #define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE) #define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24) #define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B) #define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40) #define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) |
ef7a4f979 ALSA: add DSD for... |
179 180 |
#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) |
d4288d3fa ALSA: pcm: add ne... |
181 |
#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) |
d42472ecf ALSA: pcm: Add bi... |
182 183 |
#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE) #define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE) |
1da177e4c Linux-2.6.12-rc2 |
184 185 186 187 188 189 190 191 192 193 194 |
#ifdef SNDRV_LITTLE_ENDIAN #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE #define SNDRV_PCM_FMTBIT_U16 SNDRV_PCM_FMTBIT_U16_LE #define SNDRV_PCM_FMTBIT_S24 SNDRV_PCM_FMTBIT_S24_LE #define SNDRV_PCM_FMTBIT_U24 SNDRV_PCM_FMTBIT_U24_LE #define SNDRV_PCM_FMTBIT_S32 SNDRV_PCM_FMTBIT_S32_LE #define SNDRV_PCM_FMTBIT_U32 SNDRV_PCM_FMTBIT_U32_LE #define SNDRV_PCM_FMTBIT_FLOAT SNDRV_PCM_FMTBIT_FLOAT_LE #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_LE #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE |
823dbb6eb ALSA: pcm: add SN... |
195 196 |
#define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_LE #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_LE |
1da177e4c Linux-2.6.12-rc2 |
197 198 199 200 201 202 203 204 205 206 207 |
#endif #ifdef SNDRV_BIG_ENDIAN #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_BE #define SNDRV_PCM_FMTBIT_U16 SNDRV_PCM_FMTBIT_U16_BE #define SNDRV_PCM_FMTBIT_S24 SNDRV_PCM_FMTBIT_S24_BE #define SNDRV_PCM_FMTBIT_U24 SNDRV_PCM_FMTBIT_U24_BE #define SNDRV_PCM_FMTBIT_S32 SNDRV_PCM_FMTBIT_S32_BE #define SNDRV_PCM_FMTBIT_U32 SNDRV_PCM_FMTBIT_U32_BE #define SNDRV_PCM_FMTBIT_FLOAT SNDRV_PCM_FMTBIT_FLOAT_BE #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_BE #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE |
823dbb6eb ALSA: pcm: add SN... |
208 209 |
#define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_BE #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE |
1da177e4c Linux-2.6.12-rc2 |
210 |
#endif |
877211f5e [ALSA] Remove xxx... |
211 212 |
struct snd_pcm_file { struct snd_pcm_substream *substream; |
548a648b9 [ALSA] Fix contro... |
213 |
int no_compat_mmap; |
4b671f577 ALSA: pcm: Add an... |
214 |
unsigned int user_pversion; /* supported protocol version */ |
1da177e4c Linux-2.6.12-rc2 |
215 |
}; |
877211f5e [ALSA] Remove xxx... |
216 217 218 |
struct snd_pcm_hw_rule; typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule); |
1da177e4c Linux-2.6.12-rc2 |
219 |
|
877211f5e [ALSA] Remove xxx... |
220 |
struct snd_pcm_hw_rule { |
1da177e4c Linux-2.6.12-rc2 |
221 |
unsigned int cond; |
1da177e4c Linux-2.6.12-rc2 |
222 223 |
int var; int deps[4]; |
d16efa062 ALSA: Close holes... |
224 225 |
snd_pcm_hw_rule_func_t func; |
1da177e4c Linux-2.6.12-rc2 |
226 227 |
void *private; }; |
877211f5e [ALSA] Remove xxx... |
228 229 |
struct snd_pcm_hw_constraints { struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - |
1da177e4c Linux-2.6.12-rc2 |
230 |
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; |
877211f5e [ALSA] Remove xxx... |
231 |
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - |
1da177e4c Linux-2.6.12-rc2 |
232 233 234 |
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; unsigned int rules_num; unsigned int rules_all; |
877211f5e [ALSA] Remove xxx... |
235 236 |
struct snd_pcm_hw_rule *rules; }; |
1da177e4c Linux-2.6.12-rc2 |
237 |
|
877211f5e [ALSA] Remove xxx... |
238 239 |
static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs, snd_pcm_hw_param_t var) |
1da177e4c Linux-2.6.12-rc2 |
240 241 242 |
{ return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } |
877211f5e [ALSA] Remove xxx... |
243 244 |
static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs, snd_pcm_hw_param_t var) |
1da177e4c Linux-2.6.12-rc2 |
245 246 247 |
{ return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } |
877211f5e [ALSA] Remove xxx... |
248 |
struct snd_ratnum { |
1da177e4c Linux-2.6.12-rc2 |
249 250 |
unsigned int num; unsigned int den_min, den_max, den_step; |
877211f5e [ALSA] Remove xxx... |
251 |
}; |
1da177e4c Linux-2.6.12-rc2 |
252 |
|
877211f5e [ALSA] Remove xxx... |
253 |
struct snd_ratden { |
1da177e4c Linux-2.6.12-rc2 |
254 255 |
unsigned int num_min, num_max, num_step; unsigned int den; |
877211f5e [ALSA] Remove xxx... |
256 |
}; |
1da177e4c Linux-2.6.12-rc2 |
257 |
|
877211f5e [ALSA] Remove xxx... |
258 |
struct snd_pcm_hw_constraint_ratnums { |
1da177e4c Linux-2.6.12-rc2 |
259 |
int nrats; |
e5e113cf0 ALSA: Constify ra... |
260 |
const struct snd_ratnum *rats; |
877211f5e [ALSA] Remove xxx... |
261 |
}; |
1da177e4c Linux-2.6.12-rc2 |
262 |
|
877211f5e [ALSA] Remove xxx... |
263 |
struct snd_pcm_hw_constraint_ratdens { |
1da177e4c Linux-2.6.12-rc2 |
264 |
int nrats; |
e5e113cf0 ALSA: Constify ra... |
265 |
const struct snd_ratden *rats; |
877211f5e [ALSA] Remove xxx... |
266 |
}; |
1da177e4c Linux-2.6.12-rc2 |
267 |
|
877211f5e [ALSA] Remove xxx... |
268 |
struct snd_pcm_hw_constraint_list { |
4af87a939 ALSA: pcm: Consti... |
269 |
const unsigned int *list; |
782e50e0b ALSA: Close holes... |
270 |
unsigned int count; |
1da177e4c Linux-2.6.12-rc2 |
271 |
unsigned int mask; |
877211f5e [ALSA] Remove xxx... |
272 |
}; |
1da177e4c Linux-2.6.12-rc2 |
273 |
|
f66f898e9 ALSA: pcm: Add sn... |
274 275 276 277 278 |
struct snd_pcm_hw_constraint_ranges { unsigned int count; const struct snd_interval *ranges; unsigned int mask; }; |
229d04309 ALSA: core: selec... |
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
/* * userspace-provided audio timestamp config to kernel, * structure is for internal use only and filled with dedicated unpack routine */ struct snd_pcm_audio_tstamp_config { /* 5 of max 16 bits used */ u32 type_requested:4; u32 report_delay:1; /* add total delay to A/D or D/A */ }; static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data, struct snd_pcm_audio_tstamp_config *config) { config->type_requested = data & 0xF; config->report_delay = (data >> 4) & 1; } /* * kernel-provided audio timestamp report to user-space * structure is for internal use only and read by dedicated pack routine */ struct snd_pcm_audio_tstamp_report { /* 6 of max 16 bits used for bit-fields */ /* for backwards compatibility */ u32 valid:1; /* actual type if hardware could not support requested timestamp */ u32 actual_type:4; /* accuracy represented in ns units */ u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */ u32 accuracy; /* up to 4.29s, will be packed in separate field */ }; static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy, const struct snd_pcm_audio_tstamp_report *report) { u32 tmp; tmp = report->accuracy_report; tmp <<= 4; tmp |= report->actual_type; tmp <<= 1; tmp |= report->valid; *data &= 0xffff; /* zero-clear MSBs */ *data |= (tmp << 16); *accuracy = report->accuracy; } |
877211f5e [ALSA] Remove xxx... |
329 |
struct snd_pcm_runtime { |
1da177e4c Linux-2.6.12-rc2 |
330 |
/* -- Status -- */ |
877211f5e [ALSA] Remove xxx... |
331 |
struct snd_pcm_substream *trigger_master; |
07799e756 [ALSA] Use getnst... |
332 |
struct timespec trigger_tstamp; /* trigger timestamp */ |
2b79d7a6b ALSA: pcm: allow ... |
333 |
bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */ |
1da177e4c Linux-2.6.12-rc2 |
334 335 336 |
int overrange; snd_pcm_uframes_t avail_max; snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ |
e76369257 ALSA: pcm_lib - r... |
337 |
snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ |
bbf6ad139 [ALSA] pcm-midlev... |
338 |
unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ |
bd76af0f8 ALSA: pcm midleve... |
339 |
unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */ |
4bbe1ddf8 ALSA: Add extra d... |
340 |
snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */ |
0e8014d77 ALSA: core: keep ... |
341 |
u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */ |
1da177e4c Linux-2.6.12-rc2 |
342 343 344 345 346 347 348 349 350 351 |
/* -- HW params -- */ snd_pcm_access_t access; /* access mode */ snd_pcm_format_t format; /* SNDRV_PCM_FORMAT_* */ snd_pcm_subformat_t subformat; /* subformat */ unsigned int rate; /* rate in Hz */ unsigned int channels; /* channels */ snd_pcm_uframes_t period_size; /* period size */ unsigned int periods; /* periods */ snd_pcm_uframes_t buffer_size; /* buffer size */ |
1da177e4c Linux-2.6.12-rc2 |
352 353 354 355 356 357 358 |
snd_pcm_uframes_t min_align; /* Min alignment for the format */ size_t byte_align; unsigned int frame_bits; unsigned int sample_bits; unsigned int info; unsigned int rate_num; unsigned int rate_den; |
ab69a4904 ALSA: pcm: suppor... |
359 |
unsigned int no_period_wakeup: 1; |
1da177e4c Linux-2.6.12-rc2 |
360 361 |
/* -- SW params -- */ |
877211f5e [ALSA] Remove xxx... |
362 |
int tstamp_mode; /* mmap timestamp is updated */ |
1da177e4c Linux-2.6.12-rc2 |
363 |
unsigned int period_step; |
1da177e4c Linux-2.6.12-rc2 |
364 365 366 367 368 369 370 371 372 |
snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; /* Silence filling happens when noise is nearest than this */ snd_pcm_uframes_t silence_size; /* Silence filling size */ snd_pcm_uframes_t boundary; /* pointers wrap point */ snd_pcm_uframes_t silence_start; /* starting pointer to silence area */ snd_pcm_uframes_t silence_filled; /* size filled with silence */ |
877211f5e [ALSA] Remove xxx... |
373 |
union snd_pcm_sync_id sync; /* hardware synchronization ID */ |
1da177e4c Linux-2.6.12-rc2 |
374 375 |
/* -- mmap -- */ |
503fc85a3 [ALSA] Kill usele... |
376 377 |
struct snd_pcm_mmap_status *status; struct snd_pcm_mmap_control *control; |
1da177e4c Linux-2.6.12-rc2 |
378 379 |
/* -- locking / scheduling -- */ |
5daeba34d ALSA: pcm_lib: av... |
380 |
snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */ |
c91a988dc ALSA: pcm_core: F... |
381 382 |
wait_queue_head_t sleep; /* poll sleep */ wait_queue_head_t tsleep; /* transfer sleep */ |
1da177e4c Linux-2.6.12-rc2 |
383 384 385 386 |
struct fasync_struct *fasync; /* -- private section -- */ void *private_data; |
877211f5e [ALSA] Remove xxx... |
387 |
void (*private_free)(struct snd_pcm_runtime *runtime); |
1da177e4c Linux-2.6.12-rc2 |
388 389 |
/* -- hardware description -- */ |
877211f5e [ALSA] Remove xxx... |
390 391 |
struct snd_pcm_hardware hw; struct snd_pcm_hw_constraints hw_constraints; |
1da177e4c Linux-2.6.12-rc2 |
392 |
|
1da177e4c Linux-2.6.12-rc2 |
393 394 |
/* -- timer -- */ unsigned int timer_resolution; /* timer resolution */ |
b751eef1f [ALSA] Use posix ... |
395 |
int tstamp_type; /* timestamp type */ |
1da177e4c Linux-2.6.12-rc2 |
396 397 398 399 400 401 402 |
/* -- DMA -- */ unsigned char *dma_area; /* DMA area */ dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */ size_t dma_bytes; /* size of DMA area */ struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ |
229d04309 ALSA: core: selec... |
403 404 405 406 |
/* -- audio timestamp config -- */ struct snd_pcm_audio_tstamp_config audio_tstamp_config; struct snd_pcm_audio_tstamp_report audio_tstamp_report; struct timespec driver_tstamp; |
6d2412b80 ALSA: Use IS_ENAB... |
407 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
1da177e4c Linux-2.6.12-rc2 |
408 |
/* -- OSS things -- */ |
877211f5e [ALSA] Remove xxx... |
409 |
struct snd_pcm_oss_runtime oss; |
1da177e4c Linux-2.6.12-rc2 |
410 411 |
#endif }; |
877211f5e [ALSA] Remove xxx... |
412 |
struct snd_pcm_group { /* keep linked substreams */ |
1da177e4c Linux-2.6.12-rc2 |
413 |
spinlock_t lock; |
257f8cce5 ALSA: pcm: Allow ... |
414 |
struct mutex mutex; |
1da177e4c Linux-2.6.12-rc2 |
415 |
struct list_head substreams; |
f57f3df03 ALSA: pcm: More f... |
416 |
refcount_t refs; |
877211f5e [ALSA] Remove xxx... |
417 |
}; |
1da177e4c Linux-2.6.12-rc2 |
418 |
|
e7373b702 sound: pcm: recor... |
419 |
struct pid; |
877211f5e [ALSA] Remove xxx... |
420 421 422 |
struct snd_pcm_substream { struct snd_pcm *pcm; struct snd_pcm_str *pstr; |
1da177e4c Linux-2.6.12-rc2 |
423 424 425 426 |
void *private_data; /* copied from pcm->private_data */ int number; char name[32]; /* substream name */ int stream; /* stream (direction) */ |
cc7499861 PM QoS: Minor cle... |
427 |
struct pm_qos_request latency_pm_qos_req; /* pm_qos request */ |
1da177e4c Linux-2.6.12-rc2 |
428 429 |
size_t buffer_bytes_max; /* limit ring buffer size */ struct snd_dma_buffer dma_buffer; |
1da177e4c Linux-2.6.12-rc2 |
430 431 |
size_t dma_max; /* -- hardware operations -- */ |
e6c2e7eb2 ALSA: Constify th... |
432 |
const struct snd_pcm_ops *ops; |
1da177e4c Linux-2.6.12-rc2 |
433 |
/* -- runtime information -- */ |
877211f5e [ALSA] Remove xxx... |
434 |
struct snd_pcm_runtime *runtime; |
1da177e4c Linux-2.6.12-rc2 |
435 |
/* -- timer section -- */ |
877211f5e [ALSA] Remove xxx... |
436 |
struct snd_timer *timer; /* timer */ |
1da177e4c Linux-2.6.12-rc2 |
437 |
unsigned timer_running: 1; /* time is running */ |
d64c5cf8e ALSA: pcm: Allow ... |
438 |
long wait_time; /* time in ms for R/W to wait for avail */ |
1da177e4c Linux-2.6.12-rc2 |
439 |
/* -- next substream -- */ |
877211f5e [ALSA] Remove xxx... |
440 |
struct snd_pcm_substream *next; |
1da177e4c Linux-2.6.12-rc2 |
441 442 |
/* -- linked substreams -- */ struct list_head link_list; /* linked list member */ |
877211f5e [ALSA] Remove xxx... |
443 444 |
struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ struct snd_pcm_group *group; /* pointer to current group */ |
1da177e4c Linux-2.6.12-rc2 |
445 |
/* -- assigned files -- */ |
0df63e44c [ALSA] Add O_APPE... |
446 |
int ref_count; |
9c323fcbc [ALSA] Fix mmap_c... |
447 |
atomic_t mmap_count; |
0df63e44c [ALSA] Add O_APPE... |
448 |
unsigned int f_flags; |
3bf75f9b9 [ALSA] Clean up P... |
449 |
void (*pcm_release)(struct snd_pcm_substream *); |
e7373b702 sound: pcm: recor... |
450 |
struct pid *pid; |
6d2412b80 ALSA: Use IS_ENAB... |
451 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
1da177e4c Linux-2.6.12-rc2 |
452 |
/* -- OSS things -- */ |
877211f5e [ALSA] Remove xxx... |
453 |
struct snd_pcm_oss_substream oss; |
1da177e4c Linux-2.6.12-rc2 |
454 |
#endif |
b7d90a356 [ALSA] Fix Oops a... |
455 |
#ifdef CONFIG_SND_VERBOSE_PROCFS |
877211f5e [ALSA] Remove xxx... |
456 |
struct snd_info_entry *proc_root; |
2b30d411d ALSA: pcm: Add xr... |
457 |
#endif /* CONFIG_SND_VERBOSE_PROCFS */ |
1da177e4c Linux-2.6.12-rc2 |
458 |
/* misc flags */ |
3bf75f9b9 [ALSA] Clean up P... |
459 |
unsigned int hw_opened: 1; |
1da177e4c Linux-2.6.12-rc2 |
460 |
}; |
0df63e44c [ALSA] Add O_APPE... |
461 |
#define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0) |
1da177e4c Linux-2.6.12-rc2 |
462 |
|
877211f5e [ALSA] Remove xxx... |
463 |
struct snd_pcm_str { |
1da177e4c Linux-2.6.12-rc2 |
464 |
int stream; /* stream (direction) */ |
877211f5e [ALSA] Remove xxx... |
465 |
struct snd_pcm *pcm; |
1da177e4c Linux-2.6.12-rc2 |
466 467 468 |
/* -- substreams -- */ unsigned int substream_count; unsigned int substream_opened; |
877211f5e [ALSA] Remove xxx... |
469 |
struct snd_pcm_substream *substream; |
6d2412b80 ALSA: Use IS_ENAB... |
470 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
1da177e4c Linux-2.6.12-rc2 |
471 |
/* -- OSS things -- */ |
877211f5e [ALSA] Remove xxx... |
472 |
struct snd_pcm_oss_stream oss; |
1da177e4c Linux-2.6.12-rc2 |
473 |
#endif |
b7d90a356 [ALSA] Fix Oops a... |
474 |
#ifdef CONFIG_SND_VERBOSE_PROCFS |
877211f5e [ALSA] Remove xxx... |
475 |
struct snd_info_entry *proc_root; |
b7d90a356 [ALSA] Fix Oops a... |
476 |
#ifdef CONFIG_SND_PCM_XRUN_DEBUG |
1da177e4c Linux-2.6.12-rc2 |
477 |
unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ |
1da177e4c Linux-2.6.12-rc2 |
478 |
#endif |
b7d90a356 [ALSA] Fix Oops a... |
479 |
#endif |
2d3391ec0 ALSA: PCM: channe... |
480 |
struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ |
ef46c7af9 ALSA: pcm: Embed ... |
481 |
struct device dev; |
1da177e4c Linux-2.6.12-rc2 |
482 |
}; |
877211f5e [ALSA] Remove xxx... |
483 484 |
struct snd_pcm { struct snd_card *card; |
f87135f56 [ALSA] dynamic mi... |
485 |
struct list_head list; |
f90c06a2b ALSA: Fix limit o... |
486 |
int device; /* device number */ |
1da177e4c Linux-2.6.12-rc2 |
487 488 489 490 491 |
unsigned int info_flags; unsigned short dev_class; unsigned short dev_subclass; char id[64]; char name[80]; |
877211f5e [ALSA] Remove xxx... |
492 |
struct snd_pcm_str streams[2]; |
1a60d4c5a [ALSA] semaphore ... |
493 |
struct mutex open_mutex; |
1da177e4c Linux-2.6.12-rc2 |
494 495 |
wait_queue_head_t open_wait; void *private_data; |
877211f5e [ALSA] Remove xxx... |
496 |
void (*private_free) (struct snd_pcm *pcm); |
945e50384 ALSA: PCM - Add P... |
497 |
bool internal; /* pcm is for internal use only */ |
257f8cce5 ALSA: pcm: Allow ... |
498 |
bool nonatomic; /* whole PCM operations are in non-atomic context */ |
3d21ef0b4 ALSA: pcm: Suspen... |
499 |
bool no_device_suspend; /* don't invoke device PM suspend */ |
6d2412b80 ALSA: Use IS_ENAB... |
500 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) |
877211f5e [ALSA] Remove xxx... |
501 |
struct snd_pcm_oss oss; |
1da177e4c Linux-2.6.12-rc2 |
502 503 |
#endif }; |
1da177e4c Linux-2.6.12-rc2 |
504 505 506 |
/* * Registering */ |
540473208 [PATCH] mark stru... |
507 |
extern const struct file_operations snd_pcm_f_ops[2]; |
1da177e4c Linux-2.6.12-rc2 |
508 |
|
e61616530 ALSA: snd_pcm_new... |
509 |
int snd_pcm_new(struct snd_card *card, const char *id, int device, |
1da177e4c Linux-2.6.12-rc2 |
510 |
int playback_count, int capture_count, |
877211f5e [ALSA] Remove xxx... |
511 |
struct snd_pcm **rpcm); |
945e50384 ALSA: PCM - Add P... |
512 513 514 |
int snd_pcm_new_internal(struct snd_card *card, const char *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); |
877211f5e [ALSA] Remove xxx... |
515 |
int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); |
1da177e4c Linux-2.6.12-rc2 |
516 |
|
58f30d650 ALSA: pcm: Build ... |
517 518 519 520 521 522 523 |
#if IS_ENABLED(CONFIG_SND_PCM_OSS) struct snd_pcm_notify { int (*n_register) (struct snd_pcm * pcm); int (*n_disconnect) (struct snd_pcm * pcm); int (*n_unregister) (struct snd_pcm * pcm); struct list_head list; }; |
877211f5e [ALSA] Remove xxx... |
524 |
int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); |
58f30d650 ALSA: pcm: Build ... |
525 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
526 527 528 529 |
/* * Native I/O */ |
877211f5e [ALSA] Remove xxx... |
530 531 532 533 534 |
int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); int snd_pcm_info_user(struct snd_pcm_substream *substream, struct snd_pcm_info __user *info); int snd_pcm_status(struct snd_pcm_substream *substream, struct snd_pcm_status *status); |
877211f5e [ALSA] Remove xxx... |
535 |
int snd_pcm_start(struct snd_pcm_substream *substream); |
fea952e5c ALSA: core: spars... |
536 |
int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); |
877211f5e [ALSA] Remove xxx... |
537 |
int snd_pcm_drain_done(struct snd_pcm_substream *substream); |
1fb8510cd ALSA: pcm: Add sn... |
538 |
int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); |
1da177e4c Linux-2.6.12-rc2 |
539 |
#ifdef CONFIG_PM |
877211f5e [ALSA] Remove xxx... |
540 |
int snd_pcm_suspend_all(struct snd_pcm *pcm); |
1cf05ba2c ALSA: pcm: Define... |
541 |
#else |
1cf05ba2c ALSA: pcm: Define... |
542 543 544 545 |
static inline int snd_pcm_suspend_all(struct snd_pcm *pcm) { return 0; } |
1da177e4c Linux-2.6.12-rc2 |
546 |
#endif |
877211f5e [ALSA] Remove xxx... |
547 |
int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); |
3bf75f9b9 [ALSA] Clean up P... |
548 549 |
int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file, struct snd_pcm_substream **rsubstream); |
877211f5e [ALSA] Remove xxx... |
550 |
void snd_pcm_release_substream(struct snd_pcm_substream *substream); |
3bf75f9b9 [ALSA] Clean up P... |
551 552 553 |
int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, struct file *file, struct snd_pcm_substream **rsubstream); void snd_pcm_detach_substream(struct snd_pcm_substream *substream); |
877211f5e [ALSA] Remove xxx... |
554 |
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); |
1da177e4c Linux-2.6.12-rc2 |
555 |
|
acb03d440 ALSA: Make snd_pc... |
556 557 558 559 560 561 562 563 564 565 566 |
#ifdef CONFIG_SND_DEBUG void snd_pcm_debug_name(struct snd_pcm_substream *substream, char *name, size_t len); #else static inline void snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) { *buf = 0; } #endif |
1da177e4c Linux-2.6.12-rc2 |
567 568 569 |
/* * PCM library */ |
30b771cf8 ALSA: pcm: More k... |
570 571 572 573 574 575 |
/** * snd_pcm_stream_linked - Check whether the substream is linked with others * @substream: substream to check * * Returns true if the given substream is being linked with others. */ |
877211f5e [ALSA] Remove xxx... |
576 |
static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
577 578 579 |
{ return substream->group != &substream->self_group; } |
7af142f75 ALSA: pcm: Uninli... |
580 581 582 583 584 |
void snd_pcm_stream_lock(struct snd_pcm_substream *substream); void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); |
30b771cf8 ALSA: pcm: More k... |
585 586 587 588 589 590 591 592 593 594 |
/** * snd_pcm_stream_lock_irqsave - Lock the PCM stream * @substream: PCM substream * @flags: irq flags * * This locks the PCM stream like snd_pcm_stream_lock() but with the local * IRQ (only when nonatomic is false). In nonatomic case, this is identical * as snd_pcm_stream_lock(). */ |
7af142f75 ALSA: pcm: Uninli... |
595 596 597 598 599 600 601 |
#define snd_pcm_stream_lock_irqsave(substream, flags) \ do { \ typecheck(unsigned long, flags); \ flags = _snd_pcm_stream_lock_irqsave(substream); \ } while (0) void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, unsigned long flags); |
1da177e4c Linux-2.6.12-rc2 |
602 |
|
30b771cf8 ALSA: pcm: More k... |
603 604 605 606 607 608 609 610 611 |
/** * snd_pcm_group_for_each_entry - iterate over the linked substreams * @s: the iterator * @substream: the substream * * Iterate over the all linked substreams to the given @substream. * When @substream isn't linked with any others, this gives returns @substream * itself once. */ |
ef991b95a [ALSA] Add snd_pc... |
612 613 |
#define snd_pcm_group_for_each_entry(s, substream) \ list_for_each_entry(s, &substream->group->substreams, link_list) |
1da177e4c Linux-2.6.12-rc2 |
614 |
|
30b771cf8 ALSA: pcm: More k... |
615 616 617 618 619 620 621 |
/** * snd_pcm_running - Check whether the substream is in a running state * @substream: substream to check * * Returns true if the given substream is in the state RUNNING, or in the * state DRAINING for playback. */ |
877211f5e [ALSA] Remove xxx... |
622 |
static inline int snd_pcm_running(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
623 624 625 626 627 |
{ return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING || (substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING && substream->stream == SNDRV_PCM_STREAM_PLAYBACK)); } |
30b771cf8 ALSA: pcm: More k... |
628 629 630 631 632 |
/** * bytes_to_samples - Unit conversion of the size from bytes to samples * @runtime: PCM runtime instance * @size: size in bytes */ |
877211f5e [ALSA] Remove xxx... |
633 |
static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) |
1da177e4c Linux-2.6.12-rc2 |
634 635 636 |
{ return size * 8 / runtime->sample_bits; } |
30b771cf8 ALSA: pcm: More k... |
637 638 639 640 641 |
/** * bytes_to_frames - Unit conversion of the size from bytes to frames * @runtime: PCM runtime instance * @size: size in bytes */ |
877211f5e [ALSA] Remove xxx... |
642 |
static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) |
1da177e4c Linux-2.6.12-rc2 |
643 644 645 |
{ return size * 8 / runtime->frame_bits; } |
30b771cf8 ALSA: pcm: More k... |
646 647 648 649 650 |
/** * samples_to_bytes - Unit conversion of the size from samples to bytes * @runtime: PCM runtime instance * @size: size in samples */ |
877211f5e [ALSA] Remove xxx... |
651 |
static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) |
1da177e4c Linux-2.6.12-rc2 |
652 653 654 |
{ return size * runtime->sample_bits / 8; } |
30b771cf8 ALSA: pcm: More k... |
655 656 657 658 659 |
/** * frames_to_bytes - Unit conversion of the size from frames to bytes * @runtime: PCM runtime instance * @size: size in frames */ |
877211f5e [ALSA] Remove xxx... |
660 |
static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) |
1da177e4c Linux-2.6.12-rc2 |
661 662 663 |
{ return size * runtime->frame_bits / 8; } |
30b771cf8 ALSA: pcm: More k... |
664 665 666 667 668 |
/** * frame_aligned - Check whether the byte size is aligned to frames * @runtime: PCM runtime instance * @bytes: size in bytes */ |
877211f5e [ALSA] Remove xxx... |
669 |
static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) |
1da177e4c Linux-2.6.12-rc2 |
670 671 672 |
{ return bytes % runtime->byte_align == 0; } |
30b771cf8 ALSA: pcm: More k... |
673 674 675 676 |
/** * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes * @substream: PCM substream */ |
877211f5e [ALSA] Remove xxx... |
677 |
static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
678 |
{ |
877211f5e [ALSA] Remove xxx... |
679 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
680 681 |
return frames_to_bytes(runtime, runtime->buffer_size); } |
30b771cf8 ALSA: pcm: More k... |
682 683 684 685 |
/** * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes * @substream: PCM substream */ |
877211f5e [ALSA] Remove xxx... |
686 |
static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
687 |
{ |
877211f5e [ALSA] Remove xxx... |
688 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
689 690 |
return frames_to_bytes(runtime, runtime->period_size); } |
30b771cf8 ALSA: pcm: More k... |
691 692 693 694 695 |
/** * snd_pcm_playback_avail - Get the available (writable) space for playback * @runtime: PCM runtime instance * * Result is between 0 ... (boundary - 1) |
1da177e4c Linux-2.6.12-rc2 |
696 |
*/ |
877211f5e [ALSA] Remove xxx... |
697 |
static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) |
1da177e4c Linux-2.6.12-rc2 |
698 699 700 701 702 703 704 705 |
{ snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; if (avail < 0) avail += runtime->boundary; else if ((snd_pcm_uframes_t) avail >= runtime->boundary) avail -= runtime->boundary; return avail; } |
30b771cf8 ALSA: pcm: More k... |
706 |
/** |
c24a12696 ALSA: pcm: Fix fu... |
707 |
* snd_pcm_capture_avail - Get the available (readable) space for capture |
30b771cf8 ALSA: pcm: More k... |
708 709 710 |
* @runtime: PCM runtime instance * * Result is between 0 ... (boundary - 1) |
1da177e4c Linux-2.6.12-rc2 |
711 |
*/ |
877211f5e [ALSA] Remove xxx... |
712 |
static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) |
1da177e4c Linux-2.6.12-rc2 |
713 714 715 716 717 718 |
{ snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; if (avail < 0) avail += runtime->boundary; return avail; } |
30b771cf8 ALSA: pcm: More k... |
719 720 721 722 |
/** * snd_pcm_playback_hw_avail - Get the queued space for playback * @runtime: PCM runtime instance */ |
877211f5e [ALSA] Remove xxx... |
723 |
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) |
1da177e4c Linux-2.6.12-rc2 |
724 725 726 |
{ return runtime->buffer_size - snd_pcm_playback_avail(runtime); } |
30b771cf8 ALSA: pcm: More k... |
727 728 729 730 |
/** * snd_pcm_capture_hw_avail - Get the free space for capture * @runtime: PCM runtime instance */ |
877211f5e [ALSA] Remove xxx... |
731 |
static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) |
1da177e4c Linux-2.6.12-rc2 |
732 733 734 735 736 737 738 739 740 741 |
{ return runtime->buffer_size - snd_pcm_capture_avail(runtime); } /** * snd_pcm_playback_ready - check whether the playback buffer is available * @substream: the pcm substream instance * * Checks whether enough free space is available on the playback buffer. * |
eb7c06e8e ALSA: add/change ... |
742 |
* Return: Non-zero if available, or zero if not. |
1da177e4c Linux-2.6.12-rc2 |
743 |
*/ |
877211f5e [ALSA] Remove xxx... |
744 |
static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
745 |
{ |
877211f5e [ALSA] Remove xxx... |
746 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
747 748 749 750 751 752 753 754 755 |
return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min; } /** * snd_pcm_capture_ready - check whether the capture buffer is available * @substream: the pcm substream instance * * Checks whether enough capture data is available on the capture buffer. * |
eb7c06e8e ALSA: add/change ... |
756 |
* Return: Non-zero if available, or zero if not. |
1da177e4c Linux-2.6.12-rc2 |
757 |
*/ |
877211f5e [ALSA] Remove xxx... |
758 |
static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
759 |
{ |
877211f5e [ALSA] Remove xxx... |
760 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
761 762 763 764 765 766 767 |
return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min; } /** * snd_pcm_playback_data - check whether any data exists on the playback buffer * @substream: the pcm substream instance * |
eb7c06e8e ALSA: add/change ... |
768 |
* Checks whether any data exists on the playback buffer. |
1da177e4c Linux-2.6.12-rc2 |
769 |
* |
eb7c06e8e ALSA: add/change ... |
770 771 |
* Return: Non-zero if any data exists, or zero if not. If stop_threshold * is bigger or equal to boundary, then this function returns always non-zero. |
1da177e4c Linux-2.6.12-rc2 |
772 |
*/ |
877211f5e [ALSA] Remove xxx... |
773 |
static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
774 |
{ |
877211f5e [ALSA] Remove xxx... |
775 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
776 777 778 779 780 781 782 783 784 785 786 787 |
if (runtime->stop_threshold >= runtime->boundary) return 1; return snd_pcm_playback_avail(runtime) < runtime->buffer_size; } /** * snd_pcm_playback_empty - check whether the playback buffer is empty * @substream: the pcm substream instance * * Checks whether the playback buffer is empty. * |
eb7c06e8e ALSA: add/change ... |
788 |
* Return: Non-zero if empty, or zero if not. |
1da177e4c Linux-2.6.12-rc2 |
789 |
*/ |
877211f5e [ALSA] Remove xxx... |
790 |
static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
791 |
{ |
877211f5e [ALSA] Remove xxx... |
792 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
793 794 795 796 797 798 799 800 801 |
return snd_pcm_playback_avail(runtime) >= runtime->buffer_size; } /** * snd_pcm_capture_empty - check whether the capture buffer is empty * @substream: the pcm substream instance * * Checks whether the capture buffer is empty. * |
eb7c06e8e ALSA: add/change ... |
802 |
* Return: Non-zero if empty, or zero if not. |
1da177e4c Linux-2.6.12-rc2 |
803 |
*/ |
877211f5e [ALSA] Remove xxx... |
804 |
static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) |
1da177e4c Linux-2.6.12-rc2 |
805 |
{ |
877211f5e [ALSA] Remove xxx... |
806 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
807 808 |
return snd_pcm_capture_avail(runtime) == 0; } |
30b771cf8 ALSA: pcm: More k... |
809 810 811 812 813 814 815 816 817 818 819 820 821 822 |
/** * snd_pcm_trigger_done - Mark the master substream * @substream: the pcm substream instance * @master: the linked master substream * * When multiple substreams of the same card are linked and the hardware * supports the single-shot operation, the driver calls this in the loop * in snd_pcm_group_for_each_entry() for marking the substream as "done". * Then most of trigger operations are performed only to the given master * substream. * * The trigger_master mark is cleared at timestamp updates at the end * of trigger operations. */ |
877211f5e [ALSA] Remove xxx... |
823 824 |
static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, struct snd_pcm_substream *master) |
1da177e4c Linux-2.6.12-rc2 |
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
{ substream->runtime->trigger_master = master; } static inline int hw_is_mask(int var) { return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK && var <= SNDRV_PCM_HW_PARAM_LAST_MASK; } static inline int hw_is_interval(int var) { return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL && var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; } |
877211f5e [ALSA] Remove xxx... |
840 |
static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params, |
1da177e4c Linux-2.6.12-rc2 |
841 842 843 844 |
snd_pcm_hw_param_t var) { return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; } |
877211f5e [ALSA] Remove xxx... |
845 |
static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params, |
1da177e4c Linux-2.6.12-rc2 |
846 847 848 849 |
snd_pcm_hw_param_t var) { return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; } |
877211f5e [ALSA] Remove xxx... |
850 |
static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params, |
1da177e4c Linux-2.6.12-rc2 |
851 852 |
snd_pcm_hw_param_t var) { |
b9f09a485 [ALSA] Fix 'disca... |
853 |
return ¶ms->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK]; |
1da177e4c Linux-2.6.12-rc2 |
854 |
} |
877211f5e [ALSA] Remove xxx... |
855 |
static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params, |
1da177e4c Linux-2.6.12-rc2 |
856 857 |
snd_pcm_hw_param_t var) { |
b9f09a485 [ALSA] Fix 'disca... |
858 |
return ¶ms->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; |
1da177e4c Linux-2.6.12-rc2 |
859 |
} |
85926e0fe ALSA: pcm: Conver... |
860 861 862 863 864 865 866 867 868 869 |
/** * params_channels - Get the number of channels from the hw params * @p: hw params */ static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min; } /** |
62f64a880 ALSA: pcm: Fix ke... |
870 |
* params_rate - Get the sample rate from the hw params |
85926e0fe ALSA: pcm: Conver... |
871 872 873 874 875 876 877 878 |
* @p: hw params */ static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min; } /** |
62f64a880 ALSA: pcm: Fix ke... |
879 |
* params_period_size - Get the period size (in frames) from the hw params |
85926e0fe ALSA: pcm: Conver... |
880 881 882 883 884 885 886 887 |
* @p: hw params */ static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min; } /** |
62f64a880 ALSA: pcm: Fix ke... |
888 |
* params_periods - Get the number of periods from the hw params |
85926e0fe ALSA: pcm: Conver... |
889 890 891 892 893 894 895 896 |
* @p: hw params */ static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min; } /** |
62f64a880 ALSA: pcm: Fix ke... |
897 |
* params_buffer_size - Get the buffer size (in frames) from the hw params |
85926e0fe ALSA: pcm: Conver... |
898 899 900 901 902 903 904 905 |
* @p: hw params */ static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min; } /** |
62f64a880 ALSA: pcm: Fix ke... |
906 |
* params_buffer_bytes - Get the buffer size (in bytes) from the hw params |
85926e0fe ALSA: pcm: Conver... |
907 908 909 910 911 912 |
* @p: hw params */ static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) { return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min; } |
1da177e4c Linux-2.6.12-rc2 |
913 |
|
877211f5e [ALSA] Remove xxx... |
914 |
int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); |
4af87a939 ALSA: pcm: Consti... |
915 916 |
int snd_interval_list(struct snd_interval *i, unsigned int count, const unsigned int *list, unsigned int mask); |
f66f898e9 ALSA: pcm: Add sn... |
917 918 |
int snd_interval_ranges(struct snd_interval *i, unsigned int count, const struct snd_interval *list, unsigned int mask); |
877211f5e [ALSA] Remove xxx... |
919 |
int snd_interval_ratnum(struct snd_interval *i, |
e5e113cf0 ALSA: Constify ra... |
920 |
unsigned int rats_count, const struct snd_ratnum *rats, |
1da177e4c Linux-2.6.12-rc2 |
921 |
unsigned int *nump, unsigned int *denp); |
877211f5e [ALSA] Remove xxx... |
922 923 |
void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); |
1da177e4c Linux-2.6.12-rc2 |
924 |
|
877211f5e [ALSA] Remove xxx... |
925 |
int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); |
1da177e4c Linux-2.6.12-rc2 |
926 |
|
877211f5e [ALSA] Remove xxx... |
927 |
int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, |
1da177e4c Linux-2.6.12-rc2 |
928 |
u_int64_t mask); |
877211f5e [ALSA] Remove xxx... |
929 |
int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, |
1da177e4c Linux-2.6.12-rc2 |
930 |
unsigned int min, unsigned int max); |
877211f5e [ALSA] Remove xxx... |
931 932 |
int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var); int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
933 934 |
unsigned int cond, snd_pcm_hw_param_t var, |
1464189f8 ALSA: pcm: Make c... |
935 |
const struct snd_pcm_hw_constraint_list *l); |
f66f898e9 ALSA: pcm: Add sn... |
936 937 938 939 |
int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, const struct snd_pcm_hw_constraint_ranges *r); |
877211f5e [ALSA] Remove xxx... |
940 |
int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
941 942 |
unsigned int cond, snd_pcm_hw_param_t var, |
e5e113cf0 ALSA: Constify ra... |
943 |
const struct snd_pcm_hw_constraint_ratnums *r); |
877211f5e [ALSA] Remove xxx... |
944 |
int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
945 946 |
unsigned int cond, snd_pcm_hw_param_t var, |
e5e113cf0 ALSA: Constify ra... |
947 |
const struct snd_pcm_hw_constraint_ratdens *r); |
877211f5e [ALSA] Remove xxx... |
948 |
int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
949 950 951 |
unsigned int cond, unsigned int width, unsigned int msbits); |
877211f5e [ALSA] Remove xxx... |
952 |
int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
953 954 955 |
unsigned int cond, snd_pcm_hw_param_t var, unsigned long step); |
877211f5e [ALSA] Remove xxx... |
956 |
int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
957 958 |
unsigned int cond, snd_pcm_hw_param_t var); |
d5b702a64 ALSA: pcm: add sn... |
959 960 |
int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, unsigned int base_rate); |
877211f5e [ALSA] Remove xxx... |
961 |
int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, |
1da177e4c Linux-2.6.12-rc2 |
962 963 964 965 |
unsigned int cond, int var, snd_pcm_hw_rule_func_t func, void *private, int dep, ...); |
bc1043cdc ALSA: Add helper ... |
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 |
/** * snd_pcm_hw_constraint_single() - Constrain parameter to a single value * @runtime: PCM runtime instance * @var: The hw_params variable to constrain * @val: The value to constrain to * * Return: Positive if the value is changed, zero if it's not changed, or a * negative error code. */ static inline int snd_pcm_hw_constraint_single( struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsigned int val) { return snd_pcm_hw_constraint_minmax(runtime, var, val, val); } |
1da177e4c Linux-2.6.12-rc2 |
981 982 983 984 985 |
int snd_pcm_format_signed(snd_pcm_format_t format); int snd_pcm_format_unsigned(snd_pcm_format_t format); int snd_pcm_format_linear(snd_pcm_format_t format); int snd_pcm_format_little_endian(snd_pcm_format_t format); int snd_pcm_format_big_endian(snd_pcm_format_t format); |
52204718b ALSA: pcm: fix th... |
986 |
#if 0 /* just for kernel-doc */ |
1b44c28dc [ALSA] Another fi... |
987 |
/** |
9502dcad6 [ALSA] Export mis... |
988 989 990 |
* snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian * @format: the format to check * |
eb7c06e8e ALSA: add/change ... |
991 |
* Return: 1 if the given PCM format is CPU-endian, 0 if |
9502dcad6 [ALSA] Export mis... |
992 993 |
* opposite, or a negative error code if endian not specified. */ |
8cdfd2519 [ALSA] Remove sup... |
994 |
int snd_pcm_format_cpu_endian(snd_pcm_format_t format); |
1b44c28dc [ALSA] Another fi... |
995 |
#endif /* DocBook */ |
9502dcad6 [ALSA] Export mis... |
996 |
#ifdef SNDRV_LITTLE_ENDIAN |
9d01a82e4 [PATCH] DocBook: ... |
997 |
#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format) |
9502dcad6 [ALSA] Export mis... |
998 |
#else |
9d01a82e4 [PATCH] DocBook: ... |
999 |
#define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format) |
9502dcad6 [ALSA] Export mis... |
1000 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
1001 1002 |
int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ |
9502dcad6 [ALSA] Export mis... |
1003 |
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); |
1da177e4c Linux-2.6.12-rc2 |
1004 1005 |
const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); |
1da177e4c Linux-2.6.12-rc2 |
1006 |
|
e6c2e7eb2 ALSA: Constify th... |
1007 1008 |
void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, const struct snd_pcm_ops *ops); |
877211f5e [ALSA] Remove xxx... |
1009 |
void snd_pcm_set_sync(struct snd_pcm_substream *substream); |
877211f5e [ALSA] Remove xxx... |
1010 |
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, |
1da177e4c Linux-2.6.12-rc2 |
1011 |
unsigned int cmd, void *arg); |
877211f5e [ALSA] Remove xxx... |
1012 |
void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); |
5c7264cfb ALSA: pcm: Unify ... |
1013 |
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, |
c48f12ee0 ALSA: pcm: Call d... |
1014 |
void *buf, bool interleaved, |
685412137 ALSA: pcm: Direct... |
1015 |
snd_pcm_uframes_t frames, bool in_kernel); |
c48f12ee0 ALSA: pcm: Call d... |
1016 1017 1018 1019 1020 |
static inline snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, snd_pcm_uframes_t frames) { |
95a48b7d4 ALSA: pcm: Add __... |
1021 |
return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); |
c48f12ee0 ALSA: pcm: Call d... |
1022 1023 1024 1025 1026 1027 |
} static inline snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __user *buf, snd_pcm_uframes_t frames) { |
95a48b7d4 ALSA: pcm: Add __... |
1028 |
return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); |
c48f12ee0 ALSA: pcm: Call d... |
1029 1030 1031 1032 1033 1034 |
} static inline snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames) { |
685412137 ALSA: pcm: Direct... |
1035 |
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); |
c48f12ee0 ALSA: pcm: Call d... |
1036 1037 1038 1039 1040 1041 |
} static inline snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, void __user **bufs, snd_pcm_uframes_t frames) { |
685412137 ALSA: pcm: Direct... |
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 |
return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); } static inline snd_pcm_sframes_t snd_pcm_kernel_write(struct snd_pcm_substream *substream, const void *buf, snd_pcm_uframes_t frames) { return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames, true); } static inline snd_pcm_sframes_t snd_pcm_kernel_read(struct snd_pcm_substream *substream, void *buf, snd_pcm_uframes_t frames) { return __snd_pcm_lib_xfer(substream, buf, true, frames, true); } static inline snd_pcm_sframes_t snd_pcm_kernel_writev(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames) { return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); } static inline snd_pcm_sframes_t snd_pcm_kernel_readv(struct snd_pcm_substream *substream, void **bufs, snd_pcm_uframes_t frames) { return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); |
c48f12ee0 ALSA: pcm: Call d... |
1071 |
} |
1da177e4c Linux-2.6.12-rc2 |
1072 |
|
877211f5e [ALSA] Remove xxx... |
1073 |
int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); |
918f3a0e8 [ALSA] pcm: add s... |
1074 |
unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); |
4be77a530 ALSA: pcm: Add sn... |
1075 |
unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); |
e3a9269f8 ALSA: Add helper ... |
1076 1077 |
unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, unsigned int rates_b); |
3bdff244a ALSA: pcm: Add sn... |
1078 1079 |
unsigned int snd_pcm_rate_range_to_bits(unsigned int rate_min, unsigned int rate_max); |
1da177e4c Linux-2.6.12-rc2 |
1080 |
|
30b771cf8 ALSA: pcm: More k... |
1081 1082 1083 1084 1085 1086 1087 1088 |
/** * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer * @substream: PCM substream to set * @bufp: the buffer information, NULL to clear * * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL. * Otherwise it clears the current buffer information. */ |
877211f5e [ALSA] Remove xxx... |
1089 |
static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, |
1da177e4c Linux-2.6.12-rc2 |
1090 1091 |
struct snd_dma_buffer *bufp) { |
877211f5e [ALSA] Remove xxx... |
1092 |
struct snd_pcm_runtime *runtime = substream->runtime; |
1da177e4c Linux-2.6.12-rc2 |
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 |
if (bufp) { runtime->dma_buffer_p = bufp; runtime->dma_area = bufp->area; runtime->dma_addr = bufp->addr; runtime->dma_bytes = bufp->bytes; } else { runtime->dma_buffer_p = NULL; runtime->dma_area = NULL; runtime->dma_addr = 0; runtime->dma_bytes = 0; } } |
30b771cf8 ALSA: pcm: More k... |
1105 1106 1107 1108 1109 |
/** * snd_pcm_gettime - Fill the timespec depending on the timestamp mode * @runtime: PCM runtime instance * @tv: timespec to fill */ |
b751eef1f [ALSA] Use posix ... |
1110 1111 1112 |
static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, struct timespec *tv) { |
0ac8a52d4 ALSA: Provide a C... |
1113 1114 |
switch (runtime->tstamp_type) { case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC: |
26204e048 ALSA: core: Use k... |
1115 |
ktime_get_ts(tv); |
0ac8a52d4 ALSA: Provide a C... |
1116 1117 1118 1119 1120 |
break; case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: getrawmonotonic(tv); break; default: |
b751eef1f [ALSA] Use posix ... |
1121 |
getnstimeofday(tv); |
0ac8a52d4 ALSA: Provide a C... |
1122 1123 |
break; } |
b751eef1f [ALSA] Use posix ... |
1124 |
} |
1da177e4c Linux-2.6.12-rc2 |
1125 1126 1127 |
/* * Memory */ |
bb580602f ALSA: pcm: Define... |
1128 1129 1130 |
void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
1da177e4c Linux-2.6.12-rc2 |
1131 1132 |
int type, struct device *data, size_t size, size_t max); |
bb580602f ALSA: pcm: Define... |
1133 |
void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
1da177e4c Linux-2.6.12-rc2 |
1134 1135 |
int type, void *data, size_t size, size_t max); |
877211f5e [ALSA] Remove xxx... |
1136 1137 |
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); |
1da177e4c Linux-2.6.12-rc2 |
1138 |
|
681b84e17 sound: pcm: add v... |
1139 1140 1141 1142 1143 |
int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, size_t size, gfp_t gfp_flags); int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, unsigned long offset); |
681b84e17 sound: pcm: add v... |
1144 1145 1146 1147 1148 1149 1150 1151 1152 |
/** * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer * @substream: the substream to allocate the buffer to * @size: the requested buffer size, in bytes * * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is * contiguous in kernel virtual space, but not in physical memory. Use this * if the buffer is accessed by kernel code but not by device DMA. * |
eb7c06e8e ALSA: add/change ... |
1153 |
* Return: 1 if the buffer was changed, 0 if not changed, or a negative error |
681b84e17 sound: pcm: add v... |
1154 1155 |
* code. */ |
f213d8f79 ALSA: pcm: Use st... |
1156 1157 1158 1159 1160 1161 |
static inline int snd_pcm_lib_alloc_vmalloc_buffer (struct snd_pcm_substream *substream, size_t size) { return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); } |
681b84e17 sound: pcm: add v... |
1162 1163 1164 1165 1166 1167 1168 |
/** * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer * @substream: the substream to allocate the buffer to * @size: the requested buffer size, in bytes * * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. |
eb7c06e8e ALSA: add/change ... |
1169 1170 1171 |
* * Return: 1 if the buffer was changed, 0 if not changed, or a negative error * code. |
681b84e17 sound: pcm: add v... |
1172 |
*/ |
f213d8f79 ALSA: pcm: Use st... |
1173 1174 1175 1176 1177 1178 |
static inline int snd_pcm_lib_alloc_vmalloc_32_buffer (struct snd_pcm_substream *substream, size_t size) { return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); } |
681b84e17 sound: pcm: add v... |
1179 |
|
9d069dc00 ALSA: Make snd_sg... |
1180 |
#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) |
cc6a8acde ALSA: Fix SG-buff... |
1181 |
#ifdef CONFIG_SND_DMA_SGBUF |
77a23f269 ALSA: Clean up SG... |
1182 1183 1184 1185 |
/* * SG-buffer handling */ #define snd_pcm_substream_sgbuf(substream) \ |
9d069dc00 ALSA: Make snd_sg... |
1186 |
snd_pcm_get_dma_buf(substream)->private_data |
77a23f269 ALSA: Clean up SG... |
1187 1188 1189 |
struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset); |
cc6a8acde ALSA: Fix SG-buff... |
1190 1191 1192 1193 |
#else /* !SND_DMA_SGBUF */ /* * fake using a continuous buffer */ |
9d069dc00 ALSA: Make snd_sg... |
1194 1195 |
#define snd_pcm_sgbuf_ops_page NULL #endif /* SND_DMA_SGBUF */ |
30b771cf8 ALSA: pcm: More k... |
1196 1197 1198 1199 1200 |
/** * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset * @substream: PCM substream * @ofs: byte offset */ |
cc6a8acde ALSA: Fix SG-buff... |
1201 1202 1203 |
static inline dma_addr_t snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) { |
9d069dc00 ALSA: Make snd_sg... |
1204 |
return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); |
cc6a8acde ALSA: Fix SG-buff... |
1205 |
} |
30b771cf8 ALSA: pcm: More k... |
1206 1207 1208 1209 1210 |
/** * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset * @substream: PCM substream * @ofs: byte offset */ |
cc6a8acde ALSA: Fix SG-buff... |
1211 1212 1213 |
static inline void * snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) { |
9d069dc00 ALSA: Make snd_sg... |
1214 |
return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); |
cc6a8acde ALSA: Fix SG-buff... |
1215 |
} |
30b771cf8 ALSA: pcm: More k... |
1216 1217 1218 1219 1220 1221 1222 |
/** * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig. * page from the given size * @substream: PCM substream * @ofs: byte offset * @size: byte size to examine */ |
9d069dc00 ALSA: Make snd_sg... |
1223 1224 1225 1226 1227 1228 |
static inline unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, unsigned int ofs, unsigned int size) { return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); } |
cc6a8acde ALSA: Fix SG-buff... |
1229 |
|
30b771cf8 ALSA: pcm: More k... |
1230 1231 1232 1233 1234 1235 |
/** * snd_pcm_mmap_data_open - increase the mmap counter * @area: VMA * * PCM mmap callback should handle this counter properly */ |
1da177e4c Linux-2.6.12-rc2 |
1236 1237 |
static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) { |
877211f5e [ALSA] Remove xxx... |
1238 |
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; |
9c323fcbc [ALSA] Fix mmap_c... |
1239 |
atomic_inc(&substream->mmap_count); |
1da177e4c Linux-2.6.12-rc2 |
1240 |
} |
30b771cf8 ALSA: pcm: More k... |
1241 1242 1243 1244 1245 1246 |
/** * snd_pcm_mmap_data_close - decrease the mmap counter * @area: VMA * * PCM mmap callback should handle this counter properly */ |
1da177e4c Linux-2.6.12-rc2 |
1247 1248 |
static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) { |
877211f5e [ALSA] Remove xxx... |
1249 |
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data; |
9c323fcbc [ALSA] Fix mmap_c... |
1250 |
atomic_dec(&substream->mmap_count); |
1da177e4c Linux-2.6.12-rc2 |
1251 |
} |
18a2b9623 ALSA: pcm - Expor... |
1252 1253 |
int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, struct vm_area_struct *area); |
1da177e4c Linux-2.6.12-rc2 |
1254 1255 1256 |
/* mmap for io-memory area */ #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) #define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP |
877211f5e [ALSA] Remove xxx... |
1257 |
int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area); |
1da177e4c Linux-2.6.12-rc2 |
1258 1259 1260 1261 |
#else #define SNDRV_PCM_INFO_MMAP_IOMEM 0 #define snd_pcm_lib_mmap_iomem NULL #endif |
30b771cf8 ALSA: pcm: More k... |
1262 1263 1264 1265 1266 |
/** * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer * @dma: DMA number * @max: pointer to store the max size */ |
1da177e4c Linux-2.6.12-rc2 |
1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 |
static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) { *max = dma < 4 ? 64 * 1024 : 128 * 1024; } /* * Misc */ #define SNDRV_PCM_DEFAULT_CON_SPDIF (IEC958_AES0_CON_EMPHASIS_NONE|\ (IEC958_AES1_CON_ORIGINAL<<8)|\ (IEC958_AES1_CON_PCM_CODER<<8)|\ (IEC958_AES3_CON_FS_48000<<24)) |
7eaa943c8 ALSA: Kill snd_as... |
1280 |
#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) |
6e5265ec3 ALSA: Re-export s... |
1281 |
const char *snd_pcm_format_name(snd_pcm_format_t format); |
1aad779fc ALSA: pcm: Add de... |
1282 |
/** |
8513915ac ALSA: fix pcm.h k... |
1283 1284 |
* snd_pcm_stream_str - Get a string naming the direction of a stream * @substream: the pcm substream instance |
eb7c06e8e ALSA: add/change ... |
1285 1286 |
* * Return: A string naming the direction of the stream. |
1aad779fc ALSA: pcm: Add de... |
1287 1288 1289 1290 1291 1292 1293 1294 |
*/ static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) return "Playback"; else return "Capture"; } |
2d3391ec0 ALSA: PCM: channe... |
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 |
/* * PCM channel-mapping control API */ /* array element of channel maps */ struct snd_pcm_chmap_elem { unsigned char channels; unsigned char map[15]; }; /* channel map information; retrieved via snd_kcontrol_chip() */ struct snd_pcm_chmap { struct snd_pcm *pcm; /* assigned PCM instance */ int stream; /* PLAYBACK or CAPTURE */ struct snd_kcontrol *kctl; const struct snd_pcm_chmap_elem *chmap; unsigned int max_channels; unsigned int channel_mask; /* optional: active channels bitmask */ void *private_data; /* optional: private data pointer */ }; |
30b771cf8 ALSA: pcm: More k... |
1314 1315 1316 1317 1318 |
/** * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info * @info: chmap information * @idx: the substream number index */ |
2d3391ec0 ALSA: PCM: channe... |
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 |
static inline struct snd_pcm_substream * snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) { struct snd_pcm_substream *s; for (s = info->pcm->streams[info->stream].substream; s; s = s->next) if (s->number == idx) return s; return NULL; } /* ALSA-standard channel maps (RL/RR prior to C/LFE) */ extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; /* Other world's standard channel maps (C/LFE prior to RL/RR) */ extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[]; /* bit masks to be passed to snd_pcm_chmap.channel_mask field */ #define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4)) #define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6)) #define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8)) int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, const struct snd_pcm_chmap_elem *chmap, int max_channels, unsigned long private_value, struct snd_pcm_chmap **info_ret); |
30b771cf8 ALSA: pcm: More k... |
1344 1345 1346 1347 |
/** * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise * @pcm_format: PCM format */ |
74c34ca1c ALSA: pcm_format_... |
1348 1349 1350 1351 |
static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) { return 1ULL << (__force int) pcm_format; } |
09e56df8b ALSA: pcm: Use st... |
1352 1353 1354 1355 1356 1357 1358 |
/* printk helpers */ #define pcm_err(pcm, fmt, args...) \ dev_err((pcm)->card->dev, fmt, ##args) #define pcm_warn(pcm, fmt, args...) \ dev_warn((pcm)->card->dev, fmt, ##args) #define pcm_dbg(pcm, fmt, args...) \ dev_dbg((pcm)->card->dev, fmt, ##args) |
1da177e4c Linux-2.6.12-rc2 |
1359 |
#endif /* __SOUND_PCM_H */ |