summaryrefslogtreecommitdiff
path: root/include/arch/infineon-tc1796-mock/driver/counter.h
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-07-21 12:49:26 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2022-07-21 12:49:26 +0200
commit61f4d2dc0e672f2c26bc964a27789cfd4fb81b88 (patch)
treee6e688cc34cf69928039f58e2fd9c5796cf611d6 /include/arch/infineon-tc1796-mock/driver/counter.h
parente2d191ebe69745fe658df8c56be2f8d3c4e7af47 (diff)
tc1796 is a proper arch now
Diffstat (limited to 'include/arch/infineon-tc1796-mock/driver/counter.h')
-rw-r--r--include/arch/infineon-tc1796-mock/driver/counter.h41
1 files changed, 0 insertions, 41 deletions
diff --git a/include/arch/infineon-tc1796-mock/driver/counter.h b/include/arch/infineon-tc1796-mock/driver/counter.h
deleted file mode 100644
index 38d039e..0000000
--- a/include/arch/infineon-tc1796-mock/driver/counter.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2022 Daniel Friesel
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-#ifndef COUNTER_H
-#define COUNTER_H
-
-#define STM_TIM0 (*(volatile unsigned int*)0xf0000210)
-#define STM_CAP (*(volatile unsigned int*)0xf000022c)
-
-typedef unsigned int counter_value_t;
-typedef unsigned int counter_overflow_t;
-
-class Counter {
- private:
- Counter(const Counter &copy);
- unsigned long long startvalue, stopvalue;
-
- public:
- counter_value_t value;
- counter_overflow_t overflow;
-
- Counter() : overflow(0) {}
-
- inline void start() {
- startvalue = STM_TIM0;
- startvalue += (unsigned long long)STM_CAP << 32;
- }
-
- inline void stop() {
- stopvalue = STM_TIM0;
- stopvalue += (unsigned long long)STM_CAP << 32;
- value = (stopvalue - startvalue) & 0xffffffff;
- overflow = (unsigned long long)(stopvalue - startvalue) >> 32;
- }
-};
-
-extern Counter counter;
-
-#endif