📄 [转载]framebuffer驱动程序模型 - linux dev - 逍遥游.htm
字号:
height=199 alt=""
src="[转载]Framebuffer驱动程序模型 - linux Dev - 逍遥游.files/1_29132846.jpg"
width=578 border=0></A><BR><BR><BR>
<TABLE style="BORDER-COLLAPSE: collapse"
borderColor=#999999 cellSpacing=0 cellPadding=0
width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)"><SPAN
style="COLOR: rgb(255,153,0)">/*颜色映射表*/</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">{</SPAN><BR> __u32
start<SPAN style="COLOR: rgb(0,0,204)">;</SPAN>
<SPAN style="COLOR: rgb(255,153,0)">/* First
entry
*/</SPAN><BR> __u32
len<SPAN style="COLOR: rgb(0,0,204)">;</SPAN>
<SPAN style="COLOR: rgb(255,153,0)">/* Number of
entries
*/</SPAN><BR> __u16
<SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>red<SPAN
style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN
style="COLOR: rgb(255,153,0)">/* 红色
*/</SPAN><BR> __u16
<SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>green<SPAN
style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN
style="COLOR: rgb(255,153,0)">/*绿色*/</SPAN><BR> __u16
<SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>blue<SPAN
style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN
style="COLOR: rgb(255,153,0)">/*蓝色*/</SPAN><BR> __u16
<SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>transp<SPAN
style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN
style="COLOR: rgb(255,153,0)">/* 透明度,允许 NULL
*/</SPAN><BR><SPAN
style="COLOR: rgb(0,0,204)">}</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN></SPAN></CODE></P></TD></TR></TBODY></TABLE><BR>该结构在fb.h文件中定义,在struct
fb_ops结构中有两个成员函数与其相关:<BR><BR>
<TABLE
style="WIDTH: 590px; BORDER-COLLAPSE: collapse; HEIGHT: 132px"
borderColor=#999999 cellSpacing=0 cellPadding=0
bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)"><SPAN
style="COLOR: rgb(255,153,0)">/*获取颜色表*/</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> <SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>fb_get_cmap<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>cmap<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> kspc<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> con<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_info <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>info<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN><BR><SPAN
style="COLOR: rgb(255,153,0)">/*设定颜色表*/</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> <SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>fb_set_cmap<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>cmap<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> kspc<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> con<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_info <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>info<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN></SPAN></CODE></P></TD></TR></TBODY></TABLE><BR><BR>在struct
fb_info结构中有变量:<BR> <BR>
<TABLE style="BORDER-COLLAPSE: collapse"
borderColor=#999999 cellSpacing=0 cellPadding=0
width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)"><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap cmap<SPAN
style="COLOR: rgb(0,0,204)">;</SPAN> <SPAN
style="COLOR: rgb(255,153,0)">/* Current cmap
*/</SPAN></SPAN></CODE></P></TD></TR></TBODY></TABLE><BR>在fpgen基础操作下提供:<BR><BR>
<TABLE
style="WIDTH: 562px; BORDER-COLLAPSE: collapse; HEIGHT: 102px"
borderColor=#999999 cellSpacing=0 cellPadding=0
bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)"><SPAN
style="COLOR: rgb(0,0,255)">extern</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
<BR></SPAN></CODE></P>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)">fbgen_get_cmap<SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>cmap<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> kspc<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> con<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_info <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>info<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">extern</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
<BR></SPAN></CODE></P>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)">fbgen_set_cmap<SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>cmap<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> kspc<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> con,
<SPAN style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_info <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>info<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN></SPAN></CODE></P></TD></TR></TBODY></TABLE><BR>在文件/*
drivers/video/fbcmap.c */中提供更多的cmap应用<BR><BR>
<TABLE style="BORDER-COLLAPSE: collapse"
borderColor=#999999 cellSpacing=0 cellPadding=0
width="95%" bgColor=#f1f1f1 border=1>
<TBODY>
<TR>
<TD>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: rgb(0,0,0)"><SPAN
style="COLOR: rgb(0,0,255)">extern</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
fb_alloc_cmap<SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>cmap<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN> len<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
transp<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">extern</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">void</SPAN>
fb_copy_cmap<SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>from<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
fb_cmap <SPAN
style="COLOR: rgb(0,0,204)">*</SPAN>to<SPAN
style="COLOR: rgb(0,0,204)">,</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
fsfromto<SPAN
style="COLOR: rgb(0,0,204)">)</SPAN><SPAN
style="COLOR: rgb(0,0,204)">;</SPAN><BR><SPAN
style="COLOR: rgb(0,0,255)">extern</SPAN> <SPAN
style="COLOR: rgb(0,0,255)">int</SPAN>
fb_get_cmap<SPAN
style="COLOR: rgb(0,0,204)">(</SPAN><SPAN
style="COLOR: rgb(0,0,255)">struct</SPAN>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -