---
name: "ose_erl_driver"
section: "3erl"
platform: "linux"
package: "erlang-manpages"
version: "1:17.3-dfsg-4+deb8u2"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/ose_erl_driver"
---

# ose\_erl\_driver(3erl)

Linked-in drivers in Enea OSE

## NAME

ose\_erl\_driver - Linked-in drivers in Enea OSE

## DESCRIPTION

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.

## DATA TYPES

- **union SIGNAL:**

  See the Enea OSE SPI documentation for a description.

- **SIGSELECT:**

  See the Enea OSE SPI documentation for a description.

- **ErlDrvEvent:**

  The *ErlDrvEvent* is a handle to a signal number and id combination. It is passed to **driver\_select(3erl)**.

- **ErlDrvOseEventId:**

  This is the id used to associate a specific signal to a certain driver instance.

## EXPORTS

**union SIGNAL \*erl\_drv\_ose\_get\_signal(ErlDrvEvent drv\_event)**\

Fetch the next signal associated with *drv\_event*. Signals will be returned in the order which they were received and when no more signals are available *NULL* will be returned. Use this function in the ready\_input/ready\_output callbacks to get signals.

**ErlDrvEvent erl\_drv\_ose\_event\_alloc(SIGSELECT signo, ErlDrvOseEventId id, ErlDrvOseEventId (\*resolve\_signal)(union SIGNAL\* sig), void \*extra)**\

Create a new *ErlDrvEvent* associated with *signo*, *id* and uses the *resolve\_signal* function to extract the *id* from a signal with *signo*. The *extra* parameter can be used for additional data. See  **Signals in a Linked-in driver** in the OSE User's Guide.

**void erl\_drv\_ose\_event\_free(ErlDrvEvent drv\_event)**\

Free a *ErlDrvEvent*. This should always be done in the **stop\_select** callback when the event is no longer being used.

**void erl\_drv\_ose\_event\_fetch(ErlDrvEvent drv\_event, SIGSELECT \*signo, ErlDrvOseEventId \*id, void \*\*extra)**\

Write the signal number, id and any extra data associated with *drv\_event* into *\*signo* and *\*id* respectively. *NULL* can be also passed as *signo* or *id* in order to ignore that field.

## SEE ALSO

**[driver\_entry(3erl)](/driver_entry/3erl.md)**, **[erl\_driver(3erl)](/erl_driver/3erl.md)**
