TOC PREV NEXT INDEX

Put your logo here!


2 USER'S GUIDE

This part of the document provides a functional description of the module: how to use it and what to use it for.

2.1 Overview

The program controlling hardware is usually called driver, and the specific hardware to control is called a device. The driver can control several devices simultaneously, where each device consists of the same type of hardware, using the same code but with different sets of data for each device. The set of data defining the device and containing the status of the device is called device descriptor table. The driver concept of VxWorks is described in [1].

The minimal hardware system consists of a CAN card, which provides a bridge from VME to CAN bus, a CAN network consisting of a two-wire connection and the CANopen analog/digital I/O module consisting of several I/O terminals and one CAN bus coupler. Several modules can operate simultaneously on a CAN network identified by a unique node address. The CAN card also supports up to two independent CAN networks. A device descriptor is assigned to each CAN node, which controls and synchronizes the simultaneous access to this node. Because different devices share one CAN card, the driver routines for sending and receiving CAN messages provided by the vendor of the CAN card must be threadsafe to allow concurrent access for different devices.

The software interface is based on the VxWorks driver model implementing all its functionalities via ioctl commands, which are the same as for acro and aio devices. The interface has been designed to be as close as possible to that of the acro and aio drivers concerning error handling and codes, ioctl commands and data types. A canio device behaves like a combination of an acro and aio device. The use of acro and aio command identifiers for ioctl calls has made it necessary to redefine the numeric values of these identifiers to be unique and to modify the include files containing these identifiers. This change does not affect any software as long as the symbolic names for these ioctl command identifiers are used. The acroxInducer and aioxInducer panels parse the include files to access these ioctl command values and are therefore unconcerned by this modification This feature allows in most cases an easy adaption of existing software by modifying only the device name leaving all other parameters unchanged. Additional commands are provided to take into account special features of the I/O module e.g. requesting device properties like the number of supported signals.

The structure of the canio driver consists of 3 software layers:

· the VxWorks driver model as described above
· the CANopen layer implementing the CANopen protocol
· the CAN layer containing CAN card specific routines

The numbering of signals is based on the following scheme:

For digital signals, a valid signal number covers the range from 0 to <number of digital signals> - 1. Digital input signals have numbers from 0 to <number of digital input signals> - 1, while digital output signals are assigned to <number of digital input signals> to <number of digital signals> - 1 ( for acro devices each signal can be configured as input or output, which is not possible for a canio device )

For analog signals, there is a clear separation of input and output signals. A valid signal number covers the range 0 to <number of analog input signals> - 1 for analog inputs and 0 to <number of analog output signals> - 1 for analog outputs.

The mapping of these signal numbers to the I/O channels on the physical device is given by the following rules:

· one I/O bus terminal can have 2 or 4 I/O channels, which have subsequent signal numbers ( the order of these signals can found in the datasheet of the bus terminal )
· an I/O bus terminal can be only of the type analog input, analog output, digital input or digital output
· the signal count starts with the terminal nearest to the bus coupler

2.2 Driver Functions

This driver implements basically the functionality of the analog/digital I/O module The driver conforms to the VxWorks driver concept, i.e. it supports the functions open, close and ioctl.

The open and close calls are used to specify or free a channel to get and regulate access to the device. The filename is specifying the device to which the channel shall be opened and is made up of two parts:

· the driver name /canio and
· the device unit 0, 1, 2 ...

Write accesses are only permitted to the task which has opened the device in read/write mode, while read accesses are not restricted.

The read and write calls are only empty routines to conform to the standard driver interface, [1].

All supported operations are implemented via the ioctl calls. The ioctl call has a parameter specifying the action requested by the device. Because most of the commands are derived from the acro and aio driver interface, the parameters for these ioctl calls have the same form as for acro ( if digital signals are involved ) and aio ( if analog signals are involved ) drivers. These commands are grouped into read and write commands. Read commands are used to read values or status from the board, while write commands are used to write values or perform some action.

Before a task has performed an open call it cannot send any read or write command to the driver.

The driver controls the access to the device, provided by the open/close calls giving the following possibilities (read accesses are always permitted for a task which has opened the device in read or read/write mode):

1. Read-Only access: on a channel opened in this mode only read commands can be issued.
2. Exclusive read/write access: write access is granted only to the user that performed the open with this option. Requesting exclusive access to a device already opened in Exclusive or Shared access mode gives back an error.
3. Shared read/write access: write access is granted to the user that performed the open and to any other task that later on will request a similar open. Requesting Shared access to a device already opened in Exclusive access mode gives back an error.
4. Test read/write access: write access is granted to the user that performed the open with this option without limitation to the present opening status. Requesting Test access to a device already opened in Test access mode gives back an error, i.e. Test access mode is only granted to one task. This mode shall only be used by test and maintenance software. The idea is that test and maintenance software can access the driver without interfering with other users of the driver.

In addition, the driver calls are mutually exclusive, i.e. the device accessed by a task is protected from access from any other authorized task until the executing driver call has terminated. This means that if a task is executing a driver call and another task tries to access the driver for the same device, then this second task will be blocked until the driver call of the first one has terminated. The blocked task will be put on a queue. There is one queue for each device and the tasks on the queue will be scheduled according to their priority. The implementation of the driver uses the VxWorks mutex semaphore for this functionality and to provide priority inheritance, see reference [1].

A task blocked for access of a device will have a timeout.

Ioctl commands directly accessing a register do not have any protection from simultaneous access as the command is executed by an immediate action, that is in one non-interruptible instruction. In this case there is no need for any protection as no other task can interfere during the action. Section 5.1 defines for which Ioctl commands the access checks are performed. The open call returns a file handle with which the channel is identified in any further driver calls.

3 REFERENCE

3.1 Introduction

This chapter provides a detailed description of the CANopen analog/digital I/O module interface to the user, namely functions, commands, include files and tools.

The functions are described in UNIX man-page format and are organized in a functional order. Below is an index of the routines in the same order.

· open to open a channel
· close to close a channel
· ioctl to issue a control command
· canioDrv to install the CANopen analog/digital I/O driver
· canioDevCreate to add a CANopen analog/digital I/O device to the driver

Each of these calls returns a status code which signals the success of the call. A zero value always means successful completion while a negative value indicates an error. The value -1 stands for general error and origins in VxWorks while other values signal a specific error reason and are returned by the driver itself. Literals of all error codes can be found in the include file canioErrors.h and in [8].

