]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/include/socketcan/can/isotp.h
361dc300cf5747b968320838eefddc547fce4292
[socketcan-devel.git] / kernel / 2.6 / include / socketcan / can / isotp.h
1 /*
2  * socketcan/can/isotp.h
3  *
4  * Definitions for isotp CAN sockets
5  *
6  * $Id$
7  *
8  * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
9  * Copyright (c) 2008 Volkswagen Group Electronic Research
10  * All rights reserved.
11  *
12  * Send feedback to <socketcan-users@lists.berlios.de>
13  *
14  */
15
16 #ifndef CAN_ISOTP_H
17 #define CAN_ISOTP_H
18
19 #include <socketcan/can.h>
20
21 #define SOL_CAN_ISOTP (SOL_CAN_BASE + CAN_ISOTP)
22
23 /* for socket options affecting the socket (not the global system) */
24
25 #define CAN_ISOTP_OPTS          1
26 #define CAN_ISOTP_RECV_FC       2
27
28 struct can_isotp_options {
29
30         __u32 flags;            /* set flags for isotp behaviour.       */
31                                 /* __u32 value : flags see below        */
32
33         __u32 frame_txtime;     /* frame transmission time (N_As/N_Ar)  */
34                                 /* __u32 value : time in nano secs      */
35
36         __u8  ext_address;      /* set address for extended addressing  */
37                                 /* __u8 value : extended address        */
38
39         __u8  txpad_content;    /* set content of padding byte (tx)     */
40                                 /* __u8 value : content on tx path      */
41
42         __u8  rxpad_content;    /* set content of padding byte (rx)     */
43                                 /* __u8 value : content on rx path      */
44 };
45
46 struct can_isotp_fc_options {
47
48         __u8  bs;               /* blocksize provided in FC frame       */
49                                 /* __u8 value : blocksize. 0 = off      */
50
51         __u8  stmin;            /* separation time provided in FC frame */
52                                 /* __u8 value :                         */
53                                 /* 0x00 - 0x7F : 0 - 127 ms             */
54                                 /* 0x80 - 0xF0 : reserved               */
55                                 /* 0xF1 - 0xF9 : 100 us - 900 us        */
56                                 /* 0xFA - 0xFF : reserved               */
57
58         __u8  wftmax;           /* max. number of wait frame transmiss. */
59                                 /* __u8 value : 0 = omit FC N_PDU WT    */
60 };
61
62
63 /* flags for isotp behaviour */
64
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 */
72
73
74 /* default values */
75
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
84
85 /*
86  * Remark on CAN_ISOTP_DEFAULT_RECV_* values:
87  *
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.
94  *
95  */
96
97 #endif