aboutsummaryrefslogtreecommitdiffstats
path: root/src/ar100/internal.h
diff options
context:
space:
mode:
authorElias Bakken <elias@iagent.no>2023-02-21 02:15:01 +0100
committerGitHub <noreply@github.com>2023-02-20 20:15:01 -0500
commitb7978d37b360fb270782a8db5d690342654e6977 (patch)
tree5383243d85dee85a521f466ac966460ee092efa2 /src/ar100/internal.h
parentd7bd7f1f4ba6cecd19daa566fdc1864561269ae1 (diff)
downloadkutter-b7978d37b360fb270782a8db5d690342654e6977.tar.gz
kutter-b7978d37b360fb270782a8db5d690342654e6977.tar.xz
kutter-b7978d37b360fb270782a8db5d690342654e6977.zip
ar100: Support for ar100 (#6054)
Add files to support AR100 Signed-off-by: Elias Bakken <elias@iagent.no>
Diffstat (limited to 'src/ar100/internal.h')
-rw-r--r--src/ar100/internal.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ar100/internal.h b/src/ar100/internal.h
new file mode 100644
index 00000000..406a4cd2
--- /dev/null
+++ b/src/ar100/internal.h
@@ -0,0 +1,34 @@
+#ifndef __AR100_INTERNAL_H
+#define __AR100_INTERNAL_H
+
+#define R_PIO_BASE 0x01F02C00
+#define PIO_BASE 0x01C20800
+
+enum pin_func {
+ PIO_INPUT,
+ PIO_OUTPUT,
+ PIO_ALT1,
+ PIO_ALT2,
+ PIO_ALT3,
+ PIO_ALT4,
+ PIO_ALT5,
+ PIO_DISABLE
+};
+
+struct gpio_mux {
+ uint32_t pin;
+ uint8_t bank;
+ uint32_t reg;
+};
+
+struct gpio_mux gpio_mux_setup(uint8_t pin, enum pin_func func);
+static inline unsigned long mfspr(unsigned long add){
+ unsigned long ret;
+ __asm__ __volatile__ ("l.mfspr %0,r0,%1" : "=r" (ret) : "K" (add));
+ return ret;
+}
+static inline void mtspr(unsigned long add, unsigned long val){
+ __asm__ __volatile__ ("l.mtspr r0,%1,%0" : : "K" (add), "r" (val));
+}
+
+#endif // internal.h