linux

canOpenChannel

Syntax


#include <canlib.h>
int canOpenChannel(
    unsigned int channelNumber, 
    unsigned int flags);

Description

Opens a CAN channel (circuit) and returns a handle which is used in subsequent calls to CANLIB.

Parameters

channelNumber
The number of the channel. Channel numbering is hardware dependent.
flags
A combination of the following values:
canWANT_EXCLUSIVEDon't allow sharing of this circuit between applications.
canWANT_EXTENDED This flag causes two things to happen:
  • the call will fail if the specified circuit doesn't allow extended CAN (CAN 2.0B)
  • if no frame-type flag is specified in a call to canWrite, it is assumed that extended CAN should be used.
Return Value

Returns a handle to the opened circuit, or a negative error code (of type canStatus) if the call failed.

Note that the handle may be zero which is perfectly valid.

Notes

Channel numbering is dependent on the installed hardware.
If you have a single LAPcan, the channels are numbered 0 and 1.