Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/linux
File: can.h
/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
[0] Fix | Delete
/*
[1] Fix | Delete
* linux/can.h
[2] Fix | Delete
*
[3] Fix | Delete
* Definitions for CAN network layer (socket addr / CAN frame / CAN filter)
[4] Fix | Delete
*
[5] Fix | Delete
* Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
[6] Fix | Delete
* Urs Thuermann <urs.thuermann@volkswagen.de>
[7] Fix | Delete
* Copyright (c) 2002-2007 Volkswagen Group Electronic Research
[8] Fix | Delete
* All rights reserved.
[9] Fix | Delete
*
[10] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[11] Fix | Delete
* modification, are permitted provided that the following conditions
[12] Fix | Delete
* are met:
[13] Fix | Delete
* 1. Redistributions of source code must retain the above copyright
[14] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[15] Fix | Delete
* 2. Redistributions in binary form must reproduce the above copyright
[16] Fix | Delete
* notice, this list of conditions and the following disclaimer in the
[17] Fix | Delete
* documentation and/or other materials provided with the distribution.
[18] Fix | Delete
* 3. Neither the name of Volkswagen nor the names of its contributors
[19] Fix | Delete
* may be used to endorse or promote products derived from this software
[20] Fix | Delete
* without specific prior written permission.
[21] Fix | Delete
*
[22] Fix | Delete
* Alternatively, provided that this notice is retained in full, this
[23] Fix | Delete
* software may be distributed under the terms of the GNU General
[24] Fix | Delete
* Public License ("GPL") version 2, in which case the provisions of the
[25] Fix | Delete
* GPL apply INSTEAD OF those given above.
[26] Fix | Delete
*
[27] Fix | Delete
* The provided data structures and external interfaces from this code
[28] Fix | Delete
* are not restricted to be used by modules with a GPL compatible license.
[29] Fix | Delete
*
[30] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
[31] Fix | Delete
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
[32] Fix | Delete
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
[33] Fix | Delete
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
[34] Fix | Delete
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
[35] Fix | Delete
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
[36] Fix | Delete
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
[37] Fix | Delete
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
[38] Fix | Delete
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
[39] Fix | Delete
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
[40] Fix | Delete
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
[41] Fix | Delete
* DAMAGE.
[42] Fix | Delete
*/
[43] Fix | Delete
[44] Fix | Delete
#ifndef _CAN_H
[45] Fix | Delete
#define _CAN_H
[46] Fix | Delete
[47] Fix | Delete
#include <linux/types.h>
[48] Fix | Delete
#include <linux/socket.h>
[49] Fix | Delete
[50] Fix | Delete
/* controller area network (CAN) kernel definitions */
[51] Fix | Delete
[52] Fix | Delete
/* special address description flags for the CAN_ID */
[53] Fix | Delete
#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
[54] Fix | Delete
#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
[55] Fix | Delete
#define CAN_ERR_FLAG 0x20000000U /* error message frame */
[56] Fix | Delete
[57] Fix | Delete
/* valid bits in CAN ID for frame formats */
[58] Fix | Delete
#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
[59] Fix | Delete
#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
[60] Fix | Delete
#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */
[61] Fix | Delete
[62] Fix | Delete
/*
[63] Fix | Delete
* Controller Area Network Identifier structure
[64] Fix | Delete
*
[65] Fix | Delete
* bit 0-28 : CAN identifier (11/29 bit)
[66] Fix | Delete
* bit 29 : error message frame flag (0 = data frame, 1 = error message)
[67] Fix | Delete
* bit 30 : remote transmission request flag (1 = rtr frame)
[68] Fix | Delete
* bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
[69] Fix | Delete
*/
[70] Fix | Delete
typedef __u32 canid_t;
[71] Fix | Delete
[72] Fix | Delete
#define CAN_SFF_ID_BITS 11
[73] Fix | Delete
#define CAN_EFF_ID_BITS 29
[74] Fix | Delete
[75] Fix | Delete
/*
[76] Fix | Delete
* Controller Area Network Error Message Frame Mask structure
[77] Fix | Delete
*
[78] Fix | Delete
* bit 0-28 : error class mask (see include/linux/can/error.h)
[79] Fix | Delete
* bit 29-31 : set to zero
[80] Fix | Delete
*/
[81] Fix | Delete
typedef __u32 can_err_mask_t;
[82] Fix | Delete
[83] Fix | Delete
/* CAN payload length and DLC definitions according to ISO 11898-1 */
[84] Fix | Delete
#define CAN_MAX_DLC 8
[85] Fix | Delete
#define CAN_MAX_DLEN 8
[86] Fix | Delete
[87] Fix | Delete
/* CAN FD payload length and DLC definitions according to ISO 11898-7 */
[88] Fix | Delete
#define CANFD_MAX_DLC 15
[89] Fix | Delete
#define CANFD_MAX_DLEN 64
[90] Fix | Delete
[91] Fix | Delete
/**
[92] Fix | Delete
* struct can_frame - basic CAN frame structure
[93] Fix | Delete
* @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition
[94] Fix | Delete
* @can_dlc: frame payload length in byte (0 .. 8) aka data length code
[95] Fix | Delete
* N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1
[96] Fix | Delete
* mapping of the 'data length code' to the real payload length
[97] Fix | Delete
* @__pad: padding
[98] Fix | Delete
* @__res0: reserved / padding
[99] Fix | Delete
* @__res1: reserved / padding
[100] Fix | Delete
* @data: CAN frame payload (up to 8 byte)
[101] Fix | Delete
*/
[102] Fix | Delete
struct can_frame {
[103] Fix | Delete
canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
[104] Fix | Delete
__u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */
[105] Fix | Delete
__u8 __pad; /* padding */
[106] Fix | Delete
__u8 __res0; /* reserved / padding */
[107] Fix | Delete
__u8 __res1; /* reserved / padding */
[108] Fix | Delete
__u8 data[CAN_MAX_DLEN] __attribute__((aligned(8)));
[109] Fix | Delete
};
[110] Fix | Delete
[111] Fix | Delete
/*
[112] Fix | Delete
* defined bits for canfd_frame.flags
[113] Fix | Delete
*
[114] Fix | Delete
* The use of struct canfd_frame implies the Extended Data Length (EDL) bit to
[115] Fix | Delete
* be set in the CAN frame bitstream on the wire. The EDL bit switch turns
[116] Fix | Delete
* the CAN controllers bitstream processor into the CAN FD mode which creates
[117] Fix | Delete
* two new options within the CAN FD frame specification:
[118] Fix | Delete
*
[119] Fix | Delete
* Bit Rate Switch - to indicate a second bitrate is/was used for the payload
[120] Fix | Delete
* Error State Indicator - represents the error state of the transmitting node
[121] Fix | Delete
*
[122] Fix | Delete
* As the CANFD_ESI bit is internally generated by the transmitting CAN
[123] Fix | Delete
* controller only the CANFD_BRS bit is relevant for real CAN controllers when
[124] Fix | Delete
* building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make
[125] Fix | Delete
* sense for virtual CAN interfaces to test applications with echoed frames.
[126] Fix | Delete
*/
[127] Fix | Delete
#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
[128] Fix | Delete
#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
[129] Fix | Delete
[130] Fix | Delete
/**
[131] Fix | Delete
* struct canfd_frame - CAN flexible data rate frame structure
[132] Fix | Delete
* @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition
[133] Fix | Delete
* @len: frame payload length in byte (0 .. CANFD_MAX_DLEN)
[134] Fix | Delete
* @flags: additional flags for CAN FD
[135] Fix | Delete
* @__res0: reserved / padding
[136] Fix | Delete
* @__res1: reserved / padding
[137] Fix | Delete
* @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte)
[138] Fix | Delete
*/
[139] Fix | Delete
struct canfd_frame {
[140] Fix | Delete
canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
[141] Fix | Delete
__u8 len; /* frame payload length in byte */
[142] Fix | Delete
__u8 flags; /* additional flags for CAN FD */
[143] Fix | Delete
__u8 __res0; /* reserved / padding */
[144] Fix | Delete
__u8 __res1; /* reserved / padding */
[145] Fix | Delete
__u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8)));
[146] Fix | Delete
};
[147] Fix | Delete
[148] Fix | Delete
#define CAN_MTU (sizeof(struct can_frame))
[149] Fix | Delete
#define CANFD_MTU (sizeof(struct canfd_frame))
[150] Fix | Delete
[151] Fix | Delete
/* particular protocols of the protocol family PF_CAN */
[152] Fix | Delete
#define CAN_RAW 1 /* RAW sockets */
[153] Fix | Delete
#define CAN_BCM 2 /* Broadcast Manager */
[154] Fix | Delete
#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */
[155] Fix | Delete
#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */
[156] Fix | Delete
#define CAN_MCNET 5 /* Bosch MCNet */
[157] Fix | Delete
#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */
[158] Fix | Delete
#define CAN_NPROTO 7
[159] Fix | Delete
[160] Fix | Delete
#define SOL_CAN_BASE 100
[161] Fix | Delete
[162] Fix | Delete
/**
[163] Fix | Delete
* struct sockaddr_can - the sockaddr structure for CAN sockets
[164] Fix | Delete
* @can_family: address family number AF_CAN.
[165] Fix | Delete
* @can_ifindex: CAN network interface index.
[166] Fix | Delete
* @can_addr: protocol specific address information
[167] Fix | Delete
*/
[168] Fix | Delete
struct sockaddr_can {
[169] Fix | Delete
__kernel_sa_family_t can_family;
[170] Fix | Delete
int can_ifindex;
[171] Fix | Delete
union {
[172] Fix | Delete
/* transport protocol class address information (e.g. ISOTP) */
[173] Fix | Delete
struct { canid_t rx_id, tx_id; } tp;
[174] Fix | Delete
[175] Fix | Delete
/* reserved for future CAN protocols address information */
[176] Fix | Delete
} can_addr;
[177] Fix | Delete
};
[178] Fix | Delete
[179] Fix | Delete
/**
[180] Fix | Delete
* struct can_filter - CAN ID based filter in can_register().
[181] Fix | Delete
* @can_id: relevant bits of CAN ID which are not masked out.
[182] Fix | Delete
* @can_mask: CAN mask (see description)
[183] Fix | Delete
*
[184] Fix | Delete
* Description:
[185] Fix | Delete
* A filter matches, when
[186] Fix | Delete
*
[187] Fix | Delete
* <received_can_id> & mask == can_id & mask
[188] Fix | Delete
*
[189] Fix | Delete
* The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
[190] Fix | Delete
* filter for error message frames (CAN_ERR_FLAG bit set in mask).
[191] Fix | Delete
*/
[192] Fix | Delete
struct can_filter {
[193] Fix | Delete
canid_t can_id;
[194] Fix | Delete
canid_t can_mask;
[195] Fix | Delete
};
[196] Fix | Delete
[197] Fix | Delete
#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
[198] Fix | Delete
#define CAN_RAW_FILTER_MAX 512 /* maximum number of can_filter set via setsockopt() */
[199] Fix | Delete
[200] Fix | Delete
#endif /* !_UAPI_CAN_H */
[201] Fix | Delete
[202] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function