summaryrefslogtreecommitdiffstats
path: root/drivers/staging/csr/unifi_os.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2012-06-20 01:15:42 +0200
committerGreg Kroah-Hartman2012-06-20 01:37:01 +0200
commit635d2b00e5070378e7bf812acf47fb135c6ab928 (patch)
tree7048a0a511f3d221aa2dfe40aa3a401991f1b175 /drivers/staging/csr/unifi_os.h
parentStaging: add CSR Wifi "os helper" module (diff)
downloadkernel-qcow2-linux-635d2b00e5070378e7bf812acf47fb135c6ab928.tar.gz
kernel-qcow2-linux-635d2b00e5070378e7bf812acf47fb135c6ab928.tar.xz
kernel-qcow2-linux-635d2b00e5070378e7bf812acf47fb135c6ab928.zip
Staging: add CSR wifi module
This consists of two modules, the driver, and a "helper" module that is just a wrapper around common kernel functions. The wrapper module will be removed soon, but for now it's needed. These files were based on the csr-linux-wifi-5.0.3-oss.tar.gz package provided by CSR and Blue Giga, and is covered under the license specified in the LICENSE.txt file (basically dual BSD and GPLv2). The files were flattened out of the deep directory mess they were originally in, and a few EXPORT_SYMBOL_GPL() were added in order for everything to link properly with the helper module setup. Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/csr/unifi_os.h')
-rw-r--r--drivers/staging/csr/unifi_os.h137
1 files changed, 137 insertions, 0 deletions
diff --git a/drivers/staging/csr/unifi_os.h b/drivers/staging/csr/unifi_os.h
new file mode 100644
index 000000000000..579c7e0544a3
--- /dev/null
+++ b/drivers/staging/csr/unifi_os.h
@@ -0,0 +1,137 @@
+/*
+ * ---------------------------------------------------------------------------
+ *
+ * FILE: os_linux/unifi_os.h
+ *
+ * PURPOSE:
+ * This header file provides the OS-dependent facilities for a linux
+ * environment.
+ *
+ * Copyright (C) 2005-2008 by Cambridge Silicon Radio Ltd.
+ *
+ * Refer to LICENSE.txt included with this source code for details on
+ * the license terms.
+ *
+ * ---------------------------------------------------------------------------
+ */
+#ifndef __UNIFI_OS_LINUX_H__
+#define __UNIFI_OS_LINUX_H__ 1
+
+#include <linux/kernel.h>
+#include <linux/time.h>
+#include <linux/list.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+
+/*
+ * Needed for core/signals.c
+ */
+#include <stddef.h>
+
+
+/* Define INLINE directive*/
+#define INLINE inline
+
+/* Malloc and free */
+CsrResult unifi_net_data_malloc(void *ospriv, bulk_data_desc_t *bulk_data_slot, unsigned int size);
+void unifi_net_data_free(void *ospriv, bulk_data_desc_t *bulk_data_slot);
+#define CSR_WIFI_ALIGN_BYTES 4
+CsrResult unifi_net_dma_align(void *ospriv, bulk_data_desc_t *bulk_data_slot);
+
+/*
+ * Byte Order
+ * Note that __le*_to_cpu and __cpu_to_le* return an unsigned value!
+ */
+#ifdef __KERNEL__
+#define unifi2host_16(n) (__le16_to_cpu((n)))
+#define unifi2host_32(n) (__le32_to_cpu((n)))
+#define host2unifi_16(n) (__cpu_to_le16((n)))
+#define host2unifi_32(n) (__cpu_to_le32((n)))
+#endif
+
+/* Module parameters */
+extern int unifi_debug;
+
+/* debugging */
+#ifdef UNIFI_DEBUG
+/*
+ * unifi_debug is a verbosity level for debug messages
+ * UDBG0 msgs are always printed if UNIFI_DEBUG is defined
+ * UDBG1 msgs are printed if UNIFI_DEBUG is defined and unifi_debug > 0
+ * etc.
+ */
+
+#define func_enter() \
+ do { \
+ if (unifi_debug >= 5) { \
+ printk("unifi: => %s\n", __FUNCTION__); \
+ } \
+ } while (0)
+#define func_exit() \
+ do { \
+ if (unifi_debug >= 5) { \
+ printk("unifi: <= %s\n", __FUNCTION__); \
+ } \
+ } while (0)
+#define func_exit_r(_rc) \
+ do { \
+ if (unifi_debug >= 5) { \
+ printk("unifi: <= %s %d\n", __FUNCTION__, (int)(_rc)); \
+ } \
+ } while (0)
+
+
+#define ASSERT(cond) \
+ do { \
+ if (!(cond)) { \
+ printk("Assertion failed in %s at %s:%d: %s\n", \
+ __FUNCTION__, __FILE__, __LINE__, #cond); \
+ } \
+ } while (0)
+
+
+void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len);
+void dump(void *mem, CsrUint16 len);
+void dump16(void *mem, CsrUint16 len);
+#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
+void dump_str(void *mem, CsrUint16 len);
+#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */
+
+#else
+
+/* Stubs */
+#define func_enter()
+#define func_exit()
+#define func_exit_r(_rc)
+
+#define ASSERT(cond)
+
+static inline void unifi_dump(void *ospriv, int lvl, const char *msg, void *mem, CsrUint16 len) {}
+static inline void dump(void *mem, CsrUint16 len) {}
+static inline void dump16(void *mem, CsrUint16 len) {}
+#ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
+static inline void dump_str(void *mem, CsrUint16 len) {}
+#endif /* CSR_WIFI_HIP_DEBUG_OFFLINE */
+
+#endif /* UNIFI_DEBUG */
+
+
+void unifi_error(void* ospriv, const char *fmt, ...);
+void unifi_warning(void* ospriv, const char *fmt, ...);
+void unifi_notice(void* ospriv, const char *fmt, ...);
+void unifi_info(void* ospriv, const char *fmt, ...);
+
+void unifi_trace(void* ospriv, int level, const char *fmt, ...);
+
+/* Different levels of diagnostic detail... */
+#define UDBG0 0 /* always prints in debug build */
+#define UDBG1 1
+#define UDBG2 2
+#define UDBG3 3
+#define UDBG4 4
+#define UDBG5 5
+#define UDBG6 6
+#define UDBG7 7
+
+
+#endif /* __UNIFI_OS_LINUX_H__ */