diff options
-rw-r--r-- | Common.mk | 4 | ||||
-rw-r--r-- | include/cpu/atomic/swap.h (renamed from src/cpu/atomic/swap.h) | 0 | ||||
-rw-r--r-- | include/cpu/irq.h (renamed from src/cpu/irq.h) | 0 | ||||
-rw-r--r-- | include/drivers/uart.h (renamed from src/drivers/uart.h) | 0 | ||||
-rw-r--r-- | include/graphics/drawer.h (renamed from src/graphics/drawer.h) | 0 | ||||
-rw-r--r-- | include/graphics/font.bin.h (renamed from src/graphics/font.bin.h) | 0 | ||||
-rw-r--r-- | include/graphics/glyphs.h (renamed from src/graphics/glyphs.h) | 0 | ||||
-rw-r--r-- | include/graphics/homer.h (renamed from src/graphics/homer.h) | 0 | ||||
-rw-r--r-- | include/graphics/lfb.h (renamed from src/graphics/lfb.h) | 0 | ||||
-rw-r--r-- | include/graphics/mbox.h (renamed from src/graphics/mbox.h) | 0 | ||||
-rw-r--r-- | include/graphics/philosopher_toad.h (renamed from src/graphics/philosopher_toad.h) | 0 | ||||
-rw-r--r-- | include/lib/ll.h (renamed from src/lib/ll.h) | 0 | ||||
-rw-r--r-- | include/lib/mem.h (renamed from src/lib/mem.h) | 0 | ||||
-rw-r--r-- | include/lib/q.h (renamed from src/lib/q.h) | 0 | ||||
-rw-r--r-- | include/lib/strings.h (renamed from src/lib/strings.h) | 0 | ||||
-rw-r--r-- | include/symbols.h (renamed from src/sys/core.h) | 57 | ||||
-rw-r--r-- | include/sys/core.h | 55 | ||||
-rw-r--r-- | include/sys/kernel.h (renamed from src/sys/kernel.h) | 0 | ||||
-rw-r--r-- | include/sys/power.h (renamed from src/sys/power.h) | 0 | ||||
-rw-r--r-- | include/sys/timer.h (renamed from src/sys/timer.h) | 0 | ||||
-rw-r--r-- | include/util/mutex.h (renamed from src/util/mutex.h) | 0 | ||||
-rw-r--r-- | include/util/status.h (renamed from src/util/status.h) | 0 | ||||
-rw-r--r-- | include/util/time.h (renamed from src/util/time.h) | 0 | ||||
-rw-r--r-- | src/cpu/irq.c | 19 | ||||
-rw-r--r-- | src/drivers/uart.c | 2 | ||||
-rw-r--r-- | src/graphics/drawer.c | 4 | ||||
-rw-r--r-- | src/graphics/lfb.c | 10 | ||||
-rw-r--r-- | src/graphics/mbox.c | 2 | ||||
-rw-r--r-- | src/lib/ll.c | 4 | ||||
-rw-r--r-- | src/lib/mem.c | 4 | ||||
-rw-r--r-- | src/lib/q.c | 4 | ||||
-rw-r--r-- | src/lib/strings.c | 2 | ||||
-rw-r--r-- | src/sys/core.c | 30 | ||||
-rw-r--r-- | src/sys/power.c | 5 | ||||
-rw-r--r-- | src/sys/timer.c | 16 | ||||
-rw-r--r-- | src/util/mutex.c | 6 | ||||
-rw-r--r-- | src/util/status.c | 15 | ||||
-rw-r--r-- | src/util/time.c | 3 |
38 files changed, 126 insertions, 116 deletions
@@ -13,8 +13,8 @@ OBJCOPY = ${CROSS}-objcopy OBJDUMP = ${CROSS}-objdump QEMU = qemu-system-arm GDB = gdb-multiarch -CFLAGS = -mcpu=cortex-a7 -fpic -ffreestanding -std=gnu99 -O3 -Wall -Wextra -nostdlib -g -AFLAGS = -mcpu=cortex-a7 -g +CFLAGS = -mcpu=cortex-a7 -fpic -ffreestanding -std=gnu99 -O3 -Wall -Wextra -nostdlib -Iinclude -g +AFLAGS = -mcpu=cortex-a7 -Iinclude -g QFLAGS = -M raspi2 -cpu arm1176 -m 1G -chardev stdio,id=char0,mux=on,logfile=serial.log,signal=off -serial chardev:char0 -mon chardev=char0 -device usb-kbd #QFLAGS += -trace events=events #QFLAGS += -nographic diff --git a/src/cpu/atomic/swap.h b/include/cpu/atomic/swap.h index cbed62c..cbed62c 100644 --- a/src/cpu/atomic/swap.h +++ b/include/cpu/atomic/swap.h diff --git a/src/cpu/irq.h b/include/cpu/irq.h index 3b8f085..3b8f085 100644 --- a/src/cpu/irq.h +++ b/include/cpu/irq.h diff --git a/src/drivers/uart.h b/include/drivers/uart.h index b83732f..b83732f 100644 --- a/src/drivers/uart.h +++ b/include/drivers/uart.h diff --git a/src/graphics/drawer.h b/include/graphics/drawer.h index 6d97163..6d97163 100644 --- a/src/graphics/drawer.h +++ b/include/graphics/drawer.h diff --git a/src/graphics/font.bin.h b/include/graphics/font.bin.h index f883cda..f883cda 100644 --- a/src/graphics/font.bin.h +++ b/include/graphics/font.bin.h diff --git a/src/graphics/glyphs.h b/include/graphics/glyphs.h index 1a9319d..1a9319d 100644 --- a/src/graphics/glyphs.h +++ b/include/graphics/glyphs.h diff --git a/src/graphics/homer.h b/include/graphics/homer.h index 459bc3d..459bc3d 100644 --- a/src/graphics/homer.h +++ b/include/graphics/homer.h diff --git a/src/graphics/lfb.h b/include/graphics/lfb.h index a4eef2e..a4eef2e 100644 --- a/src/graphics/lfb.h +++ b/include/graphics/lfb.h diff --git a/src/graphics/mbox.h b/include/graphics/mbox.h index fe021a2..fe021a2 100644 --- a/src/graphics/mbox.h +++ b/include/graphics/mbox.h diff --git a/src/graphics/philosopher_toad.h b/include/graphics/philosopher_toad.h index c58d6b4..c58d6b4 100644 --- a/src/graphics/philosopher_toad.h +++ b/include/graphics/philosopher_toad.h diff --git a/src/lib/ll.h b/include/lib/ll.h index ab4148d..ab4148d 100644 --- a/src/lib/ll.h +++ b/include/lib/ll.h diff --git a/src/lib/mem.h b/include/lib/mem.h index 5c5cc94..5c5cc94 100644 --- a/src/lib/mem.h +++ b/include/lib/mem.h diff --git a/src/lib/q.h b/include/lib/q.h index cf75c6d..cf75c6d 100644 --- a/src/lib/q.h +++ b/include/lib/q.h diff --git a/src/lib/strings.h b/include/lib/strings.h index 1bbcac8..1bbcac8 100644 --- a/src/lib/strings.h +++ b/include/lib/strings.h diff --git a/src/sys/core.h b/include/symbols.h index 9e25f9d..dda0f27 100644 --- a/src/sys/core.h +++ b/include/symbols.h @@ -1,56 +1,5 @@ -#ifndef SYS_CORE_H -#define SYS_CORE_H - -#ifndef SYS_CORE_C -extern char* os_info_v; -#endif - -extern unsigned long cntfrq; - -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; -} +#ifndef SYMBOLS_H +#define SYMBOLS_H enum { @@ -149,6 +98,4 @@ enum PM_RSTC_RESET = 0x00000102, }; -void sysinit(void); - #endif 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/src/sys/kernel.h b/include/sys/kernel.h index e724513..e724513 100644 --- a/src/sys/kernel.h +++ b/include/sys/kernel.h diff --git a/src/sys/power.h b/include/sys/power.h index 711842b..711842b 100644 --- a/src/sys/power.h +++ b/include/sys/power.h diff --git a/src/sys/timer.h b/include/sys/timer.h index 29dc2dd..29dc2dd 100644 --- a/src/sys/timer.h +++ b/include/sys/timer.h diff --git a/src/util/mutex.h b/include/util/mutex.h index 524a461..524a461 100644 --- a/src/util/mutex.h +++ b/include/util/mutex.h diff --git a/src/util/status.h b/include/util/status.h index f6966dd..f6966dd 100644 --- a/src/util/status.h +++ b/include/util/status.h diff --git a/src/util/time.h b/include/util/time.h index f6dacb0..f6dacb0 100644 --- a/src/util/time.h +++ b/include/util/time.h diff --git a/src/cpu/irq.c b/src/cpu/irq.c index 4a96018..28ad886 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -1,12 +1,13 @@ -#include "../cpu/irq.h" -#include "../drivers/uart.h" -#include "../graphics/drawer.h" -#include "../sys/core.h" -#include "../sys/kernel.h" -#include "../sys/timer.h" -#include "../util/mutex.h" -#include "../util/status.h" -#include "../util/time.h" +#include <cpu/irq.h> +#include <drivers/uart.h> +#include <graphics/drawer.h> +#include <symbols.h> +#include <sys/core.h> +#include <sys/kernel.h> +#include <sys/timer.h> +#include <util/mutex.h> +#include <util/status.h> +#include <util/time.h> void localtest(void); diff --git a/src/drivers/uart.c b/src/drivers/uart.c index 142a5c3..f6fe79b 100644 --- a/src/drivers/uart.c +++ b/src/drivers/uart.c @@ -1,4 +1,4 @@ -#include "../drivers/uart.h" +#include <drivers/uart.h> void uart_10(unsigned long val) { diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c index 04d3e89..35aea32 100644 --- a/src/graphics/drawer.c +++ b/src/graphics/drawer.c @@ -1,5 +1,5 @@ -#include "../graphics/drawer.h" -#include "../graphics/lfb.h" +#include <graphics/drawer.h> +#include <graphics/lfb.h> #define GRAPHICS_DRAWER_C struct Drawer g_Drawer = {.x = 0, .y = 0}; diff --git a/src/graphics/lfb.c b/src/graphics/lfb.c index ffc27de..39d921d 100644 --- a/src/graphics/lfb.c +++ b/src/graphics/lfb.c @@ -1,8 +1,8 @@ -#include "../drivers/uart.h" -#include "../graphics/glyphs.h" -#include "../graphics/philosopher_toad.h" -#include "../graphics/lfb.h" -#include "../graphics/mbox.h" +#include <drivers/uart.h> +#include <graphics/glyphs.h> +#include <graphics/lfb.h> +#include <graphics/mbox.h> +#include <graphics/philosopher_toad.h> #define GRAPHICS_LFB_C unsigned int width, height, pitch, isrgb; /* dimensions and channel order */ diff --git a/src/graphics/mbox.c b/src/graphics/mbox.c index c0a8a57..0dac497 100644 --- a/src/graphics/mbox.c +++ b/src/graphics/mbox.c @@ -1,4 +1,4 @@ -#include "../sys/core.h" +#include <symbols.h> /* mailbox message buffer */ volatile unsigned int __attribute__((aligned(16))) mbox[36]; diff --git a/src/lib/ll.c b/src/lib/ll.c index 7f1a47e..4eaa291 100644 --- a/src/lib/ll.c +++ b/src/lib/ll.c @@ -1,5 +1,5 @@ -#include "../lib/ll.h" -#include "../lib/mem.h" +#include <lib/ll.h> +#include <lib/mem.h> struct LL* new_ll(void* val) { diff --git a/src/lib/mem.c b/src/lib/mem.c index 2b495ef..f8a8cc5 100644 --- a/src/lib/mem.c +++ b/src/lib/mem.c @@ -1,5 +1,5 @@ -#include "../lib/mem.h" -#include "../drivers/uart.h" +#include <drivers/uart.h> +#include <lib/mem.h> void memshow32(unsigned long* addr, unsigned int n) { diff --git a/src/lib/q.c b/src/lib/q.c index 1f5a871..ebae2b9 100644 --- a/src/lib/q.c +++ b/src/lib/q.c @@ -1,5 +1,5 @@ -#include "../lib/q.h" -#include "../lib/mem.h" +#include <lib/q.h> +#include <lib/mem.h> struct Q_base* new_q() { diff --git a/src/lib/strings.c b/src/lib/strings.c index 94b315f..8b83c9f 100644 --- a/src/lib/strings.c +++ b/src/lib/strings.c @@ -1,4 +1,4 @@ -#include "../lib/strings.h" +#include <lib/strings.h> unsigned long strlen(string_t s) { diff --git a/src/sys/core.c b/src/sys/core.c index 97a77c0..6bd2abf 100644 --- a/src/sys/core.c +++ b/src/sys/core.c @@ -1,17 +1,19 @@ -#include "../cpu/irq.h" -#include "../drivers/uart.h" -#include "../graphics/drawer.h" -#include "../graphics/lfb.h" -#include "../lib/ll.h" -#include "../lib/mem.h" -#include "../lib/q.h" -#include "../lib/strings.h" -#include "../sys/core.h" -#include "../sys/power.h" -#include "../sys/timer.h" -#include "../util/mutex.h" -#include "../util/status.h" -#include "../util/time.h" +#include <cpu/irq.h> +#include <drivers/uart.h> +#include <graphics/drawer.h> +#include <graphics/lfb.h> +#include <lib/ll.h> +#include <lib/mem.h> +#include <lib/q.h> +#include <lib/strings.h> +#include <symbols.h> +#include <sys/core.h> +#include <sys/kernel.h> +#include <sys/power.h> +#include <sys/timer.h> +#include <util/mutex.h> +#include <util/status.h> +#include <util/time.h> #define SYS_CORE_C #ifndef VERSION diff --git a/src/sys/power.c b/src/sys/power.c index 6b04404..8c2f469 100644 --- a/src/sys/power.c +++ b/src/sys/power.c @@ -1,5 +1,6 @@ -#include "../sys/core.h" -#include "../sys/power.h" +#include <symbols.h> +#include <sys/core.h> +#include <sys/power.h> void reboot(void) { diff --git a/src/sys/timer.c b/src/sys/timer.c index 3753561..5a3b8d4 100644 --- a/src/sys/timer.c +++ b/src/sys/timer.c @@ -1,10 +1,12 @@ -#include "../drivers/uart.h" -#include "../graphics/drawer.h" -#include "../sys/core.h" -#include "../sys/timer.h" -#include "../util/mutex.h" -#include "../util/status.h" -#include "../util/time.h" +#include <drivers/uart.h> +#include <graphics/drawer.h> +#include <sys/core.h> +#include <sys/kernel.h> +#include <sys/timer.h> +#include <util/mutex.h> +#include <util/status.h> +#include <util/time.h> +#include <symbols.h> /// Cycles Per Second #define CPS 10 diff --git a/src/util/mutex.c b/src/util/mutex.c index 1763de2..ade0be3 100644 --- a/src/util/mutex.c +++ b/src/util/mutex.c @@ -1,6 +1,6 @@ -#include "../cpu/atomic/swap.h" -#include "../lib/mem.h" -#include "../util/mutex.h" +#include <cpu/atomic/swap.h> +#include <lib/mem.h> +#include <util/mutex.h> unsigned char lock_mutex(struct Mutex* m, unsigned long pid) { diff --git a/src/util/status.c b/src/util/status.c index 6ab21c0..f59ede6 100644 --- a/src/util/status.c +++ b/src/util/status.c @@ -1,10 +1,11 @@ -#include "../graphics/drawer.h" -#include "../graphics/lfb.h" -#include "../sys/core.h" -#include "../sys/timer.h" -#include "../util/mutex.h" -#include "../util/status.h" -#include "../util/time.h" +#include <graphics/drawer.h> +#include <graphics/lfb.h> +#include <symbols.h> +#include <sys/core.h> +#include <sys/timer.h> +#include <util/mutex.h> +#include <util/status.h> +#include <util/time.h> void output_irq_status(void) { diff --git a/src/util/time.c b/src/util/time.c index c09567f..035ff82 100644 --- a/src/util/time.c +++ b/src/util/time.c @@ -1,4 +1,5 @@ -#include "../sys/core.h" +#include <symbols.h> +#include <sys/core.h> void routing_core0cntv_to_core0irq(void) { |