1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
26 void tick_start(unsigned int interval
);
34 struct event_queue main_q
;
36 int tick_add_task(void (*f
)(void));
40 if(current_tick
== 5000)
49 struct queue_event
*ev
;
52 SSR1
&= ~(SCI_RDRF
| SCI_ORER
| SCI_PER
| SCI_FER
);
54 /* This enables the serial Rx interrupt, to be able to exit into the
55 debugger when you hit CTRL-C */
58 IPRE
|= 0xf000; /* Set to highest priority */
60 debugf("OK. Let's go\n");
66 tick_add_task(testfunc
);
68 debugf("sleeping 10s...\n");
74 create_thread(t1
, s1
, 1024, 0);
75 create_thread(t2
, s2
, 1024, 0);
79 ev
= queue_wait(&main_q
);
80 debugf("Thread 0 got an event. ID: %d\n", ev
->id
);
86 debugf("Thread 1 started\n");
90 debugf("Thread 1 posting an event\n");
91 queue_post(&main_q
, 1234, 0);
92 queue_post(&main_q
, 5678, 0);
98 debugf("Thread 2 started\n");
102 debugf("Thread 2 awakened\n");