nico@215: nico@215: nico@215: CanFestival: drivers/can_lincan/canmsg.h Source File nico@215: nico@215: nico@215: nico@215: nico@215:
nico@215:
nico@215:
nico@215:
nico@215: nico@215:

canmsg.h

Go to the documentation of this file.
00001 /* canmsg.h - common kernel-space and user-space CAN message structure
nico@215: 00002  * Linux CAN-bus device driver.
nico@215: 00003  * Written by Pavel Pisa - OCERA team member
nico@215: 00004  * email:pisa@cmp.felk.cvut.cz
nico@215: 00005  * This software is released under the GPL-License.
nico@215: 00006  * Version lincan-0.3  17 Jun 2004
nico@215: 00007  */
nico@215: 00008 
nico@215: 00009 #ifndef _CANMSG_T_H
nico@215: 00010 #define _CANMSG_T_H
nico@215: 00011 
nico@215: 00012 #ifdef __KERNEL__
nico@215: 00013 
nico@215: 00014 #include <linux/time.h>
nico@215: 00015 #include <linux/types.h>
nico@215: 00016 
nico@215: 00017 #else /* __KERNEL__ */
nico@215: 00018 
nico@215: 00019 #include <sys/time.h>
nico@215: 00020 #include <sys/types.h>
nico@215: 00021 
nico@215: 00022 #endif /* __KERNEL__ */
nico@215: 00023 
nico@215: 00024 #ifdef __cplusplus
nico@215: 00025 extern "C" {
nico@215: 00026 #endif
nico@215: 00027 
nico@215: 00028 /*
nico@215: 00029  * CAN_MSG_VERSION_2 enables new canmsg_t layout compatible with
nico@215: 00030  * can4linux project from http://www.port.de/
nico@215: 00031  *
nico@215: 00032  */
nico@215: 00033 #define CAN_MSG_VERSION_2
nico@215: 00034 
nico@215: 00035 /* Number of data bytes in one CAN message */
nico@215: 00036 #define CAN_MSG_LENGTH 8
nico@215: 00037 
nico@215: 00038 #ifdef CAN_MSG_VERSION_2
nico@215: 00039 
nico@215: 00040 typedef struct timeval canmsg_tstamp_t ;
nico@215: 00041 
nico@215: 00042 typedef unsigned long canmsg_id_t;
nico@215: 00043 
nico@215: 00059 struct canmsg_t {
nico@215: 00060         int             flags;
nico@215: 00061         int             cob;
nico@215: 00062         canmsg_id_t     id;
nico@215: 00063         canmsg_tstamp_t timestamp;
nico@215: 00064         unsigned short  length;
nico@215: 00065         unsigned char   data[CAN_MSG_LENGTH];
nico@215: 00066 };
nico@215: 00067 
nico@215: 00068 #else /*CAN_MSG_VERSION_2*/
nico@215: 00069 #ifndef PACKED
nico@215: 00070 #define PACKED __attribute__((packed))
nico@215: 00071 #endif
nico@215: 00072 /* Old, deprecated version of canmsg_t structure */
nico@215: 00073 struct canmsg_t {
nico@215: 00074         short           flags;
nico@215: 00075         int             cob;
nico@215: 00076         canmsg_id_t     id;
nico@215: 00077         unsigned long   timestamp;
nico@215: 00078         unsigned int    length;
nico@215: 00079         unsigned char   data[CAN_MSG_LENGTH];
nico@215: 00080 } PACKED;
nico@215: 00081 #endif /*CAN_MSG_VERSION_2*/
nico@215: 00082 
nico@215: 00083 typedef struct canmsg_t canmsg_t;
nico@215: 00084 
nico@215: 00105 struct canfilt_t {
nico@215: 00106         int             flags;
nico@215: 00107         int             queid;
nico@215: 00108         int             cob;
nico@215: 00109         canmsg_id_t     id;
nico@215: 00110         canmsg_id_t     mask;
nico@215: 00111 };
nico@215: 00112 
nico@215: 00113 typedef struct canfilt_t canfilt_t;
nico@215: 00114 
nico@215: 00115 /* Definitions to use for canmsg_t and canfilt_t flags */
nico@215: 00116 #define MSG_RTR   (1<<0)
nico@215: 00117 #define MSG_OVR   (1<<1)
nico@215: 00118 #define MSG_EXT   (1<<2)
nico@215: 00119 #define MSG_LOCAL (1<<3)
nico@215: 00120 /* If you change above lines, check canque_filtid2internal function */
nico@215: 00121 
nico@215: 00122 /* Additional definitions used for canfilt_t only */
nico@215: 00123 #define MSG_FILT_MASK_SHIFT   8
nico@215: 00124 #define MSG_RTR_MASK   (MSG_RTR<<MSG_FILT_MASK_SHIFT)
nico@215: 00125 #define MSG_EXT_MASK   (MSG_EXT<<MSG_FILT_MASK_SHIFT)
nico@215: 00126 #define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
nico@215: 00127 #define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
nico@215: 00128 
nico@215: 00129 /* Can message ID mask */
nico@215: 00130 #define MSG_ID_MASK ((1l<<29)-1)
nico@215: 00131 
nico@215: 00132 #ifdef __cplusplus
nico@215: 00133 } /* extern "C"*/
nico@215: 00134 #endif
nico@215: 00135 
nico@215: 00136 #endif /*_CANMSG_T_H*/
nico@215: 

Generated on Fri Jun 8 08:51:38 2007 for CanFestival by  nico@215: nico@215: doxygen 1.5.1
nico@215: nico@215: