1.1 --- a/stage2/irq.c Sat Apr 23 17:26:50 2016 +0200
1.2 +++ b/stage2/irq.c Sat Apr 23 18:19:38 2016 +0200
1.3 @@ -21,54 +21,9 @@
1.4
1.5 #include "init.h"
1.6 #include "board.h"
1.7 -#include "lcd.h"
1.8 -#include "jzlcd.h"
1.9 #include "cpu.h"
1.10 -#include "paging.h"
1.11 #include "irq.h"
1.12 -
1.13 -extern vidinfo_t panel_info;
1.14 -
1.15 -void next_pixel(unsigned short *x, unsigned short *y)
1.16 -{
1.17 - (*x)++;
1.18 - if (*x >= panel_info.vl_col) {
1.19 - *x = 0;
1.20 - (*y)++;
1.21 - if (*y >= panel_info.vl_row)
1.22 - *y = 0;
1.23 - }
1.24 -}
1.25 -
1.26 -/* Task management. */
1.27 -
1.28 -enum { max_tasks = 3 };
1.29 -static u32 stack_pointers[max_tasks];
1.30 -static u32 registers[max_tasks][32];
1.31 -
1.32 -u8 current_task;
1.33 -u32 *current_stack_pointer;
1.34 -u32 *current_registers;
1.35 -
1.36 -extern u32 _got_copy_start;
1.37 -
1.38 -const u32 stack_start = 0x00080000;
1.39 -const u32 stack_size = 0x00002000;
1.40 -const u32 pagesize = 4 * 1024;
1.41 -
1.42 -/* Tasks. */
1.43 -
1.44 -void plot_pattern(unsigned short pixel_type, unsigned short x, unsigned short y)
1.45 -{
1.46 - while (1) {
1.47 - if (pixel_type)
1.48 - test_pixel(x, y, pixel_type);
1.49 - else
1.50 - clear_pixel(x, y);
1.51 - next_pixel(&x, &y);
1.52 - udelay(100);
1.53 - }
1.54 -}
1.55 +#include "tasks.h"
1.56
1.57 /* Initialisation and handling. */
1.58
1.59 @@ -104,48 +59,3 @@
1.60 }
1.61 }
1.62 }
1.63 -
1.64 -void init_tasks()
1.65 -{
1.66 - current_task = 0;
1.67 - current_stack_pointer = &stack_pointers[current_task];
1.68 - current_registers = registers[current_task];
1.69 -}
1.70 -
1.71 -void start_task(unsigned short task)
1.72 -{
1.73 - u32 args[] = {task, 0, (task - 1) * 60};
1.74 - u32 virtual, physical;
1.75 -
1.76 - /*
1.77 - Each task employs a stack at a multiple of the given start address in
1.78 - physical memory, but at the same address in virtual memory.
1.79 - */
1.80 -
1.81 - virtual = stack_start;
1.82 - physical = stack_start - stack_size * task;
1.83 -
1.84 - init_page_table(page_table_start, virtual - pagesize * 2, physical - pagesize * 2, pagesize, 0x1e, task);
1.85 -
1.86 - stack_pointers[task] = virtual - 12;
1.87 -
1.88 - /*
1.89 - Set the registers for the new task, initialising the global pointer and
1.90 - return address.
1.91 - */
1.92 -
1.93 - init_registers(registers[task], _got_copy_start, (void (*)()) plot_pattern, args, 3);
1.94 -}
1.95 -
1.96 -void switch_task()
1.97 -{
1.98 - /* Switch the current task. */
1.99 -
1.100 - current_task++;
1.101 - if (current_task == max_tasks) current_task = 0;
1.102 -
1.103 - /* Indicate the current stack pointer and task registers. */
1.104 -
1.105 - current_stack_pointer = &stack_pointers[current_task];
1.106 - current_registers = registers[current_task];
1.107 -}