Exemple #1
0
void lcd_ctrl_init(void *lcdbase)
{
	int type = DCACHE_OFF;
	int size;

	assert(disp_config);

	/* Make sure that we can acommodate the selected LCD */
	assert(disp_config->width <= LCD_MAX_WIDTH);
	assert(disp_config->height <= LCD_MAX_HEIGHT);
	assert(disp_config->log2_bpp <= LCD_MAX_LOG2_BPP);
	if (disp_config->width <= LCD_MAX_WIDTH
			&& disp_config->height <= LCD_MAX_HEIGHT
			&& disp_config->log2_bpp <= LCD_MAX_LOG2_BPP)
		update_panel_size(disp_config);
	size = lcd_get_size(&lcd_line_length);

	/* Set up the LCD caching as requested */
	if (config.cache_type & FDT_LCD_CACHE_WRITE_THROUGH)
		type = DCACHE_WRITETHROUGH;
	else if (config.cache_type & FDT_LCD_CACHE_WRITE_BACK)
		type = DCACHE_WRITEBACK;
	mmu_set_region_dcache_behaviour(disp_config->frame_buffer, size, type);

	/* Enable flushing after LCD writes if requested */
	lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH);

	debug("LCD frame buffer at %08X\n", disp_config->frame_buffer);
}
Exemple #2
0
void window_update_layout(window_t *win)
{
    char proc_info[1024];

    int new_w, new_h;
    uint8_t  state;

    int winx, winy, winw, winh;

//    __asm__ __volatile__("int3");

    get_proc_info(proc_info);

    winx = *(uint32_t*)(proc_info+34);
    winy = *(uint32_t*)(proc_info+38);
    winw = *(uint32_t*)(proc_info+42)+1;
    winh = *(uint32_t*)(proc_info+46)+1;

    state  = *(uint8_t*)(proc_info+70);

    if(state & 2)
    {   win->win_state = MINIMIZED;
        return;
    }
    if(state & 4)
    {
        win->win_state = ROLLED;
        return;
    };

    if(state & 1)
        state = MAXIMIZED;
    else
        state = NORMAL;

    if( (winx != win->rc.l) || (winy != win->rc.t) )
    {
        win->rc.l = winx;
        win->rc.t = winy;
        win->rc.r = winx + win->w;
        win->rc.b = winy + win->h;
    };

//    if( winw  == win->w &&
//        winh  == win->h &&
//        state == win->win_state)
//        return;

    if(win->win_state != FULLSCREEN)
        win->win_state = state;

#if 0
    int old_size;
    int new_size;
    int pitch;


    old_size = win->bitmap.pitch * win->bitmap.height;
    old_size = (old_size+4095) & ~4095;

    pitch = ALIGN(win->w*4, 16);

    new_size = pitch * win->h;
    new_size = (new_size+4095) & ~4095;

    if( new_size < old_size)
        user_unmap(win->bitmap.data, new_size, old_size-new_size);

    win->bitmap.width = win->w;
    win->bitmap.pitch = pitch;
#endif

    win->rc.r = winx + winw;
    win->rc.b = winy + winh;
    win->w = winw;
    win->h = winh;

    update_caption_size(win);
    update_panel_size(win);
    adjust_frame(win);

    send_message((ctrl_t*)win, MSG_SIZE, 0, 0);
    draw_window(win);
};
int init_panel(window_t *win)
{
    button_t     *btn;
    progress_t   *prg;
    level_t      *lvl;
    slider_t     *sld;

    panel_t *panel = &win->panel;
    ctx_t   *ctx = &panel->ctx;

    link_initialize(&panel->ctrl.link);
    list_initialize(&panel->ctrl.child);

    panel->ctrl.handler = panel_proc;
    panel->ctrl.parent  = (ctrl_t*)win;

    panel->layout = 0;
    
    panel->bitmap.width  = 1920;
    panel->bitmap.height = PANEL_HEIGHT;
    panel->bitmap.flags  = 0;

    if( create_bitmap(&panel->bitmap) )
    {
        printf("not enough memory for panel bitmap\n");
        return 0;
    }

    ctx->pixmap   = &panel->bitmap;
    ctx->offset_x = 0;
    ctx->offset_y = 0;

    panel->ctrl.ctx = ctx;

    btn = create_button(NULL, ID_PLAY,0,19,32,32,&panel->ctrl);
    panel->play_btn = btn;

    btn->img_default = res_pause_btn;
    btn->img_hilite  = res_pause_btn;
    btn->img_pressed = res_pause_btn_pressed;

    btn = create_button(NULL, ID_STOP,0,19,24,24,&panel->ctrl);
    panel->stop_btn = btn;

    btn->img_default = res_stop_btn;
    btn->img_hilite  = res_stop_btn;
    btn->img_pressed = res_stop_btn_pressed;

    prg = create_progress(NULL,ID_PROGRESS,0,4,0,10,&panel->ctrl);
    panel->prg = prg;

    lvl = create_level(NULL, ID_VOL_LEVEL, 0, 20, 96, 10, &panel->ctrl);
    lvl->vol = -1875;
    panel->lvl = lvl;
    
    sld = create_slider(NULL, ID_VOL_CTRL, 0, 20, 96+12, 12, &panel->ctrl);
    panel->sld = sld; 
     
//    btn = create_button(NULL, ID_MINIMIZE,0,5,16,18,(ctrl_t*)cpt);
//    cpt->minimize_btn = btn;

//    btn->img_default = res_minimize_btn;
//    btn->img_hilite  = res_minimize_btn_hl;
//    btn->img_pressed = res_minimize_btn_pressed;



    update_panel_size(win);

    return 1;
};