]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/can.h
The original version of Arnaud Westenberg Linux CAN-bus driver
[lincan.git] / lincan / include / can.h
diff --git a/lincan/include/can.h b/lincan/include/can.h
new file mode 100644 (file)
index 0000000..071deae
--- /dev/null
@@ -0,0 +1,45 @@
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#ifndef PACKED
+#define PACKED __attribute__((packed))
+#endif
+
+#define CAN_MSG_LENGTH 8
+
+struct canmsg_t {
+       short           flags;
+       int             cob;
+       unsigned long   id;
+       unsigned long   timestamp;
+       unsigned int    length;
+       char            data[CAN_MSG_LENGTH];
+} PACKED;
+
+/* Definitions to use for canmsg_t flags */
+#define MSG_RTR (1<<0)
+#define MSG_OVR (1<<1)
+#define MSG_EXT (1<<2)
+
+/* CAN ioctl magic number */
+#define CAN_IOC_MAGIC 'd'
+
+unsigned long bittiming;
+unsigned short channel;
+
+/* CAN ioctl functions */
+#define CMD_START _IOW(CAN_IOC_MAGIC, 1, channel)
+#define CMD_STOP _IOW(CAN_IOC_MAGIC, 2, channel)
+//#define CMD_RESET 3
+
+#define CONF_BAUD _IOW(CAN_IOC_MAGIC, 4, bittiming)
+//#define CONF_ACCM
+//#define CONF_XTDACCM
+//#define CONF_TIMING
+//#define CONF_OMODE
+#define CONF_FILTER _IOW(CAN_IOC_MAGIC, 8, unsigned char)
+//#define CONF_FENABLE
+//#define CONF_FDISABLE
+
+
+#define STAT _IO(CAN_IOC_MAGIC, 9)