3.2 Functions

As mentioned above, the CANopen analog/digital I/O driver uses the standard VxWorks I/O system calls open, close and ioctl to interface to the user. These functions are described in the following sections with respect to their special meaning in the CANopen analog/digital I/O driver context. For more general information see the VxWorks Programmers Guide [1].

3.2.1 open


NAME
open - open a channel to an CANopen analog/digital I/O device

SYNOPSIS

#include "canio.h"
int open (char *deviceName, int openMode, int *status)

DESCRIPTION

This operation opens the device corresponding to deviceName in read-only mode or in one of the read/write modes described below. The read accesses are always granted for any open modes.

* deviceName specifies the device (e.g. "/canio0")
* openMode can be:
-lcudrvOPEN_READONLY
Read only mode.
-lcudrvOPEN_SHARED
Shareable read and write mode. Write access is granted to a defined number of tasks to use this open mode. Exceeding this number or requesting this mode for a device already opened in Exclusive mode returns an error.
-lcudrvOPEN_EXCLUSIVE
Exclusive read write mode. Write access is granted to the task using this open mode. Requesting this mode for a device already opened in Exclusive or Shareable write mode returns an error.
-lcudrvOPEN_TEST
Test read and write open mode. Write access is granted to the task using this open mode regardless of the status of the device. Requesting this mode for a device already opened in Test mode returns an error.

RETURN VALUES

* A positive file descriptor number, which must be used for subsequent close and ioctl operations.
* A value of -1 signals a general error. The specific error reason is provided in the argument status which can be
-lcudrvERROR_INVALID_DEVICE
If the specified device name is invalid.
-lcudrvERROR_INVALID_OPEN_MODE
If open mode is invalid.
-lcudrvERROR_NO_MORE_CHANNEL
No more channel is available.
-lcudrvERROR_ACCESS_CONFLICT
The requested open mode is conflicting with the open modes of already existing channels. This error is caused by one of the following reasons:
+ Shared mode requested and device already open in Exclusive mode.
+ Exclusive mode requested and the device is already open in Exclusive or Shared mode.
+ Test mode requested and the device is already open in Test mode.
* The zero value should never be returned.

EXAMPLE

int fd, status;
......
fd = open ("/canio0", lcudrvOPEN_READONLY, (int)&status);
if (fd <= 0)
{
/* error processing */
......
}
else
{
/* normal processing */
......
}

CAUTIONS

* A cast to (int) for the third parameter is necessary because the declaration in VxWorks overrides the one shown here.
* Device names shall not be longer than 15 characters. They are defined by use of the function canioDevCreate at startup.
* The number of opened channels for all devices of the driver is limited to the value defined at installation-time.
* The returned file descriptor can be shared by several applications.
* Applications can have the same device opened several times, using different file descriptors. Furthermore, open modes can be mixed according to the rules previously described.
* As only one task can open a device for Exclusive mode at any one time, and the number of channels is limited, applications should issue a close call if no more action on the device has to be performed.

VxWorks

* The VxWorks include file configAll.h contains two literals used by iosInit function: NUM_DRIVERS which defines the maximum number of drivers allowed, and NUM_FILES, the maximum number of simultaneously open files. They are respectively defined as 20 and 50.
* The VxWorks command iosDrvShow shows all drivers of the system and their basic I/O function entry-points. The command iosFdShow shows all currently used file descriptors, and iosDevShow (or devs) all installed devices.


3.2.2 close


NAME
close - close a channel to a CANopen analog/digital I/O device

SYNOPSIS
#include "canio.h"
int close (int fileDescriptor)

DESCRIPTION
This operation closes a channel to an opened device and frees the file descriptor. fileDescriptor must correspond to one of those obtained previously be an open call.

RETURN VALUES
* lcudrvOK if successfully done.
* Other error codes returned by the driver are described in chapter 5.

EXAMPLE
int fd, status;
int closeError;
fd = open ("/canio0", lcudrvOPEN_TEST, (int)&status);
......
closeError = close (fd);
if (closeError != lcudrvOK)
{
/* error processing */
......
}
else
{
/* normal processing */
......
}

CAUTIONS
* This function is not queued by the driver, it always returns on of the above two status codes immediately.

3.2.3 ioctl


NAME
ioctl - send an ioctl command to a CANopen analog/digital I/O device

SYNOPSIS
#include "canio.h"
int ioctl (int fileDescriptor, int command, void *argument)

DESCRIPTION
This function commands the driver to perform the specified operation on the device. The commands are devided into read and write commands. Read commands are allowed in each open mode, while write commands will be rejected if the channel was not previously opened in Shared, Exclusive or Test mode

* fileDescriptor must correspond to one of those obtained previously by an open operation.
* command is an integer, identifying an ioctl command to be sent to the driver. The values identifying a command are defined in the include file canioCommands.h. The numeric values of these identifiers are identical to the corresponding commands defined in acroCommands.h and aioCommands.h. The only reason why these command identifiers are redefined in this include file with different symbolic names is that the canioxInducer panel parses this file to get the numeric values.
* argument is the address of the command argument, or NULL if no argument is used. For `Write' commands, argument contains the values to be written, for `Read' commands, the value read is returned in argument.
Argument, when used, can only be an integer, or structures defined in the include files acroCommands.h and aioCommands.h provided by driver libraries and described in section "Ioctl control commands".
RETURN VALUES
* lcudrvOK if the command is successfully transmitted and performed by the device.
* lcudrvERROR_ACCESS_CONFLICT if the write command can not be executed by use of a file descriptor previously obtained with a read-only open mode.
* lcudrvERROR_INVALID_ARGUMENT if command code is invalid.
* lcudrvERROR_TIMEOUT if access protection timed out.
* Other specific values returned by the driver are described for each ioctl command in section 3.3 and a full description of errors can be found in chapter 5.

EXAMPLE

int fd, status;
int arg;
int ioctlError;
fd = open ("/canio0", lcudrvOPEN_TEST, (int)&status);
......
arg = 30;
ioctlError = ioctl (fd, canioCMD_SET_TIMEOUT, (int)&arg);
if (ioctlError != lcudrvOK)
{
/* error processing */
......
}
else
{
/* normal processing */
......
}

CAUTIONS
* A cast to (int) for the third parameter is necessary because the declaration in VxWorks overrides the one shown here.
* This function is protected by a semaphore, and commands are queued by application priorities rather than by First-in First-out.
* A timeout is implemented to ensure the permissible maximum blocking delay of a task. This delay, expressed in ticks (currently there are 100 ticks in 1 second), is initialized at start-up, and can be read or modified at run-time by two additional commands (get/set timeout).

3.2.4 canioDrv(3)

NAME
canioDrv - Install the canio I/O drviver


SYNOPSIS
#include "canio.h"
int canioDrv(int devices, int channels, int timeout)



DESCRIPTION
This function is called only once at startup. It hooks up the various
I/O service calls to the driver's functions, assigns the driver number,
and adds the driver to the driver table.

devices - number of supported devices
channels - number of channels that can be simultanously be opened
timeout - access timeout value



RETURN VALUES
lcudrvOK - driver successfully installed
lcudrvERROR_DRIVER_EXISTS - the driver is already installed
lcudrvERROR_NO_MEMORY - there is not enough memory for dynamic
data structures
lcudrvERROR_INVALID_ARGUMENT - the value of one of the parameters is
out of range



SEE ALSO
canioDevCreate(3)




- - - - - -
Last change: 22/03/02-12:35


3.2.5 canioDevCreate(3)

NAME
canioDevCreate - Add a CANopen analog/digital I/O device to the
canio driver


SYNOPSIS
int canioDevCreate(char *devName,
int node,
int dummy,
int netNumber)


DESCRIPTION
This function is called at startup for each device to be installed.
It adds a device to the driver, making it available for subsequent open
operations.

devName - device name (must be "/canioX" X>=0, e.g. "/canio0")

node - unique identifier for CAN device ( 0 - 63 )
On the Beckhof module, the node ID can be set with
a DIP switch ( 0 - 6 )
dummy - This parameter is
kept for compatibility, but does not have a meaning.
netNumber - number of the CAN net
A ESD CAN card supports up to 4 independent CAN networks.

The assignment of the CAN network numbers to the ESD CAN cards are hardcoded.
Up to 4 ESD can cards can be used simultaneously within one LCU.

ESD CAN card #1 uses CAN network numbers 0, 1, (2, 3)
ESD CAN card #2 uses CAN netwok numbers 4, 5, (6, 7)
ESD CAN card #3 uses CAN network numbers 8, 9, (10, 11)
ESD CAN card #4 uses CAN network numbers 12, 13, (14, 15)

The numbers in brackets are only valid for 4-channel CAN cards.
If 2-channel cards are used, the numbers in brackets are NOT used.

This implies that if one uses two 2-channel CAN cards within a LCU, the available CAN network numbers are 0, 1, 4, and 5.

RETURN VALUES
lcudrvOK - successful completion
lcudrvERROR - there is a general VxWorks I/O error
lcudrvERROR_NO_DRIVER - driver not yet installed
lcudrvERROR_INVALID_DEVICE - invalid device name
lcudrvERROR_INVALID_ARGUMENT - invalid parameter
lcudrvERROR_DEVICE_EXISTS - device already installed
lcudrvERROR_NO_SEMAPHORE - creation of access protection semaphore
failed


EXAMPLE
int status;
status = canioDevCreate("/canio0", 1, 0);
if (status != lcudrvOK)
{
// error process
}


SEE ALSO
canioDrv(3)



- - - - - -
Last change: 22/03/02-12:35

3.3 Ioctl control Commands

This section describes all control commands which can be invoked by use of the VxWorks ioctl function. The parameter command specifies which operation has to be performed by the driver while the parameter argument passes the address of an argument to the command handler. In cases where multiple arguments are needed the address of a structure which contains those is passed.

All command literals and argument data structures are defined in the include file canioCommands.h.

The supported commands can be divided into two groups: Read and Write Commands. Read Commands are allowed in each open mode, while Write Commands are allowed only in Shared, Exclusive or Test mode.

This section lists all control commands supported by the driver. The list also contains a short description of each command and its literal. The error codes sent in case of an error are described in Chapter 5.

3.3.1 Ioctl Read I/O Commands

· canioCMD_READ_BITS - Read multiple digital I/O signals
This command is compatible to the acro command acroCMD_READ_BITS and returns the states of the specified input signal(s).
Argument: address of an acroREAD data structure with the fields
· .firstSignal (in) the number of the first signal ( the supported range depends on the number of digital input signals )
· .numSignal (in) the number of signals ( the supported range depends on the number of digital signals and must be smaller or equal than 32, because the signal values are returned as bits in a 32-bit unsigned integer value)
· .returnValue (out) the signal status, where a one in the corresponding bit indicates that the signal is active; the value is right shifted, that is bit 0 contains the state of the first signal, bit 1 the second signal etc. This parameter is returned by the driver.
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_READ_CONFIG_BITS - Read multiple configuration bits
This command is compatible to the acro command acroCMD_READ_CONFIG_BITS and returns the configuration of the specified signal(s).
Argument: address of an acroCONFIG data structure with the fields
· .firstSignal (in) the number of the first signal ( the supported range depends on the number of digital signals )
· .numSignal (in) the number of signals ( the supported range depends on the number of digital signals and must be smaller or equal than 32, because the signal properties inputOutput and polarity are returned as bits in a 32-bit unsigned integer value )
· .inputOutput (out) the input/output configuration, where a one indicates an output and a zero an input. This parameter is returned by the driver.
· .polarity (out) the active signal level, where a one indicates signal active high and a zero signal active low; the value is right shifted, i.e. bit 0 contains the state of the first signal, bit 1 the second etc. This parameter is returned by the driver.
Return Values:
· lcudrvOK - successful completion

· canioCMD_CHECK_PULSE_BIT - Check if signal bit is pulsing
This command is compatible to the acro command acroCMD_CHECK_PULSE_BIT. Argument: address of an integer value, containing the number of the signal to be checked ( the signal must be an digital output signal )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_NOT_IN_PROGRESS - signal not in pulse time

· canioCMD_READ_BOARD_ID - Get board id string
canioCMD_GET_BOARD_ID - Get board id string
The command returns the node ID as the low byte and the net ID as the high byte.
Argument: (out) pointer to an integer value
Return Values:
· lcudrvOK - successful completion

