4 #include <linux/types.h>
5 #include <linux/ioctl.h>
8 #define PACKED __attribute__((packed))
11 #define CAN_MSG_LENGTH 8
14 * struct canmsg_t - structure representing CAN message
15 * @flags: message flags
16 * %MSG_RTR .. message is Remote Transmission Request,
17 * %MSG_EXT .. message with extended ID,
18 * %MSG_OVR .. indication of queue overflow condition,
19 * %MSG_LOCAL .. message originates from this node.
20 * @cob: communication object number (not used)
21 * @id: ID of CAN message
22 * @timestamp: not used
23 * @length: length of used data
24 * @data: data bytes buffer
32 unsigned long timestamp;
34 unsigned char data[CAN_MSG_LENGTH];
38 * struct canfilt_t - structure for acceptance filter setup
39 * @flags: message flags
40 * %MSG_RTR .. message is Remote Transmission Request,
41 * %MSG_EXT .. message with extended ID,
42 * %MSG_OVR .. indication of queue overflow condition,
43 * %MSG_LOCAL .. message originates from this node.
44 * there are corresponding mask bits
45 * %MSG_RTR_MASK, %MSG_EXT_MASK, %MSG_LOCAL_MASK.
46 * %MSG_PROCESSLOCAL enables local messages processing in the
47 * combination with global setting
48 * @queid: CAN queue identification in the case of the multiple
49 * queues per one user (open instance)
50 * @cob: communication object number (not used)
51 * @id: selected required value of cared ID id bits
52 * @mask: select bits significand for the comparation;
53 * 1 .. take care about corresponding ID bit, 0 .. don't care
65 /* Definitions to use for canmsg_t and canfilt_t flags */
66 #define MSG_RTR (1<<0)
67 #define MSG_OVR (1<<1)
68 #define MSG_EXT (1<<2)
69 #define MSG_LOCAL (1<<3)
70 /* If you change above lines, check canque_filtid2internal function */
72 /* Additional definitions used for canfilt_t only */
73 #define MSG_FILT_MASK_SHIFT 8
74 #define MSG_RTR_MASK (MSG_RTR<<MSG_FILT_MASK_SHIFT)
75 #define MSG_EXT_MASK (MSG_EXT<<MSG_FILT_MASK_SHIFT)
76 #define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
77 #define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
80 /* Can message ID mask */
81 #define MSG_ID_MASK ((1l<<29)-1)
83 /* CAN ioctl magic number */
84 #define CAN_IOC_MAGIC 'd'
86 typedef unsigned long bittiming_t;
87 typedef unsigned short channel_t;
89 /* CAN ioctl functions */
90 #define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel_t)
91 #define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel_t)
94 #define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming_t)
96 //#define CONF_XTDACCM
99 #define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
101 //#define CONF_FENABLE
102 //#define CONF_FDISABLE
104 #define STAT _IO(CAN_IOC_MAGIC, 9)
105 #define CANQUE_FILTER _IOW(CAN_IOC_MAGIC, 10, struct canfilt_t)
106 #define CANQUE_FLUSH _IO(CAN_IOC_MAGIC, 11)
108 #endif /*_CANMSG_T_H*/