From a32bb562cafdb3184823fcd32c395d841c1b21d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20G=C3=BCntner?= Date: Sat, 18 Nov 2023 17:54:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5:=20remove=20support=20for=20Linux?= =?UTF-8?q?=20<=203.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 13 --- include/linux/can.h | 194 ---------------------------------- include/linux/can/bcm.h | 98 ----------------- include/linux/can/error.h | 123 ---------------------- include/linux/can/gw.h | 203 ------------------------------------ include/linux/can/netlink.h | 135 ------------------------ include/linux/can/raw.h | 62 ----------- 7 files changed, 828 deletions(-) delete mode 100644 include/linux/can.h delete mode 100644 include/linux/can/bcm.h delete mode 100644 include/linux/can/error.h delete mode 100644 include/linux/can/gw.h delete mode 100644 include/linux/can/netlink.h delete mode 100644 include/linux/can/raw.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d8b371..08a20a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,19 +20,6 @@ if(NOT SCTP_FOUND AND SCTP_SUPPORT) message(STATUS "Install lksctp-tools for SCTP.") endif(NOT SCTP_FOUND AND SCTP_SUPPORT) -find_file(LINUX_VERSION_H "linux/version.h") -if(LINUX_VERSION_H) - execute_process( - COMMAND sed -n "s/#define\\s\\+LINUX_VERSION_CODE\\s\\+\\([0-9]\\+\\)/\\1/p" ${LINUX_VERSION_H} - OUTPUT_VARIABLE LINUX_VERSION_CODE - ) - if(LINUX_VERSION_CODE LESS 198144) - # The Linux Kernel headers are older than version 3.6 - # We need to use the ones shipped with cannelloni - include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include) - endif() -endif() - CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h diff --git a/include/linux/can.h b/include/linux/can.h deleted file mode 100644 index d9ba97f..0000000 --- a/include/linux/can.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * linux/can.h - * - * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) - * - * Authors: Oliver Hartkopp - * Urs Thuermann - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Volkswagen nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * Alternatively, provided that this notice is retained in full, this - * software may be distributed under the terms of the GNU General - * Public License ("GPL") version 2, in which case the provisions of the - * GPL apply INSTEAD OF those given above. - * - * The provided data structures and external interfaces from this code - * are not restricted to be used by modules with a GPL compatible license. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef _CAN_H -#define _CAN_H - -#include -#include - -/* controller area network (CAN) kernel definitions */ - -/* special address description flags for the CAN_ID */ -#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ -#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ -#define CAN_ERR_FLAG 0x20000000U /* error message frame */ - -/* valid bits in CAN ID for frame formats */ -#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ -#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ -#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ - -/* - * Controller Area Network Identifier structure - * - * bit 0-28 : CAN identifier (11/29 bit) - * bit 29 : error message frame flag (0 = data frame, 1 = error message) - * bit 30 : remote transmission request flag (1 = rtr frame) - * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) - */ -typedef __u32 canid_t; - -#define CAN_SFF_ID_BITS 11 -#define CAN_EFF_ID_BITS 29 - -/* - * Controller Area Network Error Message Frame Mask structure - * - * bit 0-28 : error class mask (see include/linux/can/error.h) - * bit 29-31 : set to zero - */ -typedef __u32 can_err_mask_t; - -/* CAN payload length and DLC definitions according to ISO 11898-1 */ -#define CAN_MAX_DLC 8 -#define CAN_MAX_DLEN 8 - -/* CAN FD payload length and DLC definitions according to ISO 11898-7 */ -#define CANFD_MAX_DLC 15 -#define CANFD_MAX_DLEN 64 - -/** - * struct can_frame - basic CAN frame structure - * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition - * @can_dlc: frame payload length in byte (0 .. 8) aka data length code - * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 - * mapping of the 'data length code' to the real payload length - * @data: CAN frame payload (up to 8 byte) - */ -struct can_frame { - canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ - __u8 can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ - __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8))); -}; - -/* - * defined bits for canfd_frame.flags - * - * The use of struct canfd_frame implies the Extended Data Length (EDL) bit to - * be set in the CAN frame bitstream on the wire. The EDL bit switch turns - * the CAN controllers bitstream processor into the CAN FD mode which creates - * two new options within the CAN FD frame specification: - * - * Bit Rate Switch - to indicate a second bitrate is/was used for the payload - * Error State Indicator - represents the error state of the transmitting node - * - * As the CANFD_ESI bit is internally generated by the transmitting CAN - * controller only the CANFD_BRS bit is relevant for real CAN controllers when - * building a CAN FD frame for transmission. Setting the CANFD_ESI bit can make - * sense for virtual CAN interfaces to test applications with echoed frames. - */ -#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */ -#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */ - -/** - * struct canfd_frame - CAN flexible data rate frame structure - * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition - * @len: frame payload length in byte (0 .. CANFD_MAX_DLEN) - * @flags: additional flags for CAN FD - * @__res0: reserved / padding - * @__res1: reserved / padding - * @data: CAN FD frame payload (up to CANFD_MAX_DLEN byte) - */ -struct canfd_frame { - canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ - __u8 len; /* frame payload length in byte */ - __u8 flags; /* additional flags for CAN FD */ - __u8 __res0; /* reserved / padding */ - __u8 __res1; /* reserved / padding */ - __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8))); -}; - -#define CAN_MTU (sizeof(struct can_frame)) -#define CANFD_MTU (sizeof(struct canfd_frame)) - -/* particular protocols of the protocol family PF_CAN */ -#define CAN_RAW 1 /* RAW sockets */ -#define CAN_BCM 2 /* Broadcast Manager */ -#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ -#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ -#define CAN_MCNET 5 /* Bosch MCNet */ -#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ -#define CAN_NPROTO 7 - -#define SOL_CAN_BASE 100 - -/** - * struct sockaddr_can - the sockaddr structure for CAN sockets - * @can_family: address family number AF_CAN. - * @can_ifindex: CAN network interface index. - * @can_addr: protocol specific address information - */ -struct sockaddr_can { - __kernel_sa_family_t can_family; - int can_ifindex; - union { - /* transport protocol class address information (e.g. ISOTP) */ - struct { canid_t rx_id, tx_id; } tp; - - /* reserved for future CAN protocols address information */ - } can_addr; -}; - -/** - * struct can_filter - CAN ID based filter in can_register(). - * @can_id: relevant bits of CAN ID which are not masked out. - * @can_mask: CAN mask (see description) - * - * Description: - * A filter matches, when - * - * & mask == can_id & mask - * - * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can - * filter for error message frames (CAN_ERR_FLAG bit set in mask). - */ -struct can_filter { - canid_t can_id; - canid_t can_mask; -}; - -#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ - -#endif /* !_UAPI_CAN_H */ diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h deleted file mode 100644 index 29ecf76..0000000 --- a/include/linux/can/bcm.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * linux/can/bcm.h - * - * Definitions for CAN Broadcast Manager (BCM) - * - * Author: Oliver Hartkopp - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Volkswagen nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * Alternatively, provided that this notice is retained in full, this - * software may be distributed under the terms of the GNU General - * Public License ("GPL") version 2, in which case the provisions of the - * GPL apply INSTEAD OF those given above. - * - * The provided data structures and external interfaces from this code - * are not restricted to be used by modules with a GPL compatible license. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef _CAN_BCM_H -#define _CAN_BCM_H - -#include -#include - -/** - * struct bcm_msg_head - head of messages to/from the broadcast manager - * @opcode: opcode, see enum below. - * @flags: special flags, see below. - * @count: number of frames to send before changing interval. - * @ival1: interval for the first @count frames. - * @ival2: interval for the following frames. - * @can_id: CAN ID of frames to be sent or received. - * @nframes: number of frames appended to the message head. - * @frames: array of CAN frames. - */ -struct bcm_msg_head { - __u32 opcode; - __u32 flags; - __u32 count; - struct timeval ival1, ival2; - canid_t can_id; - __u32 nframes; - struct can_frame frames[0]; -}; - -enum { - TX_SETUP = 1, /* create (cyclic) transmission task */ - TX_DELETE, /* remove (cyclic) transmission task */ - TX_READ, /* read properties of (cyclic) transmission task */ - TX_SEND, /* send one CAN frame */ - RX_SETUP, /* create RX content filter subscription */ - RX_DELETE, /* remove RX content filter subscription */ - RX_READ, /* read properties of RX content filter subscription */ - TX_STATUS, /* reply to TX_READ request */ - TX_EXPIRED, /* notification on performed transmissions (count=0) */ - RX_STATUS, /* reply to RX_READ request */ - RX_TIMEOUT, /* cyclic message is absent */ - RX_CHANGED /* updated CAN frame (detected content change) */ -}; - -#define SETTIMER 0x0001 -#define STARTTIMER 0x0002 -#define TX_COUNTEVT 0x0004 -#define TX_ANNOUNCE 0x0008 -#define TX_CP_CAN_ID 0x0010 -#define RX_FILTER_ID 0x0020 -#define RX_CHECK_DLC 0x0040 -#define RX_NO_AUTOTIMER 0x0080 -#define RX_ANNOUNCE_RESUME 0x0100 -#define TX_RESET_MULTI_IDX 0x0200 -#define RX_RTR_FRAME 0x0400 - -#endif /* !_UAPI_CAN_BCM_H */ diff --git a/include/linux/can/error.h b/include/linux/can/error.h deleted file mode 100644 index ca12b3d..0000000 --- a/include/linux/can/error.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * linux/can/error.h - * - * Definitions of the CAN error messages to be filtered and passed to the user. - * - * Author: Oliver Hartkopp - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Volkswagen nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * Alternatively, provided that this notice is retained in full, this - * software may be distributed under the terms of the GNU General - * Public License ("GPL") version 2, in which case the provisions of the - * GPL apply INSTEAD OF those given above. - * - * The provided data structures and external interfaces from this code - * are not restricted to be used by modules with a GPL compatible license. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef _CAN_ERROR_H -#define _CAN_ERROR_H - -#define CAN_ERR_DLC 8 /* dlc for error message frames */ - -/* error class (mask) in can_id */ -#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ -#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ -#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ -#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ -#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ -#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ -#define CAN_ERR_BUSOFF 0x00000040U /* bus off */ -#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ -#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ - -/* arbitration lost in bit ... / data[0] */ -#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ - /* else bit number in bitstream */ - -/* error status of CAN-controller / data[1] */ -#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ -#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ -#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ -#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ -#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ -#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ -#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ - /* (at least one error counter exceeds */ - /* the protocol-defined level of 127) */ - -/* error in CAN protocol (type) / data[2] */ -#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ -#define CAN_ERR_PROT_BIT 0x01 /* single bit error */ -#define CAN_ERR_PROT_FORM 0x02 /* frame format error */ -#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ -#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ -#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ -#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ -#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ -#define CAN_ERR_PROT_TX 0x80 /* error occurred on transmission */ - -/* error in CAN protocol (location) / data[3] */ -#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ -#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ -#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ -#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ -#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ -#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ -#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ -#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ -#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ -#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ -#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ -#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ -#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ -#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ -#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ -#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ -#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ -#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ -#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ -#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ - -/* error status of CAN-transceiver / data[4] */ -/* CANH CANL */ -#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ -#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ -#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ -#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ -#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ -#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ -#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ -#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ -#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ -#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ - -/* controller specific additional information / data[5..7] */ - -#endif /* _CAN_ERROR_H */ diff --git a/include/linux/can/gw.h b/include/linux/can/gw.h deleted file mode 100644 index 5439efc..0000000 --- a/include/linux/can/gw.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * linux/can/gw.h - * - * Definitions for CAN frame Gateway/Router/Bridge - * - * Author: Oliver Hartkopp - * Copyright (c) 2011 Volkswagen Group Electronic Research - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Volkswagen nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * Alternatively, provided that this notice is retained in full, this - * software may be distributed under the terms of the GNU General - * Public License ("GPL") version 2, in which case the provisions of the - * GPL apply INSTEAD OF those given above. - * - * The provided data structures and external interfaces from this code - * are not restricted to be used by modules with a GPL compatible license. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef _CAN_GW_H -#define _CAN_GW_H - -#include -#include - -struct rtcanmsg { - __u8 can_family; - __u8 gwtype; - __u16 flags; -}; - -/* CAN gateway types */ -enum { - CGW_TYPE_UNSPEC, - CGW_TYPE_CAN_CAN, /* CAN->CAN routing */ - __CGW_TYPE_MAX -}; - -#define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1) - -/* CAN rtnetlink attribute definitions */ -enum { - CGW_UNSPEC, - CGW_MOD_AND, /* CAN frame modification binary AND */ - CGW_MOD_OR, /* CAN frame modification binary OR */ - CGW_MOD_XOR, /* CAN frame modification binary XOR */ - CGW_MOD_SET, /* CAN frame modification set alternate values */ - CGW_CS_XOR, /* set data[] XOR checksum into data[index] */ - CGW_CS_CRC8, /* set data[] CRC8 checksum into data[index] */ - CGW_HANDLED, /* number of handled CAN frames */ - CGW_DROPPED, /* number of dropped CAN frames */ - CGW_SRC_IF, /* ifindex of source network interface */ - CGW_DST_IF, /* ifindex of destination network interface */ - CGW_FILTER, /* specify struct can_filter on source CAN device */ - CGW_DELETED, /* number of deleted CAN frames (see max_hops param) */ - CGW_LIM_HOPS, /* limit the number of hops of this specific rule */ - __CGW_MAX -}; - -#define CGW_MAX (__CGW_MAX - 1) - -#define CGW_FLAGS_CAN_ECHO 0x01 -#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02 -#define CGW_FLAGS_CAN_IIF_TX_OK 0x04 - -#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */ - -/* CAN frame elements that are affected by curr. 3 CAN frame modifications */ -#define CGW_MOD_ID 0x01 -#define CGW_MOD_DLC 0x02 -#define CGW_MOD_DATA 0x04 - -#define CGW_FRAME_MODS 3 /* ID DLC DATA */ - -#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS) - -struct cgw_frame_mod { - struct can_frame cf; - __u8 modtype; -} __attribute__((packed)); - -#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod) - -struct cgw_csum_xor { - __s8 from_idx; - __s8 to_idx; - __s8 result_idx; - __u8 init_xor_val; -} __attribute__((packed)); - -struct cgw_csum_crc8 { - __s8 from_idx; - __s8 to_idx; - __s8 result_idx; - __u8 init_crc_val; - __u8 final_xor_val; - __u8 crctab[256]; - __u8 profile; - __u8 profile_data[20]; -} __attribute__((packed)); - -/* length of checksum operation parameters. idx = index in CAN frame data[] */ -#define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor) -#define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8) - -/* CRC8 profiles (compute CRC for additional data elements - see below) */ -enum { - CGW_CRC8PRF_UNSPEC, - CGW_CRC8PRF_1U8, /* compute one additional u8 value */ - CGW_CRC8PRF_16U8, /* u8 value table indexed by data[1] & 0xF */ - CGW_CRC8PRF_SFFID_XOR, /* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */ - __CGW_CRC8PRF_MAX -}; - -#define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1) - -/* - * CAN rtnetlink attribute contents in detail - * - * CGW_XXX_IF (length 4 bytes): - * Sets an interface index for source/destination network interfaces. - * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory. - * - * CGW_FILTER (length 8 bytes): - * Sets a CAN receive filter for the gateway job specified by the - * struct can_filter described in include/linux/can.h - * - * CGW_MOD_(AND|OR|XOR|SET) (length 17 bytes): - * Specifies a modification that's done to a received CAN frame before it is - * send out to the destination interface. - * - * data used as operator - * affected CAN frame elements - * - * CGW_LIM_HOPS (length 1 byte): - * Limit the number of hops of this specific rule. Usually the received CAN - * frame can be processed as much as 'max_hops' times (which is given at module - * load time of the can-gw module). This value is used to reduce the number of - * possible hops for this gateway rule to a value smaller then max_hops. - * - * CGW_CS_XOR (length 4 bytes): - * Set a simple XOR checksum starting with an initial value into - * data[result-idx] using data[start-idx] .. data[end-idx] - * - * The XOR checksum is calculated like this: - * - * xor = init_xor_val - * - * for (i = from_idx .. to_idx) - * xor ^= can_frame.data[i] - * - * can_frame.data[ result_idx ] = xor - * - * CGW_CS_CRC8 (length 282 bytes): - * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table, - * a given initial value and a defined input data[start-idx] .. data[end-idx]. - * Finally the result value is XOR'ed with the final_xor_val. - * - * The CRC8 checksum is calculated like this: - * - * crc = init_crc_val - * - * for (i = from_idx .. to_idx) - * crc = crctab[ crc ^ can_frame.data[i] ] - * - * can_frame.data[ result_idx ] = crc ^ final_xor_val - * - * The calculated CRC may contain additional source data elements that can be - * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs - * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf - * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs) - * that are used depending on counter values inside the CAN frame data[]. - * So far only three profiles have been implemented for illustration. - * - * Remark: In general the attribute data is a linear buffer. - * Beware of sending unpacked or aligned structs! - */ - -#endif /* !_UAPI_CAN_GW_H */ diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h deleted file mode 100644 index 6d4ec2a..0000000 --- a/include/linux/can/netlink.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * linux/can/netlink.h - * - * Definitions for the CAN netlink interface - * - * Copyright (c) 2009 Wolfgang Grandegger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the version 2 of the GNU General Public License - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _CAN_NETLINK_H -#define _CAN_NETLINK_H - -#include - -/* - * CAN bit-timing parameters - * - * For further information, please read chapter "8 BIT TIMING - * REQUIREMENTS" of the "Bosch CAN Specification version 2.0" - * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf. - */ -struct can_bittiming { - __u32 bitrate; /* Bit-rate in bits/second */ - __u32 sample_point; /* Sample point in one-tenth of a percent */ - __u32 tq; /* Time quanta (TQ) in nanoseconds */ - __u32 prop_seg; /* Propagation segment in TQs */ - __u32 phase_seg1; /* Phase buffer segment 1 in TQs */ - __u32 phase_seg2; /* Phase buffer segment 2 in TQs */ - __u32 sjw; /* Synchronisation jump width in TQs */ - __u32 brp; /* Bit-rate prescaler */ -}; - -/* - * CAN harware-dependent bit-timing constant - * - * Used for calculating and checking bit-timing parameters - */ -struct can_bittiming_const { - char name[16]; /* Name of the CAN controller hardware */ - __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */ - __u32 tseg1_max; - __u32 tseg2_min; /* Time segement 2 = phase_seg2 */ - __u32 tseg2_max; - __u32 sjw_max; /* Synchronisation jump width */ - __u32 brp_min; /* Bit-rate prescaler */ - __u32 brp_max; - __u32 brp_inc; -}; - -/* - * CAN clock parameters - */ -struct can_clock { - __u32 freq; /* CAN system clock frequency in Hz */ -}; - -/* - * CAN operational and error states - */ -enum can_state { - CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */ - CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */ - CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */ - CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */ - CAN_STATE_STOPPED, /* Device is stopped */ - CAN_STATE_SLEEPING, /* Device is sleeping */ - CAN_STATE_MAX -}; - -/* - * CAN bus error counters - */ -struct can_berr_counter { - __u16 txerr; - __u16 rxerr; -}; - -/* - * CAN controller mode - */ -struct can_ctrlmode { - __u32 mask; - __u32 flags; -}; - -#define CAN_CTRLMODE_LOOPBACK 0x01 /* Loopback mode */ -#define CAN_CTRLMODE_LISTENONLY 0x02 /* Listen-only mode */ -#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ -#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ -#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ -#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */ -#define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */ -#define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */ - -/* - * CAN device statistics - */ -struct can_device_stats { - __u32 bus_error; /* Bus errors */ - __u32 error_warning; /* Changes to error warning state */ - __u32 error_passive; /* Changes to error passive state */ - __u32 bus_off; /* Changes to bus off state */ - __u32 arbitration_lost; /* Arbitration lost errors */ - __u32 restarts; /* CAN controller re-starts */ -}; - -/* - * CAN netlink interface - */ -enum { - IFLA_CAN_UNSPEC, - IFLA_CAN_BITTIMING, - IFLA_CAN_BITTIMING_CONST, - IFLA_CAN_CLOCK, - IFLA_CAN_STATE, - IFLA_CAN_CTRLMODE, - IFLA_CAN_RESTART_MS, - IFLA_CAN_RESTART, - IFLA_CAN_BERR_COUNTER, - IFLA_CAN_DATA_BITTIMING, - IFLA_CAN_DATA_BITTIMING_CONST, - __IFLA_CAN_MAX -}; - -#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1) - -#endif /* !_UAPI_CAN_NETLINK_H */ diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h deleted file mode 100644 index f2c1a0a..0000000 --- a/include/linux/can/raw.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * linux/can/raw.h - * - * Definitions for raw CAN sockets - * - * Authors: Oliver Hartkopp - * Urs Thuermann - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Volkswagen nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * Alternatively, provided that this notice is retained in full, this - * software may be distributed under the terms of the GNU General - * Public License ("GPL") version 2, in which case the provisions of the - * GPL apply INSTEAD OF those given above. - * - * The provided data structures and external interfaces from this code - * are not restricted to be used by modules with a GPL compatible license. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - */ - -#ifndef _CAN_RAW_H -#define _CAN_RAW_H - -#include - -#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) - -/* for socket options affecting the socket (not the global system) */ - -enum { - CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ - CAN_RAW_ERR_FILTER, /* set filter for error frames */ - CAN_RAW_LOOPBACK, /* local loopback (default:on) */ - CAN_RAW_RECV_OWN_MSGS, /* receive my own msgs (default:off) */ - CAN_RAW_FD_FRAMES, /* allow CAN FD frames (default:off) */ -}; - -#endif /* !_UAPI_CAN_RAW_H */