22f4dca8 |
1 | //----------------------------------------------------------------------------- |
2 | // Jonathan Westhues, Aug 2005 |
3 | // Iceman, Sept 2016 |
4 | // |
5 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, |
6 | // at your option, any later version. See the LICENSE.txt file for the text of |
7 | // the license. |
8 | //----------------------------------------------------------------------------- |
9 | // Timers, Clocks functions used in LF or Legic where you would need detailed time. |
10 | //----------------------------------------------------------------------------- |
11 | |
12 | #ifndef __TICKS_H |
13 | #define __TICKS_H |
14 | |
15 | #include <stddef.h> |
16 | #include <stdint.h> |
17 | #include "common.h" |
18 | #include "apps.h" |
19 | #include "proxmark3.h" |
20 | |
21 | #ifndef GET_TICKS |
c649c433 |
22 | # define GET_TICKS (uint32_t)((AT91C_BASE_TC1->TC_CV << 16) | AT91C_BASE_TC0->TC_CV) |
22f4dca8 |
23 | #endif |
24 | |
25 | void SpinDelay(int ms); |
26 | void SpinDelayUs(int us); |
27 | |
28 | void StartTickCount(void); |
29 | uint32_t RAMFUNC GetTickCount(void); |
30 | |
31 | void StartCountUS(void); |
32 | uint32_t RAMFUNC GetCountUS(void); |
33 | void ResetUSClock(void); |
34 | void SpinDelayCountUs(uint32_t us); |
35 | //uint32_t RAMFUNC GetDeltaCountUS(void); |
36 | |
37 | void StartCountSspClk(); |
38 | void ResetSspClk(void); |
39 | uint32_t RAMFUNC GetCountSspClk(); |
40 | |
41 | extern void StartTicks(void); |
42 | extern void WaitTicks(uint32_t ticks); |
43 | extern void WaitUS(uint16_t us); |
44 | extern void WaitMS(uint16_t ms); |
45 | extern void ResetTicks(); |
46 | extern void ResetTimer(AT91PS_TC timer); |
d41efbf2 |
47 | extern void StopTicks(void); |
22f4dca8 |
48 | #endif |