diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-04-22 19:12:37 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-04-22 19:12:37 +0000 |
| commit | 1f563bfd290b56ebf1865fbe950c276dfb8018e5 (patch) | |
| tree | be20726a274e9991ae74ca4aaf14ed082a5651d3 /firmware/test/kernel/main.c | |
| parent | 34f026eb479806c0698437cc66f028ccaa995f57 (diff) | |
| download | rockbox-1f563bfd290b56ebf1865fbe950c276dfb8018e5.zip rockbox-1f563bfd290b56ebf1865fbe950c276dfb8018e5.tar.gz rockbox-1f563bfd290b56ebf1865fbe950c276dfb8018e5.tar.bz2 rockbox-1f563bfd290b56ebf1865fbe950c276dfb8018e5.tar.xz | |
First version
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@175 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/kernel/main.c')
| -rw-r--r-- | firmware/test/kernel/main.c | 82 |
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 0000000..7e0bd3e --- /dev/null +++ b/firmware/test/kernel/main.c @@ -0,0 +1,82 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2002 by Linus Nielsen Feltzing + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "thread.h" +#include "sh7034.h" +#include "debug.h" + +unsigned int s1[256]; +unsigned int s2[256]; + +void t1(void); +void t2(void); + +int main(void) +{ + char buf[40]; + char str[32]; + int i=0; + + /* Clear it all! */ + SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER); + + /* This enables the serial Rx interrupt, to be able to exit into the + debugger when you hit CTRL-C */ + SCR1 |= 0x40; + SCR1 &= ~0x80; + asm ("ldc\t%0,sr" : : "r"(0<<4)); + + debugf("OK. Let's go\n"); + + create_thread(t1, s1, 1024); + create_thread(t2, s2, 1024); + + while(1) + { + debugf("t0\n"); + switch_thread(); + } +} + +void t1(void) +{ + while(1) + { + debugf("t1\n"); + switch_thread(); + } +} + +void t2(void) +{ + while(1) + { + debugf("t2\n"); + switch_thread(); + } +} + +extern const void stack(void); + +const void* vectors[] __attribute__ ((section (".vectors"))) = +{ + main, /* Power-on reset */ + stack, /* Power-on reset (stack pointer) */ + main, /* Manual reset */ + stack /* Manual reset (stack pointer) */ +}; |