Rev 1552 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1552 | Rev 1555 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | * Copyright (C) 2006 Ondrej Palkovsky |
2 | * Copyright (C) 2006 Ondrej Palkovsky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
8 | * |
8 | * |
9 | * - Redistributions of source code must retain the above copyright |
9 | * - Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * - Redistributions in binary form must reproduce the above copyright |
11 | * - Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the |
12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. |
13 | * documentation and/or other materials provided with the distribution. |
14 | * - The name of the author may not be used to endorse or promote products |
14 | * - The name of the author may not be used to endorse or promote products |
15 | * derived from this software without specific prior written permission. |
15 | * derived from this software without specific prior written permission. |
16 | * |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <ipc/fb.h> |
29 | #include <ipc/fb.h> |
30 | #include <ipc/ipc.h> |
30 | #include <ipc/ipc.h> |
31 | #include <async.h> |
31 | #include <async.h> |
32 | #include <stdio.h> |
32 | #include <stdio.h> |
33 | #include <sys/mman.h> |
33 | #include <sys/mman.h> |
34 | #include <string.h> |
34 | #include <string.h> |
- | 35 | #include <align.h> |
|
35 | 36 | ||
36 | #include "console.h" |
37 | #include "console.h" |
37 | #include "gcons.h" |
38 | #include "gcons.h" |
38 | 39 | ||
39 | #define CONSOLE_TOP 65 |
40 | #define CONSOLE_TOP 65 |
40 | #define CONSOLE_MARGIN 10 |
41 | #define CONSOLE_MARGIN 6 |
41 | 42 | ||
42 | #define STATUS_START 120 |
43 | #define STATUS_START 110 |
- | 44 | #define STATUS_TOP 8 |
|
43 | #define STATUS_SPACE 5 |
45 | #define STATUS_SPACE 3 |
44 | #define STATUS_WIDTH 40 |
46 | #define STATUS_WIDTH 48 |
45 | #define STATUS_HEIGHT 30 |
47 | #define STATUS_HEIGHT 48 |
46 | 48 | ||
47 | #define MAIN_COLOR 0xffffff |
49 | #define MAIN_COLOR 0xffffff |
48 | 50 | ||
49 | static int use_gcons = 0; |
51 | static int use_gcons = 0; |
50 | static ipcarg_t xres,yres; |
52 | static ipcarg_t xres,yres; |
51 | 53 | ||
- | 54 | enum butstate { |
|
- | 55 | CONS_DISCONNECTED = 0, |
|
- | 56 | CONS_SELECTED, |
|
- | 57 | CONS_IDLE, |
|
- | 58 | CONS_HAS_DATA, |
|
- | 59 | CONS_KERNEL, |
|
- | 60 | CONS_DISCONNECTED_SEL, |
|
- | 61 | CONS_LAST |
|
- | 62 | }; |
|
- | 63 | ||
52 | static int console_vp; |
64 | static int console_vp; |
53 | static int cstatus_vp[CONSOLE_COUNT]; |
65 | static int cstatus_vp[CONSOLE_COUNT]; |
54 | static int console_has_input[CONSOLE_COUNT]; |
- | |
55 | static int cstat_row, cstat_col; /* Size of cstatus buttons */ |
66 | static int cstat_row, cstat_col; /* Size of cstatus buttons */ |
- | 67 | static enum butstate console_state[CONSOLE_COUNT]; |
|
56 | 68 | ||
57 | static int fbphone; |
69 | static int fbphone; |
58 | 70 | ||
59 | enum butstate { |
- | |
60 | CONS_ACTIVE = 0, |
- | |
61 | CONS_IDLE, |
- | |
62 | CONS_HAS_INPUT, |
- | |
63 | CONS_DISCONNECTED |
- | |
64 | }; |
- | |
65 | - | ||
66 | static struct { |
71 | /** List of pixmaps identifying these icons */ |
67 | int fgcolor; |
- | |
68 | int bgcolor; |
- | |
69 | } stat_colors[] = { |
72 | static int ic_pixmaps[CONS_LAST] = {-1,-1,-1,-1,-1,-1}; |
70 | {0xd0d0d0, 0x808080}, |
- | |
71 | {0xd0d0d0, 0x0}, |
- | |
72 | {0xd0d0d0, 0xa04040}, |
- | |
73 | {0xd0d0d0, 0x0} |
- | |
74 | }; |
- | |
75 | 73 | ||
76 | static int active_console = 0; |
74 | static int active_console = 0; |
77 | 75 | ||
78 | static void vp_switch(int vp) |
76 | static void vp_switch(int vp) |
79 | { |
77 | { |
80 | nsend_call(fbphone,FB_VIEWPORT_SWITCH, vp); |
78 | nsend_call(fbphone,FB_VIEWPORT_SWITCH, vp); |
81 | } |
79 | } |
82 | 80 | ||
83 | /** Create view port */ |
81 | /** Create view port */ |
84 | static int vp_create(unsigned int x, unsigned int y, |
82 | static int vp_create(unsigned int x, unsigned int y, |
85 | unsigned int width, unsigned int height) |
83 | unsigned int width, unsigned int height) |
86 | { |
84 | { |
87 | /* Init function, use ipc_call_sync */ |
85 | /* Init function, use ipc_call_sync */ |
88 | return ipc_call_sync_2(fbphone, FB_VIEWPORT_CREATE, |
86 | return ipc_call_sync_2(fbphone, FB_VIEWPORT_CREATE, |
89 | (x << 16) | y, (width << 16) | height, |
87 | (x << 16) | y, (width << 16) | height, |
90 | NULL, NULL); |
88 | NULL, NULL); |
91 | } |
89 | } |
92 | 90 | ||
93 | static void clear(void) |
91 | static void clear(void) |
94 | { |
92 | { |
95 | nsend_call(fbphone, FB_CLEAR, 0); |
93 | nsend_call(fbphone, FB_CLEAR, 0); |
96 | 94 | ||
97 | } |
95 | } |
98 | 96 | ||
99 | static void set_style(int fgcolor, int bgcolor) |
97 | static void set_style(int fgcolor, int bgcolor) |
100 | { |
98 | { |
101 | nsend_call_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor); |
99 | nsend_call_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor); |
102 | } |
100 | } |
103 | 101 | ||
104 | static void putch(char c, int row, int col) |
102 | static void putch(char c, int row, int col) |
105 | { |
103 | { |
106 | nsend_call_3(fbphone, FB_PUTCHAR, c, row, col); |
104 | nsend_call_3(fbphone, FB_PUTCHAR, c, row, col); |
107 | } |
105 | } |
108 | 106 | ||
109 | static void draw_stat(int consnum, enum butstate state) |
107 | static void redraw_state(int consnum) |
110 | { |
108 | { |
111 | char data[5]; |
109 | char data[5]; |
112 | int i; |
110 | int i; |
- | 111 | enum butstate state = console_state[consnum]; |
|
113 | 112 | ||
114 | vp_switch(cstatus_vp[consnum]); |
113 | vp_switch(cstatus_vp[consnum]); |
- | 114 | if (ic_pixmaps[state] != -1) |
|
115 | set_style(stat_colors[state].fgcolor, stat_colors[state].bgcolor); |
115 | nsend_call_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], ic_pixmaps[state]); |
116 | clear(); |
116 | |
117 | if (state != CONS_DISCONNECTED) { |
117 | if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != CONS_DISCONNECTED_SEL) { |
118 | snprintf(data, 5, "%d", consnum+1); |
118 | snprintf(data, 5, "%d", consnum+1); |
119 | for (i=0;data[i];i++) |
119 | for (i=0;data[i];i++) |
120 | putch(data[i], 0, i); |
120 | putch(data[i], 1, 2+i); |
121 | } |
121 | } |
122 | } |
122 | } |
123 | 123 | ||
- | 124 | /** Notification run on changing console (except kernel console) */ |
|
124 | void gcons_change_console(int consnum) |
125 | void gcons_change_console(int consnum) |
125 | { |
126 | { |
- | 127 | int i; |
|
- | 128 | ||
126 | if (!use_gcons) |
129 | if (!use_gcons) |
127 | return; |
130 | return; |
128 | 131 | ||
129 | if (active_console != -1) |
132 | if (active_console == KERNEL_CONSOLE) { |
- | 133 | for (i=0; i < CONSOLE_COUNT; i++) |
|
- | 134 | redraw_state(i); |
|
- | 135 | } else { |
|
- | 136 | if (console_state[active_console] == CONS_DISCONNECTED_SEL) |
|
- | 137 | console_state[active_console] = CONS_DISCONNECTED; |
|
- | 138 | else |
|
130 | draw_stat(active_console, CONS_IDLE); |
139 | console_state[active_console] = CONS_IDLE; |
- | 140 | redraw_state(active_console); |
|
- | 141 | } |
|
131 | active_console = consnum; |
142 | active_console = consnum; |
- | 143 | ||
- | 144 | if (console_state[consnum] == CONS_DISCONNECTED) { |
|
- | 145 | console_state[consnum] = CONS_DISCONNECTED_SEL; |
|
132 | draw_stat(consnum, CONS_ACTIVE); |
146 | redraw_state(consnum); |
- | 147 | } else |
|
133 | console_has_input[consnum] = 0; |
148 | console_state[consnum] = CONS_SELECTED; |
- | 149 | redraw_state(consnum); |
|
134 | 150 | ||
135 | vp_switch(console_vp); |
151 | vp_switch(console_vp); |
136 | } |
152 | } |
137 | 153 | ||
138 | /** Notification function that gets called on new output to virtual console */ |
154 | /** Notification function that gets called on new output to virtual console */ |
139 | void gcons_notify_char(int consnum) |
155 | void gcons_notify_char(int consnum) |
140 | { |
156 | { |
141 | if (!use_gcons) |
157 | if (!use_gcons) |
142 | return; |
158 | return; |
143 | 159 | ||
144 | if (consnum == active_console || console_has_input[consnum]) |
160 | if (consnum == active_console || console_state[consnum] == CONS_HAS_DATA) |
145 | return; |
161 | return; |
146 | 162 | ||
147 | console_has_input[consnum] = 1; |
163 | console_state[consnum] = CONS_HAS_DATA; |
148 | 164 | ||
149 | if (active_console == -1) |
165 | if (active_console == KERNEL_CONSOLE) |
150 | return; |
166 | return; |
151 | 167 | ||
152 | draw_stat(consnum, CONS_HAS_INPUT); |
168 | redraw_state(consnum); |
153 | 169 | ||
154 | vp_switch(console_vp); |
170 | vp_switch(console_vp); |
- | 171 | } |
|
155 | 172 | ||
- | 173 | void gcons_notify_connect(int consnum) |
|
- | 174 | { |
|
- | 175 | if (!use_gcons) |
|
- | 176 | return; |
|
- | 177 | if (active_console == consnum) |
|
- | 178 | console_state[consnum] = CONS_SELECTED; |
|
- | 179 | else |
|
- | 180 | console_state[consnum] = CONS_IDLE; |
|
- | 181 | ||
- | 182 | if (active_console == KERNEL_CONSOLE) |
|
- | 183 | return; |
|
- | 184 | ||
- | 185 | redraw_state(consnum); |
|
- | 186 | vp_switch(console_vp); |
|
156 | } |
187 | } |
157 | 188 | ||
158 | /** Change to kernel console */ |
189 | /** Change to kernel console */ |
159 | void gcons_in_kernel(void) |
190 | void gcons_in_kernel(void) |
160 | { |
191 | { |
- | 192 | if (console_state[active_console] = CONS_DISCONNECTED_SEL) |
|
- | 193 | console_state[active_console] = CONS_DISCONNECTED; |
|
- | 194 | else |
|
161 | draw_stat(active_console, CONS_IDLE); |
195 | console_state[active_console] = CONS_IDLE; |
- | 196 | redraw_state(active_console); |
|
- | 197 | ||
162 | active_console = -1; /* Set to kernel console */ |
198 | active_console = KERNEL_CONSOLE; /* Set to kernel console */ |
163 | vp_switch(0); |
199 | vp_switch(0); |
164 | } |
200 | } |
165 | 201 | ||
166 | /** Draw a PPM pixmap to framebuffer |
202 | /** Draw a PPM pixmap to framebuffer |
167 | * |
203 | * |
168 | * @param logo Pointer to PPM data |
204 | * @param logo Pointer to PPM data |
169 | * @param size Size of PPM data |
205 | * @param size Size of PPM data |
170 | * @param x Coordinate of upper left corner |
206 | * @param x Coordinate of upper left corner |
171 | * @param y Coordinate of upper left corner |
207 | * @param y Coordinate of upper left corner |
172 | */ |
208 | */ |
173 | static void draw_pixmap(char *logo, size_t size, int x, int y) |
209 | static void draw_pixmap(char *logo, size_t size, int x, int y) |
174 | { |
210 | { |
175 | char *shm; |
211 | char *shm; |
176 | int rc; |
212 | int rc; |
177 | 213 | ||
178 | /* Create area */ |
214 | /* Create area */ |
179 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
215 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
180 | if (shm == MAP_FAILED) |
216 | if (shm == MAP_FAILED) |
181 | return; |
217 | return; |
182 | 218 | ||
183 | memcpy(shm, logo, size); |
219 | memcpy(shm, logo, size); |
184 | /* Send area */ |
220 | /* Send area */ |
185 | rc = sync_send_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
221 | rc = sync_send_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
186 | if (rc) |
222 | if (rc) |
187 | goto exit; |
223 | goto exit; |
188 | rc = sync_send_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
224 | rc = sync_send_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
189 | if (rc) |
225 | if (rc) |
190 | goto drop; |
226 | goto drop; |
191 | /* Draw logo */ |
227 | /* Draw logo */ |
192 | send_call_2(fbphone, FB_DRAW_PPM, x, y); |
228 | nsend_call_2(fbphone, FB_DRAW_PPM, x, y); |
193 | drop: |
229 | drop: |
194 | /* Drop area */ |
230 | /* Drop area */ |
195 | nsend_call(fbphone, FB_DROP_SHM, 0); |
231 | nsend_call(fbphone, FB_DROP_SHM, 0); |
196 | exit: |
232 | exit: |
197 | /* Remove area */ |
233 | /* Remove area */ |
198 | munmap(shm, size); |
234 | munmap(shm, size); |
199 | } |
235 | } |
200 | 236 | ||
201 | extern char _binary_helenos_ppm_start[0]; |
237 | extern char _binary_helenos_ppm_start[0]; |
202 | extern int _binary_helenos_ppm_size; |
238 | extern int _binary_helenos_ppm_size; |
203 | extern char _binary_nameic_ppm_start[0]; |
239 | extern char _binary_nameic_ppm_start[0]; |
204 | extern int _binary_nameic_ppm_size; |
240 | extern int _binary_nameic_ppm_size; |
205 | void gcons_redraw_console(void) |
241 | static void gcons_redraw_console(void) |
206 | { |
242 | { |
207 | int i; |
243 | int i; |
208 | size_t hsize = (size_t)&_binary_helenos_ppm_size; |
244 | size_t hsize = (size_t)&_binary_helenos_ppm_size; |
209 | 245 | ||
210 | if (!use_gcons) |
246 | if (!use_gcons) |
211 | return; |
247 | return; |
212 | 248 | ||
213 | vp_switch(0); |
249 | vp_switch(0); |
214 | set_style(MAIN_COLOR, MAIN_COLOR); |
250 | set_style(MAIN_COLOR, MAIN_COLOR); |
215 | clear(); |
251 | clear(); |
216 | draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-64, 0); |
252 | draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-66, 2); |
217 | draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 10); |
253 | draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 17); |
218 | 254 | ||
219 | 255 | ||
220 | for (i=0;i < CONSOLE_COUNT; i++) |
256 | for (i=0;i < CONSOLE_COUNT; i++) |
221 | draw_stat(i, i == active_console ? CONS_ACTIVE : CONS_DISCONNECTED); |
257 | redraw_state(i); |
222 | vp_switch(console_vp); |
258 | vp_switch(console_vp); |
223 | } |
259 | } |
224 | 260 | ||
- | 261 | static int make_pixmap(char *data, int size) |
|
- | 262 | { |
|
- | 263 | char *shm; |
|
- | 264 | int rc; |
|
- | 265 | int pxid = -1; |
|
- | 266 | ||
- | 267 | /* Create area */ |
|
- | 268 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
|
- | 269 | if (shm == MAP_FAILED) |
|
- | 270 | return -1; |
|
- | 271 | ||
- | 272 | memcpy(shm, data, size); |
|
- | 273 | /* Send area */ |
|
- | 274 | rc = sync_send_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
|
- | 275 | if (rc) |
|
- | 276 | goto exit; |
|
- | 277 | rc = sync_send_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
|
- | 278 | if (rc) |
|
- | 279 | goto drop; |
|
- | 280 | ||
- | 281 | /* Obtain pixmap */ |
|
- | 282 | rc = sync_send(fbphone, FB_SHM2PIXMAP, 0, NULL); |
|
- | 283 | if (rc < 0) |
|
- | 284 | goto drop; |
|
- | 285 | pxid = rc; |
|
- | 286 | drop: |
|
- | 287 | /* Drop area */ |
|
- | 288 | nsend_call(fbphone, FB_DROP_SHM, 0); |
|
- | 289 | exit: |
|
- | 290 | /* Remove area */ |
|
- | 291 | munmap(shm, size); |
|
- | 292 | ||
- | 293 | return pxid; |
|
- | 294 | } |
|
- | 295 | ||
- | 296 | extern char _binary_cons_selected_ppm_start[0]; |
|
- | 297 | extern int _binary_cons_selected_ppm_size; |
|
- | 298 | extern char _binary_cons_idle_ppm_start[0]; |
|
- | 299 | extern int _binary_cons_idle_ppm_size; |
|
- | 300 | extern char _binary_cons_has_data_ppm_start[0]; |
|
- | 301 | extern int _binary_cons_has_data_ppm_size; |
|
- | 302 | extern char _binary_cons_kernel_ppm_start[0]; |
|
- | 303 | extern int _binary_cons_kernel_ppm_size; |
|
225 | /** Initialize nice graphical console environment */ |
304 | /** Initialize nice graphical console environment */ |
226 | void gcons_init(int phone) |
305 | void gcons_init(int phone) |
227 | { |
306 | { |
228 | int rc; |
307 | int rc; |
229 | int i; |
308 | int i; |
230 | 309 | ||
231 | fbphone = phone; |
310 | fbphone = phone; |
232 | 311 | ||
233 | rc = ipc_call_sync_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres); |
312 | rc = ipc_call_sync_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres); |
234 | if (rc) |
313 | if (rc) |
235 | return; |
314 | return; |
236 | 315 | ||
237 | if (xres < 800 || yres < 600) |
316 | if (xres < 800 || yres < 600) |
238 | return; |
317 | return; |
239 | 318 | ||
240 | /* create console viewport */ |
319 | /* create console viewport */ |
- | 320 | /* Align width & height to character size */ |
|
241 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, xres-2*CONSOLE_MARGIN, |
321 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, |
- | 322 | ALIGN_DOWN(xres-2*CONSOLE_MARGIN, 8), |
|
242 | yres-(CONSOLE_TOP+CONSOLE_MARGIN)); |
323 | ALIGN_DOWN(yres-(CONSOLE_TOP+CONSOLE_MARGIN),16)); |
243 | if (console_vp < 0) |
324 | if (console_vp < 0) |
244 | return; |
325 | return; |
245 | 326 | ||
246 | /* Create status buttons */ |
327 | /* Create status buttons */ |
247 | for (i=0; i < CONSOLE_COUNT; i++) { |
328 | for (i=0; i < CONSOLE_COUNT; i++) { |
248 | cstatus_vp[i] = vp_create(STATUS_START+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), |
329 | cstatus_vp[i] = vp_create(STATUS_START+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), |
249 | CONSOLE_MARGIN, STATUS_WIDTH, STATUS_HEIGHT); |
330 | STATUS_TOP, STATUS_WIDTH, STATUS_HEIGHT); |
250 | if (cstatus_vp[i] < 0) |
331 | if (cstatus_vp[i] < 0) |
251 | return; |
332 | return; |
- | 333 | vp_switch(cstatus_vp[i]); |
|
- | 334 | set_style(0x202020, 0xffffff); |
|
252 | } |
335 | } |
253 | 336 | ||
- | 337 | /* Initialize icons */ |
|
- | 338 | ic_pixmaps[CONS_SELECTED] = make_pixmap(_binary_cons_selected_ppm_start, |
|
- | 339 | (int)&_binary_cons_selected_ppm_size); |
|
- | 340 | ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, |
|
- | 341 | (int)&_binary_cons_idle_ppm_size); |
|
- | 342 | ic_pixmaps[CONS_HAS_DATA] = make_pixmap(_binary_cons_has_data_ppm_start, |
|
- | 343 | (int)&_binary_cons_has_data_ppm_size); |
|
- | 344 | ic_pixmaps[CONS_DISCONNECTED] = make_pixmap(_binary_cons_idle_ppm_start, |
|
- | 345 | (int)&_binary_cons_idle_ppm_size); |
|
- | 346 | ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, |
|
- | 347 | (int)&_binary_cons_kernel_ppm_size); |
|
- | 348 | ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; |
|
- | 349 | ||
254 | use_gcons = 1; |
350 | use_gcons = 1; |
- | 351 | console_state[0] = CONS_DISCONNECTED_SEL; |
|
- | 352 | console_state[KERNEL_CONSOLE] = CONS_KERNEL; |
|
255 | gcons_redraw_console(); |
353 | gcons_redraw_console(); |
256 | } |
354 | } |
257 | 355 |