对Framebuffer的操作
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <asm/page.h>
#include <linux/fb.h>

#define TRUE    1
#define FALSE   0

#define MIN(x,y)        ((x)>(y)?(y):(x))
#define MAX(x,y)        ((x)>(y)?(x):(y))

typedef struct fbdev{
        int fb;
        unsigned long fb_mem_offset;
        unsigned long fb_mem;
        struct fb_fix_screeninfo fb_fix;
        struct fb_var_screeninfo fb_var;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <asm/page.h>
#include <linux/fb.h>

#define TRUE    1
#define FALSE   0

#define MIN(x,y)        ((x)>(y)?(y):(x))
#define MAX(x,y)        ((x)>(y)?(x):(y))

typedef struct fbdev{
        int fb;
        unsigned long fb_mem_offset;
        unsigned long fb_mem;
        struct fb_fix_screeninfo fb_fix;
        struct fb_var_screeninfo fb_var;
        char dev[20];
} FBDEV, *PFBDEV;

typedef struct point{
        int x;
        int y;
        int z;

} POINT, *PPOINT;

int fb_open(PFBDEV pFbdev)
{
        pFbdev->fb = open(pFbdev->dev, O_RDWR);
        if(pFbdev->fb < 0)
        {
                printf("Error opening %s: %m. Check kernel config\n", pFbdev->dev);
                return FALSE;
        }
        if (-1 == ioctl(pFbdev->fb,FBIOGET_VSCREENINFO,&(pFbdev->fb_var)))
        {
                printf("ioctl FBIOGET_VSCREENINFO\n");
                return FALSE;
        }
        if (-1 == ioctl(pFbdev->fb,FBIOGET_FSCREENINFO,&(pFbdev->fb_fix)))
  

阅读更多
文章标签: framebuffer
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

对Framebuffer的操作

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