aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/d_timer.c
diff options
context:
space:
mode:
authorNicolas Schodet2023-03-06 17:36:31 +0100
committerNicolas Schodet2023-03-06 17:36:31 +0100
commitd383f2bcdb6ff13cc562fce1ff55d826035debad (patch)
treef5cd0440869b8ba823fd254b361cdefe95e153b4 /src/d_timer.c
parent8fce63fda48a6593870ffd3c584c9dd0808bc2c2 (diff)
Simplify source tree
Now just use make in the root directory to build.
Diffstat (limited to 'src/d_timer.c')
-rw-r--r--src/d_timer.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/d_timer.c b/src/d_timer.c
new file mode 100644
index 0000000..cba73d0
--- /dev/null
+++ b/src/d_timer.c
@@ -0,0 +1,62 @@
+//
+// Date init 14.12.2004
+//
+// Revision date $Date: 23-04-08 11:15 $
+//
+// Filename $Workfile:: d_timer.c $
+//
+// Version $Revision: 2 $
+//
+// Archive $Archive:: /LMS2006/Sys01/Main_V02/Firmware/Source/d_time $
+//
+// Platform C
+//
+
+
+#include "stdconst.h"
+#include "m_sched.h"
+#include "d_timer.h"
+#include "d_timer.r"
+
+
+void dTimerInit(void)
+{
+ TIMERInit;
+}
+
+
+ULONG dTimerRead(void)
+{
+ ULONG V;
+
+ TIMERReadAlt(V)
+ return (V);
+}
+
+ULONG dTimerReadNoPoll(void)
+{
+ return (Timer1mS);
+}
+
+ULONG dTimerReadHiRes(void)
+{
+
+// return ((*AT91C_PITC_PIIR)/3); following code is equivalent and about five times faster, see Hacker's Delight or exact division
+ ULONG tmp= ((*AT91C_PITC_PIIR)*2863311531);
+ if(tmp > 2863311531)
+ return tmp - 2863311531;
+ else if(tmp > 1431655766)
+ return tmp - 1431655766;
+ else
+ return tmp;
+}
+
+ULONG dTimerGetNextMSTickCnt(void) {
+ return NextTimerValue;
+}
+
+void dTimerExit(void)
+{
+ TIMERExit;
+}
+