elomax.h File Reference

This file defines the interface between the user application and this Elomax Driver package. More...

Classes

struct  elomax_bare_data
 The data-type to use for 'bare' communication with an elomax unit (see also ELOMAX_DEVICE_FILE). More...
struct  elomax_status_data
 The data-type to read the values and the status of the unit. More...
struct  elomax_monitor_data
 The data-type to read the values, the status and the values recently written to the unit. More...
struct  elomax_id_data
 The data-type to read the identification and connection of the unit. More...

Defines

#define ELOMAX_DEVICE_FILE   "/dev/elomax%d"
 The device file for an elomax unit, the interface for an user application to talk to an unit.
#define ELOMAX_VENDOR_ID   0x07a0
 The usb vendor-id of the elomax unit.
#define ELOMAX_IOSOLUTION_ID   0x1001
 The usb product-id of an elomax iosolution unit.
#define ELOMAX_ANINSOLUTION_ID   0x1002
 The usb product-id of an elomax aninsolution unit.
#define ELOMAX_FANSOLUTION_ID   0x1003
 The usb product-id of an elomax fansolution unit.
#define ELOMAX_UNKNOWN_ID   0x0000
 The usb product-id of an unknown elomax unit.
#define ELOMAX_READ_ANNOUNCED   0x01
 Status bit which is set when the read is announced successfull.
#define ELOMAX_READ_RECEIVED   0x02
 Status bit which is set when data from the unit is successfull read.
#define ELOMAX_WRITE_ONCEDONE   0x04
 Status bit which is set when at least once data is written to the unit.
#define ELOMAX_WRITE_DONE   0x08
 Status bit which is set when the last write to the unit was succesfull.
#define ELOMAX_IS_STATUS(statusword, statusbit)   ( 0 != ( statusword & ( statusbit ) ) ? 1 : 0 )
 Macro to read variables of type elomax_status_word.
#define ELOMAX_SET_STATUS(statusword, statusbit, value)
 Macro to write variables of type elomax_status_word.

Typedefs

typedef struct elomax_bare_data elomax_bare_data
 The data-type to use for 'bare' communication with an elomax unit (see also ELOMAX_DEVICE_FILE).
typedef unsigned char elomax_status_word
 The data-type in which the status of the unit is returned.
typedef struct elomax_status_data elomax_status_data
 The data-type to read the values and the status of the unit.
typedef struct elomax_monitor_data elomax_monitor_data
 The data-type to read the values, the status and the values recently written to the unit.
typedef unsigned int elomax_solution_type
 The data-type to read the type of unit.
typedef char elomax_connection_type [255]
 The data-type to read the connection of the unit.
typedef struct elomax_id_data elomax_id_data
 The data-type to read the identification and connection of the unit.

Detailed Description

This file defines the interface between the user application and this Elomax Driver package.

The interface is accessible via the device file. This file is automatically created (via udev) when this driver is loaded and accepts control over a connected unit.

The user application can use the <fcntl.h> system library to open(), read() and/or write() and close() the device file. The file is named according ELOMAX_DEVICE_FILE.


Define Documentation

#define ELOMAX_ANINSOLUTION_ID   0x1002

The usb product-id of an elomax aninsolution unit.

This value is used to identify an unit of type aninsolution. It is returned in the elomax_id_data::type field in an elomax_id_data typed read (see also ELOMAX_DEVICE_FILE).

#define ELOMAX_DEVICE_FILE   "/dev/elomax%d"

The device file for an elomax unit, the interface for an user application to talk to an unit.

This 'file' is created by udev, on request of the usb-core, when an elomax unit is connected to the usb bus. The %d is replaced with an integer number, to have an unique file for every attached unit.

When the unit is disconnected, this 'file' is removed by udev.

A user application uses this file to access the unit. This file allows certain types of reads and writes. The reads allowed are:

  • of type elomax_bare_data, to read the bare data from the unit,
  • of type elomax_status_data, to read the bare data from the unit and the status of the unit,
  • of type elomax_monitor_data, to read the bare data from the unit, the status of the unit and the bare data most recently written to the unit,
  • of type elomax_id_data, to read the type and connection of the unit.

Only one type of write is allowed on this file:

#define ELOMAX_FANSOLUTION_ID   0x1003

The usb product-id of an elomax fansolution unit.

