Lely core libraries  2.3.4
ixxat.h File Reference
#include <lely/io2/can.h>
Include dependency graph for ixxat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int io_ixxat_init (void)
 Loads the "vcinpl.dll" or "vcinpl2.dll" library and makes the IXXAT functions available for use. More...
 
void io_ixxat_fini (void)
 Frees the "vcinpl.dll" or "vcinpl2.dll" library and terminates the availability of the IXXAT functions. More...
 
io_can_ctrl_tio_ixxat_ctrl_create_from_index (UINT32 dwIndex, UINT32 dwCanNo, int flags, int nominal, int data)
 Creates a new IXXAT CAN controller from a device index. More...
 
io_can_ctrl_tio_ixxat_ctrl_create_from_luid (const LUID *lpLuid, UINT32 dwCanNo, int flags, int nominal, int data)
 Creates a new IXXAT CAN controller from a locally unique identifier (LUID). More...
 
void io_ixxat_ctrl_destroy (io_can_ctrl_t *ctrl)
 Destroys an IXXAT CAN controller. More...
 
HANDLE io_ixxat_ctrl_get_handle (const io_can_ctrl_t *ctrl)
 Returns the native handle of the CAN controller.
 
io_can_chan_tio_ixxat_chan_create (io_ctx_t *ctx, ev_exec_t *exec, int rxtimeo, int txtimeo)
 Creates a new IXXAT CAN channel. More...
 
void io_ixxat_chan_destroy (io_can_chan_t *chan)
 Destroys an IXXAT CAN channel. More...
 
HANDLE io_ixxat_chan_get_handle (const io_can_chan_t *chan)
 Returns the native handle of the CAN channel, or NULL if the channel is closed.
 
int io_ixxat_chan_open (io_can_chan_t *chan, const io_can_ctrl_t *ctrl, UINT16 wRxFifoSize, UINT16 wTxFifoSize)
 Opens a CAN channel. More...
 
int io_ixxat_chan_assign (io_can_chan_t *chan, HANDLE hCanChn, UINT32 dwTscClkFreq, UINT32 dwTscDivisor)
 Assigns an existing handle to a CAN channel, and activates the channel if necessary. More...
 
HANDLE io_ixxat_chan_release (io_can_chan_t *chan)
 Dissociates and returns the native handle from a CAN channel. More...
 
int io_ixxat_chan_is_open (const io_can_chan_t *chan)
 Returns 1 is the CAN channel is open and 0 if not. More...
 
int io_ixxat_chan_close (io_can_chan_t *chan)
 Closes a CAN channel. More...
 

Detailed Description

This header file is part of the I/O library; it contains the IXXAT CAN bus declarations for Windows.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file ixxat.h.

Function Documentation

◆ io_ixxat_init()

int io_ixxat_init ( void  )

Loads the "vcinpl.dll" or "vcinpl2.dll" library and makes the IXXAT functions available for use.

This function is not thread-safe, but can be invoked multiple times, as long as it is matched by an equal number of calls to io_ixxat_fini().

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().

◆ io_ixxat_fini()

void io_ixxat_fini ( void  )

Frees the "vcinpl.dll" or "vcinpl2.dll" library and terminates the availability of the IXXAT functions.

Note that this function MUST be invoked once for each call to io_ixxat_init(). Only the last invocation will free the library.

◆ io_ixxat_ctrl_create_from_index()

io_can_ctrl_t* io_ixxat_ctrl_create_from_index ( UINT32  dwIndex,
UINT32  dwCanNo,
int  flags,
int  nominal,
int  data 
)

Creates a new IXXAT CAN controller from a device index.

Parameters
dwIndexthe index of the device in the list of fieldbus adapters registered with the VCI server.
dwCanNothe number of the CAN connection of the control unit to be opened.
flagsthe flags specifying which CAN bus features MUST be enabled (any combination of IO_CAN_BUS_FLAG_ERR, IO_CAN_BUS_FLAG_FDF and IO_CAN_BUS_FLAG_BRS).
nominalthe nominal bitrate. For the CAN FD protocol, this is the bit rate of the arbitration phase.
datathe data bitrate. This bit rate is only defined for the CAN FD protocol; the value is ignored otherwise.
Returns
a pointer to a new CAN controller, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
io_ixxat_ctrl_create_from_luid()

◆ io_ixxat_ctrl_create_from_luid()

io_can_ctrl_t* io_ixxat_ctrl_create_from_luid ( const LUID *  lpLuid,
UINT32  dwCanNo,
int  flags,
int  nominal,
int  data 
)

Creates a new IXXAT CAN controller from a locally unique identifier (LUID).

