?? linux resource, platform_device和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - csdnblog.htm
字號(hào):
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>最近評(píng)論</H3>
<UL class=list>
<LI class=listitem>shaw_xiao2006:<A title=點(diǎn)擊查看《回復(fù):PCLint》
href="http://blog.csdn.net/wawuta/archive/2007/01/24/1491826.aspx#545702">感覺(jué)說(shuō)得不是很清晰哈</A>
<LI class=listitem>neowang:<A title=點(diǎn)擊查看《回復(fù):u-boot移植點(diǎn)滴記錄》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#538057">另外,博主可否透露一下你的開發(fā)板的硬件配置,比如SDRAM,NOR
Flash和NAND Flash的大小和型號(hào),還有地址分配?在不知道這些的情況下,我基本看不懂你對(duì)lowlevel_init.S文件的修改;-(</A>
<LI class=listitem>neowang:<A title=點(diǎn)擊查看《回復(fù):u-boot移植點(diǎn)滴記錄》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537880">非常感謝你的指點(diǎn),我在U-Boot的郵件列表里面也搜到了相關(guān)的解釋,原來(lái)-mabi選項(xiàng)是從GCC
4才開始出現(xiàn)的。</A>
<LI class=listitem>wawuta:<A title=點(diǎn)擊查看《回復(fù):u-boot移植點(diǎn)滴記錄》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537112">neowang,<BR>我剛剛貼了一篇關(guān)于APCS的文章你可以看看。
:)</A>
<LI class=listitem>wawuta:<A title=點(diǎn)擊查看《回復(fù):u-boot移植點(diǎn)滴記錄》
href="http://blog.csdn.net/wawuta/archive/2007/01/23/1491520.aspx#537105">錯(cuò)誤:Invalid
option `abi=apcs-gnu'<BR>指示編譯器不支持選項(xiàng)
-mabi=apcs-gnu<BR><BR>函數(shù)cc-option用于檢查編譯器是否支持給定的選項(xiàng)<BR>在PLATform_CPPFLAGS
+=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)中<BR>apcs:指的是 ARM
過(guò)程調(diào)用標(biāo)準(zhǔn)……</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中有什么區(qū)別么?</A> | <A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529307.aspx">下一篇: 我對(duì)專利的看法</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和驅(qū)動(dòng)的關(guān)系 - 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和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - CSDNBlog_files/zhuan.gif"
width=15 border=0> linux resource, platform_device和驅(qū)動(dòng)的關(guān)系</A>
<SCRIPT
src="linux resource, platform_device和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - CSDNBlog_files/count.htm"></SCRIPT>
</DIV>
<DIV class=postText>
<P><FONT
color=#333333>首先你需要為SOC的各個(gè)功能部分定義他的一些資源.例如可用于訪問(wèn)的寄存器地址.中斷號(hào),DMA什么的。然后將這些資源(resource)
作為 platform 的dev
.通過(guò)platform_add_devices函數(shù)將你定義的paltform_device變量注冊(cè)到系統(tǒng)的dev里面.?;蛘吣憧梢韵笪疫@樣將你需要的驅(qū)動(dòng)添加:<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>這樣你的硬件的信息和資源就會(huì)注冊(cè)到系統(tǒng)中.</FONT></P>
<P><FONT
color=#333333>說(shuō)了半天,這回該說(shuō)這有什么用了。<BR>你編寫的驅(qū)動(dòng)或者移植別人的驅(qū)動(dòng),一般在驅(qū)動(dòng)里有這樣的代碼,例如:<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",這條關(guān)鍵的語(yǔ)句沒(méi)有??,它和我在上面注冊(cè)的&s3c_device_sdi,里的device的名稱是一致的.我這里展開我的s3c_device_sdi,的內(nèi)容<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>在驅(qū)動(dòng)程序里的init代碼大致如下:<BR>static int __init
s3c2410sdi_init(void)<BR>{<BR>return
platform_driver_register(&s3c2410sdi_driver);<BR>}<BR>用platform_driver_register
向系統(tǒng)注冊(cè)這個(gè)驅(qū)動(dòng)程序.而這個(gè)函數(shù)會(huì)在s3c2410sdi_driver的信息里提取name為搜索內(nèi)容,搜索系統(tǒng)注冊(cè)的device中有沒(méi)有這個(gè)
platform_device。 如果有注冊(cè),那么接著會(huì)執(zhí)行platform_driver 里probe函數(shù).在這里顯然是s3c2410sdi_probe函數(shù)
在probe函數(shù)里,用的最多和剛才platform_device有關(guān)的語(yǔ)句是platform_get_resource,這條語(yǔ)句用于獲取
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=功能強(qiáng)大的網(wǎng)絡(luò)收藏夾,一秒鐘操作就可以輕松實(shí)現(xiàn)保存帶來(lái)的價(jià)值、分享帶來(lái)的快樂(lè)
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();">收藏到我的網(wǎng)摘</A>]
[<A
href="http://tb.blog.csdn.net/TrackBack.aspx?PostId=1529621">發(fā)送Trackback]</A> fd發(fā)表于
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和驅(qū)動(dòng)的關(guān)系"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>相關(guān)文章:</DIV>
<UL class=postText>
<LI><A href="http://blog.csdn.net/songtitan/archive/2005/01/01/236954.aspx"
target=_blank>CE下的驅(qū)動(dòng)程序和服務(wù)開發(fā)筆記,體驗(yàn)及總結(jié)</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網(wǎng)絡(luò)設(shè)備驅(qū)動(dòng)程序設(shè)計(jì)----劉文濤 </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驅(qū)動(dòng)自己的總結(jié)(PCI相關(guān))</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驅(qū)動(dòng)</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 (驅(qū)動(dòng)結(jié)構(gòu))--翻譯</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>更多內(nèi)容...</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中有什么區(qū)別么?</A> | <A
href="http://blog.csdn.net/wawuta/archive/2007/03/14/1529307.aspx">下一篇: 我對(duì)專利的看法</A></DIV></SPAN><SPAN
id=Anthem_Comments.ascx_ltlComments__><SPAN id=Comments.ascx_ltlComments><BR>
<DIV id=comments>
<H3>評(píng)論</H3>沒(méi)有評(píng)論。 </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和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - CSDNBlog_files/showads.js"
type=text/javascript></SCRIPT>
<SCRIPT language=javascript
src="linux resource, platform_device和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - CSDNBlog_files/showgm.js"
type=text/javascript></SCRIPT>
</DIV>
<DIV class=CommentForm id=commentform>
<H3>發(fā)表評(píng)論 </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>請(qǐng)輸入尊姓大名"
controltovalidate="PostComment.ascx_tbName"><BR>請(qǐng)輸入尊姓大名</SPAN> </TD></TR>
<TR>
<TD width=70>網(wǎng)址:</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>校驗(yàn)碼:</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">檢驗(yàn)碼無(wú)效!</SPAN> <SPAN
id=Anthem_PostComment.ascx_imgAntiBotImage__><IMG
id=PostComment.ascx_imgAntiBotImage alt=""
src="linux resource, platform_device和驅(qū)動(dòng)的關(guān)系 - 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>評(píng)論 <SPAN id=PostComment.ascx_RequiredFieldValidator3
style="DISPLAY: none; COLOR: red" initialvalue=""
evaluationfunction="RequiredFieldValidatorEvaluateIsValid"
display="Dynamic" errormessage="<br>請(qǐng)輸入評(píng)論"
controltovalidate="PostComment.ascx_tbComment"><BR>請(qǐng)輸入評(píng)論</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和驅(qū)動(dòng)的關(guān)系 - 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和驅(qū)動(dòng)的關(guān)系 - fd的專欄 - CSDNBlog_files/PoweredByAsp.Net.gif"
border=0></A> <BR>Copyright ? fd </P>
<SCRIPT
src="linux resource, platform_device和驅(qū)動(dòng)的關(guān)系 - 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>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -