Rev 1867 | Rev 2070 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1867 | Rev 2025 | ||
---|---|---|---|
Line 117... | Line 117... | ||
117 | int i; |
117 | int i; |
118 | enum butstate state = console_state[consnum]; |
118 | enum butstate state = console_state[consnum]; |
119 | 119 | ||
120 | vp_switch(cstatus_vp[consnum]); |
120 | vp_switch(cstatus_vp[consnum]); |
121 | if (ic_pixmaps[state] != -1) |
121 | if (ic_pixmaps[state] != -1) |
122 | async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], ic_pixmaps[state]); |
122 | async_msg_2(fbphone, FB_VP_DRAW_PIXMAP, cstatus_vp[consnum], |
- | 123 | ic_pixmaps[state]); |
|
123 | 124 | ||
124 | if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != CONS_DISCONNECTED_SEL) { |
125 | if (state != CONS_DISCONNECTED && state != CONS_KERNEL && state != |
- | 126 | CONS_DISCONNECTED_SEL) { |
|
125 | snprintf(data, 5, "%d", consnum+1); |
127 | snprintf(data, 5, "%d", consnum + 1); |
126 | for (i=0;data[i];i++) |
128 | for (i=0; data[i]; i++) |
127 | tran_putch(data[i], 1, 2+i); |
129 | tran_putch(data[i], 1, 2 + i); |
128 | } |
130 | } |
129 | } |
131 | } |
Line 164... | Line 166... | ||
164 | void gcons_notify_char(int consnum) |
166 | void gcons_notify_char(int consnum) |
165 | { |
167 | { |
166 | if (!use_gcons) |
168 | if (!use_gcons) |
167 | return; |
169 | return; |
168 | 170 | ||
169 | if (consnum == active_console || console_state[consnum] == CONS_HAS_DATA) |
171 | if (consnum == active_console || console_state[consnum] == |
- | 172 | CONS_HAS_DATA) |
|
170 | return; |
173 | return; |
171 | 174 | ||
172 | console_state[consnum] = CONS_HAS_DATA; |
175 | console_state[consnum] = CONS_HAS_DATA; |
173 | 176 | ||
174 | if (active_console == KERNEL_CONSOLE) |
177 | if (active_console == KERNEL_CONSOLE) |
Line 312... | Line 315... | ||
312 | { |
315 | { |
313 | char *shm; |
316 | char *shm; |
314 | int rc; |
317 | int rc; |
315 | 318 | ||
316 | /* Create area */ |
319 | /* Create area */ |
317 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
320 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
- | 321 | MAP_ANONYMOUS, 0, 0); |
|
318 | if (shm == MAP_FAILED) |
322 | if (shm == MAP_FAILED) |
319 | return; |
323 | return; |
320 | 324 | ||
321 | memcpy(shm, logo, size); |
325 | memcpy(shm, logo, size); |
322 | /* Send area */ |
326 | /* Send area */ |
323 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
327 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, |
- | 328 | NULL); |
|
324 | if (rc) |
329 | if (rc) |
325 | goto exit; |
330 | goto exit; |
326 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
331 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
- | 332 | PROTO_READ, NULL, NULL, NULL); |
|
327 | if (rc) |
333 | if (rc) |
328 | goto drop; |
334 | goto drop; |
329 | /* Draw logo */ |
335 | /* Draw logo */ |
330 | async_msg_2(fbphone, FB_DRAW_PPM, x, y); |
336 | async_msg_2(fbphone, FB_DRAW_PPM, x, y); |
331 | drop: |
337 | drop: |
Line 349... | Line 355... | ||
349 | return; |
355 | return; |
350 | 356 | ||
351 | vp_switch(0); |
357 | vp_switch(0); |
352 | set_style(MAIN_COLOR, MAIN_COLOR); |
358 | set_style(MAIN_COLOR, MAIN_COLOR); |
353 | clear(); |
359 | clear(); |
354 | draw_pixmap(_binary_helenos_ppm_start, (size_t)&_binary_helenos_ppm_size, xres-66, 2); |
360 | draw_pixmap(_binary_helenos_ppm_start, (size_t) |
- | 361 | &_binary_helenos_ppm_size, xres - 66, 2); |
|
355 | draw_pixmap(_binary_nameic_ppm_start, (size_t)&_binary_nameic_ppm_size, 5, 17); |
362 | draw_pixmap(_binary_nameic_ppm_start, (size_t) |
- | 363 | &_binary_nameic_ppm_size, 5, 17); |
|
356 | 364 | ||
357 | for (i=0;i < CONSOLE_COUNT; i++) |
365 | for (i=0;i < CONSOLE_COUNT; i++) |
358 | redraw_state(i); |
366 | redraw_state(i); |
359 | vp_switch(console_vp); |
367 | vp_switch(console_vp); |
360 | } |
368 | } |
Line 370... | Line 378... | ||
370 | char *shm; |
378 | char *shm; |
371 | int rc; |
379 | int rc; |
372 | int pxid = -1; |
380 | int pxid = -1; |
373 | 381 | ||
374 | /* Create area */ |
382 | /* Create area */ |
375 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | MAP_ANONYMOUS, 0, 0); |
383 | shm = mmap(NULL, size, PROTO_READ | PROTO_WRITE, MAP_SHARED | |
- | 384 | MAP_ANONYMOUS, 0, 0); |
|
376 | if (shm == MAP_FAILED) |
385 | if (shm == MAP_FAILED) |
377 | return -1; |
386 | return -1; |
378 | 387 | ||
379 | memcpy(shm, data, size); |
388 | memcpy(shm, data, size); |
380 | /* Send area */ |
389 | /* Send area */ |
381 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t)shm, 0, NULL, NULL); |
390 | rc = async_req_2(fbphone, FB_PREPARE_SHM, (ipcarg_t) shm, 0, NULL, |
- | 391 | NULL); |
|
382 | if (rc) |
392 | if (rc) |
383 | goto exit; |
393 | goto exit; |
384 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t)shm, 0, PROTO_READ, NULL, NULL, NULL); |
394 | rc = async_req_3(fbphone, IPC_M_AS_AREA_SEND, (ipcarg_t) shm, 0, |
- | 395 | PROTO_READ, NULL, NULL, NULL); |
|
385 | if (rc) |
396 | if (rc) |
386 | goto drop; |
397 | goto drop; |
387 | 398 | ||
388 | /* Obtain pixmap */ |
399 | /* Obtain pixmap */ |
389 | rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL); |
400 | rc = async_req(fbphone, FB_SHM2PIXMAP, 0, NULL); |
Line 406... | Line 417... | ||
406 | extern int _binary_anim_2_ppm_size; |
417 | extern int _binary_anim_2_ppm_size; |
407 | extern char _binary_anim_3_ppm_start[0]; |
418 | extern char _binary_anim_3_ppm_start[0]; |
408 | extern int _binary_anim_3_ppm_size; |
419 | extern int _binary_anim_3_ppm_size; |
409 | extern char _binary_anim_4_ppm_start[0]; |
420 | extern char _binary_anim_4_ppm_start[0]; |
410 | extern int _binary_anim_4_ppm_size; |
421 | extern int _binary_anim_4_ppm_size; |
- | 422 | ||
411 | static void make_anim(void) |
423 | static void make_anim(void) |
412 | { |
424 | { |
413 | int an; |
425 | int an; |
414 | int pm; |
426 | int pm; |
415 | 427 | ||
416 | an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], NULL); |
428 | an = async_req(fbphone, FB_ANIM_CREATE, cstatus_vp[KERNEL_CONSOLE], |
- | 429 | NULL); |
|
417 | if (an < 0) |
430 | if (an < 0) |
418 | return; |
431 | return; |
419 | 432 | ||
420 | pm = make_pixmap(_binary_anim_1_ppm_start, (int)&_binary_anim_1_ppm_size); |
433 | pm = make_pixmap(_binary_anim_1_ppm_start, (int) |
- | 434 | &_binary_anim_1_ppm_size); |
|
421 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
435 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
422 | 436 | ||
423 | pm = make_pixmap(_binary_anim_2_ppm_start, (int)&_binary_anim_2_ppm_size); |
437 | pm = make_pixmap(_binary_anim_2_ppm_start, (int) |
- | 438 | &_binary_anim_2_ppm_size); |
|
424 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
439 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
425 | 440 | ||
426 | pm = make_pixmap(_binary_anim_3_ppm_start, (int)&_binary_anim_3_ppm_size); |
441 | pm = make_pixmap(_binary_anim_3_ppm_start, (int) |
- | 442 | &_binary_anim_3_ppm_size); |
|
427 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
443 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
428 | 444 | ||
429 | pm = make_pixmap(_binary_anim_4_ppm_start, (int)&_binary_anim_4_ppm_size); |
445 | pm = make_pixmap(_binary_anim_4_ppm_start, (int) |
- | 446 | &_binary_anim_4_ppm_size); |
|
430 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
447 | async_msg_2(fbphone, FB_ANIM_ADDPIXMAP, an, pm); |
431 | 448 | ||
432 | async_msg(fbphone, FB_ANIM_START, an); |
449 | async_msg(fbphone, FB_ANIM_START, an); |
433 | 450 | ||
434 | animation = an; |
451 | animation = an; |
Line 440... | Line 457... | ||
440 | extern int _binary_cons_idle_ppm_size; |
457 | extern int _binary_cons_idle_ppm_size; |
441 | extern char _binary_cons_has_data_ppm_start[0]; |
458 | extern char _binary_cons_has_data_ppm_start[0]; |
442 | extern int _binary_cons_has_data_ppm_size; |
459 | extern int _binary_cons_has_data_ppm_size; |
443 | extern char _binary_cons_kernel_ppm_start[0]; |
460 | extern char _binary_cons_kernel_ppm_start[0]; |
444 | extern int _binary_cons_kernel_ppm_size; |
461 | extern int _binary_cons_kernel_ppm_size; |
- | 462 | ||
445 | /** Initialize nice graphical console environment */ |
463 | /** Initialize nice graphical console environment */ |
446 | void gcons_init(int phone) |
464 | void gcons_init(int phone) |
447 | { |
465 | { |
448 | int rc; |
466 | int rc; |
449 | int i; |
467 | int i; |
Line 458... | Line 476... | ||
458 | if (xres < 800 || yres < 600) |
476 | if (xres < 800 || yres < 600) |
459 | return; |
477 | return; |
460 | 478 | ||
461 | /* create console viewport */ |
479 | /* create console viewport */ |
462 | /* Align width & height to character size */ |
480 | /* Align width & height to character size */ |
463 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, |
481 | console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP, ALIGN_DOWN(xres - |
464 | ALIGN_DOWN(xres-2*CONSOLE_MARGIN, 8), |
482 | 2 * CONSOLE_MARGIN, 8), ALIGN_DOWN(yres - (CONSOLE_TOP + |
465 | ALIGN_DOWN(yres-(CONSOLE_TOP+CONSOLE_MARGIN),16)); |
483 | CONSOLE_MARGIN), 16)); |
466 | if (console_vp < 0) |
484 | if (console_vp < 0) |
467 | return; |
485 | return; |
468 | 486 | ||
469 | /* Create status buttons */ |
487 | /* Create status buttons */ |
470 | status_start += (xres-800) / 2; |
488 | status_start += (xres - 800) / 2; |
471 | for (i=0; i < CONSOLE_COUNT; i++) { |
489 | for (i = 0; i < CONSOLE_COUNT; i++) { |
472 | cstatus_vp[i] = vp_create(status_start+CONSOLE_MARGIN+i*(STATUS_WIDTH+STATUS_SPACE), |
490 | cstatus_vp[i] = vp_create(status_start + CONSOLE_MARGIN + i * |
- | 491 | (STATUS_WIDTH + STATUS_SPACE), STATUS_TOP, |
|
473 | STATUS_TOP, STATUS_WIDTH, STATUS_HEIGHT); |
492 | STATUS_WIDTH, STATUS_HEIGHT); |
474 | if (cstatus_vp[i] < 0) |
493 | if (cstatus_vp[i] < 0) |
475 | return; |
494 | return; |
476 | vp_switch(cstatus_vp[i]); |
495 | vp_switch(cstatus_vp[i]); |
477 | set_style(0x202020, 0xffffff); |
496 | set_style(0x202020, 0xffffff); |
478 | } |
497 | } |
479 | 498 | ||
480 | /* Initialize icons */ |
499 | /* Initialize icons */ |
- | 500 | ic_pixmaps[CONS_SELECTED] = |
|
481 | ic_pixmaps[CONS_SELECTED] = make_pixmap(_binary_cons_selected_ppm_start, |
501 | make_pixmap(_binary_cons_selected_ppm_start, (int) |
482 | (int)&_binary_cons_selected_ppm_size); |
502 | &_binary_cons_selected_ppm_size); |
483 | ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, |
503 | ic_pixmaps[CONS_IDLE] = make_pixmap(_binary_cons_idle_ppm_start, (int) |
484 | (int)&_binary_cons_idle_ppm_size); |
504 | &_binary_cons_idle_ppm_size); |
- | 505 | ic_pixmaps[CONS_HAS_DATA] = |
|
485 | ic_pixmaps[CONS_HAS_DATA] = make_pixmap(_binary_cons_has_data_ppm_start, |
506 | make_pixmap(_binary_cons_has_data_ppm_start, (int) |
486 | (int)&_binary_cons_has_data_ppm_size); |
507 | &_binary_cons_has_data_ppm_size); |
- | 508 | ic_pixmaps[CONS_DISCONNECTED] = |
|
487 | ic_pixmaps[CONS_DISCONNECTED] = make_pixmap(_binary_cons_idle_ppm_start, |
509 | make_pixmap(_binary_cons_idle_ppm_start, (int) |
488 | (int)&_binary_cons_idle_ppm_size); |
510 | &_binary_cons_idle_ppm_size); |
489 | ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, |
511 | ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start, |
490 | (int)&_binary_cons_kernel_ppm_size); |
512 | (int) &_binary_cons_kernel_ppm_size); |
491 | ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; |
513 | ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED]; |
492 | 514 | ||
493 | make_anim(); |
515 | make_anim(); |