
71 RSB-4210 User Manual
Chapter 3 Software Functionality
close(fd);
printf("test exit\n");
return 0;
}
(More detail please reference "source/linux-2.6.35.3/Documentation/serial/tty.txt")
3.11.4 CAN bus
CAN bus is a set of open source CAN drivers and a networking stack contributed by
Volkswagen Research to the Linux kernel. Formerly known as Low Level CAN
Framework (LLCF).
Typical CAN communication layers. With SocketCAN (left) or conventional (right).
Traditional CAN drivers for Linux are based on the model of character devices. Typi-
cally they only allow sending to and receiving from the CAN controller. Conventional
implementations of this class of device driver only allow a single process to access
the device, which means that all other processes are blocked in the meantime. In
addition, these drivers typically all differ slightly in the interface presented to the
application, stifling portability. The SocketCAN concept on the other hand uses the
model of network devices, which allows multiple applications to access one CAN
device simultaneously. Also, a single application is able to access multiple CAN net-
works in parallel.
The application first sets up its access to the CAN interface by initialising a socket
(much like in TCP/IP communications), then binding that socket to an interface (or all
interfaces, if the application so desires). Once bound, the socket can then be used
like a UDP socket via read, write, etc...
The following is a simple (incomplete) example, that sends a packet, then reads back
a packet using the raw interface. It is based on the notes documented in the Linux
Kernel.
#include <can_config.h>
#include <getopt.h>
#include <li/jointfilesconvert/402216/bgen.h>
Comentarios a estos manuales