Adding support for MOXA ART SoC. Testing port of linux-2.6.32.60-moxart.
[linux-3.6.7-moxart.git] / drivers / staging / csr / csr_time.c
blob83586ca34e8c55bc59c1830977153ed7b77e9923
1 /*****************************************************************************
3 (c) Cambridge Silicon Radio Limited 2010
4 All rights reserved and confidential information of CSR
6 Refer to LICENSE.txt included with this source for details
7 on the license terms.
9 *****************************************************************************/
11 #include <linux/kernel.h>
12 #include <linux/version.h>
14 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
15 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
16 #include <linux/autoconf.h>
17 #include <linux/config.h>
18 #endif
20 #include <linux/time.h>
21 #include <linux/module.h>
23 #include "csr_time.h"
25 CsrTime CsrTimeGet(CsrTime *high)
27 struct timespec ts;
28 u64 time;
29 CsrTime low;
31 ts = current_kernel_time();
32 time = (u64) ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
34 if (high != NULL)
36 *high = (CsrTime) ((time >> 32) & 0xFFFFFFFF);
39 low = (CsrTime) (time & 0xFFFFFFFF);
41 return low;
43 EXPORT_SYMBOL_GPL(CsrTimeGet);