· canioCMD_READ_VALUE - Read analog input signal
This command is compatible to the aio command aioCMD_READ_VALUE and returns the value of the specified signal.
Argument: address of an aioSignal data structure with the fields
· .number (in) the signal number (the supported range depends on the number of analog input signals )
· .value (out) the signal value as floating point number ( the 16-bit value is converted to a voltage )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· aioERROR_INVALID_SIGNAL_GAIN - unknown signal gain
· aioERROR_NOT_CONFIGURED - no valid signal configuration found
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_READ_BIN_VALUE - Read analog input signal
This command is compatible to the aio command aioCMD_READ_BIN_VALUE and returns the value of the specified signal.
Argument: address of an aioBinSignal data structure with the fields
· .number (in) the signal number ( the supported range depends on the number of analog input signals )
· .value (out) the signal value as 16-bit integer value ( no conversion to a voltage )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_GET_VALUE - Read analog output signal
This command returns the value of the specified signal.
Argument: address of an aioSignal data structure with the fields
· .number (in) the signal number (the supported range depends on the number of analog output signals )
· .value (out) the signal value ( converted to a voltage ) as a floating point number
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· aioERROR_NOT_CONFIGURED - no valid signal configuration found

· canioCMD_GET_BIN_VALUE - Read analog output signal
This command returns the value of the specified signal.
Argument: address of an aioBinSignal data structure with the fields
· .number (in) the signal number (the supported range depends on the number of analog output signals )
· .value (out) the signal value as a 16-bit integer value ( no conversion to a voltage ).
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range

· canioCMD_GET_INPUT_CONFIG - Get the configuration of an analog input signal
This command is compatible to the aio command aioCMD_GET_INPUT_CONFIG and get the configuration ( voltage range, gain factor ) of the specified signal.
Argument: address of an aioSignal data structure with the fields
· .config (out) the voltage range. Alaways returns the value 1 corresponding to the range [-10,+10}, which is the only range supported by the hardware
· .gain (out) the gain factor for the voltage conversion. The only value supported by the hardware is 1 which corresponds to a gain of 1
· .number (in) the signal number (the supported range depends on the number of analog input signals )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range

· canioCMD_GET_OUTPUT_CONFIG - Get the configuration of an analog output signal
This command is compatible to the aio command aioCMD_GET_OUTPUT_CONFIG and configures the specified signal.
Argument: address of an aioSignal data structure with the fields
· .config (out) the voltage range. Alaways returns the value 1 corresponding to the range [-10,+10}, which is the only range supported by the hardware
· .gain (out) the gain factor for the voltage conversion. The only value supported by the hardware is 1 which corresponds to a gain of 1
· .number (in) the signal number (the supported range depends on the number of analog output signals )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range

· canioCMD_NUM_ANALOG_INPUTS - Get the number of analog input signals
The command returns the number of available analog input signals
Argument: (out) pointer to an integer value
Return Values:
· lcudrvOK - successful completion

· canioCMD_NUM_ANALOG_OUTPUTS - Get the number of analog output signals
The command returns the number of available analog output signals
Argument: (out) pointer to an integer value
Return Values:
· lcudrvOK - successful completion

· canioCMD_NUM_DIGITAL_INPUTS - Get the number of digital input signals
The command returns the number of available digital input signals
Argument: (out) pointer to an integer value
Return Values:
· lcudrvOK - successful completion

· canioCMD_NUM_DIGITAL_OUTPUTS - Get the number of digital output signals
The command returns the number of available digital output signals
Argument: (out) pointer to an integer value
Return Values:
· lcudrvOK - successful completion

3.3.2 Ioctl Write I/O Commands

· canioCMD_WRITE_CONFIG_BITS - Configure signal(s)
This command is compatible to the acro command acroCMD_WRITE_CONFIG_BITS ( beside the missing possibility to define if a signal is an input or output ) and configures the polarity of the signal(s) .
Argument: address of an acroCONFIG data structure with the fields
· .firstSignal the number of the first signal
· .numSignal the number of signals
· .inputOutput ignored, because this property can not be changed for a canio device.
· .polarity the active signal level, where a one indicates signal active high and a zero signal active low. The value is used for all specified signals.
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_IN_PROGRESS - change a signal during pulse time

· canioCMD_WRITE_BITS - Write multiple I/O signal bits
This command is compatible to the acro command acroCMD_WRITE_BITS and writes a value to the signal(s) specified..
Argument: address of an acroREAD data structure with the fields
· .firstSignal the number of the first signal ( must be a digital output signal )
· .numSignal the number of signals ( the supported range depends on the number of digital signals and must be smaller or equal than 32, because the signal values are stored as bits of a 32-bit unsigned integer value )
· .value the signal(s) states, where the range must correspond to the number of signals specified; bit 0 of the value shall contain the state of the first signal, bit 1 the second signal etc.
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_IN_PROGRESS - change a signal during pulse time
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_VALUE - Write analog output signal
This command is compatible to the aio command aioCMD_WRITE_VALUE and sets the value of the specified signal.
Argument: address of an aioSignal data structure with the fields
· .number (in) the signal number (the supported range depends on the number of analog output signals )
· .value (in) the signal value as floating point number ( the voltage value is converted to a 16-bit integer value )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· aioERROR_INVALID_SIGNAL_VALUE - signal value out of range
· aioERROR_NOT_CONFIGURED - signal number out of range
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_BIN_VALUE - Write analog output signal
This command is compatible to the aio command aioCMD_WRITE_BIN_VALUE and sets the value of the specified signal.
Argument: address of an aioBinSignal data structure with the fields
· .number (in) the signal number (the supported range depends on the number of analog output signals )
· .value (in) the signal value as a 16-bit integer value
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_SET_INPUT_CONFIG - Configures an analog input signal
This command is compatible to the aio command aioCMD_SET_INPUT_CONFIG and configures the specified signal.
Argument: address of an aioSignal data structure with the fields
· .config (in) the voltage range. Only the value 1 corresponding to voltage range [-10,+10] is supported
· .gain (in) the gain factor. Only the value 1 corresponding to gain 1 is supported
· .number (in) the signal number (the supported range depends on the number of analog input signals )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· aioERROR_INVALID_SIGNAL_CONFIG - unknown signal range

