用户空间编写S3c2440 lcd的驱动程序
来源:互联网 发布:淘宝店铺有哪些类型? 编辑:程序博客网 时间:2024/06/05 01:59
s3c2410test.c
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <linux/fb.h> #include <sys/mman.h> #include <sys/ioctl.h> extern const unsigned char tu1_320240[]; int main() { int fbfd = 0; struct fb_var_screeninfo vinfo; struct fb_fix_screeninfo finfo; long int screensize = 0; char *fbp = 0; int x = 0, y = 0; long int location = 0; int p=0; unsigned shortc; // Open the file for reading and writing fbfd = open("/dev/fb0", O_RDWR); if (fbfd == -1) { perror("Error: cannot open framebuffer device"); exit(1); } printf("The framebuffer device was opened successfully.\n"); // Get fixed screen information if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo) == -1) { perror("Error reading fixed information"); exit(2); } // Get variable screen information if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo) == -1) { perror("Error reading variable information"); exit(3); } printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel); // Figure out the size of the screen in bytes 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) { perror("Error: failed to map framebuffer device to memory"); exit(4); } printf("The framebuffer device was mapped to memory successfully.\n"); // Figure out where in memory to put the pixel for (y = 0; y < 240; y++) for (x = 0; x < 320; x++) { location = (x) * (vinfo.bits_per_pixel/8) + (y+vinfo.yoffset) * finfo.line_length; c=tu1_320240[p+1]|(tu1_320240[p]<<8);*((unsigned short int*)(fbp + location)) =c ;p+=2; } munmap(fbp, screensize); close(fbfd); return 0; }JAkILL_LOGO.h
extern const unsigned char tu1_320240[];JAKILL_LOGO.C
/*BMP C file converted from BMP file*/#include "pic.h"const unsigned char pic[] = { /* image header, 20 bytes */ /* scan line 1 */ #ifdefWIN32 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
.......
....
arm-linux-gcc -static -o jakilltest s3c2410lcdtest.c JAKILL_LOGO.H JAKILL_LOGO.C
生成的 jakiiltest 在板子在上执行 ./jakilltest
会看到出现一个美女哦
前提:
s3c244 开发板,已经安装linux2.6.30.6,LCD驱动也完好
下一节,linux下的lcd驱动
- 用户空间编写S3c2440 lcd的驱动程序
- s3c2440的LCD驱动程序--转韦东山
- Linux LCD 驱动程序的编写
- Linux LCD 驱动程序的编写
- 编写Linux用户空间驱动程序
- 编写Linux用户空间驱动程序
- 在用户空间编写设备驱动程序的优缺点
- 用户空间的驱动程序
- s3c2440 LCD ——驱动程序
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WinCE的LCD驱动程序编写指南
- WCF实战网站
- session和cookie的区别
- 使用netlink机制在内核与应用程序之间通信
- 深入分析Windows和Linux动态库应用异同
- Oracle数据库通过undo保证一致性读和不发生脏读
- 用户空间编写S3c2440 lcd的驱动程序
- 常用和必备的Javascript片段
- 解决chrome浏览器无法得到window.showModalDialog返回值
- Access数据库操作语句
- Android--WindowManager
- java se 类的加载过程
- 基于XMPP协议的Android即时通信系
- 第十五篇 Android 的Backup服务管理机制与架构分析
- windows运行命令全集