From ffb2c4adfb8e65e355b39abd39d994eebc649c98 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 3 Jan 2020 04:53:01 +0100 Subject: add (not yet fully working - it can only send through uart now) interrupt-driven uart together with "scheduler" --- setup.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'setup.c') diff --git a/setup.c b/setup.c index ad01720..f1d1263 100644 --- a/setup.c +++ b/setup.c @@ -6,12 +6,13 @@ // for POWER_OF_2() macro... perhaps the macro should be moved #include "memory.h" #include "armclock.h" +#include "scheduler.h" void setup(uint32_t r0, uint32_t machine_type, struct atag_header *atags) { uart_init(); - + // When we attach screen session after loading kernel with socat // we miss kernel's greeting... So we'll make the kernel wait for // one char we're going to send from within screen @@ -94,26 +95,19 @@ void setup(uint32_t r0, uint32_t machine_type, // prints some info and sets upp translation table, turns on MMU setup_flat_map(); - // prints some info and sets up a section for PL0 code, - // loads a blob there - demo_setup_PL0(); - + puts("Initializing clock"); // sets some general settings for arm timer armclk_init(); - // turns on irq from arm timer - armclk_enable_timer_irq(); - - // jumps to unprivileged code... never, ever, ever returns - demo_go_unprivileged(); - - while (1) - { - char c = getchar(); + puts("Setting up scheduler's internal structures"); + setup_scheduler_structures(); - if (c == '\r') - putchar('\n'); + puts("Switching uart to use irqs"); - putchar(c); - } + // note, that kernel's puts() is still going to use blocking io + uart_irq_enable(); + + // prints some info and sets up a section for PL0 code, loads a blob + // there, then runs scheduler... never, ever, ever returns + demo_setup_PL0(); } -- cgit v1.2.3