1139749Simp/*-
2123120Simp * Cronyx DDK: platform dependent definitions.
3123120Simp *
4123120Simp * Copyright (C) 1998-1999 Cronyx Engineering
5123120Simp * Author: Alexander Kvitchenko, <aak@cronyx.ru>
6123120Simp *
7123120Simp * Copyright (C) 2001-2003 Cronyx Engineering.
8123120Simp * Author: Roman Kurakin, <rik@cronyx.ru>
9123120Simp *
10123120Simp * This software is distributed with NO WARRANTIES, not even the implied
11123120Simp * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12123120Simp *
13123120Simp * Authors grant any other persons or organisations permission to use
14123120Simp * or modify this software as long as this message is kept with the software,
15123120Simp * all derivative works or modified versions.
16123120Simp *
17123120Simp * Cronyx Id: machdep.h,v 1.3.4.3 2003/11/27 14:21:58 rik Exp $
18123120Simp * $FreeBSD: releng/10.3/sys/dev/cx/machdep.h 143063 2005-03-02 21:33:29Z joerg $
19123120Simp */
20123120Simp
21123120Simp/*
22123120Simp * DOS (Borland Turbo C++ 1.0)
23123120Simp */
24123120Simp#if defined (MSDOS) || defined (__MSDOS__)
25123120Simp#   include <dos.h>
26123120Simp#   include <string.h>
27123120Simp#   define inb(port)		inportb(port)
28123120Simp#   define inw(port)		inport(port)
29123120Simp#   define outb(port,b)		outportb(port,b)
30123120Simp#   define outw(port,w)		outport(port,w)
31123120Simp#   define GETTICKS()		biostime(0,0L)
32123120Simp#else
33123120Simp
34123120Simp/*
35123120Simp * Windows NT
36123120Simp */
37123120Simp#ifdef NDIS_MINIPORT_DRIVER
38123120Simp#   include <string.h>
39123120Simp#   define inb(port)		inp((unsigned short)(port))
40123120Simp#   define inw(port)		inpw((unsigned short)(port))
41123120Simp#   define outb(port,b)		outp((unsigned short)(port),b)
42123120Simp#   define outw(port,w)		outpw((unsigned short)(port),(unsigned short)(w))
43123120Simp#pragma warning (disable: 4761)
44123120Simp#pragma warning (disable: 4242)
45123120Simp#pragma warning (disable: 4244)
46123120Simp#define ulong64			unsigned __int64
47123120Simp#else
48123120Simp
49123120Simp/*
50123120Simp * Linux
51123120Simp */
52123120Simp#ifdef __linux__
53123120Simp#   undef REALLY_SLOW_IO
54123120Simp#   include <asm/io.h>		/* should swap outb() arguments */
55123120Simp#   include <linux/string.h>
56123120Simp#   include <linux/delay.h>
57123120Simp    static inline void __ddk_outb (unsigned port, unsigned char byte)
58123120Simp    { outb (byte, port); }
59123120Simp    static inline void __ddk_outw (unsigned port, unsigned short word)
60123120Simp    { outw (word, port); }
61123120Simp#   undef outb
62123120Simp#   undef outw
63123120Simp#   define outb(port,val)	__ddk_outb(port, val)
64123120Simp#   define outw(port,val)	__ddk_outw(port, val)
65123120Simp#   define GETTICKS()		(jiffies * 200 / 11 / HZ)
66123120Simp#else
67123120Simp
68123120Simp/*
69123120Simp * FreeBSD and BSD/OS
70123120Simp */
71123120Simp#ifdef __FreeBSD__
72123120Simp#   include <sys/param.h>
73123120Simp#   include <machine/cpufunc.h>
74123120Simp#   include <sys/libkern.h>
75123120Simp#   include <sys/systm.h>
76123120Simp#   define memset(a,b,c)	bzero (a,c)
77136472Sphk#   define port_t int
78143063Sjoerg
79143063Sjoerg#ifndef _SYS_CDEFS_H_
80143063Sjoerg#error this file needs sys/cdefs.h as a prerequisite
81123120Simp#endif
82143063Sjoerg#endif
83123120Simp
84123120Simp#endif
85123120Simp#endif
86123120Simp#endif
87123120Simp
88123120Simp#ifndef inline
89143063Sjoerg#   ifdef __CC_SUPPORTS___INLINE__
90123120Simp#      define inline __inline__
91123120Simp#   else
92123120Simp#      define inline /**/
93123120Simp#   endif
94123120Simp#endif
95123120Simp
96123120Simp#ifndef ulong64
97123120Simp#define ulong64 unsigned long long
98123120Simp#endif
99