summaryrefslogtreecommitdiffstats
path: root/sys/dev/cx/machdep.h
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-12-03 07:29:38 +0000
committerimp <imp@FreeBSD.org>2003-12-03 07:29:38 +0000
commitf6ae273bd0ee3c14e5c7cc2650865f5ead7fa808 (patch)
tree87af7efeab367d034ff04731cacb4fe3c29d84fc /sys/dev/cx/machdep.h
parent9524d14ce664a11e19c13090ddfa8d80344b8d91 (diff)
downloadFreeBSD-src-f6ae273bd0ee3c14e5c7cc2650865f5ead7fa808.zip
FreeBSD-src-f6ae273bd0ee3c14e5c7cc2650865f5ead7fa808.tar.gz
Updated cx driver commit part 1: bring in the new kernel driver.
This is the vastly updated cx drvier from Roman Kurakin <rik@cronyx.ru> who has been patiently waiting for this update for sometime. The driver is mostly a rewrite from the version we have in the tree. While some similarities remain, losing the little history that the old driver has is not a big loss, and the re@ felt it was easier this way (less error prone). The userland parts of this update will be committed shortly. The driver is not connected to the build yet. I want to make sure I don't break any platform at any time, so I want to test that with these files in the tree before I continue (on the off chance I'm forgetting a file). I changed the DEBUG macro to CX_DEBUG from the code that was submitted (to not break when we go to building with opt_global.h after the release), as well adding $FreeBSD$. Submitted by: Roman Kurakin Approved by: re@ <scottl>
Diffstat (limited to 'sys/dev/cx/machdep.h')
-rw-r--r--sys/dev/cx/machdep.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/sys/dev/cx/machdep.h b/sys/dev/cx/machdep.h
new file mode 100644
index 0000000..b88e900
--- /dev/null
+++ b/sys/dev/cx/machdep.h
@@ -0,0 +1,96 @@
+/*
+ * Cronyx DDK: platform dependent definitions.
+ *
+ * Copyright (C) 1998-1999 Cronyx Engineering
+ * Author: Alexander Kvitchenko, <aak@cronyx.ru>
+ *
+ * Copyright (C) 2001-2003 Cronyx Engineering.
+ * Author: Roman Kurakin, <rik@cronyx.ru>
+ *
+ * This software is distributed with NO WARRANTIES, not even the implied
+ * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Authors grant any other persons or organisations permission to use
+ * or modify this software as long as this message is kept with the software,
+ * all derivative works or modified versions.
+ *
+ * Cronyx Id: machdep.h,v 1.3.4.3 2003/11/27 14:21:58 rik Exp $
+ * $FreeBSD$
+ */
+
+/*
+ * DOS (Borland Turbo C++ 1.0)
+ */
+#if defined (MSDOS) || defined (__MSDOS__)
+# include <dos.h>
+# include <string.h>
+# define inb(port) inportb(port)
+# define inw(port) inport(port)
+# define outb(port,b) outportb(port,b)
+# define outw(port,w) outport(port,w)
+# define GETTICKS() biostime(0,0L)
+#else
+
+/*
+ * Windows NT
+ */
+#ifdef NDIS_MINIPORT_DRIVER
+# include <string.h>
+# define inb(port) inp((unsigned short)(port))
+# define inw(port) inpw((unsigned short)(port))
+# define outb(port,b) outp((unsigned short)(port),b)
+# define outw(port,w) outpw((unsigned short)(port),(unsigned short)(w))
+#pragma warning (disable: 4761)
+#pragma warning (disable: 4242)
+#pragma warning (disable: 4244)
+#define ulong64 unsigned __int64
+#else
+
+/*
+ * Linux
+ */
+#ifdef __linux__
+# undef REALLY_SLOW_IO
+# include <asm/io.h> /* should swap outb() arguments */
+# include <linux/string.h>
+# include <linux/delay.h>
+ static inline void __ddk_outb (unsigned port, unsigned char byte)
+ { outb (byte, port); }
+ static inline void __ddk_outw (unsigned port, unsigned short word)
+ { outw (word, port); }
+# undef outb
+# undef outw
+# define outb(port,val) __ddk_outb(port, val)
+# define outw(port,val) __ddk_outw(port, val)
+# define GETTICKS() (jiffies * 200 / 11 / HZ)
+#else
+
+/*
+ * FreeBSD and BSD/OS
+ */
+#ifdef __FreeBSD__
+# include <sys/param.h>
+# include <machine/cpufunc.h>
+# include <sys/libkern.h>
+# include <sys/systm.h>
+# define memset(a,b,c) bzero (a,c)
+# if __FreeBSD_version > 501000
+# define port_t int
+# endif
+#endif
+
+#endif
+#endif
+#endif
+
+#ifndef inline
+# if __GNUC__ >= 2
+# define inline __inline__
+# else
+# define inline /**/
+# endif
+#endif
+
+#ifndef ulong64
+#define ulong64 unsigned long long
+#endif
OpenPOWER on IntegriCloud