1 |
13 |
serginhofr |
/*
|
2 |
|
|
* linux/can/bcm.h
|
3 |
|
|
*
|
4 |
|
|
* Definitions for CAN Broadcast Manager (BCM)
|
5 |
|
|
*
|
6 |
|
|
* Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
|
7 |
|
|
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
|
8 |
|
|
* All rights reserved.
|
9 |
|
|
*
|
10 |
|
|
* Redistribution and use in source and binary forms, with or without
|
11 |
|
|
* modification, are permitted provided that the following conditions
|
12 |
|
|
* are met:
|
13 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
14 |
|
|
* notice, this list of conditions and the following disclaimer.
|
15 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
16 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
17 |
|
|
* documentation and/or other materials provided with the distribution.
|
18 |
|
|
* 3. Neither the name of Volkswagen nor the names of its contributors
|
19 |
|
|
* may be used to endorse or promote products derived from this software
|
20 |
|
|
* without specific prior written permission.
|
21 |
|
|
*
|
22 |
|
|
* Alternatively, provided that this notice is retained in full, this
|
23 |
|
|
* software may be distributed under the terms of the GNU General
|
24 |
|
|
* Public License ("GPL") version 2, in which case the provisions of the
|
25 |
|
|
* GPL apply INSTEAD OF those given above.
|
26 |
|
|
*
|
27 |
|
|
* The provided data structures and external interfaces from this code
|
28 |
|
|
* are not restricted to be used by modules with a GPL compatible license.
|
29 |
|
|
*
|
30 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
31 |
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
32 |
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
33 |
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
34 |
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
35 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
36 |
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
37 |
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
38 |
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
39 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
40 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
41 |
|
|
* DAMAGE.
|
42 |
|
|
*/
|
43 |
|
|
|
44 |
|
|
#ifndef CAN_BCM_H
|
45 |
|
|
#define CAN_BCM_H
|
46 |
|
|
|
47 |
|
|
#include <linux/types.h>
|
48 |
|
|
#include <linux/can.h>
|
49 |
|
|
|
50 |
|
|
/**
|
51 |
|
|
* struct bcm_msg_head - head of messages to/from the broadcast manager
|
52 |
|
|
* @opcode: opcode, see enum below.
|
53 |
|
|
* @flags: special flags, see below.
|
54 |
|
|
* @count: number of frames to send before changing interval.
|
55 |
|
|
* @ival1: interval for the first @count frames.
|
56 |
|
|
* @ival2: interval for the following frames.
|
57 |
|
|
* @can_id: CAN ID of frames to be sent or received.
|
58 |
|
|
* @nframes: number of frames appended to the message head.
|
59 |
|
|
* @frames: array of CAN frames.
|
60 |
|
|
*/
|
61 |
|
|
struct bcm_msg_head {
|
62 |
|
|
__u32 opcode;
|
63 |
|
|
__u32 flags;
|
64 |
|
|
__u32 count;
|
65 |
|
|
struct timeval ival1, ival2;
|
66 |
|
|
canid_t can_id;
|
67 |
|
|
__u32 nframes;
|
68 |
|
|
struct can_frame frames[0];
|
69 |
|
|
};
|
70 |
|
|
|
71 |
|
|
enum {
|
72 |
|
|
TX_SETUP = 1, /* create (cyclic) transmission task */
|
73 |
|
|
TX_DELETE, /* remove (cyclic) transmission task */
|
74 |
|
|
TX_READ, /* read properties of (cyclic) transmission task */
|
75 |
|
|
TX_SEND, /* send one CAN frame */
|
76 |
|
|
RX_SETUP, /* create RX content filter subscription */
|
77 |
|
|
RX_DELETE, /* remove RX content filter subscription */
|
78 |
|
|
RX_READ, /* read properties of RX content filter subscription */
|
79 |
|
|
TX_STATUS, /* reply to TX_READ request */
|
80 |
|
|
TX_EXPIRED, /* notification on performed transmissions (count=0) */
|
81 |
|
|
RX_STATUS, /* reply to RX_READ request */
|
82 |
|
|
RX_TIMEOUT, /* cyclic message is absent */
|
83 |
|
|
RX_CHANGED /* updated CAN frame (detected content change) */
|
84 |
|
|
};
|
85 |
|
|
|
86 |
|
|
#define SETTIMER 0x0001
|
87 |
|
|
#define STARTTIMER 0x0002
|
88 |
|
|
#define TX_COUNTEVT 0x0004
|
89 |
|
|
#define TX_ANNOUNCE 0x0008
|
90 |
|
|
#define TX_CP_CAN_ID 0x0010
|
91 |
|
|
#define RX_FILTER_ID 0x0020
|
92 |
|
|
#define RX_CHECK_DLC 0x0040
|
93 |
|
|
#define RX_NO_AUTOTIMER 0x0080
|
94 |
|
|
#define RX_ANNOUNCE_RESUME 0x0100
|
95 |
|
|
#define TX_RESET_MULTI_IDX 0x0200
|
96 |
|
|
#define RX_RTR_FRAME 0x0400
|
97 |
|
|
|
98 |
|
|
#endif /* CAN_BCM_H */
|