📄 linux resource, platform_device和驱动的关系 - fd的专栏 - csdnblog.htm
字号:
target=_self>断水刀</A></LI></UL>
<H3 class=listtitle>存档</H3>
<UL class=list>
<LI><A
href="http://blog.csdn.net/wawuta/archive/2007/03.aspx">2007年03月(10)</A>
<LI><A
href="http://blog.csdn.net/wawuta/archive/2007/02.aspx">2007年02月(10)</A>
<LI><A
href="http://blog.csdn.net/wawuta/archive/2007/01.aspx">2007年01月(20)</A></LI></UL><SPAN
id=Anthem_RecentComments_ltlComments__><SPAN id=RecentComments_ltlComments>
<H3 class=listtitle>最近评论</H3>
<UL class=list>
<LI class=listitem>shaw_xiao2006:<A title=点击查看《回复:PCLint》
href="http://blog.csdn.net/wawuta/archive/2007/01/24/1491826.aspx#545702">感觉说得不是很清晰哈</A>
<LI class=listitem>neowang:<A title=点击查看《回复:u-boot移植点滴记录》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#538057">另外,博主可否透露一下你的开发板的硬件配置,比如SDRAM,NOR
Flash和NAND Flash的大小和型号,还有地址分配?在不知道这些的情况下,我基本看不懂你对lowlevel_init.S文件的修改;-(</A>
<LI class=listitem>neowang:<A title=点击查看《回复:u-boot移植点滴记录》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537880">非常感谢你的指点,我在U-Boot的邮件列表里面也搜到了相关的解释,原来-mabi选项是从GCC
4才开始出现的。</A>
<LI class=listitem>wawuta:<A title=点击查看《回复:u-boot移植点滴记录》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537112">neowang,<BR>我刚刚贴了一篇关于APCS的文章你可以看看。
:)</A>
<LI class=listitem>wawuta:<A title=点击查看《回复:u-boot移植点滴记录》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537105">错误:Invalid
option `abi=apcs-gnu'<BR>指示编译器不支持选项
-mabi=apcs-gnu<BR><BR>函数cc-option用于检查编译器是否支持给定的选项<BR>在PLATform_CPPFLAGS
+=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)中<BR>apcs:指的是 ARM
过程调用标准……</A></LI></UL></SPAN></SPAN><BR><BR></DIV>
<DIV id=main><SPAN class=PreAndNext id=viewpost.ascx_PreviousAndNextEntriesUp>
<DIV align=center><A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529629.aspx">上一篇: smdk2410_iodesc中定义的io资源和smdk2410_devices中有什么区别么?</A> | <A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529307.aspx">下一篇: 我对专利的看法</A></DIV></SPAN><BR>
<SCRIPT>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</SCRIPT>
<DIV class=post>
<DIV class=postTitle>
<SCRIPT
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/vote.js"></SCRIPT>
<A href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529621.aspx"><IMG
height=13
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/zhuan.gif"
width=15 border=0> linux resource, platform_device和驱动的关系</A>
<SCRIPT
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/count.htm"></SCRIPT>
</DIV>
<DIV class=postText>
<P><FONT
color=#333333>首先你需要为SOC的各个功能部分定义他的一些资源.例如可用于访问的寄存器地址.中断号,DMA什么的。然后将这些资源(resource)
作为 platform 的dev
.通过platform_add_devices函数将你定义的paltform_device变量注册到系统的dev里面.。或者你可以象我这样将你需要的驱动添加:<BR>static
struct platform_device *smdk2410_devices[] __initdata =
{<BR>&s3c_device_usb,<BR>&s3c_device_lcd,<BR>&s3c_device_bl,<BR>&s3c_device_wdt,<BR>&s3c_device_i2c,<BR>&s3c_device_iis,<BR>&s3c_device_sdi,<BR>&s3c_device_adc,
<BR>&s3c_device_nand,<BR>&s3c_device_usbgadget,<BR>&s3c_device_ts,<BR>&s3c_device_buttons,<BR>&s3c_device_rtc,<BR>&s3c_device_spi0,<BR>&s3c_device_timer1,//add
by cefanty for battery charging<BR>};<BR>这样你的硬件的信息和资源就会注册到系统中.</FONT></P>
<P><FONT
color=#333333>说了半天,这回该说这有什么用了。<BR>你编写的驱动或者移植别人的驱动,一般在驱动里有这样的代码,例如:<BR>static
struct platform_driver s3c2410sdi_driver =<BR>{<BR>.probe
= s3c2410sdi_probe,<BR>.remove =
s3c2410sdi_remove,<BR>.suspend= s3c2410mci_suspend,<BR>.resume=
s3c2410mci_resume,<BR>.driver={<BR>.name= "s3c2410-sdi",<BR>.bus =
&platform_bus_type,<BR>.owner= THIS_MODULE,<BR>},<BR>};</FONT></P>
<P><FONT color=#333333>看到 .name=
"s3c2410-sdi",这条关键的语句没有??,它和我在上面注册的&s3c_device_sdi,里的device的名称是一致的.我这里展开我的s3c_device_sdi,的内容<BR>:<BR>/*
SDI */</FONT></P>
<P><FONT color=#333333>static struct resource s3c_sdi_resource[] = {<BR>[0] =
{<BR>.start = S3C2410_PA_SDI,<BR>.end = S3C2410_PA_SDI + S3C24XX_SZ_SDI -
1,<BR>.flags = IORESOURCE_MEM,<BR>},<BR>[1] = {<BR>.start = IRQ_SDI,<BR>.end
= IRQ_SDI,<BR>.flags = IORESOURCE_IRQ,<BR>},<BR>[2] = {<BR>.start =
3,<BR>.end = 3,<BR>.flags = IORESOURCE_DMA,<BR>}<BR>};</FONT></P>
<P><FONT color=#333333>struct platform_device s3c_device_sdi = {<BR>.name
= "s3c2410-sdi",<BR>.id = -1,<BR>.num_resources =
ARRAY_SIZE(s3c_sdi_resource),<BR>.resource =
s3c_sdi_resource,<BR>};</FONT></P>
<P><FONT color=#333333>在驱动程序里的init代码大致如下:<BR>static int __init
s3c2410sdi_init(void)<BR>{<BR>return
platform_driver_register(&s3c2410sdi_driver);<BR>}<BR>用platform_driver_register
向系统注册这个驱动程序.而这个函数会在s3c2410sdi_driver的信息里提取name为搜索内容,搜索系统注册的device中有没有这个
platform_device。 如果有注册,那么接着会执行platform_driver 里probe函数.在这里显然是s3c2410sdi_probe函数
在probe函数里,用的最多和刚才platform_device有关的语句是platform_get_resource,这条语句用于获取
platform_device里的resource资料.例如映射的IO地址,中断等.剩下等得就是ioremap,和
request_irq等的事情了</FONT></P> <BR><BR>
<P id=TBPingURL>Trackback:
http://tb.blog.csdn.net/TrackBack.aspx?PostId=1529621</P><BR></DIV>
<DIV class=postFoot>
<SCRIPT src=""></SCRIPT>
[<A title=功能强大的网络收藏夹,一秒钟操作就可以轻松实现保存带来的价值、分享带来的快乐
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(saveit=window.open('http://wz.csdn.net/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=590,height=300,left=75,top=20,status=no,resizable=yes'));saveit.focus();">收藏到我的网摘</A>]
[<A
href="http://tb.blog.csdn.net/TrackBack.aspx?PostId=1529621">发送Trackback]</A> fd发表于
2007年03月14日 22:23:00 </DIV></DIV><LINK
href="http://blog.csdn.net/wawuta/Services/Pingback.aspx" rel=pingback><!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/elements/1.1/"xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"><rdf:Descriptionrdf:about="http://blog.csdn.net/wawuta/archive/2007/03/14/1529621.aspx"dc:identifier="http://blog.csdn.net/wawuta/archive/2007/03/14/1529621.aspx"dc:title="linux resource, platform_device和驱动的关系"trackback:ping="http://tb.blog.csdn.net/TrackBack.aspx?PostId=1529621" /></rdf:RDF>-->
<SCRIPT>function hide(){showComment();}</SCRIPT>
<BR>
<DIV class=post>
<DIV class=postTitle>相关文章:</DIV>
<UL class=postText>
<LI><A href="http://blog.csdn.net/songtitan/archive/2005/01/01/236954.aspx"
target=_blank>CE下的驱动程序和服务开发笔记,体验及总结</A> 2005-01-01 <A
href="http://blog.csdn.net/songtitan/" target=_blank>songtitan</A>
<LI><A href="http://blog.csdn.net/ttfwind/archive/2005/07/24/433290.aspx"
target=_blank>Linux网络设备驱动程序设计----刘文涛 </A>2005-07-24 <A
href="http://blog.csdn.net/ttfwind/" target=_blank>ttfwind</A>
<LI><A href="http://blog.csdn.net/ryman/archive/2005/05/25/380365.aspx"
target=_blank>读RTL8139驱动自己的总结(PCI相关)</A> 2005-05-25 <A
href="http://blog.csdn.net/ryman/" target=_blank>ryman</A>
<LI><A href="http://blog.csdn.net/houen_study/archive/2006/07/03/870520.aspx"
target=_blank>从usb storage开始深入linux2.6驱动</A> 2006-07-03 <A
href="http://blog.csdn.net/houen_study/" target=_blank>houen_study</A>
<LI><A href="http://blog.csdn.net/freasy/archive/2005/01/12/249928.aspx"
target=_blank>Driver Code Structure (驱动结构)--翻译</A> 2005-01-12 <A
href="http://blog.csdn.net/freasy/" target=_blank>freasy</A>
<DIV align=right><A
href="http://blog.csdn.net/wawuta/relatedarticles/1529621.aspx"
target=_blank>更多内容...</A></DIV></LI></UL></DIV><BR><BR><BR>
<DIV class=post id=csdn_zhaig_ad_yahoo></DIV>
<SCRIPT type=text/javascript>document.write("<img src=http://counter.csdn.net/pv.aspx?id=24 border=0 width=0 height=0>");</SCRIPT>
<SPAN class=PreAndNext id=viewpost.ascx_PreviousAndNextEntriesDown>
<DIV align=center><A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529629.aspx">上一篇: smdk2410_iodesc中定义的io资源和smdk2410_devices中有什么区别么?</A> | <A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529307.aspx">下一篇: 我对专利的看法</A></DIV></SPAN><SPAN
id=Anthem_Comments.ascx_ltlComments__><SPAN id=Comments.ascx_ltlComments><BR>
<DIV id=comments>
<H3>评论</H3>没有评论。 </DIV></SPAN></SPAN>
<SCRIPT language=javascript>
ad_width=468;
ad_height=60;
adcss=2;
unionuser=19;
ad_type='j';
count=5;
</SCRIPT>
<DIV>
<SCRIPT language=javascript
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/showads.js"
type=text/javascript></SCRIPT>
<SCRIPT language=javascript
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/showgm.js"
type=text/javascript></SCRIPT>
</DIV>
<DIV class=CommentForm id=commentform>
<H3>发表评论 </H3>
<DIV id=Anthem_PostComment.ascx_CommentUpdatePanel__>
<DIV id=PostComment.ascx_CommentUpdatePanel>
<TABLE class=CommentForm>
<TBODY>
<TR>
<TD width=69 height=0></TD>
<TD></TD></TR>
<TR>
<TD width=70>大名:</TD>
<TD align=left><INPUT id=PostComment.ascx_tbName style="WIDTH: 300px"
disabled maxLength=32 size=40 value=xp4105 name=PostComment.ascx:tbName>
<SPAN id=PostComment.ascx_RequiredFieldValidator2
style="DISPLAY: none; COLOR: red" initialvalue=""
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
display="Dynamic" errormessage="<br>请输入尊姓大名"
controltovalidate="PostComment.ascx_tbName"><BR>请输入尊姓大名</SPAN> </TD></TR>
<TR>
<TD width=70>网址:</TD>
<TD align=left><INPUT id=PostComment.ascx_tbUrl style="WIDTH: 300px"
maxLength=256 size=40 name=PostComment.ascx:tbUrl> </TD></TR>
<DIV id=PostComment.ascx_AntiBotImageRegion></DIV>
<TR>
<TD width=70>校验码:</TD>
<TD align=left><INPUT id=PostComment.ascx_tbAntiBotImage
style="WIDTH: 75px" name=PostComment.ascx:tbAntiBotImage> <SPAN
id=PostComment.ascx_valAntiBotImage style="DISPLAY: none; COLOR: red"
evaluationfunction="CustomValidatorEvaluateIsValid"
display="Dynamic">检验码无效!</SPAN> <SPAN
id=Anthem_PostComment.ascx_imgAntiBotImage__><IMG
id=PostComment.ascx_imgAntiBotImage alt=""
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/AntiBotImage.jpg"
align=absMiddle border=0></SPAN> <SPAN
id=Anthem_PostComment.ascx_lbCreateAntiBotImage__><A
id=PostComment.ascx_lbCreateAntiBotImage
onclick="javascript:Anthem_FireCallBackEvent(this,event,'PostComment.ascx:lbCreateAntiBotImage','',false,'','','',true,null,null,null,true,true);return false;"
href="javascript:__doPostBack('PostComment.ascx$lbCreateAntiBotImage','')">看不清,换一张</A></SPAN>
</TD></TR>
<DIV></DIV>
<TR>
<TD colSpan=3>评论 <SPAN id=PostComment.ascx_RequiredFieldValidator3
style="DISPLAY: none; COLOR: red" initialvalue=""
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
display="Dynamic" errormessage="<br>请输入评论"
controltovalidate="PostComment.ascx_tbComment"><BR>请输入评论</SPAN> <BR><TEXTAREA id=PostComment.ascx_tbComment style="WIDTH: 381px; HEIGHT: 193px" name=PostComment.ascx:tbComment rows=10 cols=50></TEXTAREA>
</TD></TR>
<TR>
<TD colSpan=3><SPAN id=Anthem_PostComment.ascx_btnSubmit__><INPUT language=javascript class=Button id=PostComment.ascx_btnSubmit onclick="javascript:Anthem_FireCallBackEvent(this,event,'PostComment.ascx:btnSubmit','',true,'','','正在处理...',false,null,null,null,true,true);return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("PostComment.ascx:btnSubmit", "", true, "", "", false, false))" type=submit value=提交 name=PostComment.ascx:btnSubmit></SPAN>
</TD></TR>
<TR>
<TD colSpan=3><SPAN id=PostComment.ascx_Message
style="COLOR: red"></SPAN></TD></TR></TBODY></TABLE></DIV></DIV></DIV></DIV>
<P id=footer>Powered by: <BR><A id=Footer1_Hyperlink2
href="http://scottwater.com/blog" name=Hyperlink1><IMG
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/100x30_Logo.gif"
border=0></A> <A id=Footer1_Hyperlink3 href="http://asp.net/"
name=Hyperlink1><IMG
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/PoweredByAsp.Net.gif"
border=0></A> <BR>Copyright © fd </P>
<SCRIPT
src="linux resource, platform_device和驱动的关系 - fd的专栏 - CSDNBlog_files/counter.js"></SCRIPT>
<SCRIPT type=text/javascript>
<!--
var Page_Validators = new Array(document.getElementById("PostComment.ascx_RequiredFieldValidator2"), document.getElementById("PostComment.ascx_valAntiBotImage"), document.getElementById("PostComment.ascx_RequiredFieldValidator3"));
// -->
</SCRIPT>
<SCRIPT type=text/javascript>
<!--
var Page_ValidationActive = false;
if (typeof(ValidatorOnLoad) == "function") {
ValidatorOnLoad();
}
function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
else {
return true;
}
}
// -->
</SCRIPT>
</FORM></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -