summaryrefslogtreecommitdiff
path: root/include/arch/tc1796-triboard/driver/gpio.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/tc1796-triboard/driver/gpio.h
parente2d191ebe69745fe658df8c56be2f8d3c4e7af47 (diff)
tc1796 is a proper arch now
Diffstat (limited to 'include/arch/tc1796-triboard/driver/gpio.h')
-rw-r--r--include/arch/tc1796-triboard/driver/gpio.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/arch/tc1796-triboard/driver/gpio.h b/include/arch/tc1796-triboard/driver/gpio.h
new file mode 100644
index 0000000..9ac43dd
--- /dev/null
+++ b/include/arch/tc1796-triboard/driver/gpio.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 Daniel Friesel
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+#ifndef GPIO_H
+#define GPIO_H
+
+class GPIO {
+ private:
+ GPIO(const GPIO &copy);
+
+ 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