#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "erl_driver.h"
#include "ei.h"
#include "common_kerl.h"
#include "kerl.h"
#include "ei_extended.h"
Functions | |
static ErlDrvData | kerlDriverStart (ErlDrvPort port, char *buff) |
static void | kerlDriverStop (ErlDrvData handle) |
static void | doFree (void *state) |
static void | kerlDriverMain (void *asyncData) |
static void | kerlDriverOutput (ErlDrvData handle, char *buff, int bufflen) |
static void | kerlDriverReadyAsync (ErlDrvData drvData, ErlDrvThreadData asyncData) |
DRIVER_INIT (kerl) | |
Variables | |
ErlDrvEntry | kerlDriverEntry |
This contains code required to load a driver into Erlang allowing calls to be made to Player.
Erlang will initialize the driver allowing it to pass calls using Erlang Interface. This driver will wrap up the varibless passed from Erlang and pass it onto kerl.cpp which will allow robot control in player.
This driver runs concurrently.
Driver is explained: http://erlang.org/doc/man/driver_entry.html
doFree | ( | void * | state | ) | [static] |
state | is the data passed into the driver Not currently used but called at the end of a function call |
DRIVER_INIT | ( | kerl | ) |
Initialise erlang driver.
kerlDriverMain | ( | void * | asyncData | ) | [static] |
asyncData | is the kerldata passed into the driver Contains the kerl main functions passed from the async driver. Decoding of the atoms passed from erlang is done here and decides what kerl function is needed to call. If no function can be called then an error is returned. |
kerlDriverOutput | ( | ErlDrvData | handle, | |
char * | buff, | |||
int | bufflen | |||
) | [static] |
handle | pointer to the passed port information (todo: not sure ;)) | |
buff | erlang port input string | |
bufflen | length of the input string Function calls to the driver go here before they run asynchronously. The memory has to be copied to avoid curruption and then a thread is spawned at the end. |
kerlDriverReadyAsync | ( | ErlDrvData | drvData, | |
ErlDrvThreadData | asyncData | |||
) | [static] |
drvData | the driver data passed | |
asyncData | the async data passed This function is called when a async thread has completed This function is called after an asynchronous call has completed. The asynchronous call is started with driver_async. |
kerlDriverStart | ( | ErlDrvPort | port, | |
char * | buff | |||
) | [static] |
port | is the port | |
buff | any commands passed |
kerlDriverStop | ( | ErlDrvData | handle | ) | [static] |
handle | data This is called when the port is closed |
Initial value:
{ NULL, kerlDriverStart, kerlDriverStop, kerlDriverOutput, NULL, NULL, "kerl", NULL, NULL, NULL, NULL, NULL, kerlDriverReadyAsync, NULL, NULL, NULL }