diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-07-21 12:49:26 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-07-21 12:49:26 +0200 |
commit | 61f4d2dc0e672f2c26bc964a27789cfd4fb81b88 (patch) | |
tree | e6e688cc34cf69928039f58e2fd9c5796cf611d6 /include/arch/infineon-tc1796-mock | |
parent | e2d191ebe69745fe658df8c56be2f8d3c4e7af47 (diff) |
tc1796 is a proper arch now
Diffstat (limited to 'include/arch/infineon-tc1796-mock')
-rw-r--r-- | include/arch/infineon-tc1796-mock/driver/counter.h | 41 | ||||
-rw-r--r-- | include/arch/infineon-tc1796-mock/driver/gpio.h | 53 | ||||
-rw-r--r-- | include/arch/infineon-tc1796-mock/driver/stdout.h | 24 | ||||
-rw-r--r-- | include/arch/infineon-tc1796-mock/driver/uptime.h | 32 |
4 files changed, 0 insertions, 150 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 ©); - 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 diff --git a/include/arch/infineon-tc1796-mock/driver/gpio.h b/include/arch/infineon-tc1796-mock/driver/gpio.h deleted file mode 100644 index 9ac43dd..0000000 --- a/include/arch/infineon-tc1796-mock/driver/gpio.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef GPIO_H -#define GPIO_H - -class GPIO { - private: - GPIO(const GPIO ©); - - public: - GPIO () {} - - enum Pin : unsigned char { - PIN_INVALID - }; - - inline void setup() { - *((int*)0xf0000f10) = 0x80808080; - *((int*)0xf0000f14) = 0x80808080; - *((int*)0xf0000f00) = 0x000000ff; - } - inline void led_on(unsigned char id = 0) { - *((int*)0xf0000f00) &= ~(1 << id); - } - inline void led_off(unsigned char id = 0) { - *((int*)0xf0000f00) |= (1 << id); - } - inline void led_toggle(unsigned char id = 0) { - *((int*)0xf0000f00) ^= (1 << id); - } - inline void input(unsigned char const pin) { - } - inline void input(unsigned char const pin, unsigned char const pull) { - } - inline void output(unsigned char const pin) { - } - inline void output(unsigned char const pin, unsigned char const value) { - } - inline unsigned char read(unsigned char const pin) { - return 0; - } - inline void write(unsigned char const pin, unsigned char value) { - } - inline void write_mask(unsigned char const pin_base, unsigned char set_mask, unsigned char clear_mask) { - } -}; - -extern GPIO gpio; - -#endif diff --git a/include/arch/infineon-tc1796-mock/driver/stdout.h b/include/arch/infineon-tc1796-mock/driver/stdout.h deleted file mode 100644 index b701dc1..0000000 --- a/include/arch/infineon-tc1796-mock/driver/stdout.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2022 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef STANDARDOUTPUT_H -#define STANDARDOUTPUT_H - -#include "object/outputstream.h" - -class StandardOutput : public OutputStream { - private: - StandardOutput(const StandardOutput ©); - - public: - StandardOutput () {} - void setup(); - - virtual void put(char c) override; -}; - -extern StandardOutput kout; - -#endif diff --git a/include/arch/infineon-tc1796-mock/driver/uptime.h b/include/arch/infineon-tc1796-mock/driver/uptime.h deleted file mode 100644 index 6f52f8f..0000000 --- a/include/arch/infineon-tc1796-mock/driver/uptime.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2022 Daniel Friesel - * - * SPDX-License-Identifier: BSD-2-Clause - */ -#ifndef UPTIME_H -#define UPTIME_H - -class Uptime { - private: - Uptime(const Uptime ©); -#ifdef TIMER_S - uint16_t seconds; -#endif - - public: -#ifdef TIMER_S - Uptime () : seconds(0) {} -#else - Uptime () {} -#endif - inline uint16_t get_us() { return 0; } - inline uint16_t get_cycles() { return 0; } -#ifdef TIMER_S - inline uint16_t get_s() { return seconds; } - inline void tick_s() { seconds++; } -#endif -}; - -extern Uptime uptime; - -#endif |