can erlang code talk directly with device driver ?

Haber, Bryan bhaber@REDACTED
Thu Jul 27 19:19:47 CEST 2006


So unless I miss my guess, you're trying to build an OS that's based off erlang. My suggestion would be to port the vm directly, or write your own. The vm, most likely, requires more then a simple elf loader to run. Its a full fledged binary that would require the support of a complete OS. 
-- bryan

-----Original Message-----
From: owner-erlang-questions@REDACTED <owner-erlang-questions@REDACTED>
To: erlang-questions@REDACTED <erlang-questions@REDACTED>
Sent: Thu Jul 27 07:01:33 2006
Subject: Re: can erlang code talk directly with device driver ?

On 7/27/06, Daniel Goertzen <goertzen@REDACTED> wrote:
> Only OpenSource wrote:
> > On 7/27/06, Javier París <javierparis@REDACTED> wrote:
> >> El Jueves, 27 de Julio de 2006 12:36, Only OpenSource escribió:
> >> > On 7/27/06, Ryan Rawson <ryanobjc@REDACTED> wrote:
> >> > > Just write a erlang port or library.  See EDTK.
> >> >
> >> > Thanks Ryan.
> >> >
> >> > I downloaded the paper list on the snookles.com site
> >> >
> >> > However, I am looking for an example, wherein erlang program works
> >> with
> >> >  - Network Device driver
> >> >  - USB Device driver
> >>
> >> You mean ioctls? You would do that, as Ryan said, using a port. There
> >> is a
> >> nice tutorial on how to do that on the web. In the network device
> >> case, if
> >> wou are only going to use a socket, there is already a library for
> >> that: look
> >> for gen_tcp and gen_udp.
> >>
> >> Regards.
> >>
> >
> > Yes IOCTLS or something similar to that.
> > As an illustration iptables on Linux implemented in erlang !
> > Could you point out the url of the nice tutorial ?
> >
> > For network device, I donot intend to use a socket !
> > What are the options available from an Erlang perspective ?
> >
> > I am also keen to do a Erlang prototype for a Wireless USB device driver.
> > Like to hear about what the erlang community has thought about this !
> >
> > In case I want to explore DMA in the erlang code, how do I do that ?
> >
> > Thanks in advance for any pointers.
> >
> If you want to solve the problem with Erlang, you need to think of it
> terms of message streams.  You'll need some way to get USB messages to
> an from the USB device.  I'm not that familiar in this area, but there
> must be some userland or kernel debugger that will give you access to a
> USB stream, perhaps as an erlang port or perhaps through direct file io
> with a device node.

Dan, thanks for your reply.

Do I necessarily need to construct the program in such a way that the
two modules communicate with each other using messages ?

As an illustration,
the typical model in C would be to define a structure.
Write a bunch of functions that would work on the struct.
Next come in the attach, detach, init, fini functions.
If it's a driver ctl, then I would define a bunch of IOCTLS

> On the other end of this you need some way to
> stream ethernet packets to and from a network interface.
>
> I would think DMA would happen at the USB subsystem level, so I doubt
> you need to think about that.
>
> Cheers,
> Dan.
>

The scenario that I am trying to visualize is this (I may be wrong) -

  Erlang runs on top of a virtual machine.
  Within erlang runtime env, there is no kernel or userland demarcation.

  If I can implement a good enough boot-loader, ELF loader and some process
  start code (not same as RTOS), then I have a good enough substrate on
  which erlang can be hosted.

  May be I just do a single 1 Gb memory allocation (lets say i have 1Gb RAM)
  and mmap the erlang into this single address space. All the segments are
  fused into a single address space (no need for multiple segments).

  In this scenario soft real-time capabilities are available in erlang
(OS like behaviours)
  and the various process hierarchy is similar to the UNIX process groups etc.

  Now, the only part that remains is the device drivers - in particular for
  USB (boot device) and NIC (networking device)
  For USB I use a extent based fs which maintains the erlang runtime file.

I am not sure if this has been attempted before.
However, I am interested in accomplishing this (no OS and no VxWorks)!

Does it make sense ?

-- 
oo@@oo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060727/41b63f0e/attachment.htm>


More information about the erlang-questions mailing list