· canioCMD_SET_OUTPUT_CONFIG - Configures an analog output signal
This command is compatible to the aio command aioCMD_SET_OUTPUT_CONFIG and configures the specified signal.
Argument: address of an aioSignal data structure with the fields
· .config (in) the voltage range. Only the value 1 corresponding to voltage range [-10,+10] is supported
· .gain (in) the gain factor. Only the value 1 corresponding to gain 1 is supported
· .number (in) the signal number (the supported range depends on the number of analog output signals )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· aioERROR_INVALID_SIGNAL_NUMBER - signal number out of range
· aioERROR_INVALID_SIGNAL_CONFIG - unknown signal range

· canioCMD_WRITE_SET_BIT - Set a bit
This command is compatible ot the acro command acroCMD_WRITE_SET_BIT and sets a signal to its active state.
Argument: address of an integer value, containing the number of signal to be set ( must be an output signal )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_IN_PROGRESS - change a signal during pulse time
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_CLEAR_BIT - Clear a bit
This command is compatible ot the acro command acroCMD_WRITE_CLEAR_BIT and sets a signal to its inactive state.
Argument: address of an integer value, containing the number of signal to be cleared ( must be an output signal)
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_CHANGE_BIT - Change a bit
This command is compatible ot the acro command acroCMD_WRITE_CHANGE_BIT and changes the state of a signal.
Argument: address of an integer value, containing the number of signal to be changed( must be an output signal )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_IN_PROGRESS - change a signal during pulse time
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_PULSE_BIT - Pulse a bit
This command is compatible ot the acro command acroCMD_WRITE_PULSE_BIT and changes the state of a signal for a specified time.
Argument: address of an acroPULSE data structure with the fields
· .numSignal the number of signals ( must be an output signal )
· .value the time in ticks to pulse the signal; the values zero gives a short pulse, for longer pulses the driver will return before the pulse has terminated; a write access to this signal before the pulse has terminated will be rejected
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_IN_PROGRESS - change a signal during pulse time
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· acroERROR_START_TIMER - cannot start the command timer
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WRITE_PULSE_BIT_RESET - Reset pulsed bit
This command is compatible with the acro command acroCMD_WRITE_PULSE_BIT_RESET and resets the timer of the pulse. The signal state will be changed.
Argument: address of an integer value, containing the number of signal number ( must be an output signal )
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument is out of range
· acroERROR_PULSEBIT_NOT_IN_PROGRESS - reset the pulse timer of a signal which is not in pulse time
· acroERROR_CONFIGURATION - change a signal which is not configured as output
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

3.3.3 Ioctl General Commands

· canioCMD_RESET - Reset the device
Sets all digital signals to active-low, all analog signals to gain 1 and voltage range -10/+10V and all digital/analog output signals to 0.
Argument: none
Return Values:
· lcudrvOK - successful completion
· canOpenERROR_INVALID_DEVICE - the device is not in an operational state

· canioCMD_WAIT - Blocks the device
This command puts the device to sleep for a specific time
Argument: sleep time in ticks
Return Values:
· lcudrvOK - successful completion

· canioCMD_GET_TIMEOUT_TICK - Get the driver timeout value
Returns the timeout of the driver in ticks.
Argument: address of an integer, receiving the timeout value
Return Values:
· lcudrvOK - successful completion

· canioCMD_SET_TIMEOUT_TICK - Set the driver timeout value
This command sets the timeout of the driver. The value must be specified in system clock ticks.
Argument: address of an integer, containing the timeout value to be set
Return Values:
· lcudrvOK - successful completion
· lcudrvERROR_INVALID_ARGUMENT - command valid but argument out of range

