include/sound/pcm_params.h
Source file repositories/reference/linux-study-clean/include/sound/pcm_params.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/pcm_params.h- Extension
.h- Size
- 8928 bytes
- Lines
- 374
- Domain
- Driver Families
- Bucket
- include/sound
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sound/pcm.h
Detected Declarations
function snd_mask_nonefunction snd_mask_anyfunction snd_mask_emptyfunction snd_mask_minfunction snd_mask_maxfunction snd_mask_setfunction snd_mask_set_formatfunction snd_mask_resetfunction snd_mask_set_rangefunction snd_mask_reset_rangefunction snd_mask_leavefunction snd_mask_intersectfunction snd_mask_eqfunction snd_mask_copyfunction snd_mask_testfunction snd_mask_test_formatfunction snd_mask_singlefunction snd_mask_refinefunction snd_mask_refine_firstfunction snd_mask_refine_lastfunction snd_mask_refine_minfunction snd_mask_refine_maxfunction snd_mask_refine_setfunction snd_mask_valuefunction snd_interval_anyfunction snd_interval_nonefunction snd_interval_checkemptyfunction snd_interval_emptyfunction snd_interval_singlefunction snd_interval_valuefunction snd_interval_minfunction snd_interval_maxfunction snd_interval_testfunction snd_interval_copyfunction snd_interval_setintegerfunction snd_interval_eqfunction params_accessfunction params_formatfunction params_subformatfunction params_period_bytesfunction params_widthfunction params_widthfunction params_set_format
Annotated Snippet
#ifndef __SOUND_PCM_PARAMS_H
#define __SOUND_PCM_PARAMS_H
/*
* PCM params helpers
* Copyright (c) by Abramo Bagnara <abramo@alsa-project.org>
*/
#include <sound/pcm.h>
int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir);
int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir);
int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir);
#define SNDRV_MASK_BITS 64 /* we use so far 64bits only */
#define SNDRV_MASK_SIZE (SNDRV_MASK_BITS / 32)
#define MASK_OFS(i) ((i) >> 5)
#define MASK_BIT(i) (1U << ((i) & 31))
static inline void snd_mask_none(struct snd_mask *mask)
{
memset(mask, 0, sizeof(*mask));
}
static inline void snd_mask_any(struct snd_mask *mask)
{
memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
}
static inline int snd_mask_empty(const struct snd_mask *mask)
{
int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++)
if (mask->bits[i])
return 0;
return 1;
}
static inline unsigned int snd_mask_min(const struct snd_mask *mask)
{
int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++) {
if (mask->bits[i])
return __ffs(mask->bits[i]) + (i << 5);
}
return 0;
}
static inline unsigned int snd_mask_max(const struct snd_mask *mask)
{
int i;
for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) {
if (mask->bits[i])
return __fls(mask->bits[i]) + (i << 5);
}
return 0;
}
static inline void snd_mask_set(struct snd_mask *mask, unsigned int val)
{
mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
}
/* Most of drivers need only this one */
static inline void snd_mask_set_format(struct snd_mask *mask,
snd_pcm_format_t format)
{
snd_mask_set(mask, (__force unsigned int)format);
}
static inline void snd_mask_reset(struct snd_mask *mask, unsigned int val)
{
mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
}
static inline void snd_mask_set_range(struct snd_mask *mask,
unsigned int from, unsigned int to)
{
unsigned int i;
for (i = from; i <= to; i++)
mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
}
static inline void snd_mask_reset_range(struct snd_mask *mask,
unsigned int from, unsigned int to)
Annotation
- Immediate include surface: `sound/pcm.h`.
- Detected declarations: `function snd_mask_none`, `function snd_mask_any`, `function snd_mask_empty`, `function snd_mask_min`, `function snd_mask_max`, `function snd_mask_set`, `function snd_mask_set_format`, `function snd_mask_reset`, `function snd_mask_set_range`, `function snd_mask_reset_range`.
- Atlas domain: Driver Families / include/sound.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.