]> rtime.felk.cvut.cz Git - linux-lin.git/commitdiff
sllin: General purpose LIN-related flags and masks moved into separate header file.
authorRostislav Lisovy <lisovy@gmail.com>
Wed, 14 Dec 2011 12:33:20 +0000 (13:33 +0100)
committerRostislav Lisovy <lisovy@gmail.com>
Wed, 14 Dec 2011 12:33:20 +0000 (13:33 +0100)
sllin/linux/lin_bus.h [new file with mode: 0644]
sllin/sllin.c

diff --git a/sllin/linux/lin_bus.h b/sllin/linux/lin_bus.h
new file mode 100644 (file)
index 0000000..e3aaea4
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef _LIN_BUS_H_
+#define _LIN_BUS_H_
+
+#define SLLIN_ID_MASK          0x3f
+#define SLLIN_ID_MAX           SLLIN_ID_MASK
+#define SLLIN_CTRL_FRAME       CAN_EFF_FLAG
+
+#define SLLIN_CANFR_FLAGS_OFFS 6 /* Lower 6 bits in can_id correspond to LIN ID */
+/* Save configuration for particular LIN ID */
+#define SLLIN_LIN_ID_CONF      (1 <<  SLLIN_CANFR_FLAGS_OFFS)
+/* Publisher of particular LIN response is SLLIN Master */
+#define SLLIN_SRC_MASTER       (1 << (SLLIN_CANFR_FLAGS_OFFS + 1))
+#define SLLIN_SRC_SLAVE                (1 << (SLLIN_CANFR_FLAGS_OFFS + 2))
+#define SLLIN_SLAVE_LOCAL      (1 << (SLLIN_CANFR_FLAGS_OFFS + 3))
+#define SLLIN_SLAVE_REMOTE     (1 << (SLLIN_CANFR_FLAGS_OFFS + 4))
+#define SLLIN_LOC_SLAVE_CACHE  (1 << (SLLIN_CANFR_FLAGS_OFFS + 5))
+#define SLLIN_CHECKSUM_EXTENDED        (1 << (SLLIN_CANFR_FLAGS_OFFS + 6))
+
+#define SLLIN_ERR_RX_TIMEOUT    (1 << (SLLIN_CANFR_FLAGS_OFFS + 7))
+#define SLLIN_ERR_CHECKSUM      (1 << (SLLIN_CANFR_FLAGS_OFFS + 8))
+//#define SLLIN_ERR_FRAMING     (1 << (SLLIN_CANFR_FLAGS_OFFS + 9))
+
+#endif /* _LIN_BUS_H_ */
index bb42c4037533b3486b52b0113ee64c228769c9bb..d1821e801ab4969f697feb750aa68541f5bdcf75 100644 (file)
@@ -58,6 +58,7 @@
 #include <linux/can.h>
 #include <linux/kthread.h>
 #include <linux/hrtimer.h>
+#include "linux/lin_bus.h"
 
 /* Should be in include/linux/tty.h */
 #define N_SLLIN                25
@@ -89,10 +90,6 @@ MODULE_PARM_DESC(maxdev, "Maximum number of sllin interfaces");
 #define SLLIN_BUFF_ID          2
 #define SLLIN_BUFF_DATA                3
 
-#define SLLIN_ID_MASK          0x3f
-#define SLLIN_ID_MAX           SLLIN_ID_MASK
-#define SLLIN_CTRL_FRAME       CAN_EFF_FLAG
-
 #define SLLIN_SAMPLES_PER_CHAR 10
 #define SLLIN_CHARS_TO_TIMEOUT 12
 
@@ -109,21 +106,6 @@ enum slstate {
 
 struct sllin_conf_entry {
        int dlc;                /* Length of data in LIN frame */
-#define SLLIN_CANFR_FLAGS_OFFS 6 /* Lower 6 bits in can_id correspond to LIN ID */
-/* Save configuration for particular LIN ID */
-#define SLLIN_LIN_ID_CONF      (1 <<  SLLIN_CANFR_FLAGS_OFFS)
-/* Publisher of particular LIN response is SLLIN Master */
-#define SLLIN_SRC_MASTER       (1 << (SLLIN_CANFR_FLAGS_OFFS + 1))
-#define SLLIN_SRC_SLAVE                (1 << (SLLIN_CANFR_FLAGS_OFFS + 2))
-#define SLLIN_SLAVE_LOCAL      (1 << (SLLIN_CANFR_FLAGS_OFFS + 3))
-#define SLLIN_SLAVE_REMOTE     (1 << (SLLIN_CANFR_FLAGS_OFFS + 4))
-#define SLLIN_LOC_SLAVE_CACHE  (1 << (SLLIN_CANFR_FLAGS_OFFS + 5))
-#define SLLIN_CHECKSUM_EXTENDED        (1 << (SLLIN_CANFR_FLAGS_OFFS + 6))
-
-#define SLLIN_ERR_RX_TIMEOUT    (1 << (SLLIN_CANFR_FLAGS_OFFS + 7))
-#define SLLIN_ERR_CHECKSUM      (1 << (SLLIN_CANFR_FLAGS_OFFS + 8))
-//#define SLLIN_ERR_FRAMING     (1 << (SLLIN_CANFR_FLAGS_OFFS + 9))
-
        canid_t frame_fl;       /* LIN frame flags. Passed from userspace as canid_t data type */
        u8 data[8];             /* LIN frame data payload */
 };