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

📄 pcm.h

📁 Linux Kernel 2.6.9 for OMAP1710
💻 H
📖 第 1 页 / 共 3 页
字号:
	volatile snd_pcm_mmap_control_t *control;	atomic_t mmap_count;	/* -- locking / scheduling -- */	wait_queue_head_t sleep;	struct timer_list tick_timer;	struct fasync_struct *fasync;	/* -- private section -- */	void *private_data;	void (*private_free)(snd_pcm_runtime_t *runtime);	/* -- hardware description -- */	snd_pcm_hardware_t hw;	snd_pcm_hw_constraints_t hw_constraints;	/* -- interrupt callbacks -- */	void (*transfer_ack_begin)(snd_pcm_substream_t *substream);	void (*transfer_ack_end)(snd_pcm_substream_t *substream);	/* -- timer -- */	unsigned int timer_resolution;	/* timer resolution */	/* -- 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 */#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)	/* -- OSS things -- */	snd_pcm_oss_runtime_t oss;#endif};typedef struct _snd_pcm_group {		/* keep linked substreams */	spinlock_t lock;	struct list_head substreams;} snd_pcm_group_t;struct _snd_pcm_substream {	snd_pcm_t *pcm;	snd_pcm_str_t *pstr;	void *private_data;		/* copied from pcm->private_data */	int number;	char name[32];			/* substream name */	int stream;			/* stream (direction) */	size_t buffer_bytes_max;	/* limit ring buffer size */	struct snd_dma_buffer dma_buffer;	unsigned int dma_buf_id;	size_t dma_max;	/* -- hardware operations -- */	unsigned int open_flag: 1;	/* lowlevel device has been opened */	snd_pcm_ops_t *ops;	/* -- runtime information -- */	snd_pcm_runtime_t *runtime;        /* -- timer section -- */	snd_timer_t *timer;		/* timer */	unsigned timer_running: 1;	/* time is running */	spinlock_t timer_lock;	/* -- next substream -- */	snd_pcm_substream_t *next;	/* -- linked substreams -- */	struct list_head link_list;	/* linked list member */	snd_pcm_group_t self_group;	/* fake group for non linked substream (with substream lock inside) */	snd_pcm_group_t *group;		/* pointer to current group */	/* -- assigned files -- */	snd_pcm_file_t *file;	struct file *ffile;#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)	/* -- OSS things -- */	snd_pcm_oss_substream_t oss;#endif	snd_info_entry_t *proc_root;	snd_info_entry_t *proc_info_entry;	snd_info_entry_t *proc_hw_params_entry;	snd_info_entry_t *proc_sw_params_entry;	snd_info_entry_t *proc_status_entry;	snd_info_entry_t *proc_prealloc_entry;};#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)#define SUBSTREAM_BUSY(substream) ((substream)->file != NULL || ((substream)->oss.file != NULL))#else#define SUBSTREAM_BUSY(substream) ((substream)->file != NULL)#endifstruct _snd_pcm_str {	int stream;				/* stream (direction) */	snd_pcm_t *pcm;	/* -- substreams -- */	unsigned int substream_count;	unsigned int substream_opened;	snd_pcm_substream_t *substream;#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)	/* -- OSS things -- */	snd_pcm_oss_stream_t oss;#endif	snd_pcm_file_t *files;	snd_minor_t *reg;	snd_info_entry_t *proc_root;	snd_info_entry_t *proc_info_entry;#ifdef CONFIG_SND_DEBUG	unsigned int xrun_debug;	/* 0 = disabled, 1 = verbose, 2 = stacktrace */	snd_info_entry_t *proc_xrun_debug_entry;#endif};struct _snd_pcm {	snd_card_t *card;	unsigned int device;	/* device number */	unsigned int info_flags;	unsigned short dev_class;	unsigned short dev_subclass;	char id[64];	char name[80];	snd_pcm_str_t streams[2];	struct semaphore open_mutex;	wait_queue_head_t open_wait;	void *private_data;	void (*private_free) (snd_pcm_t *pcm);#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)	snd_pcm_oss_t oss;#endif};typedef struct _snd_pcm_notify {	int (*n_register) (snd_pcm_t * pcm);	int (*n_disconnect) (snd_pcm_t * pcm);	int (*n_unregister) (snd_pcm_t * pcm);	struct list_head list;} snd_pcm_notify_t;/* *  Registering */extern snd_pcm_t *snd_pcm_devices[];extern snd_minor_t snd_pcm_reg[2];int snd_pcm_new(snd_card_t * card, char *id, int device,		int playback_count, int capture_count,		snd_pcm_t **rpcm);int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count);int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);/* *  Native I/O */extern rwlock_t snd_pcm_link_rwlock;int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info);int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info);int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status);int snd_pcm_prepare(snd_pcm_substream_t *substream);int snd_pcm_start(snd_pcm_substream_t *substream);int snd_pcm_stop(snd_pcm_substream_t *substream, int status);#ifdef CONFIG_PMint snd_pcm_suspend(snd_pcm_substream_t *substream);int snd_pcm_suspend_all(snd_pcm_t *pcm);#endifint snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);int snd_pcm_open(struct inode *inode, struct file *file);int snd_pcm_release(struct inode *inode, struct file *file);unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait);unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait);int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream);void snd_pcm_release_substream(snd_pcm_substream_t *substream);void snd_pcm_vma_notify_data(void *client, void *data);int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area);#if BITS_PER_LONG >= 64static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem){	*rem = *n % div;	*n /= div;}#elif defined(i386)static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem){	u_int32_t low, high;	low = *n & 0xffffffff;	high = *n >> 32;	if (high) {		u_int32_t high1 = high % div;		high /= div;		asm("divl %2":"=a" (low), "=d" (*rem):"rm" (div), "a" (low), "d" (high1));		*n = (u_int64_t)high << 32 | low;	} else {		*n = low / div;		*rem = low % div;	}}#elsestatic inline void divl(u_int32_t high, u_int32_t low,			u_int32_t div,			u_int32_t *q, u_int32_t *r){	u_int64_t n = (u_int64_t)high << 32 | low;	u_int64_t d = (u_int64_t)div << 31;	u_int32_t q1 = 0;	int c = 32;	while (n > 0xffffffffU) {		q1 <<= 1;		if (n >= d) {			n -= d;			q1 |= 1;		}		d >>= 1;		c--;	}	q1 <<= c;	if (n) {		low = n;		*q = q1 | (low / div);		*r = low % div;	} else {		*r = 0;		*q = q1;	}	return;}static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem){	u_int32_t low, high;	low = *n & 0xffffffff;	high = *n >> 32;	if (high) {		u_int32_t high1 = high % div;		u_int32_t low1 = low;		high /= div;		divl(high1, low1, div, &low, rem);		*n = (u_int64_t)high << 32 | low;	} else {		*n = low / div;		*rem = low % div;	}}#endif/* *  PCM library */static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream){	return substream->group != &substream->self_group;}static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream){	read_lock(&snd_pcm_link_rwlock);	spin_lock(&substream->self_group.lock);}static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream){	spin_unlock(&substream->self_group.lock);	read_unlock(&snd_pcm_link_rwlock);}static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream){	read_lock_irq(&snd_pcm_link_rwlock);	spin_lock(&substream->self_group.lock);}static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream){	spin_unlock(&substream->self_group.lock);	read_unlock_irq(&snd_pcm_link_rwlock);}#define snd_pcm_stream_lock_irqsave(substream, flags) \do { \	read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \	spin_lock(&substream->self_group.lock); \} while (0)#define snd_pcm_stream_unlock_irqrestore(substream, flags) \do { \	spin_unlock(&substream->self_group.lock); \	read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \} while (0)#define snd_pcm_group_for_each(pos, substream) \	list_for_each(pos, &substream->group->substreams)#define snd_pcm_group_substream_entry(pos) \	list_entry(pos, snd_pcm_substream_t, link_list)static inline int snd_pcm_running(snd_pcm_substream_t *substream){	return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||		(substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&		 substream->stream == SNDRV_PCM_STREAM_PLAYBACK));}static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size){	return size * 8 / runtime->sample_bits;}static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size){	return size * 8 / runtime->frame_bits;}static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size){	return size * runtime->sample_bits / 8;}static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size){	return size * runtime->frame_bits / 8;

⌨️ 快捷键说明

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