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