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 3
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 32
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
53 #define MSGOBJ_TX_PENDING_b 8
55 #define MSGOBJ_OPENED (1<<MSGOBJ_OPENED_b)
56 #define MSGOBJ_TX_REQUEST (1<<MSGOBJ_TX_REQUEST_b)
57 #define MSGOBJ_TX_LOCK (1<<MSGOBJ_TX_LOCK_b)
58 #define MSGOBJ_IRQ_REQUEST (1<<MSGOBJ_IRQ_REQUEST_b)
59 #define MSGOBJ_WORKER_WAKE (1<<MSGOBJ_WORKER_WAKE_b)
60 #define MSGOBJ_FILTCH_REQUEST (1<<MSGOBJ_FILTCH_REQUEST_b)
61 #define MSGOBJ_RX_MODE (1<<MSGOBJ_RX_MODE_b)
62 #define MSGOBJ_RX_MODE_EXT (1<<MSGOBJ_RX_MODE_EXT_b)
63 #define MSGOBJ_TX_PENDING (1<<MSGOBJ_TX_PENDING_b)
65 #define can_msgobj_test_fl(obj,obj_fl) \
66 test_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
67 #define can_msgobj_set_fl(obj,obj_fl) \
68 set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
69 #define can_msgobj_clear_fl(obj,obj_fl) \
70 clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
71 #define can_msgobj_test_and_set_fl(obj,obj_fl) \
72 test_and_set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
73 #define can_msgobj_test_and_clear_fl(obj,obj_fl) \
74 test_and_clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
77 /* These flags can be used for the canchip_t structure flags data entry */
78 #define CHIP_ATTACHED (1<<0) /* chip is attached to HW, release_chip() has to be called */
79 #define CHIP_CONFIGURED (1<<1) /* chip is configured and prepared for communication */
80 #define CHIP_SEGMENTED (1<<2) /* segmented access, ex: i82527 with 16 byte window*/
81 #define CHIP_IRQ_SETUP (1<<3) /* IRQ handler has been set */
82 #define CHIP_IRQ_PCI (1<<4) /* chip is on PCI board and uses PCI interrupt */
83 #define CHIP_IRQ_VME (1<<5) /* interrupt is VME bus and requires VME bridge */
84 #define CHIP_IRQ_CUSTOM (1<<6) /* custom interrupt provided by board or chip code */
85 #define CHIP_IRQ_FAST (1<<7) /* interrupt handler only schedules postponed processing */
87 #define CHIP_MAX_IRQLOOP 1000
89 /* System independent defines of IRQ handled state */
90 #define CANCHIP_IRQ_NONE 0
91 #define CANCHIP_IRQ_HANDLED 1
92 #define CANCHIP_IRQ_ACCEPTED 2
93 #define CANCHIP_IRQ_STUCK 3
95 /* These flags can be used for the candevices_t structure flags data entry */
96 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
97 #define CANDEV_IO_RESERVED (1<<1)
99 /* Next flags are specific for struct canuser_t applications connection */
100 #define CANUSER_RTL_CLIENT (1<<0)
101 #define CANUSER_RTL_MEM (1<<1)
102 #define CANUSER_DIRECT (1<<2)
110 /* Flags for baud_rate function */
111 #define BTR1_SAM (1<<1)