当前位置: 技术问答>linux和unix
在linux下怎么找到vga视频缓冲区的地址
来源: 互联网 发布时间:2014-12-21
本文导语: 如题 | #include #include #include #include #include #define VGA_ADDR1 (0xfb000000) #define VGA_ADDR2 (0xfc000000) #define MEM_LEN (64 * 1024) static char *hello="Hello! VGA test!"; int main() { int fd; char *paddr1, *...
如题
|
#include
#include
#include
#include
#include
#define VGA_ADDR1 (0xfb000000)
#define VGA_ADDR2 (0xfc000000)
#define MEM_LEN (64 * 1024)
static char *hello="Hello! VGA test!";
int main()
{
int fd;
char *paddr1, *paddr2;
fd = open("/dev/mem", O_RDONLY);
if (fd == -1)
{
perror("open");
return fd;
}
paddr1 = (char *)mmap(NULL, MEM_LEN, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, VGA_ADDR1);
paddr2 = (char *)mmap(NULL, MEM_LEN, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, VGA_ADDR2);
close(fd);
return 0;
}
#include
#include
#include
#include
#define VGA_ADDR1 (0xfb000000)
#define VGA_ADDR2 (0xfc000000)
#define MEM_LEN (64 * 1024)
static char *hello="Hello! VGA test!";
int main()
{
int fd;
char *paddr1, *paddr2;
fd = open("/dev/mem", O_RDONLY);
if (fd == -1)
{
perror("open");
return fd;
}
paddr1 = (char *)mmap(NULL, MEM_LEN, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, VGA_ADDR1);
paddr2 = (char *)mmap(NULL, MEM_LEN, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, VGA_ADDR2);
close(fd);
return 0;
}