diff options
author | Dan Everton <dan@iocaine.org> | 2006-08-12 10:28:30 +0000 |
---|---|---|
committer | Dan Everton <dan@iocaine.org> | 2006-08-12 10:28:30 +0000 |
commit | 9d2929b79b22765701e9db240d967877d7f7bab8 (patch) | |
tree | 0829913b3e58ce5d1886358395d42c5cee80ce6c /uisimulator/x11/kernel.c | |
parent | 509ee3d42cfe0660a107ae169a11cef9c0604b1f (diff) | |
download | rockbox-9d2929b79b22765701e9db240d967877d7f7bab8.tar.gz rockbox-9d2929b79b22765701e9db240d967877d7f7bab8.zip |
Remove Win32 and X11 simulator sources. They've been deprecated for a while in favour of the SDL sim. Time to go.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10543 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/x11/kernel.c')
-rw-r--r-- | uisimulator/x11/kernel.c | 165 |
1 files changed, 0 insertions, 165 deletions
diff --git a/uisimulator/x11/kernel.c b/uisimulator/x11/kernel.c deleted file mode 100644 index 947d82a550..0000000000 --- a/uisimulator/x11/kernel.c +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Jens Arnold | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stddef.h> | ||
21 | #include "kernel.h" | ||
22 | #include "thread.h" | ||
23 | #include "debug.h" | ||
24 | |||
25 | static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); | ||
26 | |||
27 | int set_irq_level (int level) | ||
28 | { | ||
29 | static int _lv = 0; | ||
30 | return (_lv = level); | ||
31 | } | ||
32 | |||
33 | void queue_init(struct event_queue *q) | ||
34 | { | ||
35 | q->read = 0; | ||
36 | q->write = 0; | ||
37 | } | ||
38 | |||
39 | void queue_delete(struct event_queue *q) | ||
40 | { | ||
41 | (void)q; | ||
42 | } | ||
43 | |||
44 | void queue_wait(struct event_queue *q, struct event *ev) | ||
45 | { | ||
46 | while(q->read == q->write) | ||
47 | { | ||
48 | switch_thread(); | ||
49 | } | ||
50 | |||
51 | *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK]; | ||
52 | } | ||
53 | |||
54 | void queue_wait_w_tmo(struct event_queue *q, struct event *ev, int ticks) | ||
55 | { | ||
56 | unsigned int timeout = current_tick + ticks; | ||
57 | |||
58 | while(q->read == q->write && TIME_BEFORE( current_tick, timeout )) | ||
59 | { | ||
60 | sleep(1); | ||
61 | } | ||
62 | |||
63 | if(q->read != q->write) | ||
64 | { | ||
65 | *ev = q->events[(q->read++) & QUEUE_LENGTH_MASK]; | ||
66 | } | ||
67 | else | ||
68 | { | ||
69 | ev->id = SYS_TIMEOUT; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | void queue_post(struct event_queue *q, long id, void *data) | ||
74 | { | ||
75 | int wr; | ||
76 | int oldlevel; | ||
77 | |||
78 | oldlevel = set_irq_level(15<<4); | ||
79 | wr = (q->write++) & QUEUE_LENGTH_MASK; | ||
80 | |||
81 | q->events[wr].id = id; | ||
82 | q->events[wr].data = data; | ||
83 | set_irq_level(oldlevel); | ||
84 | } | ||
85 | |||
86 | bool queue_empty(const struct event_queue* q) | ||
87 | { | ||
88 | return ( q->read == q->write ); | ||
89 | } | ||
90 | |||
91 | void queue_clear(struct event_queue* q) | ||
92 | { | ||
93 | /* fixme: This is potentially unsafe in case we do interrupt-like processing */ | ||
94 | q->read = 0; | ||
95 | q->write = 0; | ||
96 | } | ||
97 | |||
98 | void switch_thread (void) | ||
99 | { | ||
100 | yield (); | ||
101 | } | ||
102 | |||
103 | void sim_tick_tasks(void) | ||
104 | { | ||
105 | int i; | ||
106 | |||
107 | /* Run through the list of tick tasks */ | ||
108 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
109 | { | ||
110 | if(tick_funcs[i]) | ||
111 | { | ||
112 | tick_funcs[i](); | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | int tick_add_task(void (*f)(void)) | ||
118 | { | ||
119 | int i; | ||
120 | |||
121 | /* Add a task if there is room */ | ||
122 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
123 | { | ||
124 | if(tick_funcs[i] == NULL) | ||
125 | { | ||
126 | tick_funcs[i] = f; | ||
127 | return 0; | ||
128 | } | ||
129 | } | ||
130 | DEBUGF("Error! tick_add_task(): out of tasks"); | ||
131 | return -1; | ||
132 | } | ||
133 | |||
134 | int tick_remove_task(void (*f)(void)) | ||
135 | { | ||
136 | int i; | ||
137 | |||
138 | /* Remove a task if it is there */ | ||
139 | for(i = 0;i < MAX_NUM_TICK_TASKS;i++) | ||
140 | { | ||
141 | if(tick_funcs[i] == f) | ||
142 | { | ||
143 | tick_funcs[i] = NULL; | ||
144 | return 0; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | return -1; | ||
149 | } | ||
150 | |||
151 | void mutex_init(struct mutex *m) | ||
152 | { | ||
153 | (void)m; | ||
154 | } | ||
155 | |||
156 | void mutex_lock(struct mutex *m) | ||
157 | { | ||
158 | (void)m; | ||
159 | } | ||
160 | |||
161 | void mutex_unlock(struct mutex *m) | ||
162 | { | ||
163 | (void)m; | ||
164 | } | ||
165 | |||