Rev 2479 | Rev 2677 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2479 | Rev 2621 | ||
---|---|---|---|
Line 79... | Line 79... | ||
79 | 79 | ||
80 | static int active_console = 0; |
80 | static int active_console = 0; |
81 | 81 | ||
82 | static void vp_switch(int vp) |
82 | static void vp_switch(int vp) |
83 | { |
83 | { |
84 | async_msg(fbphone,FB_VIEWPORT_SWITCH, vp); |
84 | async_msg_1(fbphone,FB_VIEWPORT_SWITCH, vp); |
85 | } |
85 | } |
86 | 86 | ||
87 | /** Create view port */ |
87 | /** Create view port */ |
88 | static int vp_create(unsigned int x, unsigned int y, |
88 | static int vp_create(unsigned int x, unsigned int y, unsigned int width, |
89 | unsigned int width, unsigned int height) |
89 | unsigned int height) |
90 | { |
90 | { |
91 | return async_req_2(fbphone, FB_VIEWPORT_CREATE, |
91 | return async_req_2_0(fbphone, FB_VIEWPORT_CREATE, (x << 16) | y, |
92 | (x << 16) | y, (width << 16) | height, NULL, NULL); |
92 | (width << 16) | height); |
93 | } |
93 | } |
94 | 94 | ||
95 | static void clear(void) |
95 | static void clear(void) |
96 | { |
96 | { |
97 | async_msg(fbphone, FB_CLEAR, 0); |
97 | async_msg_0(fbphone, FB_CLEAR); |
98 | } |
98 | } |
99 | 99 | ||
100 | static void set_style(int fgcolor, int bgcolor) |
100 | static void set_style(int fgcolor, int bgcolor) |
101 | { |
101 | { |
102 | async_msg_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor); |
102 | async_msg_2(fbphone, FB_SET_STYLE, fgcolor, bgcolor); |
Line 116... | Line 116... | ||
116 | enum butstate state = console_state[consnum]; |
116 | enum butstate state = console_state[consnum]; |
117 | 117 | ||
118 | vp_switch(cstatus_vp[consnum]); |
118 | vp_switch(cstatus_vp[consnum]); |
119 | if (ic_pixmaps[state] != -1) |
119 | if (ic_pixmaps[state] != -1) |
120 | async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], |
120 | async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], |
121 | ic_pixmaps[state]); |
121 | ic_pixmaps[state]); |
122 | 122 | ||
123 | if (state != CONS_DISCONNECTED && state != CONS_KERNEL && |
123 | if (state != CONS_DISCONNECTED && state != CONS_KERNEL && |
124 | state != CONS_DISCONNECTED_SEL) { |
124 | state != CONS_DISCONNECTED_SEL) { |
125 | snprintf(data, 5, "%d", consnum + 1); |
125 | snprintf(data, 5, "%d", consnum + 1); |
126 | for (i = 0; data[i]; i++) |
126 | for (i = 0; data[i]; i++) |
Line 138... | Line 138... | ||
138 | 138 | ||
139 | if (active_console == KERNEL_CONSOLE) { |
139 | if (active_console == KERNEL_CONSOLE) { |
140 | for (i = 0; i < CONSOLE_COUNT; i++) |
140 | for (i = 0; i < CONSOLE_COUNT; i++) |
141 | redraw_state(i); |
141 | redraw_state(i); |
142 | if (animation != -1) |
142 | if (animation != -1) |
143 | async_msg(fbphone, FB_ANIM_START, animation); |
143 | async_msg_1(fbphone, FB_ANIM_START, animation); |
144 | } else { |
144 | } else { |
145 | if (console_state[active_console] == CONS_DISCONNECTED_SEL) |
145 | if (console_state[active_console] == CONS_DISCONNECTED_SEL) |
146 | console_state[active_console] = CONS_DISCONNECTED; |
146 | console_state[active_console] = CONS_DISCONNECTED; |
147 | else |
147 | else |
148 | console_state[active_console] = CONS_IDLE; |
148 | console_state[active_console] = CONS_IDLE; |
Line 222... | Line 222... | ||
222 | else |
222 | else |
223 | console_state[active_console] = CONS_IDLE; |
223 | console_state[active_console] = CONS_IDLE; |
224 | redraw_state(active_console); |
224 | redraw_state(active_console); |
225 | 225 | ||
226 | if (animation != -1) |
226 | if (animation != -1) |
227 | async_msg(fbphone, FB_ANIM_STOP, animation); |
227 | async_msg_1(fbphone, FB_ANIM_STOP, animation); |
228 | 228 | ||
229 | active_console = KERNEL_CONSOLE; /* Set to kernel console */ |
229 | active_console = KERNEL_CONSOLE; /* Set to kernel console */ |
230 | vp_switch(0); |
230 | vp_switch(0); |
231 | } |
231 | } |
232 | 232 | ||
Line 314... | Line 314... | ||
314 | char *shm; |
314 | char *shm; |
315 | int rc; |
315 | int rc; |
316 | 316 | ||
317 | /* Create area */ |
317 | /* Create area */ |
318 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
318 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
319 | MAP_ANONYMOUS, 0, 0); |
319 | MAP_ANONYMOUS, 0, 0); |
320 | if (shm == MAP_FAILED) |
320 | if (shm == MAP_FAILED) |
321 | return; |
321 | return; |
322 | 322 | ||
323 | memcpy(shm, logo, size); |
323 | memcpy(shm, logo, size); |
324 | /* Send area */ |
324 | /* Send area */ |
325 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, |
325 | rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); |
326 | NULL); |
- | |
327 | if (rc) |
326 | if (rc) |
328 | goto exit; |
327 | goto exit; |
329 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
328 | rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
330 | PROTO_READ, NULL, NULL, NULL); |
329 | PROTO_READ); |
331 | if (rc) |
330 | if (rc) |
332 | goto drop; |
331 | goto drop; |
333 | /* Draw logo */ |
332 | /* Draw logo */ |
334 | async_msg_2(fbphone, FB_DRAW_PPM, x, y); |
333 | async_msg_2(fbphone, FB_DRAW_PPM, x, y); |
335 | drop: |
334 | drop: |
336 | /* Drop area */ |
335 | /* Drop area */ |
337 | async_msg(fbphone, FB_DROP_SHM, 0); |
336 | async_msg_0(fbphone, FB_DROP_SHM); |
338 | exit: |
337 | exit: |
339 | /* Remove area */ |
338 | /* Remove area */ |
340 | munmap(shm, size); |
339 | munmap(shm, size); |
341 | } |
340 | } |
342 | 341 | ||
Line 354... | Line 353... | ||
354 | 353 | ||
355 | vp_switch(0); |
354 | vp_switch(0); |
356 | set_style(MAIN_COLOR, MAIN_COLOR); |
355 | set_style(MAIN_COLOR, MAIN_COLOR); |
357 | clear(); |
356 | clear(); |
358 | draw_pixmap(_binary_helenos_ppm_start, |
357 | draw_pixmap(_binary_helenos_ppm_start, |
359 | (size_t) &_binary_helenos_ppm_size, xres - 66, 2); |
358 | (size_t) &_binary_helenos_ppm_size, xres - 66, 2); |
360 | draw_pixmap(_binary_nameic_ppm_start, |
359 | draw_pixmap(_binary_nameic_ppm_start, |
361 | (size_t) &_binary_nameic_ppm_size, 5, 17); |
360 | (size_t) &_binary_nameic_ppm_size, 5, 17); |
362 | 361 | ||
363 | for (i = 0;i < CONSOLE_COUNT; i++) |
362 | for (i = 0; i < CONSOLE_COUNT; i++) |
364 | redraw_state(i); |
363 | redraw_state(i); |
365 | vp_switch(console_vp); |
364 | vp_switch(console_vp); |
366 | } |
365 | } |
367 | 366 | ||
368 | /** Creates a pixmap on framebuffer |
367 | /** Creates a pixmap on framebuffer |
Line 377... | Line 376... | ||
377 | int rc; |
376 | int rc; |
378 | int pxid = -1; |
377 | int pxid = -1; |
379 | 378 | ||
380 | /* Create area */ |
379 | /* Create area */ |
381 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
380 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
382 | MAP_ANONYMOUS, 0, 0); |
381 | MAP_ANONYMOUS, 0, 0); |
383 | if (shm == MAP_FAILED) |
382 | if (shm == MAP_FAILED) |
384 | return -1; |
383 | return -1; |
385 | 384 | ||
386 | memcpy(shm, data, size); |
385 | memcpy(shm, data, size); |
387 | /* Send area */ |
386 | /* Send area */ |
388 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, |
387 | rc = async_req_1_0(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm); |
389 | NULL); |
- | |
390 | if (rc) |
388 | if (rc) |
391 | goto exit; |
389 | goto exit; |
392 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
390 | rc = async_req_3_0(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
393 | PROTO_READ, NULL, NULL, NULL); |
391 | PROTO_READ); |
394 | if (rc) |
392 | if (rc) |
395 | goto drop; |
393 | goto drop; |
396 | 394 | ||
397 | /* Obtain pixmap */ |
395 | /* Obtain pixmap */ |
398 | rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL); |
396 | rc = async_req_0_0(fbphone, FB_SHM2PIXMAP); |
399 | if (rc < 0) |
397 | if (rc < 0) |
400 | goto drop; |
398 | goto drop; |
401 | pxid = rc; |
399 | pxid = rc; |
402 | drop: |
400 | drop: |
403 | /* Drop area */ |
401 | /* Drop area */ |
404 | async_msg(fbphone, FB_DROP_SHM, 0); |
402 | async_msg_0(fbphone, FB_DROP_SHM); |
405 | exit: |
403 | exit: |
406 | /* Remove area */ |
404 | /* Remove area */ |
407 | munmap(shm, size); |
405 | munmap(shm, size); |
408 | 406 | ||
409 | return pxid; |
407 | return pxid; |
Line 421... | Line 419... | ||
421 | static void make_anim(void) |
419 | static void make_anim(void) |
422 | { |
420 | { |
423 | int an; |
421 | int an; |
424 | int pm; |
422 | int pm; |
425 | 423 | ||
426 | an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], |
424 | an = async_req_1_0(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE]); |
427 | NULL); |
- | |
428 | if (an < 0) |
425 | if (an < 0) |
429 | return; |
426 | return; |
430 | 427 | ||
431 | pm = make_pixmap(_binary_anim_1_ppm_start, |
428 | pm = make_pixmap(_binary_anim_1_ppm_start, |
432 | (int) &_binary_anim_1_ppm_size); |
429 | (int) &_binary_anim_1_ppm_size); |
433 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
430 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
434 | 431 | ||
435 | pm = make_pixmap(_binary_anim_2_ppm_start, |
432 | pm = make_pixmap(_binary_anim_2_ppm_start, |
436 | (int) &_binary_anim_2_ppm_size); |
433 | (int) &_binary_anim_2_ppm_size); |
437 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
434 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
438 | 435 | ||
439 | pm = make_pixmap(_binary_anim_3_ppm_start, |
436 | pm = make_pixmap(_binary_anim_3_ppm_start, |
440 | (int) &_binary_anim_3_ppm_size); |
437 | (int) &_binary_anim_3_ppm_size); |
441 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
438 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
442 | 439 | ||
443 | pm = make_pixmap(_binary_anim_4_ppm_start, |
440 | pm = make_pixmap(_binary_anim_4_ppm_start, |
444 | (int) &_binary_anim_4_ppm_size); |
441 | (int) &_binary_anim_4_ppm_size); |
445 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
442 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
446 | 443 | ||
447 | async_msg(fbphone, FB_ANIM_START, an); |
444 | async_msg_1(fbphone, FB_ANIM_START, an); |
448 | 445 | ||
449 | animation = an; |
446 | animation = an; |
450 | } |
447 | } |
451 | 448 | ||
452 | extern char _binary_cons_selected_ppm_start[0]; |
449 | extern char _binary_cons_selected_ppm_start[0]; |
Line 465... | Line 462... | ||
465 | int i; |
462 | int i; |
466 | int status_start = STATUS_START; |
463 | int status_start = STATUS_START; |
467 | 464 | ||
468 | fbphone = phone; |
465 | fbphone = phone; |
469 | 466 | ||
470 | rc = async_req_2(phone, FB_GET_RESOLUTION, 0, 0, &xres, &yres); |
467 | rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres); |
471 | if (rc) |
468 | if (rc) |
472 | return; |
469 | return; |
473 | 470 | ||
474 | if (xres < 800 || yres < 600) |
471 | if (xres < 800 || yres < 600) |
475 | return; |
472 | return; |
476 | 473 | ||
477 | /* create console viewport */ |
474 | /* create console viewport */ |
478 | /* Align width & height to character size */ |
475 | /* Align width & height to character size */ |
479 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, |
476 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, |
480 | ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8), |
477 | ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8), |
481 | ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16)); |
478 | ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16)); |
482 | if (console_vp < 0) |
479 | if (console_vp < 0) |
483 | return; |
480 | return; |
484 | 481 | ||
485 | /* Create status buttons */ |
482 | /* Create status buttons */ |
486 | status_start += (xres - 800) / 2; |
483 | status_start += (xres - 800) / 2; |
487 | for (i = 0; i < CONSOLE_COUNT; i++) { |
484 | for (i = 0; i < CONSOLE_COUNT; i++) { |
488 | cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + |
485 | cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + |
489 | i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP, |
486 | i * (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP, |
490 | STATUS_WIDTH, STATUS_HEIGHT); |
487 | STATUS_WIDTH, STATUS_HEIGHT); |
491 | if (cstatus_vp[i] < 0) |
488 | if (cstatus_vp[i] < 0) |
492 | return; |
489 | return; |
493 | vp_switch(cstatus_vp[i]); |
490 | vp_switch(cstatus_vp[i]); |
494 | set_style(0x202020, 0xffffff); |
491 | set_style(0x202020, 0xffffff); |
495 | } |
492 | } |
496 | 493 | ||
497 | /* Initialize icons */ |
494 | /* Initialize icons */ |
498 | ic_pixmaps[CONS_SELECTED] = |
495 | ic_pixmaps[CONS_SELECTED] = |
499 | make_pixmap(_binary_cons_selected_ppm_start, |
496 | make_pixmap(_binary_cons_selected_ppm_start, |
500 | (int) &_binary_cons_selected_ppm_size); |
497 | (int) &_binary_cons_selected_ppm_size); |
501 | ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, |
498 | ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, |
502 | (int) &_binary_cons_idle_ppm_size); |
499 | (int) &_binary_cons_idle_ppm_size); |
503 | ic_pixmaps[CONS_HAS_DATA] = |
500 | ic_pixmaps[CONS_HAS_DATA] = |
504 | make_pixmap(_binary_cons_has_data_ppm_start, |
501 | make_pixmap(_binary_cons_has_data_ppm_start, |
505 | (int) &_binary_cons_has_data_ppm_size); |
502 | (int) &_binary_cons_has_data_ppm_size); |
506 | ic_pixmaps[CONS_DISCONNECTED] = |
503 | ic_pixmaps[CONS_DISCONNECTED] = |
507 | make_pixmap(_binary_cons_idle_ppm_start, |
504 | make_pixmap(_binary_cons_idle_ppm_start, |
508 | (int) &_binary_cons_idle_ppm_size); |
505 | (int) &_binary_cons_idle_ppm_size); |
509 | ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, |
506 | ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, |
510 | (int) &_binary_cons_kernel_ppm_size); |
507 | (int) &_binary_cons_kernel_ppm_size); |
511 | ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; |
508 | ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; |
512 | 509 | ||
513 | make_anim(); |
510 | make_anim(); |
514 | 511 | ||
515 | use_gcons = 1; |
512 | use_gcons = 1; |