1 #ifndef CSR_TIME_H__ 2 #define CSR_TIME_H__ 3 /***************************************************************************** 4 5 (c) Cambridge Silicon Radio Limited 2010 6 All rights reserved and confidential information of CSR 7 8 Refer to LICENSE.txt included with this source for details 9 on the license terms. 10 11 *****************************************************************************/ 12 13 #include <linux/types.h> 14 15 /******************************************************************************* 16 17 NAME 18 CsrTimeGet 19 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. 24 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. 28 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. 32 33 PARAMETERS 34 high - Pointer to variable that will receive the high part of the 35 current system time. Passing NULL is valid. 36 37 RETURNS 38 Low part of current system time in microseconds. 39 40 *******************************************************************************/ 41 u32 CsrTimeGet(u32 *high); 42 43 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 *----------------------------------------------------------------------------*/ 74 #define CsrTimeSub(t1, t2) ((s32) (t1) - (s32) (t2)) 75 76 #endif 77