Subversion Repositories HelenOS

Rev

Rev 3674 | Rev 4338 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3674 Rev 4337
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_1(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, unsigned int width,
88
static int vp_create(unsigned int x, unsigned int y, unsigned int width,
89
    unsigned int height)
89
    unsigned int height)
Line 103... Line 103...
103
}
103
}
104
 
104
 
105
/** Transparent putchar */
105
/** Transparent putchar */
106
static void tran_putch(char c, int row, int col)
106
static void tran_putch(char c, int row, int col)
107
{
107
{
108
    async_msg_3(fbphone, FB_TRANS_PUTCHAR, c, row, col);
108
    async_msg_3(fbphone, FB_PUTCHAR, c, row, col);
109
}
109
}
110
 
110
 
111
/** Redraw the button showing state of a given console */
111
/** Redraw the button showing state of a given console */
112
static void redraw_state(int consnum)
112
static void redraw_state(int consnum)
113
{
113
{
Line 187... Line 187...
187
        return;
187
        return;
188
    if (active_console == consnum)
188
    if (active_console == consnum)
189
        console_state[consnum] = CONS_DISCONNECTED_SEL;
189
        console_state[consnum] = CONS_DISCONNECTED_SEL;
190
    else
190
    else
191
        console_state[consnum] = CONS_DISCONNECTED;
191
        console_state[consnum] = CONS_DISCONNECTED;
192
 
192
   
193
    if (active_console == KERNEL_CONSOLE)
193
    if (active_console == KERNEL_CONSOLE)
194
        return;
194
        return;
195
 
195
   
196
    redraw_state(consnum);
196
    redraw_state(consnum);
197
    vp_switch(console_vp);
197
    vp_switch(console_vp);
198
}
198
}
199
 
199
 
200
/** Notification function called on console connect */
200
/** Notification function called on console connect */
Line 215... Line 215...
215
}
215
}
216
 
216
 
217
/** Change to kernel console */
217
/** Change to kernel console */
218
void gcons_in_kernel(void)
218
void gcons_in_kernel(void)
219
{
219
{
220
    if (console_state[active_console] == CONS_DISCONNECTED_SEL)
-
 
221
        console_state[active_console] = CONS_DISCONNECTED;
-
 
222
    else
-
 
223
        console_state[active_console] = CONS_IDLE;
-
 
224
    redraw_state(active_console);
-
 
225
 
-
 
226
    if (animation != -1)
220
    if (animation != -1)
227
        async_msg_1(fbphone, FB_ANIM_STOP, animation);
221
        async_msg_1(fbphone, FB_ANIM_STOP, animation);
228
 
222
   
229
    active_console = KERNEL_CONSOLE; /* Set to kernel console */
223
    active_console = KERNEL_CONSOLE;
230
    vp_switch(0);
224
    vp_switch(0);
231
}
225
}
232
 
226
 
233
/** Return x, where left <= x <= right && |a-x|==min(|a-x|) is smallest */
227
/** Return x, where left <= x <= right && |a-x|==min(|a-x|) is smallest */
234
static inline int limit(int a,int left, int right)
228
static inline int limit(int a,int left, int right)
Line 340... Line 334...
340
 
334
 
341
extern char _binary_helenos_ppm_start[0];
335
extern char _binary_helenos_ppm_start[0];
342
extern int _binary_helenos_ppm_size;
336
extern int _binary_helenos_ppm_size;
343
extern char _binary_nameic_ppm_start[0];
337
extern char _binary_nameic_ppm_start[0];
344
extern int _binary_nameic_ppm_size;
338
extern int _binary_nameic_ppm_size;
-
 
339
 
345
/** Redraws console graphics  */
340
/** Redraws console graphics */
346
static void gcons_redraw_console(void)
341
void gcons_redraw_console(void)
347
{
342
{
348
    int i;
343
    int i;
349
 
344
   
350
    if (!use_gcons)
345
    if (!use_gcons)
351
        return;
346
        return;
352
   
347
   
353
    vp_switch(0);
348
    vp_switch(0);
354
    set_style(MAIN_COLOR, MAIN_COLOR);
349
    set_style(MAIN_COLOR, MAIN_COLOR);
355
    clear();
350
    clear();
356
    draw_pixmap(_binary_helenos_ppm_start,
351
    draw_pixmap(_binary_helenos_ppm_start,
357
        (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
352
        (size_t) &_binary_helenos_ppm_size, xres - 66, 2);
358
    draw_pixmap(_binary_nameic_ppm_start,
353
    draw_pixmap(_binary_nameic_ppm_start,
359
        (size_t) &_binary_nameic_ppm_size, 5, 17);
354
        (size_t) &_binary_nameic_ppm_size, 5, 17);
360
 
355
   
361
    for (i = 0; i < CONSOLE_COUNT; i++)
356
    for (i = 0; i < CONSOLE_COUNT; i++)
362
        redraw_state(i);
357
        redraw_state(i);
363
    vp_switch(console_vp);
358
    vp_switch(console_vp);
364
}
359
}
365
 
360
 
Line 457... Line 452...
457
void gcons_init(int phone)
452
void gcons_init(int phone)
458
{
453
{
459
    int rc;
454
    int rc;
460
    int i;
455
    int i;
461
    int status_start = STATUS_START;
456
    int status_start = STATUS_START;
462
 
457
   
463
    fbphone = phone;
458
    fbphone = phone;
464
 
459
   
465
    rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
460
    rc = async_req_0_2(phone, FB_GET_RESOLUTION, &xres, &yres);
466
    if (rc)
461
    if (rc)
467
        return;
462
        return;
468
   
463
   
469
    if (xres < 800 || yres < 600)
464
    if ((xres < 800) || (yres < 600))
470
        return;
465
        return;
471
 
466
   
472
    /* create console viewport */
467
    /* create console viewport */
473
    /* Align width & height to character size */
468
    /* Align width & height to character size */
474
    console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
469
    console_vp = vp_create(CONSOLE_MARGIN, CONSOLE_TOP,
475
        ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
470
        ALIGN_DOWN(xres - 2 * CONSOLE_MARGIN, 8),
476
        ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
471
        ALIGN_DOWN(yres - (CONSOLE_TOP + CONSOLE_MARGIN), 16));
Line 504... Line 499...
504
    ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
499
    ic_pixmaps[CONS_KERNEL] = make_pixmap(_binary_cons_kernel_ppm_start,
505
        (int) &_binary_cons_kernel_ppm_size);
500
        (int) &_binary_cons_kernel_ppm_size);
506
    ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
501
    ic_pixmaps[CONS_DISCONNECTED_SEL] = ic_pixmaps[CONS_SELECTED];
507
   
502
   
508
    make_anim();
503
    make_anim();
509
 
504
   
510
    use_gcons = 1;
505
    use_gcons = 1;
511
    console_state[0] = CONS_DISCONNECTED_SEL;
506
    console_state[0] = CONS_DISCONNECTED_SEL;
512
    console_state[KERNEL_CONSOLE] = CONS_KERNEL;
507
    console_state[KERNEL_CONSOLE] = CONS_KERNEL;
513
    gcons_redraw_console();
508
    gcons_redraw_console();
514
}
509
}
515
 
510
 
516
/** @}
511
/** @}
517
 */
512
 */
518
 
-