資源描述:
《Linux字符設(shè)備驅(qū)動(dòng)-畢業(yè)論文.doc》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫。
1、本科畢業(yè)論文(科研訓(xùn)練、畢業(yè)設(shè)計(jì))題目:Linux字符設(shè)備驅(qū)動(dòng)姓名:學(xué)院:軟件學(xué)院系:專業(yè):軟件工程年級(jí):學(xué)號(hào):指導(dǎo)教師(校內(nèi)):職稱:指導(dǎo)教師(校外):職稱:年月摘要驅(qū)動(dòng)程序在Linux內(nèi)核里扮演著特殊的角色,它們完全隱藏了設(shè)備工作的細(xì)節(jié)。用戶通過一套標(biāo)準(zhǔn)化的調(diào)用來操作設(shè)備,這些調(diào)用是與特定的驅(qū)動(dòng)相互獨(dú)立的;設(shè)備驅(qū)動(dòng)的任務(wù)就是將這些調(diào)用映射到作用于實(shí)際硬件的相關(guān)設(shè)備操作上。這個(gè)編程接口使得驅(qū)動(dòng)可以與內(nèi)核的其他部分分開建立,并在需要的時(shí)候“插入”。這種模塊化的方法使得Linux驅(qū)動(dòng)易寫,易于修改。本文通過在嵌入式Linux上實(shí)現(xiàn)一個(gè)模塊化的RTC
2、設(shè)備驅(qū)動(dòng)實(shí)例,分析了Linux內(nèi)核中字符設(shè)備驅(qū)動(dòng)的運(yùn)行機(jī)制,并著重介紹了Linux字符設(shè)備驅(qū)動(dòng)的關(guān)鍵過程,包括基本字符設(shè)備驅(qū)動(dòng),I2C總線驅(qū)動(dòng),設(shè)備底層操作等。同時(shí)也展示了通過交叉編譯來開發(fā)和調(diào)試的全過程。關(guān)鍵詞:字符設(shè)備;設(shè)備驅(qū)動(dòng);I2C;實(shí)時(shí)時(shí)鐘;交叉編譯。AbstractDevicedriverstakeonaspecialroleintheLinuxkernel;theyhidecompletelythedetailsofhowthedeviceworks.Useractivitiesareperformedbymeansofasetof
3、standardizedcallsthatareindependentofthespecificdriver;mappingthosecallstodevice-specificoperationsthatactonrealhardwareisthentheroleofthedevicedriver.Thisprogramminginterfaceissuchthatdriverscanbebuiltseparatelyfromtherestofthekerneland"pluggedin"atruntimewhenneeded.Thismodu
4、laritymakesLinuxdriverseasytowrite,easytomodify.ThroughaninstanceofrealizingamodularizeddriveroftheRTCdeviceintheembeddedLinux,thispaperanalyzesthefunctionmechanismofthechardevicedriverindetail,andpaymoreattentiononthekeyprocessduringthedevelopmentoftheLinuxchardevicedrivers,
5、includingthebasicchardevicedriver,thei2cbusdriver,thedevicebottomoperationandsoon.ThepaperalsopresentsthewholedebuganddevelopmentprocesswiththecrosscompilemethodKeywords:chardevice;devicedriver;I2C;RTC;crosscompile.目錄第1章引言11.1Linux簡(jiǎn)介11.2設(shè)備驅(qū)動(dòng)11.3Linux驅(qū)動(dòng)21.4選題背景3第2章字符設(shè)備驅(qū)動(dòng)框架42.1
6、注冊(cè)設(shè)備文件42.1.1設(shè)備號(hào)42.1.2注冊(cè)設(shè)備號(hào)42.1.3釋放設(shè)備號(hào)52.1.4創(chuàng)建設(shè)備節(jié)點(diǎn)52.2內(nèi)核設(shè)備注冊(cè)62.3設(shè)備操作索引62.4設(shè)備操作函數(shù)72.4.1Open()72.4.2Release()72.4.3Read()72.4.4Write()82.4.5ioctl()8第3章設(shè)計(jì)與實(shí)現(xiàn)93.1設(shè)計(jì)思路93.1.1設(shè)計(jì)目標(biāo)93.1.2解決方案93.1.3最終方案93.1.4細(xì)節(jié)103.1.5數(shù)據(jù)流圖103.2I2C總線驅(qū)動(dòng)113.2.1I2C背景113.2.2傳輸格式113.2.3標(biāo)志位START&STOP123.2.4響應(yīng)13
7、3.2.5傳輸流圖133.2.6引腳地址143.2.7電平設(shè)置143.2.8引腳初始化153.2.9I2C寫數(shù)據(jù)153.2.10寫入從機(jī)地址163.2.11I2C讀數(shù)據(jù)163.3RTC設(shè)備驅(qū)動(dòng)173.3.1從機(jī)地址173.3.2設(shè)備數(shù)據(jù)地址183.3.3數(shù)據(jù)編碼183.3.4讀寄存器數(shù)據(jù)193.3.5寫寄存器數(shù)據(jù)193.3.6讀取時(shí)間193.3.7設(shè)置時(shí)間20第4章編譯調(diào)試214.1交叉編譯214.2模塊Makefile設(shè)計(jì)214.3測(cè)試設(shè)計(jì)234.3.1test.c設(shè)計(jì)234.3.2Makefile設(shè)計(jì)244.4調(diào)試腳本設(shè)計(jì)254.5調(diào)試流程2
8、74.6測(cè)試結(jié)果28結(jié)論29致謝30參考文獻(xiàn)31ContentsChapter1Introduction11.1Introduction