Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 /*
0003  * linux/can/bcm.h
0004  *
0005  * Definitions for CAN Broadcast Manager (BCM)
0006  *
0007  * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
0008  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
0009  * All rights reserved.
0010  *
0011  * Redistribution and use in source and binary forms, with or without
0012  * modification, are permitted provided that the following conditions
0013  * are met:
0014  * 1. Redistributions of source code must retain the above copyright
0015  *    notice, this list of conditions and the following disclaimer.
0016  * 2. Redistributions in binary form must reproduce the above copyright
0017  *    notice, this list of conditions and the following disclaimer in the
0018  *    documentation and/or other materials provided with the distribution.
0019  * 3. Neither the name of Volkswagen nor the names of its contributors
0020  *    may be used to endorse or promote products derived from this software
0021  *    without specific prior written permission.
0022  *
0023  * Alternatively, provided that this notice is retained in full, this
0024  * software may be distributed under the terms of the GNU General
0025  * Public License ("GPL") version 2, in which case the provisions of the
0026  * GPL apply INSTEAD OF those given above.
0027  *
0028  * The provided data structures and external interfaces from this code
0029  * are not restricted to be used by modules with a GPL compatible license.
0030  *
0031  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0032  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0033  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0034  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0035  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0036  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0037  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0038  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0039  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0040  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0041  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
0042  * DAMAGE.
0043  */
0044 
0045 #ifndef _UAPI_CAN_BCM_H
0046 #define _UAPI_CAN_BCM_H
0047 
0048 #include <linux/types.h>
0049 #include <linux/can.h>
0050 
0051 struct bcm_timeval {
0052     long tv_sec;
0053     long tv_usec;
0054 };
0055 
0056 /**
0057  * struct bcm_msg_head - head of messages to/from the broadcast manager
0058  * @opcode:    opcode, see enum below.
0059  * @flags:     special flags, see below.
0060  * @count:     number of frames to send before changing interval.
0061  * @ival1:     interval for the first @count frames.
0062  * @ival2:     interval for the following frames.
0063  * @can_id:    CAN ID of frames to be sent or received.
0064  * @nframes:   number of frames appended to the message head.
0065  * @frames:    array of CAN frames.
0066  */
0067 struct bcm_msg_head {
0068     __u32 opcode;
0069     __u32 flags;
0070     __u32 count;
0071     struct bcm_timeval ival1, ival2;
0072     canid_t can_id;
0073     __u32 nframes;
0074     struct can_frame frames[];
0075 };
0076 
0077 enum {
0078     TX_SETUP = 1,   /* create (cyclic) transmission task */
0079     TX_DELETE,  /* remove (cyclic) transmission task */
0080     TX_READ,    /* read properties of (cyclic) transmission task */
0081     TX_SEND,    /* send one CAN frame */
0082     RX_SETUP,   /* create RX content filter subscription */
0083     RX_DELETE,  /* remove RX content filter subscription */
0084     RX_READ,    /* read properties of RX content filter subscription */
0085     TX_STATUS,  /* reply to TX_READ request */
0086     TX_EXPIRED, /* notification on performed transmissions (count=0) */
0087     RX_STATUS,  /* reply to RX_READ request */
0088     RX_TIMEOUT, /* cyclic message is absent */
0089     RX_CHANGED  /* updated CAN frame (detected content change) */
0090 };
0091 
0092 #define SETTIMER            0x0001
0093 #define STARTTIMER          0x0002
0094 #define TX_COUNTEVT         0x0004
0095 #define TX_ANNOUNCE         0x0008
0096 #define TX_CP_CAN_ID        0x0010
0097 #define RX_FILTER_ID        0x0020
0098 #define RX_CHECK_DLC        0x0040
0099 #define RX_NO_AUTOTIMER     0x0080
0100 #define RX_ANNOUNCE_RESUME  0x0100
0101 #define TX_RESET_MULTI_IDX  0x0200
0102 #define RX_RTR_FRAME        0x0400
0103 #define CAN_FD_FRAME        0x0800
0104 
0105 #endif /* !_UAPI_CAN_BCM_H */