1/*-
2 * Cronyx DDK: platform dependent definitions.
3 *
4 * Copyright (C) 1998-1999 Cronyx Engineering
5 * Author: Alexander Kvitchenko, <aak@cronyx.ru>
6 *
7 * Copyright (C) 2001-2003 Cronyx Engineering.
8 * Author: Roman Kurakin, <rik@cronyx.ru>
9 *
10 * This software is distributed with NO WARRANTIES, not even the implied
11 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 * Authors grant any other persons or organisations permission to use
14 * or modify this software as long as this message is kept with the software,
15 * all derivative works or modified versions.
16 *
17 * Cronyx Id: machdep.h,v 1.3.4.3 2003/11/27 14:21:58 rik Exp $
18 * $FreeBSD$
19 */
20
21/*
22 * DOS (Borland Turbo C++ 1.0)
23 */
24#if defined (MSDOS) || defined (__MSDOS__)
25#   include <dos.h>
26#   include <string.h>
27#   define inb(port)		inportb(port)
28#   define inw(port)		inport(port)
29#   define outb(port,b)		outportb(port,b)
30#   define outw(port,w)		outport(port,w)
31#   define GETTICKS()		biostime(0,0L)
32#else
33
34/*
35 * Windows NT
36 */
37#ifdef NDIS_MINIPORT_DRIVER
38#   include <string.h>
39#   define inb(port)		inp((unsigned short)(port))
40#   define inw(port)		inpw((unsigned short)(port))
41#   define outb(port,b)		outp((unsigned short)(port),b)
42#   define outw(port,w)		outpw((unsigned short)(port),(unsigned short)(w))
43#pragma warning (disable: 4761)
44#pragma warning (disable: 4242)
45#pragma warning (disable: 4244)
46#define ulong64			unsigned __int64
47#else
48
49/*
50 * Linux
51 */
52#ifdef __linux__
53#   undef REALLY_SLOW_IO
54#   include <asm/io.h>		/* should swap outb() arguments */
55#   include <linux/string.h>
56#   include <linux/delay.h>
57    static inline void __ddk_outb (unsigned port, unsigned char byte)
58    { outb (byte, port); }
59    static inline void __ddk_outw (unsigned port, unsigned short word)
60    { outw (word, port); }
61#   undef outb
62#   undef outw
63#   define outb(port,val)	__ddk_outb(port, val)
64#   define outw(port,val)	__ddk_outw(port, val)
65#   define GETTICKS()		(jiffies * 200 / 11 / HZ)
66#else
67
68/*
69 * FreeBSD and BSD/OS
70 */
71#ifdef __FreeBSD__
72#   include <sys/param.h>
73#   include <machine/cpufunc.h>
74#   include <sys/libkern.h>
75#   include <sys/systm.h>
76#   define memset(a,b,c)	bzero (a,c)
77#   define port_t int
78
79#ifndef _SYS_CDEFS_H_
80#error this file needs sys/cdefs.h as a prerequisite
81#endif
82#endif
83
84#endif
85#endif
86#endif
87
88#ifndef inline
89#   ifdef __CC_SUPPORTS___INLINE__
90#      define inline __inline__
91#   else
92#      define inline /**/
93#   endif
94#endif
95
96#ifndef ulong64
97#define ulong64 unsigned long long
98#endif
99