1.分配一个fb_info结构体: framebuffer_alloc

2.设置

3.注册

4.硬件相关操

struct fb_fix_screeninfo {
 char id[16];   /* identification string eg "TT Builtin" */
 unsigned long smem_start; /* Start of frame buffer mem */
     /* (physical address) */
 __u32 smem_len;   /* Length of frame buffer mem */
 __u32 type;   /* see FB_TYPE_*  */
 __u32 visual;   /* see FB_VISUAL_*  */ 
 __u32 line_length;  /* length of a line in bytes    */
};

struct fb_var_screeninfo {

__u32 xres;   /* visible resolution  */

__u32 yres;

__u32 xres_virtual;  /* virtual resolution  */

__u32 yres_virtual;

__u32 bits_per_pixel;  /* guess what   */

struct fb_bitfield red;  /* bitfield in fb mem if true color, */

struct fb_bitfield green; /* else only length is significant */

struct fb_bitfield blue;

__u32 activate;   /* see FB_ACTIVATE_*  */

};

 1 static int lcd_init(void)
2 {
3 /* 1. 分配一个fb_info */
4 s3c_lcd = framebuffer_alloc(0, NULL);
5
6 /* 2. 设置 */
7 /* 2.1 设置固定的参数 */
8 strcpy(s3c_lcd->fix.id, "mylcd");
9 s3c_lcd->fix.smem_len = 480 * 272 * 16 / 8;
10 s3c_lcd->fix.type = FB_TYPE_PACKED_PIXELS;
11 s3c_lcd->fix.visual = FB_VISUAL_TRUECOLOR; /*TFT*/
12 s3c_lcd->fix.line_length = 480 * 2;
13
14 /* 2.2 设置可变的参数 */
15 s3c_lcd->var.xres = 480;
16 s3c_lcd->var.yres = 272;
17 s3c_lcd->var.xres_virtual = 480;
18 s3c_lcd->var.yres_virtual = 272;
19 s3c_lcd->var.bits_per_pixel = 16;
20
21 /* RGB:565 */
22 s3c_lcd->var.red.offset = 11;
23 s3c_lcd->var.red.length = 5;
24
25 s3c_lcd->var.green.offset = 5;
26 s3c_lcd->var.green.length = 6;
27
28 s3c_lcd->var.blue.offset = 0;
29 s3c_lcd->var.blue.length = 5;
30
31 s3c_lcd->var.activate = FB_ACTIVATE_NOW;
32
33 /* 2.3 设置操作函数 */
34 s3c_lcd->fbops = &s3c_lcdfb_ops;
35
36 /* 2.4 其他设置 */
37 //s3c_lcd->pseudo_palette;
38 //s3c_lcd->screen_base; //显存的虚拟地址
39 //s3c_lcd->screen_size = 480 * 272 * 16 / 8;
40 /* 3. 硬件相关的设置 */
41 /* 3.1 配置GPIO用于LCD */
42 /* 3.2 根据LCD手册设置LCD控制器,比如VCLK的频率等 */
43 /* 3.3 分配显存(framebuffer),并把地址告诉LCD控制器 */
44
45 /* 4. 注册 */
46
47 register_framebuffer(s3c_lcd);
48
49 return 0;
50 }

