aboutsummaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
committerChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
commit866a6ca0e749f4446b7fdc7579a6d553df85ec10 (patch)
treed259223d85c224d649c6c38675e99b155d50cf48 /include/sys
parent3a8ed19bf83f11ff00c4904fab2cc083b7e33478 (diff)
Moved includes to its own directory
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/core.h55
-rw-r--r--include/sys/kernel.h8
-rw-r--r--include/sys/power.h6
-rw-r--r--include/sys/timer.h10
4 files changed, 79 insertions, 0 deletions
diff --git a/include/sys/core.h b/include/sys/core.h
new file mode 100644
index 0000000..2d611b3
--- /dev/null
+++ b/include/sys/core.h
@@ -0,0 +1,55 @@
+#ifndef SYS_CORE_H
+#define SYS_CORE_H
+
+#ifndef SYS_CORE_C
+extern char* os_info_v;
+#endif
+
+static inline unsigned long load32(unsigned long addr)
+{
+ return *(volatile unsigned long*)addr;
+}
+
+static inline void store32(unsigned long value, unsigned long addr)
+{
+ *(volatile unsigned long*)addr = value;
+}
+
+static inline void delay(unsigned long cycles)
+{
+ asm volatile("__delay_%=: subs %[cycles], %[cycles], #1;bne __delay_%=\n"
+ : "=r"(cycles): [cycles]"0"(cycles) : "cc");
+}
+
+static inline void preserveregs(void)
+{
+ asm volatile("push {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11}");
+}
+
+static inline void restoreregs(void)
+{
+ asm volatile("pop {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11}");
+}
+
+static inline void* getsp(void)
+{
+ void* out;
+ asm volatile ("mov %0, sp" : "=r"(out));
+ return out;
+}
+
+static inline void setsp(void* in)
+{
+ asm volatile ("mov sp, %0" :: "r"(in));
+}
+
+static inline void* heap_end(void)
+{
+ unsigned long value;
+ asm volatile ("ldr %0, =__bss_end": "=r"(value));
+ return (void*)value;
+}
+
+void sysinit(void);
+
+#endif
diff --git a/include/sys/kernel.h b/include/sys/kernel.h
new file mode 100644
index 0000000..e724513
--- /dev/null
+++ b/include/sys/kernel.h
@@ -0,0 +1,8 @@
+#ifndef SYS_KERNEL_H
+#define SYS_KERNEL_H
+
+extern unsigned long cntfrq;
+extern unsigned long cmdidx;
+extern char cmd[2048];
+
+#endif
diff --git a/include/sys/power.h b/include/sys/power.h
new file mode 100644
index 0000000..711842b
--- /dev/null
+++ b/include/sys/power.h
@@ -0,0 +1,6 @@
+#ifndef SYS_POWER_H
+#define SYS_POWER_H
+
+void reboot(void);
+
+#endif
diff --git a/include/sys/timer.h b/include/sys/timer.h
new file mode 100644
index 0000000..29dc2dd
--- /dev/null
+++ b/include/sys/timer.h
@@ -0,0 +1,10 @@
+#ifndef SYS_TIMER_H
+#define SYS_TIMER_H
+
+#ifndef SYS_TIMER_C
+extern struct Mutex exe_cnt_m;
+#endif
+
+void c_timer(void);
+
+#endif