summaryrefslogtreecommitdiff
path: root/firmware/test/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test/kernel/main.c')
-rw-r--r--firmware/test/kernel/main.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/firmware/test/kernel/main.c b/firmware/test/kernel/main.c
new file mode 100644
index 0000000000..7e0bd3e3f8
--- /dev/null
+++ b/firmware/test/kernel/main.c
@@ -0,0 +1,82 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#include "thread.h"
20#include "sh7034.h"
21#include "debug.h"
22
23unsigned int s1[256];
24unsigned int s2[256];
25
26void t1(void);
27void t2(void);
28
29int main(void)
30{
31 char buf[40];
32 char str[32];
33 int i=0;
34
35 /* Clear it all! */
36 SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
37
38 /* This enables the serial Rx interrupt, to be able to exit into the
39 debugger when you hit CTRL-C */
40 SCR1 |= 0x40;
41 SCR1 &= ~0x80;
42 asm ("ldc\t%0,sr" : : "r"(0<<4));
43
44 debugf("OK. Let's go\n");
45
46 create_thread(t1, s1, 1024);
47 create_thread(t2, s2, 1024);
48
49 while(1)
50 {
51 debugf("t0\n");
52 switch_thread();
53 }
54}
55
56void t1(void)
57{
58 while(1)
59 {
60 debugf("t1\n");
61 switch_thread();
62 }
63}
64
65void t2(void)
66{
67 while(1)
68 {
69 debugf("t2\n");
70 switch_thread();
71 }
72}
73
74extern const void stack(void);
75
76const void* vectors[] __attribute__ ((section (".vectors"))) =
77{
78 main, /* Power-on reset */
79 stack, /* Power-on reset (stack pointer) */
80 main, /* Manual reset */
81 stack /* Manual reset (stack pointer) */
82};