1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
24 void tick_start(unsigned int interval
);
32 struct event_queue main_q
;
34 int tick_add_task(void (*f
)(void));
38 if(current_tick
== 5000)
47 struct queue_event
*ev
;
50 SSR1
&= ~(SCI_RDRF
| SCI_ORER
| SCI_PER
| SCI_FER
);
52 /* This enables the serial Rx interrupt, to be able to exit into the
53 debugger when you hit CTRL-C */
56 IPRE
|= 0xf000; /* Set to highest priority */
58 debugf("OK. Let's go\n");
64 tick_add_task(testfunc
);
66 debugf("sleeping 10s...\n");
72 create_thread(t1
, s1
, 1024, 0);
73 create_thread(t2
, s2
, 1024, 0);
77 ev
= queue_wait(&main_q
);
78 debugf("Thread 0 got an event. ID: %d\n", ev
->id
);
84 debugf("Thread 1 started\n");
88 debugf("Thread 1 posting an event\n");
89 queue_post(&main_q
, 1234, 0);
90 queue_post(&main_q
, 5678, 0);
96 debugf("Thread 2 started\n");
100 debugf("Thread 2 awakened\n");