This value is used to identify an unit of type fansolution. It is returned in the elomax_id_data::type field in an elomax_id_data typed read (see also ELOMAX_DEVICE_FILE).

#define ELOMAX_IOSOLUTION_ID   0x1001

The usb product-id of an elomax iosolution unit.

This value is used to identify an unit of type iosolution. It is returned in the elomax_id_data::type field in an elomax_id_data typed read (see also ELOMAX_DEVICE_FILE).

#define ELOMAX_IS_STATUS ( statusword,
statusbit   )     ( 0 != ( statusword & ( statusbit ) ) ? 1 : 0 )

Macro to read variables of type elomax_status_word.

This macro facilitates the reading of a status of the unit, by 'casting' the requested bit to a boolean value.

Parameters:
[in] statusword The statusword to be investigated. This variable must be of type elomax_status_word.
[in] statusbit The statusbit to check. This must be one of:

Returns:
The boolean equivalent of the requested bit in the status word:
  • 1, when the bit is set
  • 0, when the bit is reset
#define ELOMAX_READ_ANNOUNCED   0x01

Status bit which is set when the read is announced successfull.

Use this value to mask the status word.

The read consists of two steps. First, a read is announced. This is the driver appointing some memory to catch the incoming data of the unit. When this appointing of memory, announcing the read, is successfull, this status bit is set.

The second step of the read is executed when data of the unit is received and the appointed memory is filled. The succesfullness of that step is indicated by ELOMAX_READ_RECEIVED.

#define ELOMAX_READ_RECEIVED   0x02

Status bit which is set when data from the unit is successfull read.

Use this value to mask the status word.

The read consists of two steps. First, the driver appoints some memory to catch the incoming data of the unit. The successfullness of this appointing is indicated by ELOMAX_READ_ANNOUNCED.

The second step of the read is executed when data of the unit is received and the appointed memory is filled. The succesfullness of that step is indicated by this bit.

#define ELOMAX_SET_STATUS ( statusword,
statusbit,
value   ) 
Value:
statusword =                                                                 \
    ( statusword & ( ~ ( statusbit ) ) ) | ( value != 0 ? ( statusbit ) : 0 )

Macro to write variables of type elomax_status_word.

This macro is used by the driver internally to set the status of the unit. Do not use this macro in an user application.

Parameters:
[in] statusword The statusword to be written. This variable must be of type elomax_status_word.
[in] statusbit The statusbit to check. This must be one of:

[in] value The value to set the requested bit to. When zero, the bit is reset, when unequal zero, the bit is set.
#define ELOMAX_UNKNOWN_ID   0x0000

The usb product-id of an unknown elomax unit.

This value is used to indicate a failure while retrieving the type of elomax unit. It is returned in the elomax_id_data::type filed in an elomax_id_data typed read when the retrieving failed (see also ELOMAX_DEVICE_FILE).

#define ELOMAX_WRITE_DONE   0x08

Status bit which is set when the last write to the unit was succesfull.

Use this value to mask the status word.

This bit is set when the last write to the unit is completed succesfull.

#define ELOMAX_WRITE_ONCEDONE   0x04

Status bit which is set when at least once data is written to the unit.

Use this value to mask the status word.

For most of the elomax solution units, part of the written data is configuration of the unit (eg pull-up resistors on or off, sink current level). Since the correct functioning of the unit depends on this configuration, the user may want to know if a write is at least once succesfully completed.

This status bit indicates that at least one write is sucesfully completed.


Typedef Documentation

The data-type to use for 'bare' communication with an elomax unit (see also ELOMAX_DEVICE_FILE).

The format of the 8 data bytes differs per type of elomax unit, see the elomax documentation for the details.

typedef char elomax_connection_type[255]

The data-type to read the connection of the unit.

It is a zero terminated string, uniquely identifying where the unit in the usb-tree is connected. It is consistent over reboot and only changes when the unit is rewired in the usb-tree.

typedef unsigned int elomax_solution_type

The data-type to read the type of unit.

The returned value identifies the type of solution:

typedef unsigned char elomax_status_word

The data-type in which the status of the unit is returned.

This variable-type holds information about the read/write status of the unit. It is a bit-mask, consisting of:

Use macro's ELOMAX_IS_STATUS to read the status of the unit. The macro ELOMAX_SET_STATUS is internally used by the driver to set the status.

 All Classes Files Functions Variables Typedefs Defines
Generated by  doxygen 1.6.3