#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include “local_timer.h”
int main(int argc, char *argv)
{
int fp = 0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
long screensize = 0;
char *fbp = 0;
int x = 0, y = 0;
long location = 0;
fp = open(“/dev/fb0”, O_RDWR);
if (fp < 0){
printf("Error : Can not open framebuffer device/n");
exit(1);
}
if (ioctl(fp, FBIOGET_FSCREENINFO, &finfo)){
printf("Error reading fixed information/n");
exit(2);
}
if (ioctl(fp, FBIOGET_VSCREENINFO, &vinfo)){
printf("Error reading variable information/n");
exit(3);
}
screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, fp, 0);
if (fbp == (char *)-1) {
printf("Error: failed to map framebuffer device to memory./n");
exit(4);
}
for(int k = 0; k < 10000; k++)
for (x = 100; x < 150; x++) {
for (y = 100; y < 150; y++) {
location = x * (vinfo.bits_per_pixel / 8) + y * finfo.line_length;
#if 1
* (fbp + location) = 255;
*(fbp + location + 1) = 0;
*(fbp + location + 2) = 0;
*(fbp + location + 3) = 0;
#endif
*(fbp + location) = 0;
*(fbp + location + 1) = 0x1f;
}
}
munmap(fbp, screensize);
close(fp);
return 0;
}