]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/constants.h
Added skeleton of IRQ support on VME bus
[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 #ifndef __CONSTANTS_H__
11 #define __CONSTANTS_H__
12
13 /* Device name as it will appear in /proc/devices */
14 #define DEVICE_NAME "can"
15
16 /* Branch of the driver */
17 #define CAN_DRV_BRANCH (('L'<<24)|('I'<<16)|('N'<<8)|'C')
18
19 /* Version of the driver */
20 #define CAN_DRV_VER_MAJOR 0
21 #define CAN_DRV_VER_MINOR 2
22 #define CAN_DRV_VER_PATCH 1
23 #define CAN_DRV_VER ((CAN_DRV_VER_MAJOR<<16) | (CAN_DRV_VER_MINOR<<8) | CAN_DRV_VER_PATCH)
24
25 /* Default driver major number, see /usr/src/linux/Documentation/devices.txt */
26 #define CAN_MAJOR 91
27
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.
32  */
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 */
37 #define MAX_IRQ 32
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
42
43
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
52 #define MSGOBJ_OPENED              (1<<MSGOBJ_OPENED_b)
53 #define MSGOBJ_TX_REQUEST          (1<<MSGOBJ_TX_REQUEST_b)
54 #define MSGOBJ_TX_LOCK             (1<<MSGOBJ_TX_LOCK_b)
55 #define MSGOBJ_IRQ_REQUEST         (1<<MSGOBJ_IRQ_REQUEST_b)
56 #define MSGOBJ_WORKER_WAKE         (1<<MSGOBJ_WORKER_WAKE_b)
57 #define MSGOBJ_FILTCH_REQUEST      (1<<MSGOBJ_FILTCH_REQUEST_b)
58
59 #define can_msgobj_test_fl(obj,obj_fl) \
60   test_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
61 #define can_msgobj_set_fl(obj,obj_fl) \
62   set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
63 #define can_msgobj_clear_fl(obj,obj_fl) \
64   clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
65 #define can_msgobj_test_and_set_fl(obj,obj_fl) \
66   test_and_set_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
67 #define can_msgobj_test_and_clear_fl(obj,obj_fl) \
68   test_and_clear_bit(MSGOBJ_##obj_fl##_b,&(obj)->obj_flags)
69
70
71 /* These flags can be used for the chip_t structure flags data entry */
72 #define CHIP_CONFIGURED  (1<<0)
73 #define CHIP_SEGMENTED   (1<<1)
74 #define CHIP_IRQ_SETUP   (1<<2)
75 #define CHIP_IRQ_PCI     (1<<3)
76 #define CHIP_IRQ_VME     (1<<4)
77
78 /* These flags can be used for the candevices_t structure flags data entry */
79 #define CANDEV_PROGRAMMABLE_IRQ (1<<0)
80 #define CANDEV_IO_RESERVED      (1<<1)
81
82 /* Next flags are specific for struct canuser_t applications connection */
83 #define CANUSER_RTL_CLIENT      (1<<0)
84 #define CANUSER_RTL_MEM         (1<<1)
85 #define CANUSER_DIRECT          (1<<2)
86
87
88 enum timing_BTR1 {
89         MAX_TSEG1 = 15,
90         MAX_TSEG2 = 7
91 };
92
93 /* Flags for baud_rate function */
94 #define BTR1_SAM (1<<1)
95
96 #endif