summaryrefslogtreecommitdiffstats
path: root/drivers/staging/csr/csr_time.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 16:15:42 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-19 16:37:01 -0700
commit635d2b00e5070378e7bf812acf47fb135c6ab928 (patch)
tree7048a0a511f3d221aa2dfe40aa3a401991f1b175 /drivers/staging/csr/csr_time.c
parent15a4bc17b7f4e85cb019e683f14e834078ec2208 (diff)
downloadop-kernel-dev-635d2b00e5070378e7bf812acf47fb135c6ab928.zip
op-kernel-dev-635d2b00e5070378e7bf812acf47fb135c6ab928.tar.gz
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/csr_time.c')
-rw-r--r--drivers/staging/csr/csr_time.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c
new file mode 100644
index 0000000..1ef61e3
--- /dev/null
+++ b/drivers/staging/csr/csr_time.c
@@ -0,0 +1,71 @@
+/*****************************************************************************
+
+ (c) Cambridge Silicon Radio Limited 2010
+ All rights reserved and confidential information of CSR
+
+ Refer to LICENSE.txt included with this source for details
+ on the license terms.
+
+*****************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+#include <linux/autoconf.h>
+#include <linux/config.h>
+#endif
+
+#include <linux/time.h>
+#include <linux/module.h>
+
+#include "csr_types.h"
+#include "csr_time.h"
+
+CsrTime CsrTimeGet(CsrTime *high)
+{
+ struct timespec ts;
+ CsrUint64 time;
+ CsrTime low;
+
+ ts = current_kernel_time();
+ time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+
+ if (high != NULL)
+ {
+ *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
+ }
+
+ low = (CsrTime) (time & 0xFFFFFFFF);
+
+ return low;
+}
+EXPORT_SYMBOL_GPL(CsrTimeGet);
+
+void CsrTimeUtcGet(CsrTimeUtc *tod, CsrTime *low, CsrTime *high)
+{
+ struct timespec ts;
+ CsrUint64 time;
+
+ ts = current_kernel_time();
+ time = (CsrUint64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+
+ if (high != NULL)
+ {
+ *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
+ }
+
+ if (low != NULL)
+ {
+ *low = (CsrTime) (time & 0xFFFFFFFF);
+ }
+
+ if (tod != NULL)
+ {
+ struct timeval tv;
+ do_gettimeofday(&tv);
+ tod->sec = tv.tv_sec;
+ tod->msec = tv.tv_usec / 1000;
+ }
+}
OpenPOWER on IntegriCloud