Commit | Line | Data |
---|---|---|
635d2b00 GKH |
1 | #ifndef CSR_TIME_H__ |
2 | #define CSR_TIME_H__ | |
3 | /***************************************************************************** | |
4 | ||
71775725 SY |
5 | (c) Cambridge Silicon Radio Limited 2010 |
6 | All rights reserved and confidential information of CSR | |
635d2b00 | 7 | |
71775725 SY |
8 | Refer to LICENSE.txt included with this source for details |
9 | on the license terms. | |
635d2b00 GKH |
10 | |
11 | *****************************************************************************/ | |
12 | ||
980b5a2b | 13 | #include <linux/types.h> |
635d2b00 | 14 | |
635d2b00 GKH |
15 | /******************************************************************************* |
16 | ||
71775725 SY |
17 | NAME |
18 | CsrTimeGet | |
635d2b00 | 19 | |
71775725 SY |
20 | DESCRIPTION |
21 | Returns the current system time in a low and a high part. The low part | |
22 | is expressed in microseconds. The high part is incremented when the low | |
23 | part wraps to provide an extended range. | |
635d2b00 | 24 | |
71775725 SY |
25 | The caller may provide a NULL pointer as the high parameter. |
26 | In this case the function just returns the low part and ignores the | |
27 | high parameter. | |
635d2b00 | 28 | |
71775725 SY |
29 | Although the time is expressed in microseconds the actual resolution is |
30 | platform dependent and can be less. It is recommended that the | |
31 | resolution is at least 10 milliseconds. | |
635d2b00 | 32 | |
71775725 SY |
33 | PARAMETERS |
34 | high - Pointer to variable that will receive the high part of the | |
35 | current system time. Passing NULL is valid. | |
635d2b00 | 36 | |
71775725 SY |
37 | RETURNS |
38 | Low part of current system time in microseconds. | |
635d2b00 GKH |
39 | |
40 | *******************************************************************************/ | |
aad3d31f | 41 | u32 CsrTimeGet(u32 *high); |
635d2b00 GKH |
42 | |
43 | ||
635d2b00 GKH |
44 | /*------------------------------------------------------------------*/ |
45 | /* CsrTime Macros */ | |
46 | /*------------------------------------------------------------------*/ | |
47 | ||
48 | /*----------------------------------------------------------------------------* | |
49 | * NAME | |
50 | * CsrTimeAdd | |
51 | * | |
52 | * DESCRIPTION | |
53 | * Add two time values. Adding the numbers can overflow the range of a | |
54 | * CsrTime, so the user must be cautious. | |
55 | * | |
56 | * RETURNS | |
57 | * CsrTime - the sum of "t1" and "t2". | |
58 | * | |
59 | *----------------------------------------------------------------------------*/ | |
60 | #define CsrTimeAdd(t1, t2) ((t1) + (t2)) | |
61 | ||
62 | /*----------------------------------------------------------------------------* | |
63 | * NAME | |
64 | * CsrTimeSub | |
65 | * | |
66 | * DESCRIPTION | |
67 | * Subtract two time values. Subtracting the numbers can provoke an | |
68 | * underflow, so the user must be cautious. | |
69 | * | |
70 | * RETURNS | |
71 | * CsrTime - "t1" - "t2". | |
72 | * | |
73 | *----------------------------------------------------------------------------*/ | |
95e326c2 | 74 | #define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2)) |
635d2b00 | 75 | |
635d2b00 | 76 | #endif |