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
10 #ifdef __CONSTANTS_H__
12 #define __CONSTANTS_H__
14 /* Device name as it will appear in /proc/devices */
15 #define DEVICE_NAME "can"
17 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
20 /* Timeout in jiffies before the system calls return with an error */
21 #define CANTIMEOUT (4*HZ)
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.
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 */
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
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
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)
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)
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)
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)
78 /* Flags for baud_rate function */
79 #define BTR1_SAM (1<<1)