-/* $Id: platform.h,v 1.37.4.2 2004/08/28 20:03:53 armin Exp $
+/* $Id: platform.h,v 1.37.4.6 2005/01/31 12:22:20 armin Exp $
*
* platform.h
*
#define DIVA_BUILD "local"
#endif
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#define NULL ((void *) 0)
#endif
-#ifndef MIN
-#define MIN(a,b) ((a)>(b) ? (b) : (a))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b) ? (a) : (b))
-#endif
-
#ifndef far
#define far
#endif
}
static __inline__ void diva_os_free (unsigned long flags, void* ptr)
{
- if (ptr) {
- vfree(ptr);
- }
+ vfree(ptr);
}
/*
/*
** I/O port access abstraction
*/
-byte inpp (void*);
-word inppw (void*);
-void inppw_buffer (void*, void*, int);
-void outppw (void*, word);
-void outppw_buffer (void* , void*, int);
-void outpp (void*, word);
+byte inpp (void __iomem *);
+word inppw (void __iomem *);
+void inppw_buffer (void __iomem *, void*, int);
+void outppw (void __iomem *, word);
+void outppw_buffer (void __iomem * , void*, int);
+void outpp (void __iomem *, word);
/*
** IRQ
/*
** endian macros
+**
+** If only... In some cases we did use them for endianness conversion;
+** unfortunately, other uses were real iomem accesses.
*/
+#define READ_BYTE(addr) readb(addr)
#define READ_WORD(addr) readw(addr)
#define READ_DWORD(addr) readl(addr)
+#define WRITE_BYTE(addr,v) writeb(v,addr)
#define WRITE_WORD(addr,v) writew(v,addr)
#define WRITE_DWORD(addr,v) writel(v,addr)
+static inline __u16 GET_WORD(void *addr)
+{
+ return le16_to_cpu(*(__le16 *)addr);
+}
+static inline __u32 GET_DWORD(void *addr)
+{
+ return le32_to_cpu(*(__le32 *)addr);
+}
+static inline void PUT_WORD(void *addr, __u16 v)
+{
+ *(__le16 *)addr = cpu_to_le16(v);
+}
+static inline void PUT_DWORD(void *addr, __u32 v)
+{
+ *(__le32 *)addr = cpu_to_le32(v);
+}
+
/*
** 32/64 bit macors
*/