2 * socketcan/can/isotp.h
4 * Definitions for isotp CAN sockets
8 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
9 * Copyright (c) 2008 Volkswagen Group Electronic Research
10 * All rights reserved.
12 * Send feedback to <socketcan-users@lists.berlios.de>
19 #include <socketcan/can.h>
21 #define SOL_CAN_ISOTP (SOL_CAN_BASE + CAN_ISOTP)
23 /* for socket options affecting the socket (not the global system) */
25 #define CAN_ISOTP_OPTS 1
26 #define CAN_ISOTP_RECV_FC 2
28 struct can_isotp_options {
30 __u32 flags; /* set flags for isotp behaviour. */
31 /* __u32 value : flags see below */
33 __u32 frame_txtime; /* frame transmission time (N_As/N_Ar) */
34 /* __u32 value : time in nano secs */
36 __u8 ext_address; /* set address for extended addressing */
37 /* __u8 value : extended address */
39 __u8 txpad_content; /* set content of padding byte (tx) */
40 /* __u8 value : content on tx path */
42 __u8 rxpad_content; /* set content of padding byte (rx) */
43 /* __u8 value : content on rx path */
46 struct can_isotp_fc_options {
48 __u8 bs; /* blocksize provided in FC frame */
49 /* __u8 value : blocksize. 0 = off */
51 __u8 stmin; /* separation time provided in FC frame */
53 /* 0x00 - 0x7F : 0 - 127 ms */
54 /* 0x80 - 0xF0 : reserved */
55 /* 0xF1 - 0xF9 : 100 us - 900 us */
56 /* 0xFA - 0xFF : reserved */
58 __u8 wftmax; /* max. number of wait frame transmiss. */
59 /* __u8 value : 0 = omit FC N_PDU WT */
63 /* flags for isotp behaviour */
65 #define CAN_ISOTP_LISTEN_MODE 0x01 /* listen only (do not send FC) */
66 #define CAN_ISOTP_EXTEND_ADDR 0x02 /* enable extended addressing */
67 #define CAN_ISOTP_TX_PADDING 0x04 /* enable CAN frame padding tx path */
68 #define CAN_ISOTP_RX_PADDING 0x08 /* enable CAN frame padding rx path */
69 #define CAN_ISOTP_CHK_PAD_LEN 0x10 /* check received CAN frame padding */
70 #define CAN_ISOTP_CHK_PAD_DATA 0x20 /* check received CAN frame padding */
71 #define CAN_ISOTP_HALF_DUPLEX 0x40 /* half duplex error state handling */
76 #define CAN_ISOTP_DEFAULT_FLAGS 0
77 #define CAN_ISOTP_DEFAULT_EXT_ADDRESS 0x00
78 #define CAN_ISOTP_DEFAULT_RXPAD_CONTENT 0x00
79 #define CAN_ISOTP_DEFAULT_TXPAD_CONTENT 0x00
80 #define CAN_ISOTP_DEFAULT_FRAME_TXTIME 0
81 #define CAN_ISOTP_DEFAULT_RECV_BS 0
82 #define CAN_ISOTP_DEFAULT_RECV_STMIN 0x00
83 #define CAN_ISOTP_DEFAULT_RECV_WFTMAX 0
86 * Remark on CAN_ISOTP_DEFAULT_RECV_* values:
88 * We can strongly assume, that the Linux Kernel implementation of
89 * CAN_ISOTP is capable to run with BS=0, STmin=0 and WFTmax=0.
90 * But as we like to be able to behave as a commonly available ECU,
91 * these default settings can be changed via sockopts.
92 * For that reason the STmin value is intentionally _not_ checked for
93 * consistency and copied directly into the flow control (FC) frame.