Main Page   Data Structures   File List   Data Fields   Globals  

can4linx - CAN network device driver

The LINUX CAN driver can be used to control the CAN bus connected with the AT-CAN-MINI PC interface card. This project was done in cooperation with the LINUX LLP Project to control laboratory or automation devices via CAN.

The full featured can4linux supports many different interface boards. It is possible to use different kinds of boards at the same time. Up to four boards can be placed in one computer. With this feature it is possible to use /dev/can0 and /dev/can2 for two boards AT-CAN-MINI with SJA1000 and /dev/can1 and /dev/can3 with two CPC-XT equipped with Intel 82527. In all these configurations the programmer sees the same driver interface with open(), close(), read(), write() and ioctl() calls ( can_open(), can_close(), can_read(), can_write(), can_ioctl() ).

The driver itself is highly configurable using the /proc interface of the LINUX kernel.

The following listing shows a typical configuration with three boards:

$ grep . /proc/sys/Can/\*
/proc/sys/Can/AccCode:  -1       -1      -1      -1
/proc/sys/Can/AccMask:  -1       -1      -1      -1
/proc/sys/Can/Base:     800      672     832     896
/proc/sys/Can/Baud:     125      125     125     250
/proc/sys/Can/Chipset:  82c200   82c200  82c200  none
/proc/sys/Can/ExtID:    nnnn 
/proc/sys/Can/IOModel:  pppp
/proc/sys/Can/IRQ:      5     7       3       5
/proc/sys/Can/Outc:     0     0       250     0
/proc/sys/Can/Overrun:  0     0       0       0
/proc/sys/Can/RxErr:    0     0       0       0
/proc/sys/Can/Timeout:  100   100     100     100
/proc/sys/Can/TxErr:    0     0       0       0
/proc/sys/Can/TxSpeed:  ffff
/proc/sys/Can/VendOpt:  nnnn
/proc/sys/Can/dbgMask:  0
/proc/sys/Can/version:  2.3

This above mentioned full flexibility is not needed in embedded applications. For this applications, a stripped-down version exists. It uses the same programming interface but does the most configurations at compile time. That means especially that only one CAN controller support with a special register access method is compiled into the driver. Actually the only CAN controller supported by this version is the Philips SJA 1000 in both the compatibility mode BasicCAN and the Philips \PeliCAN mode (compile time selectable).

The following sections are describing the sysctl entries.

AccCode/AccMask
contents of the message acceptance mask and acceptance code registers of 82x200/SJA1000 compatible CAN controllers (see can_ioctl()).
Base
CAN controllers base address for each board. Depending of the IOModel entry that can be a memory or I/O address. (read-only for PCI boards)
Baud
used bit rate for this board
Chipset
name of the used CAN chip for this board. Read only for this version.
ExtID
compatibility entry, formerly (used for Intel 82527 compatible in can4linux 1.x). Selects the usage of extended CAN Ids.
IOModel
one letter for each port. Set the CAN register access model. The following models are currently supported:
IRQ
used IRQ numbers, one value for each board. (read-only for PCI boards)
Outc
value of the output control register of the CAN controller
Overrun
counter for overrun conditions in the CAN controller
RxErr
counter for CAN controller rx error conditions
Timeout
time out value for waiting for a successful transmission
TxErr
counter for CAN controller tx error conditions
TxSpeed
flag for f fast (use tx interrupts) or s slow
VendOpt
vendor specific flag for each board. Not supported with this version.
dbgMask
if compiled with debugging support, writing a value greater then 0 enables debugging to syslogd
version
read only entry containing the drivers version number
Please see also at can_ioctl() for some additional descriptions.

For initially writing these sysctl entries after loading the driver (or at any time) a shell script utility does exist. It uses a board configuration file that is written over /proc/sys/Can .

utils/cansetup port.conf
or, like used in the Makefile:
CONFIG := $(shell uname -n)

# load host specific CAN configuration
load:
        @echo "Loading etc/$(CONFIG).conf CAN configuration"
        utils/cansetup etc/$(CONFIG).conf
        echo 0 >/proc/sys/Can/dbgMask
Example *.conf files are located in the etc/ directory.

Note:
This documentation was created using the wonderful tool Doxygen http://www.doxygen.org/index.html . Die Dokumentation wurde unter Verwendung von Doxygen http://www.doxygen.org/index.html erstellt

Generated at Die Aug 20 08:08:32 CEST 2002 CAN driver can4linux by port GmbH service@port.de , © 1997-2001