This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Video mode code / eCos demo


"Kumanan" <kumanan@mindless.com> writes:

> Hi David,

> Hope you don't mind me emailing directly.

Well, the list is almost always better, because 1) other people can
answer before I can 2) they can make sure my answer is right and 3)
other people can find the conversation in the archives.

> Just a quick question: In your demo are you using MicroWindows for
> framebuffer, or are you setting the video mode directly via ints?

Doing everything directly via ints and a direct address.

    /* eCos puts the information we need here.   */
    info_block = (struct VBESVGAInfoBlock*) 0x000A0000;
    current_mode = (struct VBEModeInfoBlock*) 0x000A0200;

typedef struct screen_info {
    unsigned char *base_buf;
    int width;
    int height;
    int bpp;
    int scanline;
} screen_info;

get_screen_info(screen_info *si)
{
    /* This is screen information. */
    si->base_buf = (unsigned char*) current_mode->physical_base_ptr;
    si->scanline = info_block->version >= 0x0300
	? current_mode->linear_bytes_per_scanline :
	current_mode->bytes_per_scanline;
    si->bpp = current_mode->bits_per_pixel / 8;
    si->width = current_mode->x_resolution;
    si->height = current_mode->y_resolution;
}

> All I want to do is switch my platform to linear 640x480, 16bit mode
> and then punch pixels. I'd like to avoid bringing in a large library
> just to do that. (Of course, I have not played with MW so I could be
> way off in my estimate of how big I think it is :)

You want to look at gfx.c distributed with the eCos sources, and also
this:

cdl_option CYGNUM_HAL_I386_PC_STARTUP_VIDEO_MODE {
    # Flavor: booldata
    user_value 1 0x112
    # value_source user
    # Default value: 0 0
    # Requires:  !CYGSEM_HAL_I386_PC_DIAG_SCREEN 
    #     CYGSEM_HAL_I386_PC_DIAG_SCREEN == 0
    #   --> 1
};

be sure to use (0x4000 | your_selected_mode) (or whatever mode -
search for 'VBE modes 0x115' or something on google) to do linear
addressing!

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]