From: Adrian M. <ad...@mc...> - 2001-12-02 16:25:09
|
Well, maybe I should be writing ARM code after all - but I'm still going to give the SH4 stuff one more try and I have a question which I wonder if someone might help me with. In the dsp write the code currently does this... static ssize_t aica_audio_do_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) { aica_dev_t *devc=file->private_data; //really want to write? if (!(file->f_mode & FMODE_WRITE)) return -EINVAL; //now output this to the selected channel //fill a chunk of the sound memory with the contents of the buffer aica_halt_channel(devc->channel); //halt anything playing there already int offset = 0xf000; if (copy_from_user((void*)(0xa0800000 + offset), (const void*) buffer, count)) { DEBGM("Failed to copy memory bufferfrom user space\n"); return -EFAULT; } . . . . ...........Lots of code.......... . return count; } Now, is it right to just copy a lump of memory over from user space in this way? I haven't specifically allocated a buffer inside the sound RAM area - just claimed it for the kernel when initiating the module and assumed that it's there - the function doesn't fail in the sense that the -EFAULT error is never reported, but does that mean it has actually worked? Should I be allocating a buffer first and copying the data from user space into that? Perhaps I am just clutching at straws. |