]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/constants.h
Added full RT-Linux POSIX interface to LinCAN driver, needs preparation of RT tests.
[lincan.git] / lincan / include / constants.h
1 /* constants.h
2  * Header file for the Linux CAN-bus driver.
3  * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4  * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5  * email:pisa@cmp.felk.cvut.cz
6  * This software is released under the GPL-License.
7  * Version lincan-0.2  9 Jul 2003
8  */
9
10 #ifdef __CONSTANTS_H__
11 #else
12 #define __CONSTANTS_H__
13
14 /* Device name as it will appear in /proc/devices */
15 #define DEVICE_NAME "can"
16
17 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
18 #define CAN_MAJOR 91
19
20 /* Timeout in jiffies before the system calls return with an error */
21 #define CANTIMEOUT (4*HZ)
22
23 /* Definition of the maximum number of concurrent supported hardware boards,
24  * chips per board, total number of chips, interrupts and message objects.
25  * Obviously there are no 32 different interrupts, but each chip can have its
26  * own interrupt so we have to check for it MAX_IRQ == MAX_TOT_CHIPS times.
27  */
28 #define MAX_HW_CARDS 8
29 #define MAX_HW_CHIPS 4
30 #define MAX_TOT_CHIPS (MAX_HW_CHIPS*MAX_HW_CARDS)
31 #define MAX_TOT_CHIPS_STR 32    /* must be explicit for MODULE_PARM */
32 #define MAX_IRQ 32
33 #define MAX_MSGOBJS 15
34 #define MAX_TOT_MSGOBJS (MAX_TOT_CHIPS*MAX_MSGOBJS)
35 #define MAX_BUF_LENGTH 64
36 //#define MAX_BUF_LENGTH 4
37
38
39 /* These flags can be used for the msgobj_t structure flags data entry */
40 #define MSGOBJ_OPENED_b            0
41 #define MSGOBJ_TX_REQUEST_b        1
42 #define MSGOBJ_TX_LOCK_b           2
43 #define MSGOBJ_IRQ_REQUEST_b       3
44 #define MSGOBJ_WORKER_WAKE_b       4
45
46 #define MSGOBJ_OPENED              (1<<MSGOBJ_OPENED_b)
47 #define MSGOBJ_TX_REQUEST          (1<<MSGOBJ_TX_REQUEST_b)
48 #define MSGOBJ_TX_LOCK             (1<<MSGOBJ_TX_LOCK_b)
49 #define MSGOBJ_IRQ_REQUEST         (1<<MSGOBJ_IRQ_REQUEST_b)
50 #define MSGOBJ_WORKER_WAKE         (1<<MSGOBJ_WORKER_WAKE_b)
51
52 #define can_msgobj_test_fl(obj,obj_fl) \
53   test_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
54 #define can_msgobj_set_fl(obj,obj_fl) \
55   set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
56 #define can_msgobj_clear_fl(obj,obj_fl) \
57   clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
58 #define can_msgobj_test_and_set_fl(obj,obj_fl) \
59   test_and_set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
60 #define can_msgobj_test_and_clear_fl(obj,obj_fl) \
61   test_and_clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
62
63
64 /* These flags can be used for the chip_t structure flags data entry */
65 #define CHIP_CONFIGURED  (1<<0)
66 #define CHIP_SEGMENTED   (1<<1)
67 #define CHIP_IRQ_SETUP   (1<<2)
68
69 /* These flags can be used for the candevices_t structure flags data entry */
70 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
71 #define CANDEV_IO_RESERVED      (1<<1)
72
73 /* Next flags are specific for struct canuser_t applications connection */
74 #define CANUSER_RTL_CLIENT      (1<<0)
75 #define CANUSER_RTL_MEM         (1<<1)
76 #define CANUSER_DIRECT          (1<<2)
77
78
79 enum timing_BTR1 {
80         MAX_TSEG1 = 15,
81         MAX_TSEG2 = 7
82 };
83
84 /* Flags for baud_rate function */
85 #define BTR1_SAM (1<<1)
86
87 #endif