• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_CAN_H
20 #define _UAPI_CAN_H
21 #include <linux/types.h>
22 #include <linux/socket.h>
23 #define CAN_EFF_FLAG 0x80000000U
24 #define CAN_RTR_FLAG 0x40000000U
25 #define CAN_ERR_FLAG 0x20000000U
26 #define CAN_SFF_MASK 0x000007FFU
27 #define CAN_EFF_MASK 0x1FFFFFFFU
28 #define CAN_ERR_MASK 0x1FFFFFFFU
29 typedef __u32 canid_t;
30 #define CAN_SFF_ID_BITS 11
31 #define CAN_EFF_ID_BITS 29
32 typedef __u32 can_err_mask_t;
33 #define CAN_MAX_DLC 8
34 #define CAN_MAX_RAW_DLC 15
35 #define CAN_MAX_DLEN 8
36 #define CANFD_MAX_DLC 15
37 #define CANFD_MAX_DLEN 64
38 struct can_frame {
39   canid_t can_id;
40   union {
41     __u8 len;
42     __u8 can_dlc;
43   } __attribute__((packed));
44   __u8 __pad;
45   __u8 __res0;
46   __u8 len8_dlc;
47   __u8 data[CAN_MAX_DLEN] __attribute__((aligned(8)));
48 };
49 #define CANFD_BRS 0x01
50 #define CANFD_ESI 0x02
51 #define CANFD_FDF 0x04
52 struct canfd_frame {
53   canid_t can_id;
54   __u8 len;
55   __u8 flags;
56   __u8 __res0;
57   __u8 __res1;
58   __u8 data[CANFD_MAX_DLEN] __attribute__((aligned(8)));
59 };
60 #define CAN_MTU (sizeof(struct can_frame))
61 #define CANFD_MTU (sizeof(struct canfd_frame))
62 #define CAN_RAW 1
63 #define CAN_BCM 2
64 #define CAN_TP16 3
65 #define CAN_TP20 4
66 #define CAN_MCNET 5
67 #define CAN_ISOTP 6
68 #define CAN_J1939 7
69 #define CAN_NPROTO 8
70 #define SOL_CAN_BASE 100
71 struct sockaddr_can {
72   __kernel_sa_family_t can_family;
73   int can_ifindex;
74   union {
75     struct {
76       canid_t rx_id, tx_id;
77     } tp;
78     struct {
79       __u64 name;
80       __u32 pgn;
81       __u8 addr;
82     } j1939;
83   } can_addr;
84 };
85 struct can_filter {
86   canid_t can_id;
87   canid_t can_mask;
88 };
89 #define CAN_INV_FILTER 0x20000000U
90 #define CAN_RAW_FILTER_MAX 512
91 #endif
92