From 8fbb809a5e900b968b176311bc9ab6c18b0fd0f6 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Fri, 7 Sep 2012 23:56:32 -0400 Subject: [PATCH] Move from 'hello.c' to 'start_kernel.c' to sound more professional... ...though at this point start_kernel.c just does a test of the video and serial/printing capabilities and nothing else. --- kernel/Makefile.inc | 4 +++- kernel/hello.c | 23 ----------------------- kernel/start_kernel.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 24 deletions(-) delete mode 100644 kernel/hello.c create mode 100644 kernel/start_kernel.c diff --git a/kernel/Makefile.inc b/kernel/Makefile.inc index 21907ad..6b1fa60 100644 --- a/kernel/Makefile.inc +++ b/kernel/Makefile.inc @@ -1,3 +1,5 @@ KERNEL_PREFIX = kernel -KOBJS += $(KERNEL_PREFIX)/hello.o +KOBJS += $(KERNEL_PREFIX)/framebuffer.o +KOBJS += $(KERNEL_PREFIX)/print.o +KOBJS += $(KERNEL_PREFIX)/start_kernel.o diff --git a/kernel/hello.c b/kernel/hello.c deleted file mode 100644 index 694f5e1..0000000 --- a/kernel/hello.c +++ /dev/null @@ -1,23 +0,0 @@ -#define SERIAL_BASE 0x16000000 -#define SERIAL_FLAG_REGISTER 0x18 -#define SERIAL_BUFFER_FULL (1 << 5) - -void putc (char c) -{ - /* Wait until the serial buffer is empty */ - while (*(volatile unsigned long*)(SERIAL_BASE + SERIAL_FLAG_REGISTER) - & (SERIAL_BUFFER_FULL)); - /* Put our character, c, into the serial buffer */ - *(volatile unsigned long*)SERIAL_BASE = c; -} - -void puts (const char * str) -{ - while (*str) putc (*str++); -} - -int main (void) -{ - puts ("hello, world!\n"); - return 0; -} diff --git a/kernel/start_kernel.c b/kernel/start_kernel.c new file mode 100644 index 0000000..0552d9c --- /dev/null +++ b/kernel/start_kernel.c @@ -0,0 +1,28 @@ +#include +#include + +#include +#include + +struct fb myfb; + +void video(void) +{ + unsigned int x, y; + pl110_init(&myfb, 16); + x = 0, y = 0; + for (x=0; x<640; x++) + for (y=0; y<480; y++) + fb_write_pixel(&myfb, x, y, 0x1f, 0x1f, 0x0); + +} + +int main(void) +{ + print_init(&pl011_putc); //initialize the serial console + + video(); + + print("hello, world!\n"); + return 0; +}