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  */
etisserant@240: 00033 #define CAN_MSG_VERSION_2
nico@215: 00034 
nico@215: 00035 /* Number of data bytes in one CAN message */
etisserant@240: 00036 #define CAN_MSG_LENGTH 8
nico@215: 00037 
nico@215: 00038 #ifdef CAN_MSG_VERSION_2
nico@215: 00039 
etisserant@240: 00040 typedef struct timeval canmsg_tstamp_t ;
nico@215: 00041 
etisserant@240: 00042 typedef unsigned long canmsg_id_t;
nico@215: 00043 
nico@215: 00059 struct canmsg_t {
etisserant@240: 00060         int             flags;
etisserant@240: 00061         int             cob;
etisserant@240: 00062         canmsg_id_t     id;
etisserant@240: 00063         canmsg_tstamp_t timestamp;
etisserant@240: 00064         unsigned short  length;
etisserant@240: 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 {
etisserant@240: 00074         short           flags;
etisserant@240: 00075         int             cob;
etisserant@240: 00076         canmsg_id_t     id;
etisserant@240: 00077         unsigned long   timestamp;
etisserant@240: 00078         unsigned int    length;
etisserant@240: 00079         unsigned char   data[CAN_MSG_LENGTH];
nico@215: 00080 } PACKED;
nico@215: 00081 #endif /*CAN_MSG_VERSION_2*/
nico@215: 00082 
etisserant@240: 00083 typedef struct canmsg_t canmsg_t;
nico@215: 00084 
nico@215: 00105 struct canfilt_t {
etisserant@240: 00106         int             flags;
etisserant@240: 00107         int             queid;
etisserant@240: 00108         int             cob;
etisserant@240: 00109         canmsg_id_t     id;
etisserant@240: 00110         canmsg_id_t     mask;
nico@215: 00111 };
nico@215: 00112 
etisserant@240: 00113 typedef struct canfilt_t canfilt_t;
nico@215: 00114 
nico@215: 00115 /* Definitions to use for canmsg_t and canfilt_t flags */
etisserant@240: 00116 #define MSG_RTR   (1<<0)
etisserant@240: 00117 #define MSG_OVR   (1<<1)
etisserant@240: 00118 #define MSG_EXT   (1<<2)
etisserant@240: 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 */
etisserant@240: 00123 #define MSG_FILT_MASK_SHIFT   8
etisserant@240: 00124 #define MSG_RTR_MASK   (MSG_RTR<<MSG_FILT_MASK_SHIFT)
etisserant@240: 00125 #define MSG_EXT_MASK   (MSG_EXT<<MSG_FILT_MASK_SHIFT)
etisserant@240: 00126 #define MSG_LOCAL_MASK (MSG_LOCAL<<MSG_FILT_MASK_SHIFT)
etisserant@240: 00127 #define MSG_PROCESSLOCAL (MSG_OVR<<MSG_FILT_MASK_SHIFT)
nico@215: 00128 
nico@215: 00129 /* Can message ID mask */
etisserant@240: 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*/
etisserant@240: 

Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  nico@215: nico@215: doxygen 1.5.1
nico@215: nico@215: