Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / staging / ced1401 / machine.h
blobdbd4036d9bdddda07d8d0d97a9c0559d4f8e022d
1 /*****************************************************************************
2 **
3 ** machine.h
4 **
5 ** Copyright (c) Cambridge Electronic Design Limited 1991,1992,2010
6 **
7 ** This program is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU General Public License
9 ** as published by the Free Software Foundation; either version 2
10 ** of the License, or (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 ** Contact CED: Cambridge Electronic Design Limited, Science Park, Milton Road
22 ** Cambridge, CB6 0FE.
23 ** www.ced.co.uk
24 ** greg@ced.co.uk
26 ** This file is included at the start of 'C' or 'C++' source file to define
27 ** things for cross-platform/compiler interoperability. This used to deal with
28 ** MSDOS/16-bit stuff, but this was all removed in Decemeber 2010. There are
29 ** three things to consider: Windows, LINUX, mac OSX (BSD Unix) and 32 vs 64
30 ** bit. At the time of writing (DEC 2010) there is a consensus on the following
31 ** and their unsigned equivalents:
33 ** type bits
34 ** char 8
35 ** short 16
36 ** int 32
37 ** long long 64
39 ** long is a problem as it is always 64 bits on linux/unix and is always 32 bits
40 ** on windows.
41 ** On windows, we define _IS_WINDOWS_ and one of WIN32 or WIN64.
42 ** On linux we define LINUX
43 ** On Max OSX we define MACOSX
47 #ifndef __MACHINE_H__
48 #define __MACHINE_H__
49 #ifndef __KERNEL__
50 #include <float.h>
51 #include <limits.h>
52 #endif
55 ** The initial section is to identify the operating system
57 #if (defined(__linux__) || defined(_linux) || defined(__linux)) && !defined(LINUX)
58 #define LINUX 1
59 #endif
61 #if (defined(__WIN32__) || defined(_WIN32)) && !defined(WIN32)
62 #define WIN32 1
63 #endif
65 #if defined(__APPLE__)
66 #define MACOSX
67 #endif
69 #if defined(_WIN64)
70 #undef WIN32
71 #undef WIN64
72 #define WIN64 1
73 #endif
75 #if defined(WIN32) || defined(WIN64)
76 #define _IS_WINDOWS_ 1
77 #endif
79 #if defined(LINUX) || defined(MAXOSX)
80 #define FAR
82 typedef int BOOL; /* To match Windows */
83 typedef unsigned char BYTE;
84 #define __packed __attribute__((packed))
85 #define HIWORD(x) (unsigned short)(((x)>>16) & 0xffff)
86 #define LOWORD(x) (unsigned short)((x) & 0xffff)
87 #endif
89 #ifdef _IS_WINDOWS_
90 #include <windows.h>
91 #define __packed
92 #endif
95 ** Sort out the DllExport and DllImport macros. The GCC compiler has its own
96 ** syntax for this, though it also supports the MS specific __declspec() as
97 ** a synonym.
99 #ifdef GNUC
100 #define DllExport __attribute__((dllexport))
101 #define DllImport __attribute__((dllimport))
102 #endif
104 #ifndef DllExport
105 #ifdef _IS_WINDOWS_
106 #define DllExport __declspec(dllexport)
107 #define DllImport __declspec(dllimport)
108 #else
109 #define DllExport
110 #define DllImport
111 #endif
112 #endif /* _IS_WINDOWS_ */
114 #ifndef TRUE
115 #define TRUE 1
116 #define FALSE 0
117 #endif
119 #endif