· canioCMD_FREE_DEVICE - Free the device
The purpose of this command is to freethe device when a task which has opened the device in exclusive read/write mode is blocked or has terminated without closing the device. In this case it is not possible to send a write command to the device. This command frees the device and enables another task to open the device in read/write mode. The intention is that this command shall only be used `manually' by an operator, to free the device and should not be used by tasks which wants to send ioctl write commands to the device.
Argument: none
Return Values:
· lcudrvOK - successful completion
· acroERROR_NO_EXCLUSIVE - no channel opened in exclusive mode

· canioCMD_ANALOG_INPUT_CONFIG - Configure analog input signals to use SYNC
The purpose of this command is to configure a range of analog input signals to use the SYNC command. When the SYNC command is sent, all signals configured to use SYNC will be transfered from the bus node to the master (LCU). Reading analog-IN signals can be significantly faster when this approach is used.
But please note that this signal reflects the latest measurement available in the local memory of the bus node, which must not necessarily be the actual measurement which might be in progress. Please also note that when this command is used, all the analog-IN signals that do not use SYNC will be reconfigured to be transmitted with (slower) SDO's on the CANBus.
After a range of analog-IN signals are cnfigured as SYNC, reading one of these signals with canioCMD_READ_VALUE will just return the value that is available in the local memory of the LCU, which is updated only when a SYNC command is sent. As long as no new SYNC command is sent, the returned value will therefore be identical.
Sending this command twice will overwrite the previous configuration!
Argument: canioCONFIG_ANALOG_IN structure with the following elements:
firstSignal - Number of the first analog-IN signal that shall be configured to use SYNC
numSignals -Number of signals to be configured to use SYNC
syncEnable - 0 to disable, 1 to enable SYNC mode
Return Values:
· lcudrvOK - successful completion
· acroERROR_INVALID_ARGUMENT - Invalid range of signals, i.e. there are either not as many analog-IN signals available as requested to be configured as SYNC, or the number of the first signal is too large (and therefore an output signal).

· canioCMD_SEND_SYNC - Send the SYNC signal
This command sends a SYNC signal to the CANBus. Consequenctly, all bus nodes configured to use SYNC will send the latest available measurement to the master (LCU). Please note that this command returns as soon as SYNC was sent, not waiting for the new data to arrive. A internal semaphore is used which will cause subsequenct canioCMD_READ_VALUE commands to wait until the data is available.
Argument: Dummy parameter, should be NULL
Return Values:
· lcudrvOK - successful completion

3.4 Logging

The CANopen analog/digital I/O driver makes use of the common logging facility, i.e. the lculog module for debugging and tracing purposes. Therefore the lculog task must be loaded and spawned before the CANopen analog/digital I/O driver is used.

The logging facility simply prints messages to the VxWorks shell. There are several different types of messages:

· Errors These are printed always.
· Warnings These are printed always.
· Log These are printed always.
· Trace These are printed only if the Trace-option is enabled.
· Debug These are printed only if the Debug-option is enabled.
· Interrupt These are printed only if the Intr-option is enabled.

The Intr-, Debug- and Trace-Option can be switched on by issuing the following commands to the VxWorks shell: LCU_intr, LCU_debug and LCU_trace. All functions should return the value 1.

To switch the logging and tracing facilities off just issue the corresponding commands again and this time they should return the value 0.

3.5 Include files

Beside VxWorks include files, driver applications must include "canio.h" to interface the CANopen analog/digital I/O driver. Board dependent, this file declares as prototypes the operations provided by the driver library, and includes other files themselves.

· The needed VxWorks header files
· "lcudrv.h" defining the literals common to all drivers.
· "canioErrors.h" defining the literals of the CANopen analog/digital I/O driver errors
· "canioCommands.h" defining the literals of the CANopen analog/digital I/O driver commands and data structures for multiple argument commands as used with the ioctl procedure.

3.6 Tools

The CANopen analog/digital I/O driver includes a number of tools which can be used from the VxWorks shell. These tools are intended to be used by a system manager to ease maintenance and troubleshooting.

· canioShowDriver ()
shows the properties of the canio Driver
· canioShowDevice ( "device name" )
shows all properties of the device
· canioIoctlTest("device name", command, parameter1, parameter2, parameter3, parameter4)
used to invoke ioctl commands from the shell

All the tools require that the CANopen analog/digital I/O driver is already installed and at least one device is added.

All output is made on the standard output, i.e. either to the system console or to a host terminal.

3.6.1 canioShowDriver

This command provides a way to investigate the current driver properties.
Driver information
Description
Number
Acess timeout
Number of supported commands
Number of channels
List of channels
VxWorks driver number
timeout in ioctl calls
The number of supported ioctl commands
Maximum number of open file descriptors
List of all open file descriptors

3.6.2 canioShowDevice

This commands retrieves all information about the device.
Device information
Description
Device
Node
Card
Channel
Net
Number of bus terminals
List of the number of signals available
Sync
List of all supported Process Data Objects

State






Emergency state
Device name e.g. "/canio0"
Unique node identifier
The number of the card where the device is attached to
Channel where the CAN network cable is attached to
Unique net identifier
Number of available I/O terminals
Number of analog and digital I/O signals
Sync message identifier
Contains message identifier and the mapping of the message data to the analog and digital signals
The device state is the most important piece of information. Only in the operational state writing and reading I/O signals is possible. Possible device states are:
canOpenSTATE_STOPPED, canOpenSTATE_PREOPERATIONAL,
canOpenSTATE_OPERATIONAL,
UNKNOWN
Content of the emergency message

3.6.3 canioIoctlTest

Ioctl calls require special data structures like aioSignal or acroRead to supply parameter, which is inappropriate for invoking these commands from the shell. The routine canioIoctlTest provides an easy way to provide parameters to an ioctl call. Parameters returned by ioctl call are printed to the shell.

A list of valid parameters can be found in the next table.

Command
Value
Parameter 1
Parameter 2
Parameter 3
Parameter 4
canioCMD_RESET
canioCMD_SET_TIMEOUT_TICK
canioCMD_GET_TIMEOUT_TICK
canioCMD_FREE_DEVICE
canioCMD_READ_CONFIG_BITS
canioCMD_READ_:BITS
canioCMD_READ_BOARD_ID
canioCMD_CHECK_PULSE_BIT
canioCMD_WRITE_CONFIG_BITS
canioCMD_WRITE_BITS
canioCMD_WRITE_SET_BIT
canioCMD_WRITE_CLEAR_BIT
canioCMD_WRITE_CHANGE_BIT
canioCMD_WRITE_PULSE_BIT
canioCMD_WRITE_PULSE_BIT_RESET
canioCMD_GET_BOARD_ID
canioCMD_READ_VALUE
canioCMD_GET_INPUT_CONFIG
canioCMD_GET_OUTPUT_CONFIG
canioCMD_GET_TIMEOUT
canioCMD_READ_BIN_VALUE
canioCMD_WRITE_VALUE
canioCMD_SET_INPUT_CONFIG
canioCMD_SET_OUTPUT_CONFIG
canioCMD_SET_TIMEOUT
canioCMD_WAIT
canioCMD_WRITE_BIN_VALUE
canioCMD_NUM_ANALOG_INPUTS
canioCMD_NUM_ANALOG_OUTPUTS
canioCMD_NUM_DIGITAL_INPUTS
canioCMD_NUM_DIGITAL_OUTPUTS
canioCMD_GET_VALUE
canioCMD_GET_BIN_VALUE
canioCMD_ANALOG_INPUT_CONFIG
canioCMD_SEND_SYNC
100
105
110
115
125
130
135
140
145
150
155
160
165
170
175
300
305
310
315
325
330
340
345
350
360
385
390
500
505
510
515
520
525
540
541
0
timeout
0
0
first signal
first signal
0
signal number
first signal
first signal
signal number
signal number
signal number
signal number
signal number
0
0
0
0
0
0
0
signal range
signal range
timeout
time
0
0
0
0
0
0
0
first signal
0
0
0
0
0
number of signals
number of signals
0
0
number of signals
number of signals
0
0
time
time
0
0

0
0
0
0

signal gain
signal gain
0
0
0
0
0
0
0
0
0
number of signals
0
0
0
0
0
0
0
0
0
0
signal value
0
0
0
0
0
0
signal number
signal number
signal number
0
signal number
signal number
signal number
signal number
0
0
signal number
0
0
0
0
signal number
signal number
1 = enable sync
0
0
0
0
0
0
0
0
0
polarity
0
0
0
0
0
0
0
0
0
0
0
0
signal value
0
0
0
0
signal value
0
0
0
0
0
0
0
0


4 INSTALLATION GUIDE

The installation of the canio driver is done at startup by script files and shall not be changed at run_time. It is composed by the installation of the driver code, common to all devices using the same board type, the installation of the devices corresponding to each driver, and the connection of interrupts, to vector numbers and interrupt service routines.

This section describes how to build the canio software, if executables are not already available. It then describes step by step the boot script file to load the software on the target. Finally test procedures to verify the installation are described.

4.1 Installation Prerequisites

The following hardware and software prerequisities must be fulfilled for a successful installation of the driver.

4.1.1 Hardware Requirements

· Motorola MVME2700 or MVME2604 CPU board
· ESD CAN VME board with NTCan firmware V0.C
· Beckhoff CANopen I/O module with analog and digital bus terminals and one bus coupler
· Power supply 24V for the Beckhoff module
· CAN network cable
· Ethernet network
· LCU console

4.1.2 Software Requirements

· VxWorks 5.4 or 5.5 operating system
· lcudrv for common driver functions, version 1.34 or later
· lculog for internal logging, version 1.12 or later
· the acro module version 1.29 or later
· the aio module version 1.29 or later
· the canio module installed on a host machine
· the canstack module installed on a host machine
· the lcc3 module installed on a host machine
· the lqs module installed on a host machine
· If more than one CAN network is used, it is necessary to update the canstack.xml configuration file accroding to section 4.4. of this manual.

4.2 Building the Software

The canstack module is delivered as a UNIX tar file, either on disk or on CD. The file expands in a directory structure as defined in [3].

canstack/
|
|------include/ (include files)
|------src/ (canstack source files)
|------object/ (target dir for make)
|------config/ (canstack configuration)
|------doc/ (target dir for make)
|------test/ (test sources and includes)
|------bin/ (target dir for make)
|------man/ (target dir for make)

If it is required to build or rebuild the software the Makefile provided shall be used. To use the Makefile a number of environment variables must be defined. An example to set up the environment for VxWorks and the GNU-C-compiler can be found in [5].

Before using the Makefile the user should make sure that GNU make is defined before the make supplied by the vendor in the search path. This can be checked by issuing the UNIX command which make. As defined in [3] VLT software should be built using GNU make in order to avoid discrepancies between different vendors implementation of make. To build the software follow the procedures below:

1. Move to canstack/src directory (cd ./canstack/src)
2. Type `make clean all man install' to
a. remove everything which can be made, thus enforcing recompilation of the entire code.
b. compile and link everything. The result, the VxWorks object-modules canstack, canstackLib and the installation script canstack.boot will be stored in directory canstack/bin. Please note that canstack is a commercial product, available only in binary form. The script canstackLink will evaluate the environment variable $VXROOT to determine if the binary files for vxWorks 5.4 or 5.5 are required.
c. Other vxWorks versions than 5.4. or 5.5. are not supported!
d. move the executables and include files required by external modules to their target directories.
e. Copy the configuration file canstack.xml to the target directory $VLTROOT/config or $INTROOT/config. Please note that this file has to be adapted to the CAN network that you are using!

