📄 can.h
字号:
/** * This file include general can definitions for the candrv * * Written by Sebastian Stolzenberg email:stolzi@sebastian-stolzenberg.de * Version 1.0 04 Feb 2003 */#ifndef ___CAN_INCLUDE___# define ___CAN_INCLUDE___#include <linux/types.h>#include <linux/ioctl.h>/** * Length of can message */# define CAN_MSG_LENGTH 8/** * Definition of can message structure */struct canmsg_t{ __u32 flags; /* flags for packet */ __u32 id; /* id for frame */ long timestamp_sec; /* seconds timestamp of frame */ long timestamp_usec; /* microseconds timestamp of frame */ __u8 length; /* length for data part of frame */ __u8 data[ CAN_MSG_LENGTH ]; /* can frame data */} PACKED;/** Structure for statistics*/struct canstatistics_t{ __u32 cntRxPkt; /* Counter for received packets. */ __u32 cntRxData; /* Counter for received data bytes. */ __u32 cntTxPkt; /* Counter for sent packets. */ __u32 cntTxData; /* Counter for sent data bytes. */ __u32 cntWarnings; /* Counter for chip warning states. */ __u32 cntErrPassive; /* Counter for chip error passive mode entries. */ __u32 cntBusOff; /* Counter for chip bus off conditions. */ __u32 cntMsgLst; /* Counter for chips lost messages. */ __u32 cntRxFifoOvr; /* Counter for Rx FIFO overruns. */ __u32 cntTxFifoOvr; /* Counter for transmitter overruns (if NONBLOCK). */ __u32 cntStuffErr; /* Counter for stuff errors. */ __u32 cntFormErr; /* Counter for form erros. */ __u32 cntAckErr; /* Counter for ACK errors. */ __u32 cntBit0Err; /* Counter for Bit 0 errors. */ __u32 cntBit1Err; /* Counter for Bit 1 errors. */ __u32 cntCrcErr; /* Counter for CRC errors. */};/** Definition of a CAN frame types.*/typedef unsigned long canframetype_t;/** Definition of a CAN message.*/typedef unsigned long canmsgid_t;/* Definitions to use for canmsg_t flags */# define MSG_RTR ( 1<<0 ) /* RTR-Flag *//* CAN ioctl magic number */# define CAN_IOC_MAGIC 'z' /* AKHE changed from 'd' to 'z' ioctl.txt *//** CAN ioctl functions*//** Sets the speed at which characters are sent over the CAN net. Format of data is defined by type CanDrvBaudrate.*/# define IOCTL_CAN_SET_BAUDRATE _IOW( CAN_IOC_MAGIC, 1, __u16 )/** Enable Extended Mode */# define IOCTL_CAN_ENABLE_EXTMODE _IO( CAN_IOC_MAGIC, 2)/** Disable Extended Mode */# define IOCTL_CAN_DISABLE_EXTMODE _IO( CAN_IOC_MAGIC, 3)/** Sets the message object in reception mode for messages with the given id*/# define IOCTL_CAN_SET_READ_MODE _IOW(CAN_IOC_MAGIC, 4, __u32)/** Set filter */# define IOCTL_CAN_SET_FILTER _IOW( CAN_IOC_MAGIC, 5, __u32 )/** Disable filter */# define IOCTL_CAN_DISABLE_FILTER _IO( CAN_IOC_MAGIC, 7)/** Dump registers to the syslog */# define IOCTL_CAN_DUMP_REG _IO( CAN_IOC_MAGIC, 8 )/** Get the status byte */# define IOCTL_CAN_GET_STATUS _IOR( CAN_IOC_MAGIC, 9, __u32 )/** Get Statistic-Structure.*/# define IOCTL_CAN_GET_STATISTICS _IOR( CAN_IOC_MAGIC, 10, sizeof(struct canstatistics_t) )/** Print Statistic-Structure as kernel notice.*/# define IOCTL_CAN_PRINT_STATISTICS _IO( CAN_IOC_MAGIC, 11 )/** Resets the performance statistics for the device. No data is supplied.*/# define IOCTL_CAN_CLEAR_STATISTICS _IO( CAN_IOC_MAGIC, 12 )#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -