Linux: Framebuffer测试程序
来源:互联网 发布:c语言简单的程序例子 编辑:程序博客网 时间:2024/05/03 04:58
fb设为24位模式:
fbset -fb /dev/fb0 -g 800 600 800 600 24 -n
用r g b填充fb:
use-fb 255 0 0 //red
use-fb 0 255 0 //green
...
use-fb.c 代码:
/* use-fb.c*/
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <stdlib.h>
struct fb_var_screeninfo vinfo;
int
main(int argc, char *argv[])
{
int fbfd, fbsize, i;
int red, green, blue;
unsigned char *fbbuf;
if (argc != 4) {
printf("usage: use-fb red green blue/n");
exit(0);
}
red = atoi(argv[1]);
green = atoi(argv[2]);
blue = atoi(argv[3]);
/* Open video memory */
if ((fbfd = open("/dev/fb0", O_RDWR)) < 0) {
exit(1);
}
/* Get variable display parameters */
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
printf("Bad vscreeninfo ioctl/n");
exit(2);
}
/* Size of frame buffer */
fbsize = vinfo.xres*vinfo.yres*(vinfo.bits_per_pixel/8);
/* Map video memory */
if ((fbbuf = mmap(0, fbsize, PROT_READ | PROT_WRITE,
MAP_SHARED, fbfd, 0)) == (void *) -1) {
exit(3);
}
/* Clear the screen */
for (i = 0; i < fbsize; i++) {
*(fbbuf + i++) = red;
*(fbbuf + i++) = green;
*(fbbuf + i) = blue;
}
printf("clear screen with rgb:%s %s %s/n", argv[1], argv[2], argv[3]);
munmap(fbbuf, fbsize);
close(fbfd);
}
- Linux: Framebuffer测试程序
- Linux: Framebuffer测试程序
- 测试 framebuffer 的程序
- framebuffer测试程序
- framebuffer 测试程序 arm linux 6410 2440 2416
- 测试framebuffer
- FrameBuffer 测试
- 将FrameBuffer测试程序移植到板子上
- framebuffer小程序显示3个矩形 测试
- linux framebuffer
- Linux Framebuffer
- linux FrameBuffer
- LINUX framebuffer
- Linux framebuffer
- LINUX framebuffer
- Linux Framebuffer
- linux FrameBuffer
- Linux Framebuffer
- PHP中字符串分割、获取子串以及向文本框中添加值
- 布置工作这么做
- Linux下修改系统时间
- 工作安排及过程监督
- poj 2485 Highways(Kruskal!)
- Linux: Framebuffer测试程序
- 弹出选择文件夹的窗口(用于文件存储)
- scrollPane里加载textField不自动添加边框
- 经理发布命令要注意的几种情况
- SQL server 2000 卸载
- Unable to find a value for "tStatus" in object of class org.entity.Passport using operator "."
- 智能卡操作系统的补丁机制
- HGE 基础教程 1~5
- Sql Server Agent 服务 无法启动(2008 Express 版)