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 */ 19 20 /* 21 * DOS (Borland Turbo C++ 1.0) 22 */ 23 #if defined (MSDOS) || defined (__MSDOS__) 24 # include <dos.h> 25 # include <string.h> 26 # define inb(port) inportb(port) 27 # define inw(port) inport(port) 28 # define outb(port,b) outportb(port,b) 29 # define outw(port,w) outport(port,w) 30 # define GETTICKS() biostime(0,0L) 31 #else 32 33 /* 34 * Windows NT 35 */ 36 #ifdef NDIS_MINIPORT_DRIVER 37 # include <string.h> 38 # define inb(port) inp((unsigned short)(port)) 39 # define inw(port) inpw((unsigned short)(port)) 40 # define outb(port,b) outp((unsigned short)(port),b) 41 # define outw(port,w) outpw((unsigned short)(port),(unsigned short)(w)) 42 #pragma warning (disable: 4761) 43 #pragma warning (disable: 4242) 44 #pragma warning (disable: 4244) 45 #define ulong64 unsigned __int64 46 #else 47 48 /* 49 * Linux 50 */ 51 #ifdef __linux__ 52 # undef REALLY_SLOW_IO 53 # include <asm/io.h> /* should swap outb() arguments */ 54 # include <linux/string.h> 55 # include <linux/delay.h> __ddk_outb(unsigned port,unsigned char byte)56 static inline void __ddk_outb (unsigned port, unsigned char byte) 57 { outb (byte, port); } __ddk_outw(unsigned port,unsigned short word)58 static inline void __ddk_outw (unsigned port, unsigned short word) 59 { outw (word, port); } 60 # undef outb 61 # undef outw 62 # define outb(port,val) __ddk_outb(port, val) 63 # define outw(port,val) __ddk_outw(port, val) 64 # define GETTICKS() (jiffies * 200 / 11 / HZ) 65 #else 66 67 /* 68 * FreeBSD and BSD/OS 69 */ 70 #ifdef __FreeBSD__ 71 # include <sys/param.h> 72 # include <machine/cpufunc.h> 73 # include <sys/libkern.h> 74 # include <sys/systm.h> 75 # define port_t int 76 #endif 77 78 #endif 79 #endif 80 #endif 81 82 #ifndef inline 83 # ifdef __CC_SUPPORTS___INLINE__ 84 # define inline __inline__ 85 # else 86 # define inline /**/ 87 # endif 88 #endif 89 90 #ifndef ulong64 91 #define ulong64 unsigned long long 92 #endif 93