/* * 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 */
};
/* * 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 */
};
struct snd_pcm_runtime { /* -- Status -- */
snd_pcm_state_t state; /* stream state */
snd_pcm_state_t suspended_state; /* suspended stream state */ struct snd_pcm_substream *trigger_master; struct timespec64 trigger_tstamp; /* trigger timestamp */ bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */ int overrange;
snd_pcm_uframes_t avail_max;
snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ unsignedlong hw_ptr_jiffies; /* Time when hw_ptr is updated */ unsignedlong hw_ptr_buffer_jiffies; /* buffer time in jiffies */
snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */
u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */
/* -- SW params; see struct snd_pcm_sw_params for comments -- */ int tstamp_mode; unsignedint period_step;
snd_pcm_uframes_t start_threshold;
snd_pcm_uframes_t stop_threshold;
snd_pcm_uframes_t silence_threshold;
snd_pcm_uframes_t silence_size;
snd_pcm_uframes_t boundary;
/* internal data of auto-silencer */
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
snd_pcm_uframes_t silence_filled; /* already filled part of silence area */
bool std_sync_id; /* hardware synchronization - standard per card ID */
int snd_pcm_new(struct snd_card *card, constchar *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); int snd_pcm_new_internal(struct snd_card *card, constchar *id, int device, int playback_count, int capture_count, struct snd_pcm **rpcm); int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
#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;
}; int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); #endif
/* * Native I/O
*/
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_status64(struct snd_pcm_substream *substream, struct snd_pcm_status64 *status); int snd_pcm_start(struct snd_pcm_substream *substream); int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); int snd_pcm_drain_done(struct snd_pcm_substream *substream); int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); #ifdef CONFIG_PM int snd_pcm_suspend_all(struct snd_pcm *pcm); #else staticinlineint snd_pcm_suspend_all(struct snd_pcm *pcm)
{ return 0;
} #endif int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsignedint cmd, void *arg); int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct file *file, struct snd_pcm_substream **rsubstream); void snd_pcm_release_substream(struct snd_pcm_substream *substream); 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); int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
/** * snd_pcm_stream_linked - Check whether the substream is linked with others * @substream: substream to check * * Return: true if the given substream is being linked with others
*/ staticinlineint snd_pcm_stream_linked(struct snd_pcm_substream *substream)
{ return substream->group != &substream->self_group;
}
/** * 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().
*/ #define snd_pcm_stream_lock_irqsave(substream, flags) \ do { \
typecheck(unsignedlong, flags); \
flags = _snd_pcm_stream_lock_irqsave(substream); \
} while (0) void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, unsignedlong flags);
/** * snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking * @substream: PCM substream * @flags: irq flags * * This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with * the single-depth lockdep subclass.
*/ #define snd_pcm_stream_lock_irqsave_nested(substream, flags) \ do { \
typecheck(unsignedlong, flags); \
flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
} while (0)
/* definitions for guard(); use like guard(pcm_stream_lock) */
DEFINE_LOCK_GUARD_1(pcm_stream_lock, struct snd_pcm_substream,
snd_pcm_stream_lock(_T->lock),
snd_pcm_stream_unlock(_T->lock))
DEFINE_LOCK_GUARD_1(pcm_stream_lock_irq, struct snd_pcm_substream,
snd_pcm_stream_lock_irq(_T->lock),
snd_pcm_stream_unlock_irq(_T->lock))
DEFINE_LOCK_GUARD_1(pcm_stream_lock_irqsave, struct snd_pcm_substream,
snd_pcm_stream_lock_irqsave(_T->lock, _T->flags),
snd_pcm_stream_unlock_irqrestore(_T->lock, _T->flags), unsignedlong flags)
/** * 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.
*/ #define snd_pcm_group_for_each_entry(s, substream) \
list_for_each_entry(s, &substream->group->substreams, link_list)
/** * snd_pcm_running - Check whether the substream is in a running state * @substream: substream to check * * Return: true if the given substream is in the state RUNNING, or in the * state DRAINING for playback.
*/ staticinlineint snd_pcm_running(struct snd_pcm_substream *substream)
{ return (substream->runtime->state == SNDRV_PCM_STATE_RUNNING ||
(substream->runtime->state == SNDRV_PCM_STATE_DRAINING &&
substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
}
/** * __snd_pcm_set_state - Change the current PCM state * @runtime: PCM runtime to set * @state: the current state to set * * Call within the stream lock
*/ staticinlinevoid __snd_pcm_set_state(struct snd_pcm_runtime *runtime,
snd_pcm_state_t state)
{
runtime->state = state;
runtime->status->state = state; /* copy for mmap */
}
/** * bytes_to_samples - Unit conversion of the size from bytes to samples * @runtime: PCM runtime instance * @size: size in bytes * * Return: the size in samples
*/ staticinline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
{ return size * 8 / runtime->sample_bits;
}
/** * bytes_to_frames - Unit conversion of the size from bytes to frames * @runtime: PCM runtime instance * @size: size in bytes * * Return: the size in frames
*/ staticinline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
{ return size * 8 / runtime->frame_bits;
}
/** * samples_to_bytes - Unit conversion of the size from samples to bytes * @runtime: PCM runtime instance * @size: size in samples * * Return: the byte size
*/ staticinline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
{ return size * runtime->sample_bits / 8;
}
/** * frames_to_bytes - Unit conversion of the size from frames to bytes * @runtime: PCM runtime instance * @size: size in frames * * Return: the byte size
*/ staticinline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
{ return size * runtime->frame_bits / 8;
}
/** * frame_aligned - Check whether the byte size is aligned to frames * @runtime: PCM runtime instance * @bytes: size in bytes * * Return: true if aligned, or false if not
*/ staticinlineint frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
{ return bytes % runtime->byte_align == 0;
}
/** * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes * @substream: PCM substream * * Return: buffer byte size
*/ staticinline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; return frames_to_bytes(runtime, runtime->buffer_size);
}
/** * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes * @substream: PCM substream * * Return: period byte size
*/ staticinline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; return frames_to_bytes(runtime, runtime->period_size);
}
/** * snd_pcm_playback_avail - Get the available (writable) space for playback * @runtime: PCM runtime instance * * Result is between 0 ... (boundary - 1) * * Return: available frame size
*/ staticinline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr; if (avail < 0)
avail += runtime->boundary; elseif ((snd_pcm_uframes_t) avail >= runtime->boundary)
avail -= runtime->boundary; return avail;
}
/** * snd_pcm_capture_avail - Get the available (readable) space for capture * @runtime: PCM runtime instance * * Result is between 0 ... (boundary - 1) * * Return: available frame size
*/ staticinline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr; if (avail < 0)
avail += runtime->boundary; return avail;
}
/** * snd_pcm_playback_hw_avail - Get the queued space for playback * @runtime: PCM runtime instance * * Return: available frame size
*/ staticinline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
{ return runtime->buffer_size - snd_pcm_playback_avail(runtime);
}
/** * snd_pcm_capture_hw_avail - Get the free space for capture * @runtime: PCM runtime instance * * Return: available frame size
*/ staticinline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
{ 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. * * Return: Non-zero if available, or zero if not.
*/ staticinlineint snd_pcm_playback_ready(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; 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. * * Return: Non-zero if available, or zero if not.
*/ staticinlineint snd_pcm_capture_ready(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; 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 * * Checks whether any data exists on the playback buffer. * * 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.
*/ staticinlineint snd_pcm_playback_data(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime;
/** * snd_pcm_playback_empty - check whether the playback buffer is empty * @substream: the pcm substream instance * * Checks whether the playback buffer is empty. * * Return: Non-zero if empty, or zero if not.
*/ staticinlineint snd_pcm_playback_empty(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; 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. * * Return: Non-zero if empty, or zero if not.
*/ staticinlineint snd_pcm_capture_empty(struct snd_pcm_substream *substream)
{ struct snd_pcm_runtime *runtime = substream->runtime; return snd_pcm_capture_avail(runtime) == 0;
}
/** * 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.
*/ staticinlinevoid snd_pcm_trigger_done(struct snd_pcm_substream *substream, struct snd_pcm_substream *master)
{
substream->runtime->trigger_master = master;
}
staticinlineint hw_is_mask(int var)
{ return var >= SNDRV_PCM_HW_PARAM_FIRST_MASK &&
var <= SNDRV_PCM_HW_PARAM_LAST_MASK;
}
staticinlineint hw_is_interval(int var)
{ return var >= SNDRV_PCM_HW_PARAM_FIRST_INTERVAL &&
var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
}
/** * params_channels - Get the number of channels from the hw params * @p: hw params * * Return: the number of channels
*/ staticinlineunsignedint params_channels(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min;
}
/** * params_rate - Get the sample rate from the hw params * @p: hw params * * Return: the sample rate
*/ staticinlineunsignedint params_rate(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min;
}
/** * params_period_size - Get the period size (in frames) from the hw params * @p: hw params * * Return: the period size in frames
*/ staticinlineunsignedint params_period_size(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min;
}
/** * params_periods - Get the number of periods from the hw params * @p: hw params * * Return: the number of periods
*/ staticinlineunsignedint params_periods(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min;
}
/** * params_buffer_size - Get the buffer size (in frames) from the hw params * @p: hw params * * Return: the buffer size in frames
*/ staticinlineunsignedint params_buffer_size(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min;
}
/** * params_buffer_bytes - Get the buffer size (in bytes) from the hw params * @p: hw params * * Return: the buffer size in bytes
*/ staticinlineunsignedint params_buffer_bytes(conststruct snd_pcm_hw_params *p)
{ return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min;
}
int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask); int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsignedint min, unsignedint max); 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, unsignedint cond,
snd_pcm_hw_param_t var, conststruct snd_pcm_hw_constraint_list *l); int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime, unsignedint cond,
snd_pcm_hw_param_t var, conststruct snd_pcm_hw_constraint_ranges *r); int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, unsignedint cond,
snd_pcm_hw_param_t var, conststruct snd_pcm_hw_constraint_ratnums *r); int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, unsignedint cond,
snd_pcm_hw_param_t var, conststruct snd_pcm_hw_constraint_ratdens *r); int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, unsignedint cond, unsignedint width, unsignedint msbits); int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, unsignedint cond,
snd_pcm_hw_param_t var, unsignedlong step); int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, unsignedint cond,
snd_pcm_hw_param_t var); int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, unsignedint base_rate); int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsignedint cond, int var,
snd_pcm_hw_rule_func_t func, void *private, int dep, ...);
/** * 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.
*/ staticinlineint snd_pcm_hw_constraint_single( struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, unsignedint val)
{ return snd_pcm_hw_constraint_minmax(runtime, var, val, val);
}
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); #if 0 /* just for kernel-doc */ /** * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian * @format: the format to check * * Return: 1 if the given PCM format is CPU-endian, 0 if * opposite, or a negative error code if endian not specified.
*/ int snd_pcm_format_cpu_endian(snd_pcm_format_t format); #endif/* DocBook */ #ifdef SNDRV_LITTLE_ENDIAN #define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format) #else #define snd_pcm_format_cpu_endian(format) snd_pcm_format_big_endian(format) #endif 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 */
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); constunsignedchar *snd_pcm_format_silence_64(snd_pcm_format_t format); int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsignedint frames);
void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, conststruct snd_pcm_ops *ops); void snd_pcm_set_sync_per_card(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, constunsignedchar *id, unsignedint len); /** * snd_pcm_set_sync - set the PCM sync id * @substream: the pcm substream * * Use the default PCM sync identifier for the specific card.
*/ staticinlinevoid snd_pcm_set_sync(struct snd_pcm_substream *substream)
{
substream->runtime->std_sync_id = true;
} int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, unsignedint cmd, void *arg); void snd_pcm_period_elapsed_under_stream_lock(struct snd_pcm_substream *substream); void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, void *buf, bool interleaved,
snd_pcm_uframes_t frames, bool in_kernel);
int snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, struct device *data, size_t size, size_t max); int snd_pcm_set_managed_buffer_all(struct snd_pcm *pcm, int type, struct device *data,
size_t size, size_t max);
/** * snd_pcm_set_fixed_buffer - Preallocate and set up the fixed size PCM buffer * @substream: the pcm substream instance * @type: DMA type (SNDRV_DMA_TYPE_*) * @data: DMA type dependent data * @size: the requested pre-allocation size in bytes * * This is a variant of snd_pcm_set_managed_buffer(), but this pre-allocates * only the given sized buffer and doesn't allow re-allocation nor dynamic * allocation of a larger buffer unlike the standard one. * The function may return -ENOMEM error, hence the caller must check it. * * Return: zero if successful, or a negative error code
*/ staticinlineint __must_check
snd_pcm_set_fixed_buffer(struct snd_pcm_substream *substream, int type, struct device *data, size_t size)
{ return snd_pcm_set_managed_buffer(substream, type, data, size, 0);
}
/** * snd_pcm_set_fixed_buffer_all - Preallocate and set up the fixed size PCM buffer * @pcm: the pcm instance * @type: DMA type (SNDRV_DMA_TYPE_*) * @data: DMA type dependent data * @size: the requested pre-allocation size in bytes * * Apply the set up of the fixed buffer via snd_pcm_set_fixed_buffer() for * all substream. If any of allocation fails, it returns -ENOMEM, hence the * caller must check the return value. * * Return: zero if successful, or a negative error code
*/ staticinlineint __must_check
snd_pcm_set_fixed_buffer_all(struct snd_pcm *pcm, int type, struct device *data, size_t size)
{ return snd_pcm_set_managed_buffer_all(pcm, type, data, size, 0);
}
/** * 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
*/ staticinlinevoid snd_pcm_limit_isa_dma_size(int dma, size_t *max)
{
*max = dma < 4 ? 64 * 1024 : 128 * 1024;
}
/** * snd_pcm_direction_name - Get a string naming the direction of a stream * @direction: Stream's direction, one of SNDRV_PCM_STREAM_XXX * * Returns a string naming the direction of the stream.
*/ staticinlineconstchar *snd_pcm_direction_name(int direction)
{ if (direction == SNDRV_PCM_STREAM_PLAYBACK) return"Playback"; else return"Capture";
}
/** * snd_pcm_stream_str - Get a string naming the direction of a stream * @substream: the pcm substream instance * * Return: A string naming the direction of the stream.
*/ staticinlineconstchar *snd_pcm_stream_str(struct snd_pcm_substream *substream)
{ return snd_pcm_direction_name(substream->stream);
}
/* * PCM channel-mapping control API
*/ /* array element of channel maps */ struct snd_pcm_chmap_elem { unsignedchar channels; unsignedchar map[15];
};
/** * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info * @info: chmap information * @idx: the substream number index * * Return: the matched PCM substream, or NULL if not found
*/ staticinlinestruct snd_pcm_substream *
snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsignedint 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) */ externconststruct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; /* Other world's standard channel maps (C/LFE prior to RL/RR) */ externconststruct 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, conststruct snd_pcm_chmap_elem *chmap, int max_channels, unsignedlong private_value, struct snd_pcm_chmap **info_ret);
/** * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise * @pcm_format: PCM format * * Return: 64bit mask corresponding to the given PCM format
*/ staticinline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
{ return 1ULL << (__force int) pcm_format;
}
/** * pcm_for_each_format - helper to iterate for each format type * @f: the iterator variable in snd_pcm_format_t type
*/ #define pcm_for_each_format(f) \ for ((f) = SNDRV_PCM_FORMAT_FIRST; \
(__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST; \
(f) = (__force snd_pcm_format_t)((__force int)(f) + 1))
/* helpers for copying between iov_iter and iomem */
size_t copy_to_iter_fromio(constvoid __iomem *src, size_t bytes, struct iov_iter *iter) __must_check;
size_t copy_from_iter_toio(void __iomem *dst, size_t bytes, struct iov_iter *iter) __must_check;
struct snd_pcm_status64 {
snd_pcm_state_t state; /* stream state */
u8 rsvd[4];
s64 trigger_tstamp_sec; /* time when stream was started/stopped/paused */
s64 trigger_tstamp_nsec;
s64 tstamp_sec; /* reference timestamp */
s64 tstamp_nsec;
snd_pcm_uframes_t appl_ptr; /* appl ptr */
snd_pcm_uframes_t hw_ptr; /* hw ptr */
snd_pcm_sframes_t delay; /* current delay in frames */
snd_pcm_uframes_t avail; /* number of frames available */
snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */
snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
snd_pcm_state_t suspended_state; /* suspended stream state */
__u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
s64 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */
s64 audio_tstamp_nsec;
s64 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */
s64 driver_tstamp_nsec;
__u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ unsignedchar reserved[52-4*sizeof(s64)]; /* must be filled with zero */
};
struct snd_pcm_status32 {
snd_pcm_state_t state; /* stream state */
s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */
s32 trigger_tstamp_nsec;
s32 tstamp_sec; /* reference timestamp */
s32 tstamp_nsec;
u32 appl_ptr; /* appl ptr */
u32 hw_ptr; /* hw ptr */
s32 delay; /* current delay in frames */
u32 avail; /* number of frames available */
u32 avail_max; /* max frames available on hw since last status */
u32 overrange; /* count of ADC (capture) overrange detections from last status */
snd_pcm_state_t suspended_state; /* suspended stream state */
u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */
s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */
s32 audio_tstamp_nsec;
s32 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */
s32 driver_tstamp_nsec;
u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ unsignedchar reserved[52-4*sizeof(s32)]; /* must be filled with zero */
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.