aboutsummaryrefslogblamecommitdiffstats
path: root/lib/ose/doc/src/ose_erl_driver.xml
blob: 6687d780875e8a1b87e122123504838fe3102a83 (plain) (tree)












































































































                                                                                                                                                                                        
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cref SYSTEM "cref.dtd">

<cref>
  <header>
    <copyright>
      <year>2013</year><year>2014</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>

    <title>erl_driver for Enea OSE</title>
    <prepared>Lukas Larsson</prepared>
    <docno></docno>
    <date>2014-01-08</date>
    <rev>A</rev>
    <file>ose_erl_driver.xml</file>
  </header>
  <lib>ose_erl_driver</lib>
  <libsummary>Linked-in drivers in Enea OSE</libsummary>
  <description>
    <p>Writing Linked-in drivers that also work on Enea OSE is very similar for
    how you would do it for Unix. The difference from Unix is that
    driver_select, ready_input and ready_output all work with signals
    instead of file descriptors. This means that the driver_select is
    used to specify which type of signal should trigger calls to
    ready_input/ready_output. The functions described below are available
    to driver programmers on Enea OSE to facilitate this.
    </p>
  </description>
  <section>
    <title>DATA TYPES</title>

    <taglist>
      <tag><marker id="union_SIGNAL"/>union SIGNAL</tag>
      <item>See the Enea OSE SPI documentation for a description.</item>
      <tag><marker id="SIGSELECT"/>SIGSELECT</tag>
      <item>See the Enea OSE SPI documentation for a description.</item>
      <tag><marker id="ErlDrvEvent"/>ErlDrvEvent</tag>
      <item>The <c>ErlDrvEvent</c> is a handle to a signal number and id combination. It is passed to <seealso marker="erts:erl_driver#driver_select">driver_select(3)</seealso>.</item>
      <tag><marker id="ErlDrvOseEventId"/>ErlDrvOseEventId</tag>
      <item>This is the id used to associate a specific signal to a
      certain driver instance. </item>
    </taglist>
  </section>
  <funcs>
    <func>
      <name><ret>union SIGNAL *</ret><nametext>erl_drv_ose_get_signal(ErlDrvEvent drv_event)</nametext></name>
      <desc>
        <marker id="erl_drv_ose_get_signal"></marker>
        <p>Fetch the next signal associated with <c>drv_event</c>.
	Signals will be returned in the order which they were received and
	when no more signals are available <c>NULL</c> will be returned.
	Use this function in the ready_input/ready_output callbacks
	to get signals.</p>
      </desc>
    </func>
    <func>
      <name><ret>ErlDrvEvent</ret><nametext>erl_drv_ose_event_alloc(SIGSELECT signo, ErlDrvOseEventId id, ErlDrvOseEventId (*resolve_signal)(union SIGNAL* sig))</nametext></name>
      <desc>
        <marker id="erl_drv_ose_event_alloc"></marker>
        <p>Create a new <c>ErlDrvEvent</c> associated with <c>signo</c>,
	<c>id</c> and uses the <c>resolve_signal</c> function to extract
	the <c>id</c> from a signal with <c>signo</c>. See
	<seealso marker="ose_erl_driver_chapter#driver">
	Signals in a Linked-in driver</seealso> in the OSE User's Guide.
      </p>
      </desc>
    </func>
    <func>
      <name><ret>void</ret><nametext>erl_drv_ose_event_free(ErlDrvEvent drv_event)</nametext></name>
      <desc>
        <marker id="erl_drv_ose_event_free"></marker>
        <p>Free a <c>ErlDrvEvent</c>. This should always be done in the
	<seealso marker="erts:driver_entry#stop_select">stop_select</seealso>
	callback when the event is no longer being used.</p>
      </desc>
    </func>
    <func>
      <name><ret>void</ret><nametext>erl_drv_ose_event_fetch(ErlDrvEvent drv_event, SIGSELECT *signo, int *id)</nametext></name>
      <desc>
        <marker id="erl_drv_ose_event_fetch"></marker>
        <p>Write the signal number and id associated with <c>drv_event</c>
	into <c>*signo</c> and <c>*id</c> respectively. <c>NULL</c> can be
	also passed as <c>signo</c> or <c>id</c> in order to ignore that field.
	</p>
      </desc>
    </func>
  </funcs>
  <section>
    <title>SEE ALSO</title>
    <p>
      <seealso marker="erts:driver_entry">driver_entry(3)</seealso>,
      <seealso marker="erts:erl_driver">erl_driver(3)</seealso>
    </p>
  </section>
</cref>