StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mvmeFastTickerLib.h
1 #ifndef _MVME_FAST_TICKER_LIB_H
2 #define _MVME_FAST_TICKER_LIB_H
3 
4 #include <vxWorks.h>
5 
6 #include <MVME/ppcIOLib.h>
7 
8 #define MVME_FAST_TICKER_DIV ((UINT32 *)0xfc0010f0)
9 #define MVME_FAST_TICKER_LOAD ((UINT32 *)0xfc001110)
10 #define MVME_FAST_TICKER_READ ((UINT32 *)0xfc001100)
11 #define MVME_FAST_TICKER_VECTOR ((UINT32 *)0xfc001120)
12 #define MVME_FAST_TICKER_DEST ((UINT32 *)0xfc001130)
13 
14 extern void mvmeFastTickerInit(void) ;
15 extern UINT32 mvmeFastTickerGet(void) ;
16 
17 extern inline volatile unsigned int mvmeFastTickerMark(void)
18 {
19  return rs32(MVME_FAST_TICKER_READ) & 0x7FFFFFFF ;
20 }
21 
22 
23 extern inline volatile unsigned int mvmeFastTickerDelta(unsigned int old)
24 {
25  volatile unsigned int cur = rs32(MVME_FAST_TICKER_READ) & 0x7FFFFFFF ;
26  u_int ret ;
27 
28  if(old >= cur) ret = (old-cur) ;
29  else ret = (((unsigned int)0x7FFFFFFF-cur)+old) ;
30 
31  return (ret*4 + 17)/33 ; // round off the value to microseconds
32 }
33 
34 
35 
36 #endif