public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kernel space access to user space functions
@ 2002-11-30 20:17 Chris Ison
  2002-11-30 23:44 ` H. Peter Anvin
  2002-12-01  2:27 ` Andrew McGregor
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Ison @ 2002-11-30 20:17 UTC (permalink / raw)
  To: linux-kernel

I realize I asked this previously, but the answer given was not to the
question I asked.

How can I get a kernel module to call a function within a program?

The reason being I am creating a software midi driver and already have a
small program that does what I want the driver to do, problem is all the
math in the program is floating point.

What I would like to do, is be able to run the program, and have the
kernel software midi driver call a function within the program to que up
midi events, and have the program do all the hard work of the wavetable
synth.

This way, any improvements to the software don't have to be translated
to the driver, and visa versa.

How can I make this happen. And please give an example.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kernel space access to user space functions
  2002-11-30 20:17 kernel space access to user space functions Chris Ison
@ 2002-11-30 23:44 ` H. Peter Anvin
  2002-12-01  2:27 ` Andrew McGregor
  1 sibling, 0 replies; 3+ messages in thread
From: H. Peter Anvin @ 2002-11-30 23:44 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <3DE91CBF.295C1491@bigpond.net.au>
By author:    Chris Ison <cisos@bigpond.net.au>
In newsgroup: linux.dev.kernel
>
> I realize I asked this previously, but the answer given was not to the
> question I asked.
> 
> How can I get a kernel module to call a function within a program?
> 

You can't.

> The reason being I am creating a software midi driver and already have a
> small program that does what I want the driver to do, problem is all the
> math in the program is floating point.

There are functions now in the kernel (kernel_fpu_begin() and
kernel_fpu_end()) to allow the use of floating point inside the
kernel.

> What I would like to do, is be able to run the program, and have the
> kernel software midi driver call a function within the program to que up
> midi events, and have the program do all the hard work of the wavetable
> synth.
> 
> This way, any improvements to the software don't have to be translated
> to the driver, and visa versa.
> 
> How can I make this happen. And please give an example.

You can't.

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: kernel space access to user space functions
  2002-11-30 20:17 kernel space access to user space functions Chris Ison
  2002-11-30 23:44 ` H. Peter Anvin
@ 2002-12-01  2:27 ` Andrew McGregor
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew McGregor @ 2002-12-01  2:27 UTC (permalink / raw)
  To: Chris Ison, linux-kernel



--On Sunday, December 01, 2002 06:17:03 +1000 Chris Ison 
<cisos@bigpond.net.au> wrote:

> I realize I asked this previously, but the answer given was not to the
> question I asked.
>
> How can I get a kernel module to call a function within a program?

As others have said, you can't.  Unix in general doesn't work this way.

However, all is not lost.  There are other ways to accomplish what you want.

> The reason being I am creating a software midi driver and already have a
> small program that does what I want the driver to do, problem is all the
> math in the program is floating point.
>
> What I would like to do, is be able to run the program, and have the
> kernel software midi driver call a function within the program to que up
> midi events, and have the program do all the hard work of the wavetable
> synth.

Actually, you want to have the program open a MIDI device, and read MIDI 
from there, then output to an audio device.  ALSA already has the 
facilities to do this, and it should not be hard to write a MIDI 
cross-queue device for OSS if you need that.  For low latency, you're going 
to have to be very careful about the structure of the main loop of this 
thing, and probably use mmap-ed audio under ALSA, or the low-latency DMA 
tricks with OSS.

> This way, any improvements to the software don't have to be translated
> to the driver, and visa versa.
>
> How can I make this happen. And please give an example.

Since there are several softsynths done already, why not look at how they 
did it.

http://www.xdt.com/ar/linux-snd/ is a very big list of linux sound apps. 
There should be examples amongst them.

Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-01  2:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-30 20:17 kernel space access to user space functions Chris Ison
2002-11-30 23:44 ` H. Peter Anvin
2002-12-01  2:27 ` Andrew McGregor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox