]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/can_sysdep.h
9e6adf528217b1fdd5bb8c9b5ec1186bdcd962de
[lincan.git] / lincan / include / can_sysdep.h
1 #ifndef _CAN_SYSDEP_H
2 #define _CAN_SYSDEP_H
3
4 /*#define __NO_VERSION__*/
5 /*#include <linux/module.h>*/
6
7 #include <linux/version.h>
8 #include <linux/wait.h>
9 #include <linux/list.h>
10 #include <linux/fs.h>
11 #include <linux/ioport.h>
12 #include <linux/delay.h>
13 #include <linux/sched.h>
14 #include <linux/interrupt.h>
15 #include <asm/errno.h>
16 #include <asm/io.h>
17 #include <asm/atomic.h>
18 #include <asm/irq.h>
19 #include <asm/uaccess.h>
20
21 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
22 #include <linux/malloc.h>
23 #else
24 #include <linux/slab.h>
25 #endif
26
27
28 /* Next is not sctrictly correct, because of 2.3.0, 2.3.1, 2.3.2
29    kernels need next definitions  too */
30 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,19)) /* may need correction */
31   #define wait_queue_head_t struct wait_queue *
32   #define wait_queue_t      struct wait_queue
33   #define init_waitqueue_head(queue_head) (*queue_head=NULL)
34   #define init_waitqueue_entry(qentry,qtask) \
35                         (qentry->next=NULL,qentry->task=qtask)
36   #define DECLARE_WAIT_QUEUE_HEAD(name) \
37         struct wait_queue * name=NULL
38   #define DECLARE_WAITQUEUE(wait, current) \
39         struct wait_queue wait = { current, NULL }
40   #define init_MUTEX(sem) (*sem=MUTEX)
41   #define DECLARE_MUTEX(name) struct semaphore name=MUTEX
42 #endif /* 2.2.19 */
43
44
45 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,7)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
46
47 #define MINOR_NR \
48         (MINOR(file->f_dentry->d_inode->i_rdev))
49
50 #else /* Linux kernel < 2.5.7 or >= 2.6.0 */
51
52 #define MINOR_NR \
53         (minor(file->f_dentry->d_inode->i_rdev))
54
55 #endif /* Linux kernel < 2.5.7 or >= 2.6.0 */
56
57
58 #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) && !defined(IRQ_RETVAL))
59   typedef void irqreturn_t;
60   #define IRQ_NONE
61   #define IRQ_HANDLED
62   #define IRQ_RETVAL(x)
63 #endif /* <=2.5.67 */
64
65 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,33))
66    #define can_synchronize_irq(irqnum) synchronize_irq()
67 #else /* >=2.5.33 */
68    #define can_synchronize_irq synchronize_irq
69 #endif
70
71 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
72   #define del_timer_sync del_timer
73 #endif /* <2.4.0 */
74
75 #endif /*_CAN_SYSDEP_H*/