The canio module is delivered as a UNIX tar file, either on disk or on CD. The file expands in a directory structure as defined in [3].

canio/
|
|------include/ (include files)
|------src/ (canio source files)
|------object/ (target dir for make)
|------dbl/ (canio database classes)
|------doc/ (target dir for make)
|------test/ (test sources and includes)
|------bin/ (target dir for make)
|------man/ (target dir for make)

If it is required to build or rebuild the software the Makefile provided shall be used. As defined in [3] VLT software should be built using GNU make in order to avoid discrepancies between different vendors implementation of make. To build the software follow the procedures below:

3. Move to canio src directory (cd ./canio/src)
4. Type `make clean all man install' to
a. remove everything which can be made, thus enforcing recompilation of the entire code.
b. compile and link everything. The result, the VxWorks object-module canio and the installation script canio.boot will be stored in directory canio/bin.
c. move the executables and include files required by external modules to their target directories.

4.3 Installation Procedure

This section describes the steps to install the canio driver and the first device. A script file canio.boot is prepared to perform these steps. The utility vltMan can be used to access man-page informations for the canio-functions. Install the acro module with the tool vccConfigLcu in your LCU environment (bootScript).

1. Load the canstack driver code to the target system
2. Load the canio driver code to the target system.
3. The driver is installed by invoking the function canioDrv() with the following parameters (see Reference):
· the maximum number of supported canio devices
· the maximum number of open channels ( file descriptors )
· the access timeout in ticks
4. A device is installed by invoking the function canioDevCreate() with the following parameters (see Reference):
· the device name: "/canio<unit>" where <unit> is the device unit number, starting with 0 and incrementing by one for each additional device.
· the unique node identifier ( 0 - 63 )
· a dummy parameter, kept for compatibility
· the card channel where the CAN bus is connected ( the range depends on the number of channels supported by the card. There are cards with 2 and 4 channels available. ). Please note that the assignment of CAN network numbers to the individual ESD CAN cards is hardcoded:
ESD CAN card #1 uses CAN network numbers 0, 1, (2, 3)
ESD CAN card #2 uses CAN netwok numbers 4, 5, (6, 7)
ESD CAN card #3 uses CAN network numbers 8, 9, (10, 11)
ESD CAN card #4 uses CAN network numbers 12, 13, (14, 15)
The numbers in brackets are only valid for 4-channel CAN cards.
If 2-channel cards are used, the numbers in brackets are NOT used.

A device is uniquely identified by the node identifier, card and channel number and only one device with a given parameter set can be created.

IMPORTANT: the call to canioDevCreate will fail and stop the booting if the device does not exist. Therefore each user has to configure the canio.boot file according to his/her hardware configuration. Additionally, for each CAN network, one entry has to be added to the canstack.xml configuration file, otherwise the boot process of canstack will fail.

4.4 CANSTACK.XML

The CANOpen manager of canstack requires a configuration file.

The name of that file is canstack.xml, and it is searched for in the directories $BOOTHOME, $MODROOT, $INTROOT and $VLTROOT.

For each CAN network, one <Manager_Instance> block must be declared. Within each <Manager_Instance>, <Node_Instance> blocks describe attributes of the bus nodes. Please see [19] for a meaning of the individual keywords.

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v3.0 (http://www.xmlspy.com) by xxx (yyy) -->
<CANopen_Manager>
<Manager_Instance>
<Net_No>1</Net_No>
<Baudrate>500</Baudrate>
<Manager_Node_Id>127</Manager_Node_Id>
<Config_File_Path>./</Config_File_Path>
<Boot_Time>20000</Boot_Time>
<Heartbeat_Producer_Time>0</Heartbeat_Producer_Time>
<NMT_Master>TRUE</NMT_Master>
<NMT_Start_All>TRUE</NMT_Start_All>
<NMT_Auto_Operational>TRUE</NMT_Auto_Operational>
<NMT_Auto_Start>FALSE</NMT_Auto_Start>
<NMT_Action_On_Error>STOP_ALL</NMT_Action_On_Error>
<Node_Instance>
<Node_Id>1</Node_Id>
<NMT_Slave>TRUE</NMT_Slave>
<NMT_Mandatory_Slave>FALSE</NMT_Mandatory_Slave>
<Guard_Time>5000</Guard_Time>
<Life_Time_Factor>4</Life_Time_Factor>
<Consumer_Heartbeat_Time>0</Consumer_Heartbeat_Time>
<NMT_Check_Nodestate>FALSE</NMT_Check_Nodestate>
</Node_Instance>
</Manager_Instance>
</CANopen_Manager>

4.5 Installation Verification

Functions performed during installation phase always log OK or ERROR messages to the console.

The tools described in a previous section can be used to test that the driver and the device have been installed correctly. From the VxWorks shell issue the following commands:

· canioShowDriver()
This command prints status information about the installed canio driver.
· canioShowDevice("device name")
This command shows all properties of the installed device on the console.

If any of the procedures described above do not work as expected it may be useful to switch on the LCU debugging and tracing facility. This can be achieved by issuing the following commands to the VxWorks shell: LCU_debug and LCU_trace. Both functions should return the value 1.

Then execute the test procedures again and examine the debugging and tracing messages.

To switch the debugging and tracing facilities off just issue the corresponding commands again and this time they should return the value 0.

5 ERROR MESSAGES AND RECOVERY

5.1 Error Checking

The driver performs a number of checks that the correct conditions are fulfilled and reports an error if this is not the case. This section specifies the conditions the driver checks before or after the execution of a Ioctl control command.

An open request in exclusive read/write mode is rejected if the device is open to any other task in exclusive or shared read/write mode.

An open request in shared read/write mode is rejected if the device is open to any other task in exclusive read/write mode.

An open request in test read/write mode is rejected if the device is open to any other task in test read/write mode.

The following list shows all possible errors which can be returned by the canio driver. There are three types of errors:

· VxWorks system errors
· errors from the common driver library
· errors from the canio driver ( these errors are identical to that acro and aio error messages, because the software interface is the same )
· errors from the can library

The errors are defined in canioErrors.h (canio specific errors with the prefix canio), canOpenErrors.h, canLibErrors.h (CAN specific errors with the prefix can) and in [8] (common errors with the prefix lcudrv). Errors corresponding to each function are depicted in the section 3.2.

The CANopen layer also performs a node guarding, where a task monitors the state of the device and looks for emergency messages. If an emergency message occurs, the device state changes to canOpenSTATE_STOPPED and writing or reading I/O signals is not possible anymore. In this case the utility canioShowDevice can be used to find out more about the emergency state. If the emergency state is OK, a connection or a power failure is probably the source of this problem. In any case, the system has to be rebooted to recover from these errors.

Note: Additional errors, not described here can be returned when the VxWorks I/O system rejects a call before invoking the driver.

5.1.1 Common Driver Errors

The following list shows common driver errors as defined in [8].

· lcudrvOK
Indicates successful completion.
· lcudrvERROR
Indicates general error.
· lcudrvERROR_ACCESS_CONFLICT
The open mode conflicts with the open modes of already existing channels or the requested action is not allowed with this open mode.
· lcudrvERROR_CHANNEL_NOT_OPEN
The requested channel is not open.
· lcudrvERROR_DEVICE_EXISTS
Attempt to create an already existing device a further time.
· lcudrvERROR_DRIVER_EXISTS
Attempt to install an already existing driver a further time.
· lcudrvERROR_INVALID_ARGUMENT
The value of one of the arguments was not in a valid range.
· lcudrvERROR_INVALID_COMMAND
The ioctl command code matches no valid command.
· lcudrvERROR_INVALID_DEVICE
The device name does not specify a valid device.
· lcudrvERROR_INVALID_OPEN_MODE
The requested open mode is unknown.
· lcudrvERROR_NO_CHANNEL
No more channel to a device is available or invalid channel number.
· lcudrvERROR_NO_DRIVER
Attempt to create a device without having the driver installed yet.
· lcudrvERROR_NO_MEMORY
Not enough memory available to allocate internal data structures.
· lcudrvERROR_NO_MORE_CHANNEL
No more channel to a device can be opened.
· lcudrvERROR_NO_SEMAPHORE
Failed to create the access protection semaphore.
· lcudrvERROR_TIMEOUT
The call is timed-out because access to the device was pending for longer than the driver timeout parameter.

5.1.2 aio specific Errors

· aioERROR_NOT_CONFIGURED
The signal is not configured.
· aioERROR_INVALID_SIGNAL_NUMBER
The signal number is out of range
· aioERROR_INVALID_SIGNAL_CONFIG
The signal configuration is unknown.
· aioERROR_INVALID_SIGNAL_GAIN
The signal gain factor is out of range.
· aioERROR_INVALID_SIGNAL_VALUE
The signal value is out of range.

5.1.3 acro specific Errors

· acroERROR_CONFIGURATION
Change a signal which is not configured as output.
· acroERROR_NO_EXCLUSIVE
No channel in exclusive mode opened.
· acroERROR_PULSEBIT_IN_PROGRESS
Change a signal during the pulse time.
· acroERROR_PULSEBIT_NOT_IN_PROGRESS
Reset the pulse timer of a signal which is not in pulse time.
· acroERROR_START_TIMER
Cannot start the command timer.
· acroERROR_STOP_TIMER
Cannot cancel the currently running timer.

5.1.4 CANopen specific Errors

· canOpenERROR_INVALID_DEVICE
The device is not in an operational state.
· canOpenERROR_INVALID_SIGNAL
The signals cannot be mapped to the device


Quadralay Corporation
http://www.webworks.com
Voice: (512) 719-3399
Fax: (512) 719-3606
sales@webworks.com
TOC PREV NEXT INDEX