1 #ifndef _CAN_DRVAPI_T_H
2 #define _CAN_DRVAPI_T_H
6 #include <linux/time.h>
7 #include <linux/types.h>
8 #include <linux/ioctl.h>
10 #else /* __KERNEL__ */
13 #include <sys/types.h>
14 #include <sys/ioctl.h>
16 #endif /* __KERNEL__ */
24 /* CAN ioctl magic number */
25 #define CAN_IOC_MAGIC 'd'
27 typedef unsigned long bittiming_t;
28 typedef unsigned short channel_t;
31 * struct can_baudparams_t - datatype for calling CONF_BAUDPARAMS IOCTL
32 * @flags: reserved for additional flags for chip configuration, should be written -1 or 0
33 * @baudrate: baud rate in Hz
34 * @sjw: synchronization jump width (0-3) prescaled clock cycles
35 * @sampl_pt: sample point in % (0-100) sets (TSEG1+1)/(TSEG1+TSEG2+2) ratio
37 * The structure is used to configure new set of parameters into CAN controller chip.
38 * If default value of some field should be preserved, fill field by value -1.
40 struct can_baudparams_t {
47 /* CAN ioctl functions */
48 #define CAN_DRV_QUERY _IO(CAN_IOC_MAGIC, 0)
49 #define CAN_DRV_QRY_BRANCH 0 /* returns driver branch value - "LINC" for LinCAN driver */
50 #define CAN_DRV_QRY_VERSION 1 /* returns driver version as (major<<16) | (minor<<8) | patch */
51 #define CAN_DRV_QRY_MSGFORMAT 2 /* format of canmsg_t structure */
53 #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t)
54 #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t)
57 #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t)
59 //#define CONF_XTDACCM
62 #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
64 //#define CONF_FENABLE
65 //#define CONF_FDISABLE
67 #define STAT _IO(CAN_IOC_MAGIC, 9)
68 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
69 #define CANQUE_FLUSH _IO(CAN_IOC_MAGIC, 11)
70 #define CONF_BAUDPARAMS _IOW(CAN_IOC_MAGIC, 11, struct can_baudparams_t)
76 #endif /*_CAN_DRVAPI_T_H*/