.c文件代码:
#include <stdio.h> //printf scanf
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h> //open read lseek write close
#include <sys/mman.h> //mmap
int main(int argc, char **argv)
{
int fd_lcd;
unsigned int *pfb=NULL;
unsigned int x,y;
unsigned char bmp_buf[480*800*3];
//打开虚拟lcd设备
fd_lcd = open("/dev/ubuntu_lcd", O_RDWR);
if(fd_lcd < 0)
{
perror("open lcd");
return -1;
}
//进行内存映
pfb=(unsigned int *)mmap(NULL, //映射区的开始地址,设置为NULL时表示由系统决定映射区的起始地址
800*480*4, //映射区的长度
PROT_READ|PROT_WRITE, //内容可以被读取和写入
MAP_SHARED, //对共享区的写入,相当于输出到文件
fd_lcd, //有效的文件描述符
0 //被映射对象内容的起点
);
if(pfb == NULL)
{
perror("mmap");
return -1;
}
//打开资源图片
int fd_bmp = open("./1.bmp", O_RDONLY);
if(fd_bmp <