1. Development Platform sc6410, compiler Arm-Linux-GCC 4.3
The source code is as follows:
# Include <fcntl. h>
# Include <sys/IOCTL. h>
# Include <sys/types. h>
# Include <sys/STAT. h>
# Include <sys/Mman. h>
# Include <unistd. h>
# Include <string. h>
# Include <stdlib. h>
# Include <stdio. h>
# Include <string. h>
# Include <Linux/types. h>
# Include <Linux/FB. h>
# Include <Linux/videodev2.h>
Int main (INT argc, char * argv [])
{
Int fbfd = 0;
Struct fb_var_screeninfo vinfo;
Struct fb_fix_screeninfo finfo;
Long int screensize = 0;
Char * FBP = NULL;
Int x = 0, y = 0;
Long int location = 0;
Int sav = 0;
// Open framebuffer Device
Fbfd = open ("/dev/fb0", o_rdwr );
If (! Fbfd ){
Printf ("error: cannot open the framebuffer device! \ N ");
Exit (1 );
}
Printf ("Well you open the framebuffer sucessful! \ N ");
// Get the Fixed Screen Information
If (IOCTL (fbfd, fbioget_fscreeninfo, & finfo )){
Printf ("error reading fixed information \ n ");
Exit (2 );
}
// Get the variable screen information
If (IOCTL (fbfd, fbioget_vscreeninfo, & vinfo )){
Printf ("error reading variable information \ n ");
Exit (3 );
}
// Show these information
Printf ("vinfo. xres = % d \ n", vinfo. xres );
Printf ("vinfo. yres = % d \ n", vinfo. yres );
Printf ("vinfo. bit_per_bits = % d \ n", vinfo. bits_per_pixel );
Printf ("vinfo. xoffset = % d \ n", vinfo. xoffset );
Printf ("vinfo. yoffset = % d \ n", vinfo. yoffset );
Printf ("finfo. line_length = % d \ n", finfo. line_length );
Screensize = vinfo. xres * vinfo. yres * vinfo. bits_per_pixel/8;
// Map the device to memory
FBP = (char *) MMAP (0, screensize, prot_read | prot_write, map_shared, fbfd, 0 );
If (INT) FBP =-1 ){
Printf ("error: failed to map framebuffer device to memory \ n ");
Exit (4 );
}
Memset (FBP, 0, screensize );
// Plot the screen the color for black
For (x = 0; x <vinfo. xres; X ++)
For (y = 0; y <vinfo. yres; y ++ ){
Location = (x + vinfo. xoffset) * (vinfo. bits_per_pixel/8) + (Y + vinfo. yoffset) * finfo. line_length;
* (FBP + location) = 0xff;
* (FBP + location + 1) = 0x00;
}
Sleep (10 );
// Release the memory
Munmap (FBP, screensize );
Close (fbfd );
Return 0;
}
The result of compilation and download to the Development Board is (and the display screen of your development board turns blue ):