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.3 17 Jun 2004
10 #ifndef __CONSTANTS_H__
11 #define __CONSTANTS_H__
13 /* Device name as it will appear in /proc/devices */
14 #define DEVICE_NAME "can"
16 /* Branch of the driver */
17 #define CAN_DRV_BRANCH (('L'<<24)|('I'<<16)|('N'<<8)|'C')
19 /* Version of the driver */
20 #define CAN_DRV_VER_MAJOR 0
21 #define CAN_DRV_VER_MINOR 3
22 #define CAN_DRV_VER_PATCH 0
23 #define CAN_DRV_VER ((CAN_DRV_VER_MAJOR<<16) | (CAN_DRV_VER_MINOR<<8) | CAN_DRV_VER_PATCH)
25 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
28 /* Definition of the maximum number of concurrent supported hardware boards,
29 * chips per board, total number of chips, interrupts and message objects.
30 * Obviously there are no 32 different interrupts, but each chip can have its
31 * own interrupt so we have to check for it MAX_IRQ == MAX_TOT_CHIPS times.
33 #define MAX_HW_CARDS 8
34 #define MAX_HW_CHIPS 4
35 #define MAX_TOT_CHIPS (MAX_HW_CHIPS*MAX_HW_CARDS)
36 #define MAX_TOT_CHIPS_STR 32 /* must be explicit for MODULE_PARM */
38 #define MAX_MSGOBJS 15
39 #define MAX_TOT_MSGOBJS (MAX_TOT_CHIPS*MAX_MSGOBJS)
40 #define MAX_BUF_LENGTH 64
41 //#define MAX_BUF_LENGTH 4
44 /* These flags can be used for the msgobj_t structure flags data entry */
45 #define MSGOBJ_OPENED_b 0
46 #define MSGOBJ_TX_REQUEST_b 1
47 #define MSGOBJ_TX_LOCK_b 2
48 #define MSGOBJ_IRQ_REQUEST_b 3
49 #define MSGOBJ_WORKER_WAKE_b 4
50 #define MSGOBJ_FILTCH_REQUEST_b 5
51 #define MSGOBJ_RX_MODE_b 6
52 #define MSGOBJ_RX_MODE_EXT_b 7
54 #define MSGOBJ_OPENED (1<<MSGOBJ_OPENED_b)
55 #define MSGOBJ_TX_REQUEST (1<<MSGOBJ_TX_REQUEST_b)
56 #define MSGOBJ_TX_LOCK (1<<MSGOBJ_TX_LOCK_b)
57 #define MSGOBJ_IRQ_REQUEST (1<<MSGOBJ_IRQ_REQUEST_b)
58 #define MSGOBJ_WORKER_WAKE (1<<MSGOBJ_WORKER_WAKE_b)
59 #define MSGOBJ_FILTCH_REQUEST (1<<MSGOBJ_FILTCH_REQUEST_b)
60 #define MSGOBJ_RX_MODE (1<<MSGOBJ_RX_MODE_b)
61 #define MSGOBJ_RX_MODE_EXT (1<<MSGOBJ_RX_MODE_EXT_b)
63 #define can_msgobj_test_fl(obj,obj_fl) \
64 test_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
65 #define can_msgobj_set_fl(obj,obj_fl) \
66 set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
67 #define can_msgobj_clear_fl(obj,obj_fl) \
68 clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
69 #define can_msgobj_test_and_set_fl(obj,obj_fl) \
70 test_and_set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
71 #define can_msgobj_test_and_clear_fl(obj,obj_fl) \
72 test_and_clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
75 /* These flags can be used for the canchip_t structure flags data entry */
76 #define CHIP_CONFIGURED (1<<0) /* chip is configured and prepared for communication */
77 #define CHIP_SEGMENTED (1<<1) /* segmented access, ex: i82527 with 16 byte window*/
78 #define CHIP_IRQ_SETUP (1<<2) /* IRQ handler has been set */
79 #define CHIP_IRQ_PCI (1<<3) /* chip is on PCI board and uses PCI interrupt */
80 #define CHIP_IRQ_VME (1<<4) /* interrupt is VME bus and requires VME bridge */
81 #define CHIP_IRQ_CUSTOM (1<<5) /* custom interrupt provided by board or chip code */
82 #define CHIP_IRQ_FAST (1<<6) /* interrupt handler only schedules postponed processing */
84 #define CHIP_MAX_IRQLOOP 1000
86 /* System independent defines of IRQ handled state */
87 #define CANCHIP_IRQ_NONE 0
88 #define CANCHIP_IRQ_HANDLED 1
89 #define CANCHIP_IRQ_ACCEPTED 2
90 #define CANCHIP_IRQ_STUCK 3
92 /* These flags can be used for the candevices_t structure flags data entry */
93 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
94 #define CANDEV_IO_RESERVED (1<<1)
96 /* Next flags are specific for struct canuser_t applications connection */
97 #define CANUSER_RTL_CLIENT (1<<0)
98 #define CANUSER_RTL_MEM (1<<1)
99 #define CANUSER_DIRECT (1<<2)
107 /* Flags for baud_rate function */
108 #define BTR1_SAM (1<<1)