⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcm.h

📁 linux 内核源代码
💻 H
📖 第 1 页 / 共 3 页
字号:
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime){	return runtime->buffer_size - snd_pcm_playback_avail(runtime);}static inline 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. * * Returns non-zero if available, or zero if not. */static inline int 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. * * Returns non-zero if available, or zero if not. */static inline int 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. If stop_threshold * is bigger or equal to boundary, then this function returns always non-zero. * * Returns non-zero if exists, or zero if not. */static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream){	struct snd_pcm_runtime *runtime = substream->runtime;		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. * * Returns non-zero if empty, or zero if not. */static inline int 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. * * Returns non-zero if empty, or zero if not. */static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream){	struct snd_pcm_runtime *runtime = substream->runtime;	return snd_pcm_capture_avail(runtime) == 0;}static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, 					struct snd_pcm_substream *master){	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;}static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,				     snd_pcm_hw_param_t var){	return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];}static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,					     snd_pcm_hw_param_t var){	return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];}static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,					     snd_pcm_hw_param_t var){	return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];}static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,						     snd_pcm_hw_param_t var){	return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];}#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))#define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT))#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min#define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min#define params_period_bytes(p) ((params_period_size(p)*snd_pcm_format_physical_width(params_format(p))*params_channels(p))/8)#define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min#define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min#define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->minint snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, 			  unsigned int k, struct snd_interval *c);void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,			  const struct snd_interval *b, struct snd_interval *c);int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);int snd_interval_ratnum(struct snd_interval *i,			unsigned int rats_count, struct snd_ratnum *rats,			unsigned int *nump, unsigned int *denp);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);int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,			       u_int32_t mask);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,				 unsigned int min, unsigned int 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, 			       unsigned int cond,			       snd_pcm_hw_param_t var,			       struct snd_pcm_hw_constraint_list *l);int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, 				  unsigned int cond,				  snd_pcm_hw_param_t var,				  struct snd_pcm_hw_constraint_ratnums *r);int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, 				  unsigned int cond,				  snd_pcm_hw_param_t var,				  struct snd_pcm_hw_constraint_ratdens *r);int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, 				 unsigned int cond,				 unsigned int width,				 unsigned int msbits);int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,			       unsigned int cond,			       snd_pcm_hw_param_t var,			       unsigned long step);int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,			       unsigned int cond,			       snd_pcm_hw_param_t var);int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,			unsigned int cond,			int var,			snd_pcm_hw_rule_func_t func, void *private,			int dep, ...);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 DocBook *//** * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian * @format: the format to check * * Returns 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)#endifint 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);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);snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);void snd_pcm_set_sync(struct snd_pcm_substream *substream);int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,		      unsigned int cmd, void *arg);                      int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,				    const void __user *buf,				    snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,				   void __user *buf, snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,				     void __user **bufs, snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,				    void __user **bufs, snd_pcm_uframes_t frames);extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates;int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate);static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,					      struct snd_dma_buffer *bufp){	struct snd_pcm_runtime *runtime = substream->runtime;	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;	}}/* *  Timer interface */void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);void snd_pcm_timer_init(struct snd_pcm_substream *substream);void snd_pcm_timer_done(struct snd_pcm_substream *substream);/* *  Memory */int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,				  int type, struct device *data,				  size_t size, size_t max);int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,					  int type, void *data,					  size_t size, size_t max);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);#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);/* handle mmap counter - PCM mmap callback should handle this counter properly */static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area){	struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;	atomic_inc(&substream->mmap_count);}static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area){	struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;	atomic_dec(&substream->mmap_count);}/* mmap for io-memory area */#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)#define SNDRV_PCM_INFO_MMAP_IOMEM	SNDRV_PCM_INFO_MMAPint snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);#else#define SNDRV_PCM_INFO_MMAP_IOMEM	0#define snd_pcm_lib_mmap_iomem	NULL#endifstatic 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))#endif /* __SOUND_PCM_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -