6 #include <linux/time.h>
7 #include <linux/types.h>
12 #include <sys/types.h>
14 #endif /* __KERNEL__ */
21 * CAN_MSG_VERSION_2 enables new canmsg_t layout compatible with
22 * can4linux project from http://www.port.de/
25 #define CAN_MSG_VERSION_2
27 /* Number of data bytes in one CAN message */
28 #define CAN_MSG_LENGTH 8
30 #ifdef CAN_MSG_VERSION_2
32 typedef struct timeval canmsg_tstamp_t ;
35 * struct canmsg_t - structure representing CAN message
36 * @flags: message flags
37 * %MSG_RTR .. message is Remote Transmission Request,
38 * %MSG_EXT .. message with extended ID,
39 * %MSG_OVR .. indication of queue overflow condition,
40 * %MSG_LOCAL .. message originates from this node.
41 * @cob: communication object number (not used)
42 * @id: ID of CAN message
43 * @timestamp: not used
44 * @length: length of used data
45 * @data: data bytes buffer
53 canmsg_tstamp_t timestamp;
54 unsigned short length;
55 unsigned char data[CAN_MSG_LENGTH];
58 #else /*CAN_MSG_VERSION_2*/
60 #define PACKED __attribute__((packed))
62 /* Old, deprecated version of canmsg_t structure */
67 unsigned long timestamp;
69 unsigned char data[CAN_MSG_LENGTH];
71 #endif /*CAN_MSG_VERSION_2*/
73 typedef struct canmsg_t canmsg_t;
76 * struct canfilt_t - structure for acceptance filter setup
77 * @flags: message flags
78 * %MSG_RTR .. message is Remote Transmission Request,
79 * %MSG_EXT .. message with extended ID,
80 * %MSG_OVR .. indication of queue overflow condition,
81 * %MSG_LOCAL .. message originates from this node.
82 * there are corresponding mask bits
83 * %MSG_RTR_MASK, %MSG_EXT_MASK, %MSG_LOCAL_MASK.
84 * %MSG_PROCESSLOCAL enables local messages processing in the
85 * combination with global setting
86 * @queid: CAN queue identification in the case of the multiple
87 * queues per one user (open instance)
88 * @cob: communication object number (not used)
89 * @id: selected required value of cared ID id bits
90 * @mask: select bits significand for the comparation;
91 * 1 .. take care about corresponding ID bit, 0 .. don't care
103 typedef struct canfilt_t canfilt_t;
105 /* Definitions to use for canmsg_t and canfilt_t flags */
106 #define MSG_RTR (1<<0)
107 #define MSG_OVR (1<<1)
108 #define MSG_EXT (1<<2)
109 #define MSG_LOCAL (1<<3)
110 /* If you change above lines, check canque_filtid2internal function */
112 /* Additional definitions used for canfilt_t only */
113 #define MSG_FILT_MASK_SHIFT 8
114 #define MSG_RTR_MASK (MSG_RTR<<MSG_FILT_MASK_SHIFT)
115 #define MSG_EXT_MASK (MSG_EXT<<MSG_FILT_MASK_SHIFT)
116 #define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
117 #define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
119 /* Can message ID mask */
120 #define MSG_ID_MASK ((1l<<29)-1)
126 #endif /*_CANMSG_T_H*/