13926a3a0SYegor Yefremov /* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */ 2922cd657SDavid Howells /* 3922cd657SDavid Howells * linux/can/bcm.h 4922cd657SDavid Howells * 5922cd657SDavid Howells * Definitions for CAN Broadcast Manager (BCM) 6922cd657SDavid Howells * 7922cd657SDavid Howells * Author: Oliver Hartkopp <[email protected]> 8922cd657SDavid Howells * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 9922cd657SDavid Howells * All rights reserved. 10922cd657SDavid Howells * 112485602fSUwe Kleine-König * Redistribution and use in source and binary forms, with or without 122485602fSUwe Kleine-König * modification, are permitted provided that the following conditions 132485602fSUwe Kleine-König * are met: 142485602fSUwe Kleine-König * 1. Redistributions of source code must retain the above copyright 152485602fSUwe Kleine-König * notice, this list of conditions and the following disclaimer. 162485602fSUwe Kleine-König * 2. Redistributions in binary form must reproduce the above copyright 172485602fSUwe Kleine-König * notice, this list of conditions and the following disclaimer in the 182485602fSUwe Kleine-König * documentation and/or other materials provided with the distribution. 192485602fSUwe Kleine-König * 3. Neither the name of Volkswagen nor the names of its contributors 202485602fSUwe Kleine-König * may be used to endorse or promote products derived from this software 212485602fSUwe Kleine-König * without specific prior written permission. 222485602fSUwe Kleine-König * 232485602fSUwe Kleine-König * Alternatively, provided that this notice is retained in full, this 242485602fSUwe Kleine-König * software may be distributed under the terms of the GNU General 252485602fSUwe Kleine-König * Public License ("GPL") version 2, in which case the provisions of the 262485602fSUwe Kleine-König * GPL apply INSTEAD OF those given above. 272485602fSUwe Kleine-König * 282485602fSUwe Kleine-König * The provided data structures and external interfaces from this code 292485602fSUwe Kleine-König * are not restricted to be used by modules with a GPL compatible license. 302485602fSUwe Kleine-König * 312485602fSUwe Kleine-König * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 322485602fSUwe Kleine-König * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 332485602fSUwe Kleine-König * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 342485602fSUwe Kleine-König * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 352485602fSUwe Kleine-König * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 362485602fSUwe Kleine-König * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 372485602fSUwe Kleine-König * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 382485602fSUwe Kleine-König * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 392485602fSUwe Kleine-König * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 402485602fSUwe Kleine-König * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 412485602fSUwe Kleine-König * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 422485602fSUwe Kleine-König * DAMAGE. 43922cd657SDavid Howells */ 44922cd657SDavid Howells 4542193e3eSOliver Hartkopp #ifndef _UAPI_CAN_BCM_H 4642193e3eSOliver Hartkopp #define _UAPI_CAN_BCM_H 47922cd657SDavid Howells 48922cd657SDavid Howells #include <linux/types.h> 49922cd657SDavid Howells #include <linux/can.h> 50922cd657SDavid Howells 51ba61a8d9SArnd Bergmann struct bcm_timeval { 52ba61a8d9SArnd Bergmann long tv_sec; 53ba61a8d9SArnd Bergmann long tv_usec; 54ba61a8d9SArnd Bergmann }; 55ba61a8d9SArnd Bergmann 56922cd657SDavid Howells /** 57922cd657SDavid Howells * struct bcm_msg_head - head of messages to/from the broadcast manager 58922cd657SDavid Howells * @opcode: opcode, see enum below. 59922cd657SDavid Howells * @flags: special flags, see below. 60922cd657SDavid Howells * @count: number of frames to send before changing interval. 61922cd657SDavid Howells * @ival1: interval for the first @count frames. 62922cd657SDavid Howells * @ival2: interval for the following frames. 63922cd657SDavid Howells * @can_id: CAN ID of frames to be sent or received. 64922cd657SDavid Howells * @nframes: number of frames appended to the message head. 65922cd657SDavid Howells * @frames: array of CAN frames. 66922cd657SDavid Howells */ 67922cd657SDavid Howells struct bcm_msg_head { 68922cd657SDavid Howells __u32 opcode; 69922cd657SDavid Howells __u32 flags; 70922cd657SDavid Howells __u32 count; 71ba61a8d9SArnd Bergmann struct bcm_timeval ival1, ival2; 72922cd657SDavid Howells canid_t can_id; 73922cd657SDavid Howells __u32 nframes; 74*94dfc73eSGustavo A. R. Silva struct can_frame frames[]; 75922cd657SDavid Howells }; 76922cd657SDavid Howells 77922cd657SDavid Howells enum { 78922cd657SDavid Howells TX_SETUP = 1, /* create (cyclic) transmission task */ 79922cd657SDavid Howells TX_DELETE, /* remove (cyclic) transmission task */ 80922cd657SDavid Howells TX_READ, /* read properties of (cyclic) transmission task */ 81922cd657SDavid Howells TX_SEND, /* send one CAN frame */ 82922cd657SDavid Howells RX_SETUP, /* create RX content filter subscription */ 83922cd657SDavid Howells RX_DELETE, /* remove RX content filter subscription */ 84922cd657SDavid Howells RX_READ, /* read properties of RX content filter subscription */ 85922cd657SDavid Howells TX_STATUS, /* reply to TX_READ request */ 86922cd657SDavid Howells TX_EXPIRED, /* notification on performed transmissions (count=0) */ 87922cd657SDavid Howells RX_STATUS, /* reply to RX_READ request */ 88922cd657SDavid Howells RX_TIMEOUT, /* cyclic message is absent */ 89922cd657SDavid Howells RX_CHANGED /* updated CAN frame (detected content change) */ 90922cd657SDavid Howells }; 91922cd657SDavid Howells 92922cd657SDavid Howells #define SETTIMER 0x0001 93922cd657SDavid Howells #define STARTTIMER 0x0002 94922cd657SDavid Howells #define TX_COUNTEVT 0x0004 95922cd657SDavid Howells #define TX_ANNOUNCE 0x0008 96922cd657SDavid Howells #define TX_CP_CAN_ID 0x0010 97922cd657SDavid Howells #define RX_FILTER_ID 0x0020 98922cd657SDavid Howells #define RX_CHECK_DLC 0x0040 99922cd657SDavid Howells #define RX_NO_AUTOTIMER 0x0080 100922cd657SDavid Howells #define RX_ANNOUNCE_RESUME 0x0100 101922cd657SDavid Howells #define TX_RESET_MULTI_IDX 0x0200 102922cd657SDavid Howells #define RX_RTR_FRAME 0x0400 1036f3b911dSOliver Hartkopp #define CAN_FD_FRAME 0x0800 104922cd657SDavid Howells 10542193e3eSOliver Hartkopp #endif /* !_UAPI_CAN_BCM_H */ 106