Parameters
lpLuida pointer to the locally unique identifier of the VCI device.
dwCanNothe number of the CAN connection of the control unit to be opened.
flagsthe flags specifying which CAN bus features MUST be enabled (any combination of IO_CAN_BUS_FLAG_ERR, IO_CAN_BUS_FLAG_FDF and IO_CAN_BUS_FLAG_BRS).
nominalthe nominal bitrate. For the CAN FD protocol, this is the bit rate of the arbitration phase.
datathe data bitrate. This bit rate is only defined for the CAN FD protocol; the value is ignored otherwise.
Returns
a pointer to a new CAN controller, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
io_ixxat_ctrl_create_from_index()

◆ io_ixxat_ctrl_destroy()

void io_ixxat_ctrl_destroy ( io_can_ctrl_t ctrl)

Destroys an IXXAT CAN controller.

See also
io_ixxat_ctrl_create())

◆ io_ixxat_chan_create()

io_can_chan_t* io_ixxat_chan_create ( io_ctx_t ctx,
ev_exec_t exec,
int  rxtimeo,
int  txtimeo 
)

Creates a new IXXAT CAN channel.

Parameters
ctxa pointer to the I/O context with which the channel should be registered.
execa pointer to the executor used to execute asynchronous tasks. These tasks including blocking read and write functions, the timeout of which can be specified with rxtimeo and txtimeo, respectively.
rxtimeothe timeout (in milliseconds) when waiting asynchronously for a CAN message to be read. If rxtimeo is 0, the default value LELY_IO_RX_TIMEOUT is used. If rxtimeo is negative, the read function will wait indefinitely.
txtimeothe timeout (in milliseconds) when waiting asynchronously for a CAN message to be written. If txtimeo is 0, the default value LELY_IO_TX_TIMEOUT is used. If txtimeo is negative, the write function will wait indefinitely.
Returns
a pointer to a new CAN channel, or NULL on error. In the latter case, the error number can be obtained with get_errc().

◆ io_ixxat_chan_destroy()

void io_ixxat_chan_destroy ( io_can_chan_t chan)

Destroys an IXXAT CAN channel.

See also
io_ixxat_chan_create()

◆ io_ixxat_chan_open()

int io_ixxat_chan_open ( io_can_chan_t chan,
const io_can_ctrl_t ctrl,
UINT16  wRxFifoSize,
UINT16  wTxFifoSize 
)

Opens a CAN channel.

If the channel was already open, it is first closed as if by io_ixxat_chan_close().

Parameters
chana pointer to an IXXAT CAN channel.
ctrla pointer to an IXXAT CAN controller.
wRxFifoSizethe size of the receive buffer (in number of frames). If wRxFifoSize is 0, the default value #LELY_IO_IXXAT_RX_FIFO_SIZE is used.
wTxFifoSizethe size of the transmit buffer (in number of frames). If wTxFifoSize is 0, the default value #LELY_IO_IXXAT_TX_FIFO_SIZE is used.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
Postcondition
on success, io_ixxat_chan_is_open() returns 1.

◆ io_ixxat_chan_assign()

int io_ixxat_chan_assign ( io_can_chan_t chan,
HANDLE  hCanChn,
UINT32  dwTscClkFreq,
UINT32  dwTscDivisor 
)

Assigns an existing handle to a CAN channel, and activates the channel if necessary.

If the channel was already open, it is first closed as if by io_ixxat_chan_close().

Parameters
chana pointer to an IXXAT CAN channel.
hCanChna handle to a native CAN channel.
dwTscClkFreqthe clock frequency of the time stamp counter (in Hz).
dwTscDivisorthe divisor for the message time stamp counter.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
Postcondition
on success, io_ixxat_chan_is_open() returns 1.

◆ io_ixxat_chan_release()

HANDLE io_ixxat_chan_release ( io_can_chan_t chan)

Dissociates and returns the native handle from a CAN channel.

Any pending read or write operations are canceled as if by io_can_chan_cancel_read() and io_can_chan_cancel_write().

Returns
a file descriptor, or -1 if the channel was closed.
Postcondition
io_ixxat_chan_is_open() returns 0.

◆ io_ixxat_chan_is_open()

int io_ixxat_chan_is_open ( const io_can_chan_t chan)

Returns 1 is the CAN channel is open and 0 if not.

This function is equivalent to io_ixxat_chan_get_handle(chan) != NULL.

◆ io_ixxat_chan_close()

int io_ixxat_chan_close ( io_can_chan_t chan)

Closes a CAN channel.

Any pending read or write operations are canceled as if by io_can_chan_cancel_read() and io_can_chan_cancel_write().

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
Postcondition
io_ixxat_chan_is_open() returns 0.