]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/can.h
Added initial version of MSMCAN card support into LinCAN driver.
[lincan.git] / lincan / include / can.h
1 #ifndef _CAN_DRVAPI_T_H
2 #define _CAN_DRVAPI_T_H
3
4 #ifdef __KERNEL__
5
6 #include <linux/time.h>
7 #include <linux/types.h>
8 #include <linux/ioctl.h>
9
10 #else /* __KERNEL__ */
11
12 #include <sys/time.h>
13 #include <sys/types.h>
14 #include <sys/ioctl.h>
15
16 #endif /* __KERNEL__ */
17
18 #include "./canmsg.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
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 CAN_DRV_QUERY _IO(CAN_IOC_MAGIC, 0)
32 #define CAN_DRV_QRY_BRANCH    0 /* returns driver branch value - "LINC" for LinCAN driver */
33 #define CAN_DRV_QRY_VERSION   1 /* returns driver version as (major<<16) | (minor<<8) | patch */
34 #define CAN_DRV_QRY_MSGFORMAT 2 /* format of canmsg_t structure */
35
36 #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t)
37 #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t)
38 //#define CMD_RESET 3
39
40 #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t)
41 //#define CONF_ACCM
42 //#define CONF_XTDACCM
43 //#define CONF_TIMING
44 //#define CONF_OMODE
45 #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
46
47 //#define CONF_FENABLE
48 //#define CONF_FDISABLE
49
50 #define STAT _IO(CAN_IOC_MAGIC, 9)
51 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
52 #define CANQUE_FLUSH  _IO(CAN_IOC_MAGIC, 11)
53
54 #ifdef __cplusplus
55 } /* extern "C"*/
56 #endif
57
58 #endif /*_CAN_DRVAPI_T_H*/