Re: accessing files, devices, in kernel modules



yes, that's indeed a user level operation. the soundcard thing was just
an abstraction. to the real problem: I need to acquire the signal of an
A/D converter. this operation is analog to acquiring sound from a sound
card. this A/D will be plugged in a sort of device that measures
vibrations from machines that has engine. this device is called
accelerometer. then, I must pass the data to other device. everything
must be real time. probably hard real time. and everything will be done
using an ARM architecture.
I got Rtai (https://www.rtai.org/), which consists of a patch to the
kernel and a library to create real time programs. I compiled it.
They've done quite a good job. I can make some user level programs hard
real time, but they can't make any system call. So it won't work for
me, because I need access to the A/D converter.
If I want to access devices (make system calls), I must make my program
a kernel module. that's what is said in the rtai manuals. this is my
little story ;)

I may also use uclinux, which is just linux without the MMU
implemented. it's not a real time OS, but it's quite fast, because it
won't need any switch of program address space. obviously, it makes
programming a little trickier.
but my doubt with uclinux is if its programming model is user level
programs, instead of kernel module.

sorry for such a long post
regards,


Joe Beanfish wrote:
Yellow wrote:

but what I'd like to know is: can I use the sound card the same way I
use it in user space programs? like reading and opening a file? my
final goal is record some sound from the microphone for 3 seconds, and
then play it.

> thank you. now I understand that I shouldn't read/write files from a
> module.

Why do that in the kernel? That sounds like an user level operation.

.