Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
86 f9daq 1
#ifndef __COMMON_H__
2
#define __COMMON_H__
3
 
4
//****************************************************************************
5
// Copyright (C) 2000-2006  ARW Elektronik Germany
6
//
7
//
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
12
//
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
// GNU General Public License for more details.
17
//
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
//
22
// This product is not authorized for use as critical component in 
23
// life support systems without the express written approval of 
24
// ARW Elektronik Germany.
25
//  
26
// Please announce changes and hints to ARW Elektronik
27
//
28
// Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de)
29
//
30
//****************************************************************************
31
 
32
//****************************************************************************
33
//
34
// common.h - common definitions to include in all *.c files
35
//
36
// $Log: common.h,v $
37
// Revision 1.6  2006/06/04 12:26:07  klaus
38
// release_20060604; Version 6.9; pci_{en|dis}able_device() added; remap_page_range reorganized
39
//
40
// Revision 1.5  2004/08/12 19:59:19  klaus
41
// conversion to kernel-version 2.6, released version 6.0
42
//
43
// Revision 1.4  2003/05/11 11:12:03  klaus
44
// matched to kernel 2.4 PCI handling, debug messages improved
45
//
46
// Revision 1.3  2001/11/20 21:29:24  klaus
47
// Small changes to correct versioning down to kernel 2.3
48
//
49
// Revision 1.2  2001/11/20 20:12:50  klaus
50
// included new header and CVS log
51
//
52
//
53
// created while adapting to kernel version 2.4                 AR   4.10.2001
54
//
55
//****************************************************************************
56
 
57
#include <linux/version.h>
58
#include <generated/autoconf.h>
59
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
60
#define MODVERSIONS
61
#endif
62
 
63
#ifdef MODVERSIONS
64
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
65
    #include <config/modversions.h>
66
  #else
67
    #include <linux/modversions.h>
68
  #endif
69
#endif
70
 
71
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)  
72
#define kfree_s(ptr, size)  kfree(ptr)   /* a workaround cause kfree_s is disapeared in V 2.4 */
73
#endif
74
 
75
// some preparative defintions for kernel 2.6.x 
76
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24)
77
  typedef void irqreturn_t;
78
  #define IRQ_NONE
79
  #define IRQ_HANDLED
80
  #define IRQ_RETVAL(x)
81
#endif
82
 
83
// circumvent deprecated MOD_..._USE_COUNT
84
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
85
#define __MOD_INC_USE_COUNT__
86
#define __MOD_DEC_USE_COUNT__
87
#else
88
#define __MOD_INC_USE_COUNT__ MOD_INC_USE_COUNT
89
#define __MOD_DEC_USE_COUNT__ MOD_DEC_USE_COUNT
90
#endif
91
 
92
// switch to disable all printks for not debugging
93
#ifdef __DEBUG__
94
#define DPRINTK printk
95
#else
96
#define DPRINTK(stuff...)
97
#endif
98
 
99
#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22)
100
#define pcicc32_remap_page_range(a, b, c, d, e) remap_page_range(b, d, e)
101
#else
102
#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
103
#define pcicc32_remap_page_range(a, b, c, d. e) remap_page_range(a, b, c, d, e)
104
#else
105
#define pcicc32_remap_page_range(a, b, c, d, e) remap_pfn_range(a, b, (c >> PAGE_SHIFT), d, e)
106
#endif
107
#endif
108
 
109
#endif /* __COMMON_H__ */