summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-04-29 14:28:37 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-04-29 14:28:37 +0000
commitc5ac54877a4ce9ca3ed1b059776ce3c99678d6ea (patch)
tree10121ea1c8fc7d5955bde295174c40397af71800
parent6a199bf125f4e5018d8172bcaf8b645a6c411bfc (diff)
downloadrockbox-c5ac54877a4ce9ca3ed1b059776ce3c99678d6ea.tar.gz
rockbox-c5ac54877a4ce9ca3ed1b059776ce3c99678d6ea.zip
Added code for testing queues
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@317 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/test/kernel/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/firmware/test/kernel/main.c b/firmware/test/kernel/main.c
index 1280b8113b..fe7ddc8378 100644
--- a/firmware/test/kernel/main.c
+++ b/firmware/test/kernel/main.c
@@ -29,11 +29,14 @@ unsigned int s2[256];
29void t1(void); 29void t1(void);
30void t2(void); 30void t2(void);
31 31
32struct event_queue main_q;
33
32int main(void) 34int main(void)
33{ 35{
34 char buf[40]; 36 char buf[40];
35 char str[32]; 37 char str[32];
36 int i=0; 38 int i=0;
39 struct event *ev;
37 40
38 /* Clear it all! */ 41 /* Clear it all! */
39 SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER); 42 SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
@@ -49,13 +52,15 @@ int main(void)
49 52
50 tick_start(10); 53 tick_start(10);
51 54
55 queue_init(&main_q);
56
52 create_thread(t1, s1, 1024); 57 create_thread(t1, s1, 1024);
53 create_thread(t2, s2, 1024); 58 create_thread(t2, s2, 1024);
54 59
55 while(1) 60 while(1)
56 { 61 {
57 sleep(100); 62 ev = queue_wait(&main_q);
58 debugf("Thread 0 awakened\n"); 63 debugf("Thread 0 got an event. ID: %d\n", ev->id);
59 } 64 }
60} 65}
61 66
@@ -64,8 +69,10 @@ void t1(void)
64 debugf("Thread 1 started\n"); 69 debugf("Thread 1 started\n");
65 while(1) 70 while(1)
66 { 71 {
67 sleep(200); 72 sleep(100);
68 debugf("Thread 1 awakened\n"); 73 debugf("Thread 1 posting an event\n");
74 queue_post(&main_q, 1234, 0);
75 queue_post(&main_q, 5678, 0);
69 } 76 }
70} 77}
71 78