Erlang to driver communication: why not a non-serialized option?
Thu Apr 25 12:24:29 CEST 2002
Thanks for pointing out the new features in erl_driver et. al.
There are a number of improvements:
- ease of encoding complex erlang terms
- zero copying of terms
- ability to send terms to arbitrary processes
- registered port names
The latter allows a good deal of optimization for some uses.
I am rewriting our driver for the Netaccess LAPD/MTP2 boards
to use all of these features.
One thing that seems odd at first glance is that when doing
syncronous calls from erlang into the driver the terms are
sent and received in a different format than the asyncronous
functions used to send terms from the driver to erlang.
When erlang:port_call/3 is used the driver's callback is
passed a buffer which can be decoded with the functions in
the ei library (part of erl_interface). The same library
is used to encode the response to the erlang port.
The erl_driver functions driver_output_term() and
driver_send_term() use "the driver term format". There are
a set of functions for doing some of this encoding but they
are entirely different than ei.
I guess it goes with what you were saying about there being
some increasing differences between drivers and ports.
Motivity Telecom Inc.
+1 519 579 5816
More information about the erlang-questions