示例#1
0
// initialize vga display
static void tft_init(void)
{
	//*((uint32_t*)0x50000004) = 3; // initiate self destruction
	lcd_init(24);
	lcd_clear();
	lcd_getinfo(&tft_info);
	diag_printf("TFT framebuffer: width : %d\n", tft_info.width);
	diag_printf("                 height: %d\n", tft_info.height);
	diag_printf("                 bpp   : %d\n", tft_info.bpp);
	diag_printf("                 type  : %d\n", tft_info.type);
	diag_printf("                 rlen  : %d\n", tft_info.rlen);
}
示例#2
0
///
/// Initializes the framebuffer and the network interfaces
///
void init()
{
    //cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_EMAC);

    // initialize profiling timebase
    if (profile_tbwdtInit() != 0) {
        diag_printf("TBWDT initialization failed.\n");
    }
#ifdef DO_STATETRACE
    reconos_clearStateTrace();
#endif

    lcd_init(24);
    lcd_clear();
    lcd_getinfo(&fb_info);
    diag_printf("framebuffer @ %dx%d\n", fb_info.width, fb_info.height);

    init_all_network_interfaces();
    diag_printf("eth0_up = %d\n", eth0_up);

}
示例#3
0
/* init framebuffer*/
static PSD
fb_open(PSD psd)
{
    PSUBDRIVER subdriver;
    struct lcd_info li;

    assert(status < 2);

    // Initialize LCD screen
    lcd_init(16);
    lcd_getinfo(&li);

	psd->portrait = MWPORTRAIT_NONE;
    psd->xres = psd->xvirtres = li.width;
    psd->yres = psd->yvirtres = li.height;
    psd->planes = 1;
    psd->bpp = li.bpp;
    psd->ncolors = (psd->bpp >= 24)? (1 << 24): (1 << psd->bpp);
	psd->pitch = li.rlen;
	psd->size = psd->yres * psd->pitch;
    psd->flags = PSF_SCREEN;

    /* set pixel format*/
    switch (li.type) {
    case FB_TRUE_RGB565:
        psd->pixtype = MWPF_TRUECOLOR565;
        break;
    default:
        EPRINTF("Unsupported display type: %d\n", li.type);
        goto fail;
    }
#if 0
    if(1 /*visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR*/) {
        switch(psd->bpp) {
        case 8:
            psd->pixtype = MWPF_TRUECOLOR332;
            break;
        case 16:
            psd->pixtype = MWPF_TRUECOLOR565;
            break;
        case 24:
            psd->pixtype = MWPF_TRUECOLOR888;
            break;
        case 32:
            psd->pixtype = MWPF_TRUECOLOR8888;
            break;
        default:
            EPRINTF("Unsupported %d color (%d bpp) truecolor framebuffer\n", psd->ncolors, psd->bpp);
            goto fail;
        }
    } else psd->pixtype = MWPF_PALETTE;
#endif

    diag_printf("%dx%dx%d pitch %d type %d bpp %d\n", psd->xres,
      psd->yres, psd->ncolors, psd->pitch, li.type, psd->bpp);

	/* set standard data format from bpp and pixtype*/
	psd->data_format = set_data_format(psd);

    /* select a framebuffer subdriver based on planes and bpp*/
    subdriver = select_fb_subdriver(psd);
    if (!subdriver) {
        EPRINTF("No driver for screen bpp %d\n", psd->bpp);
        goto fail;
    }

	/* set subdriver into screen driver */
	set_subdriver(psd, subdriver);

    /* mmap framebuffer into this address space*/
    psd->addr = li.fb;
    if(psd->addr == NULL || psd->addr == (unsigned char *)-1) {
//        EPRINTF("Error mmaping %s: %m\n", env);
        goto fail;
    }

#if 0    /* FIXME */
    /* save original palette*/
    ioctl_getpalette(0, 16, saved_red, saved_green, saved_blue);

    /* setup direct color palette if required (ATI cards)*/
    if(visual == FB_VISUAL_DIRECTCOLOR)
        set_directcolor_palette(psd);
#endif

    status = 2;
    return psd;	/* success*/

 fail:
    return NULL;
}