00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _CANMSG_T_H
00010 #define _CANMSG_T_H
00011
00012 #ifdef __KERNEL__
00013
00014 #include <linux/time.h>
00015 #include <linux/types.h>
00016
00017 #else
00018
00019 #include <sys/time.h>
00020 #include <sys/types.h>
00021
00022 #endif
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028
00029
00030
00031
00032
00033 #define CAN_MSG_VERSION_2
00034
00035
00036 #define CAN_MSG_LENGTH 8
00037
00038 #ifdef CAN_MSG_VERSION_2
00039
00040 typedef struct timeval canmsg_tstamp_t ;
00041
00042 typedef unsigned long canmsg_id_t;
00043
00059 struct canmsg_t {
00060 int flags;
00061 int cob;
00062 canmsg_id_t id;
00063 canmsg_tstamp_t timestamp;
00064 unsigned short length;
00065 unsigned char data[CAN_MSG_LENGTH];
00066 };
00067
00068 #else
00069 #ifndef PACKED
00070 #define PACKED __attribute__((packed))
00071 #endif
00072
00073 struct canmsg_t {
00074 short flags;
00075 int cob;
00076 canmsg_id_t id;
00077 unsigned long timestamp;
00078 unsigned int length;
00079 unsigned char data[CAN_MSG_LENGTH];
00080 } PACKED;
00081 #endif
00082
00083 typedef struct canmsg_t canmsg_t;
00084
00105 struct canfilt_t {
00106 int flags;
00107 int queid;
00108 int cob;
00109 canmsg_id_t id;
00110 canmsg_id_t mask;
00111 };
00112
00113 typedef struct canfilt_t canfilt_t;
00114
00115
00116 #define MSG_RTR (1<<0)
00117 #define MSG_OVR (1<<1)
00118 #define MSG_EXT (1<<2)
00119 #define MSG_LOCAL (1<<3)
00120
00121
00122
00123 #define MSG_FILT_MASK_SHIFT 8
00124 #define MSG_RTR_MASK (MSG_RTR<<MSG_FILT_MASK_SHIFT)
00125 #define MSG_EXT_MASK (MSG_EXT<<MSG_FILT_MASK_SHIFT)
00126 #define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
00127 #define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
00128
00129
00130 #define MSG_ID_MASK ((1l<<29)-1)
00131
00132 #ifdef __cplusplus
00133 }
00134 #endif
00135
00136 #endif