/home/epimerde/documents/tc11/CanFestival-3/drivers/can_lincan/canmsg.h

Go to the documentation of this file.
00001 /* canmsg.h - common kernel-space and user-space CAN message structure
00002  * Linux CAN-bus device driver.
00003  * Written by Pavel Pisa - OCERA team member
00004  * email:pisa@cmp.felk.cvut.cz
00005  * This software is released under the GPL-License.
00006  * Version lincan-0.3  17 Jun 2004
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 /* __KERNEL__ */
00018 
00019 #include <sys/time.h>
00020 #include <sys/types.h>
00021 
00022 #endif /* __KERNEL__ */
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /*
00029  * CAN_MSG_VERSION_2 enables new canmsg_t layout compatible with
00030  * can4linux project from http://www.port.de/
00031  *
00032  */
00033 #define CAN_MSG_VERSION_2
00034 
00035 /* Number of data bytes in one CAN message */
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 /*CAN_MSG_VERSION_2*/
00069 #ifndef PACKED
00070 #define PACKED __attribute__((packed))
00071 #endif
00072 /* Old, deprecated version of canmsg_t structure */
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 /*CAN_MSG_VERSION_2*/
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 /* Definitions to use for canmsg_t and canfilt_t flags */
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 /* If you change above lines, check canque_filtid2internal function */
00121 
00122 /* Additional definitions used for canfilt_t only */
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 /* Can message ID mask */
00130 #define MSG_ID_MASK ((1l<<29)-1)
00131 
00132 #ifdef __cplusplus
00133 } /* extern "C"*/
00134 #endif
00135 
00136 #endif /*_CANMSG_T_H*/

Generated on Mon Jun 4 16:29:06 2007 for CanFestival by  doxygen 1.5.1