]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/can.h
The first enhanced version of Linux CAN-bus driver for OCERA project
[lincan.git] / lincan / include / can.h
1 #include <linux/types.h>
2 #include <linux/ioctl.h>
3
4 #ifndef PACKED
5 #define PACKED __attribute__((packed))
6 #endif
7
8 #define CAN_MSG_LENGTH 8
9
10 struct canmsg_t {
11         short           flags;
12         int             cob;
13         unsigned long   id;
14         unsigned long   timestamp;
15         unsigned int    length;
16         unsigned char   data[CAN_MSG_LENGTH];
17 } PACKED;
18
19 /* Definitions to use for canmsg_t flags */
20 #define MSG_RTR (1<<0)
21 #define MSG_OVR (1<<1)
22 #define MSG_EXT (1<<2)
23
24 /* CAN ioctl magic number */
25 #define CAN_IOC_MAGIC 'd'
26
27 typedef unsigned long bittiming_t;
28 typedef unsigned short channel_t;
29
30 /* CAN ioctl functions */
31 #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t)
32 #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t)
33 //#define CMD_RESET 3
34
35 #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t)
36 //#define CONF_ACCM
37 //#define CONF_XTDACCM
38 //#define CONF_TIMING
39 //#define CONF_OMODE
40 #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
41 //#define CONF_FENABLE
42 //#define CONF_FDISABLE
43
44
45 #define STAT _IO(CAN_IOC_MAGIC, 9)