diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-10-15 02:16:31 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-10-15 02:16:31 +0000 |
commit | 688b4ddec66935aa9f4586adf00cebd8fcd535b1 (patch) | |
tree | 8164997827468538aaa653d4daa113ab6dbe0be4 /apps/main.c | |
parent | de85b67f252966df7c3b127e9fd460289e2e34c7 (diff) | |
download | rockbox-688b4ddec66935aa9f4586adf00cebd8fcd535b1.tar.gz rockbox-688b4ddec66935aa9f4586adf00cebd8fcd535b1.zip |
iRiver: the backlight blink loop is now done in C, using two threads, as a test of the threading code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5283 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main.c')
-rw-r--r-- | apps/main.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/apps/main.c b/apps/main.c index 536a181845..d391b6cd02 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -16,6 +16,48 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "config.h" | ||
20 | |||
21 | #ifdef IRIVER_H100 | ||
22 | #include "thread.h" | ||
23 | #include "cpu.h" | ||
24 | |||
25 | unsigned long test_thread_stack[0x1000]; | ||
26 | |||
27 | void yield(void) | ||
28 | { | ||
29 | switch_thread(); | ||
30 | wake_up_thread(); | ||
31 | } | ||
32 | |||
33 | void test_thread(void) | ||
34 | { | ||
35 | while(1) | ||
36 | { | ||
37 | GPIO1_OUT ^= 0x00020000; | ||
38 | yield(); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | int main(void) | ||
43 | { | ||
44 | int i; | ||
45 | |||
46 | init_threads(); | ||
47 | |||
48 | create_thread(test_thread, test_thread_stack, | ||
49 | sizeof(test_thread_stack), "Test thread"); | ||
50 | |||
51 | GPIO1_FUNCTION |= 0x00020000; | ||
52 | GPIO1_ENABLE |= 0x00020000; | ||
53 | |||
54 | while(1) { | ||
55 | for(i = 0;i < 10000;i++) {} | ||
56 | yield(); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | #else | ||
19 | #include "ata.h" | 61 | #include "ata.h" |
20 | #include "disk.h" | 62 | #include "disk.h" |
21 | #include "fat.h" | 63 | #include "fat.h" |
@@ -271,4 +313,4 @@ int main(void) | |||
271 | return 0; | 313 | return 0; |
272 | } | 314 | } |
273 | #endif | 315 | #endif |
274 | 316 | #endif | |