1.1 --- a/stage2/stage2.c Sun Oct 02 15:30:58 2016 +0200
1.2 +++ b/stage2/stage2.c Sun Oct 02 16:15:32 2016 +0200
1.3 @@ -24,7 +24,6 @@
1.4 #include "cpu.h"
1.5 #include "cpu_op.h"
1.6 #include "tasks.h"
1.7 -#include "tasks/example.h"
1.8
1.9 void c_main()
1.10 {
1.11 @@ -51,8 +50,7 @@
1.12 /* Start the tasks. */
1.13
1.14 init_tasks();
1.15 - start_plot_pattern(1);
1.16 - start_plot_pattern(2);
1.17 + start_tasks();
1.18
1.19 /* Now, wait for the tasks to be selected as interrupts occur. */
1.20
2.1 --- a/stage2/tasks.c Sun Oct 02 15:30:58 2016 +0200
2.2 +++ b/stage2/tasks.c Sun Oct 02 16:15:32 2016 +0200
2.3 @@ -23,6 +23,7 @@
2.4 #include "mips.h"
2.5 #include "paging.h"
2.6 #include "tasks.h"
2.7 +#include "tasks/manifest.h"
2.8
2.9 /* Task tables and data. */
2.10
2.11 @@ -55,6 +56,15 @@
2.12 current_registers = registers[current_task];
2.13 }
2.14
2.15 +void start_tasks()
2.16 +{
2.17 + void (**starter)(unsigned short);
2.18 + int i;
2.19 +
2.20 + for (i = 1, starter = initial_tasks; *starter; i++, starter++)
2.21 + (*starter)(i);
2.22 +}
2.23 +
2.24 void start_task(unsigned short task, void (*function)(), u32 args[], u8 nargs)
2.25 {
2.26 u32 virtual, physical, address;
3.1 --- a/stage2/tasks.h Sun Oct 02 15:30:58 2016 +0200
3.2 +++ b/stage2/tasks.h Sun Oct 02 16:15:32 2016 +0200
3.3 @@ -9,6 +9,7 @@
3.4
3.5 void init_tasks();
3.6 void init_task();
3.7 +void start_tasks();
3.8 void start_task(unsigned short, void (*)(), u32[], u8);
3.9 void start_task_now();
3.10 void switch_task();
4.1 --- a/stage2/tasks/Makefile Sun Oct 02 15:30:58 2016 +0200
4.2 +++ b/stage2/tasks/Makefile Sun Oct 02 16:15:32 2016 +0200
4.3 @@ -33,7 +33,7 @@
4.4 # Configure task objects.
4.5
4.6 DEFS =
4.7 -SRC = example.c
4.8 +SRC = $(wildcard *.c)
4.9 OBJ = $(SRC:.c=.o)
4.10
4.11 .PHONY: all clean distclean
5.1 --- a/stage2/tasks/example.h Sun Oct 02 15:30:58 2016 +0200
5.2 +++ b/stage2/tasks/example.h Sun Oct 02 16:15:32 2016 +0200
5.3 @@ -1,6 +1,8 @@
5.4 #ifndef __EXAMPLE_H__
5.5 #define __EXAMPLE_H__
5.6
5.7 +#include "xburst_types.h"
5.8 +
5.9 /* Example task functions. */
5.10
5.11 void plot_pattern(unsigned short, unsigned short, unsigned short);
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/stage2/tasks/manifest.c Sun Oct 02 16:15:32 2016 +0200
6.3 @@ -0,0 +1,31 @@
6.4 +/*
6.5 + * Task manifest.
6.6 + *
6.7 + * Copyright (C) 2016 Paul Boddie <paul@boddie.org.uk>
6.8 + *
6.9 + * This program is free software: you can redistribute it and/or modify
6.10 + * it under the terms of the GNU General Public License as published by
6.11 + * the Free Software Foundation, either version 3 of the License, or
6.12 + * (at your option) any later version.
6.13 + *
6.14 + * This program is distributed in the hope that it will be useful,
6.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.17 + * GNU General Public License for more details.
6.18 + *
6.19 + * You should have received a copy of the GNU General Public License
6.20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
6.21 + */
6.22 +
6.23 +#include "manifest.h"
6.24 +#include "example.h"
6.25 +
6.26 +/* A list of task-starting functions accepting their task identifier. */
6.27 +
6.28 +void (*initial_task_array[])(unsigned short) = {
6.29 + start_plot_pattern,
6.30 + start_plot_pattern,
6.31 + 0
6.32 + };
6.33 +
6.34 +void (**initial_tasks)(unsigned short) = initial_task_array;
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/stage2/tasks/manifest.h Sun Oct 02 16:15:32 2016 +0200
7.3 @@ -0,0 +1,6 @@
7.4 +#ifndef __TASKS_MANIFEST_H__
7.5 +#define __TASKS_MANIFEST_H__
7.6 +
7.7 +void (**initial_tasks)(unsigned short);
7.8 +
7.9 +#endif /* __TASKS_MANIFEST_H__ */