Пример #1
0
/*
 * copy to user
 */
static int
snd_nm256_capture_copy(struct snd_pcm_substream *substream,
		       int channel, /* not used (interleaved data) */
		       snd_pcm_uframes_t pos,
		       void __user *dst,
		       snd_pcm_uframes_t count)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct nm256_stream *s = runtime->private_data;
	count = frames_to_bytes(runtime, count);
	pos = frames_to_bytes(runtime, pos);
	if (copy_to_user_fromio(dst, s->bufptr + pos, count))
		return -EFAULT;
	return 0;
}
Пример #2
0
/*
  mixart_BA1 proc interface for BAR 1 - read callback
 */
static long snd_mixart_BA1_read(snd_info_entry_t *entry, void *file_private_data,
				struct file *file, char __user *buf,
				unsigned long count, unsigned long pos)
{
	mixart_mgr_t *mgr = entry->private_data;

	count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
	if(count <= 0)
		return 0;
	if(pos + count > MIXART_BA1_SIZE)
		count = (long)(MIXART_BA1_SIZE - pos);
	if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count))
		return -EFAULT;
	return count;
}
Пример #3
0
/*
  mixart_BA1 proc interface for BAR 1 - read callback
 */
static long snd_mixart_BA1_read(struct snd_info_entry *entry, void *file_private_data,
				struct file *file, char __user *buf,
				unsigned long count, unsigned long pos)
{
	struct mixart_mgr *mgr = entry->private_data;
	unsigned long maxsize;

	if (pos > MIXART_BA1_SIZE)
		return 0;
	maxsize = MIXART_BA1_SIZE - pos;
	if (count > maxsize)
		count = maxsize;
	count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
	if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
		return -EFAULT;
	return count;
}