2 * Header file for the Linux CAN-bus driver.
3 * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4 * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5 * email:pisa@cmp.felk.cvut.cz
6 * This software is released under the GPL-License.
7 * Version lincan-0.3 17 Jun 2004
10 #ifndef _CAN_DRVAPI_T_H
11 #define _CAN_DRVAPI_T_H
15 #include <linux/time.h>
16 #include <linux/types.h>
17 #include <linux/ioctl.h>
19 #else /* __KERNEL__ */
22 #include <sys/types.h>
23 #include <sys/ioctl.h>
25 #endif /* __KERNEL__ */
33 /* CAN ioctl magic number */
34 #define CAN_IOC_MAGIC 'd'
36 typedef unsigned long bittiming_t;
37 typedef unsigned short channel_t;
40 * struct can_baudparams_t - datatype for calling CONF_BAUDPARAMS IOCTL
41 * @flags: reserved for additional flags for chip configuration, should be written -1 or 0
42 * @baudrate: baud rate in Hz
43 * @sjw: synchronization jump width (0-3) prescaled clock cycles
44 * @sampl_pt: sample point in % (0-100) sets (TSEG1+1)/(TSEG1+TSEG2+2) ratio
46 * The structure is used to configure new set of parameters into CAN controller chip.
47 * If default value of some field should be preserved, fill field by value -1.
49 struct can_baudparams_t {
56 /* CAN ioctl functions */
57 #define CAN_DRV_QUERY _IO(CAN_IOC_MAGIC, 0)
58 #define CAN_DRV_QRY_BRANCH 0 /* returns driver branch value - "LINC" for LinCAN driver */
59 #define CAN_DRV_QRY_VERSION 1 /* returns driver version as (major<<16) | (minor<<8) | patch */
60 #define CAN_DRV_QRY_MSGFORMAT 2 /* format of canmsg_t structure */
62 #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t)
63 #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t)
66 #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t)
68 //#define CONF_XTDACCM
71 #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
73 //#define CONF_FENABLE
74 //#define CONF_FDISABLE
76 #define STAT _IO(CAN_IOC_MAGIC, 9)
77 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
78 #define CANQUE_FLUSH _IO(CAN_IOC_MAGIC, 11)
79 #define CONF_BAUDPARAMS _IOW(CAN_IOC_MAGIC, 11, struct can_baudparams_t)
80 #define CANRTR_READ _IOWR(CAN_IOC_MAGIC, 12, struct canmsg_t)
86 #endif /*_CAN_DRVAPI_T_H*/