Status: Installed tools, built kernel, flashed via ftp empeg +50 times, seeburg driver working, /dev/wallbox returns 256 samples.

The driver seems to be working and I'm getting the timestamps. But I had a question about blocking reads in a device... What is the correct way to block (wait for input) in a device?

The interrupt routine increments "samples_collected", but the driver needs to wait until 256 samples have been collected.

Is there some sort of kernel mutex I set in the interrupt routine and wait on in the driver?

Thanks,

-Techtom


here's the read part of the driver:
Code:

ssize_t
seeburg_read (struct file * filep, char *buff, size_t count, loff_t * offp)
{
/* function to copy kernel space buffer to user space */
if (samples_collected == MAX_SAMPLES && tick_tock==0)
{
if (copy_to_user (buff, pulse_samples, sizeof (pulse_samples)) != 0)
{
printk ("Kernel -> userspace copy failed!\n");
}
printk ("samples collected %d\n", samples_collected);
samples_collected == 0;
tick_tock = 1;
return sizeof (pulse_samples);
}
return 0;
}



Edited by techtom (21/07/2007 01:18)