KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ticks.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : timer.h
11  * Created : 8 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 
16 #ifndef TICKS_H_
17 #define TICKS_H_
18 
19 /**
20  * @file
21  *
22  * @ingroup wbdrivers
23  *
24  * White Rabbit simple timer 'Ticks' driver.
25  */
26 
27 #include <stdint.h>
28 
29 #define TICKS_PER_SEC 1000 ///< Timer is in milliseconds.
30 
31 
32 #ifndef KM3SIM
33 #include "lm32soc/dev_soc.h"
34 /**
35  * Nr of ticks since device start up. Wraps at maximum to 0.
36  */
37 static inline uint32_t ticks()
38 {
39  return TIMER->TICS;
40 }
41 #else
42 
43 #include <time.h>
44 
45 static inline uint32_t ticks()
46 {
47 
48  return (uint32_t)(clock() & 0xFFFFFFFF);
49 }
50 
51 #endif
52 
53 #endif /* TICKS_H_ */
#define TIMER
TIMER base pointer.
Definition: dev_soc.h:67
static uint32_t ticks()
Nr of ticks since device start up.
Definition: ticks.h:37
This file assigns all device structures to memory mapped structures.