From 866a6ca0e749f4446b7fdc7579a6d553df85ec10 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 5 Jan 2022 14:27:09 -0800 Subject: Moved includes to its own directory --- include/sys/core.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/sys/kernel.h | 8 ++++++++ include/sys/power.h | 6 ++++++ include/sys/timer.h | 10 ++++++++++ 4 files changed, 79 insertions(+) create mode 100644 include/sys/core.h create mode 100644 include/sys/kernel.h create mode 100644 include/sys/power.h create mode 100644 include/sys/timer.h (limited to 'include/sys') 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 -- cgit v1.2.1