LCD驱动 15 -2的更多相关文章

  1. 嵌入式Linux驱动学习之路(十八)LCD驱动

    驱动代码: /************************************************************************* > File Name: lcd ...

  2. FL2440驱动添加(3)LCD驱动添加学习笔记

    FL2440 LCD内置控制器,320*240 TFT型LCD. 自我理解总结的两种添加驱动模式: 非platform方式添加驱动: 加载驱动: 1,硬件初始化,申请内存,并作地址映射 2,分配设备号 ...

  3. Smart210学习-----lcd驱动

    帧缓冲设备 1.1帧缓冲设备:帧缓冲(framebuffer)是 Linux 系统为显示设备提供的一个接口,它将显示缓冲区抽象,屏蔽图像硬件的底层差异,允许上层应用程序在图形模式下直接对显示缓冲区进行 ...

  4. S3C2440 LCD驱动(FrameBuffer)实例开发<一>(转)

    1. 背景知识 在多媒体的推动下,彩色LCD越来越多地应用到嵌入式系统中,PDA和手机等大多都采用LCD作为显示器材,因此学习LCD的应用很有实际意义! LCD工作的硬件需求:要使一块LCD正常的显示 ...

  5. LCD驱动(FrameBuffer)实例开发讲解

    一.开发环境 主  机:VMWare--Fedora 9 开发板:Mini2440--64MB Nand, Kernel:2.6.30.4 编译器:arm-linux-gcc-4.3.2 二.背景知识 ...

  6. LCD驱动移植在在mini2440(linux2.6.29)和FS4412(linux3.14.78)上实现对比(deep dive)

    1.Linux帧缓冲子系统 帧缓冲(FrameBuffer)是Linux为显示设备提供的一个接口,用户可以将帧缓冲看成是显示内存的一种映像,将其映射到进程地址空间之后,就可以直接进行读写操作,而写操作 ...

  7. lcd驱动框架

    目录 lcd驱动框架 框图 程序分析 入口 打开open 读read 初始化registered_fb 注册 小结 程序设计 测试 方式一操作fb0 方式二操作tty 方式三操作终端 完整程序 tit ...

  8. linux 驱动之LCD驱动(有framebuffer)

    <简介> LCD驱动里有个很重要的概念叫帧缓冲(framebuffer),它是Linux系统为显示设备提供的一个接口,应用程序在图形模式允许对显示缓冲区进行读写操作.用户根本不用关心物理显 ...

  9. LCD驱动分析【转】

    转自:http://blog.csdn.net/hanmengaidudu/article/details/21559153 1.S3C2440上LCD驱动 (FrameBuffer)实例开发讲解 其 ...

随机推荐

  1. MonkeyRunner学习(3)脚本编辑

    除了cmd直接操作手机,也可以编辑好脚本后,运行脚本,一次操作多个脚本命令 a) 新建py格式脚本,如iReader.py b) 编辑脚本 #导入模块 from com.android.monkeyr ...

  2. css sprites-简单实例让你快速掌握css sprites精髓

    这段时间有几次接触到了css sprites的概念,一个就是在用css做滑动门的时候,另外一个就是在用YSlow分析网站性能的时候,于是对css sprites这个概念产生了浓厚的兴趣.在网上查找了很 ...

  3. hdu 4055 && hdu 4489 动态规划

    hdu 4055: 一开始我想的递推方向想得很复杂,看了别人的博客后才醍醐灌顶: 参照他的思路和代码: #include<cstdio> #include<cstring> # ...

  4. 利用SecureCRT上传、下载文件(使用sz与rz命令),超实用!

    利用SecureCRT上传.下载文件(使用sz与rz命令),超实用! 文章来源:http://blog.csdn.net/dongqinliuzi/article/details/39623169 借 ...

  5. windows多线程框架

    #include <iostream> #include <windows.h> using namespace std; HANDLE hMutex; //public : ...

  6. LayoutParams使用

    LayoutParams继承于Android.View.ViewGroup.LayoutParams.       LayoutParams相当于一个Layout的信息包,它封装了Layout的位置. ...

  7. Element can be click when out of view

    WebDriver can't action the element when out of view Webdriver can't action the element when the elem ...

  8. unity3d magnitude的意义

    http://blog.csdn.net/fzhlee/article/details/8663564   magnitude (Read Only) 返回向量的长度,也就是点P(x,y,z)到原点( ...

  9. 能源项目xml文件 -- app-context.xml

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  10. canvas打开本机摄像头

    (function () { var video = document.createElement("video"); video.autoplay="autoplay& ...