CrossCore XA
Revision: 1.0
Programmers Guide
Date: Jul 1, 10
3.2.
Summary of data types
The following data types are needed to access SocketCAN interface from user application. Note that
this list is only partial set of all socket features.
SocketCAN uses its own protocol family PF_CAN coexisting with others like PF_INET.
Communication is done analogue to the use of Internet Protocol via Sockets. The protocol family
provide the structures to enable different protocols on the bus.
CrossCore XA module support by default raw sockets for direct communication and broadcast
manager (bcm) for sending messages periodically or realizing complex message filters.
Definitions for particular protocols of the protocol family PF_CAN:
Define
Description
CAN_RAW
Raw sockets
CAN_BCM
Broadcast manager
CAN_TP16
VAG transport protocol v1.6
CAN_TP20
VAG transport protocol v2.0
CAN_MCNET
Bosch MCNet
CAN_ISOTP
ISO 15765-2
Enum value defining raw socket protocol level options for setsockopt:
Define
Description
CAN_RAW_FILTER = 1
Set 0..n can_filter(s)
CAN_RAW_ERR_FILTER
Set filter for error frames
CAN_RAW_LOOPBACK
Set local loopback (echo,
default: on)
CAN_RAW_RECV_OWN_MSGS
Set receiving of own messages
(default: off)
For socket level options to use with setsockopt, see sys/socket.h.
Definitions for CAN_ID description flags:
Define
Description
CAN_EFF_FLAG
Extended identifier flag is set
CAN_RTR_FLAG
Remote transmission request
CAN_ERR_FLAG
Error frame
The interface uses following struct to transfer data to and from the driver:
struct
can_frame {
canid_t can_id;
/* 32 bit EFF/RTR/ERR flags */
__u8 can_dlc;
/* data length code: 0 .. 8 */
__u8 data[8] __attribute__((aligned(8)));
/* payload */
};
www.crosscontrol.com
11