計算機(jī)usb論文.doc
計算機(jī)usb論文,摘 要usb(universal serial bus,通用串行總線)是外圍設(shè)備與計算機(jī)進(jìn)行連接的新型接口總線。自從問世以來,憑借其高速度和高通用性迅速成為個人計算機(jī)與外未設(shè)備相連的標(biāo)準(zhǔn)接口,現(xiàn)在市場上售出的所有pc機(jī)都百分之百的支持usb接口,而且很多外設(shè)只推出usb版本??梢灶A(yù)見,usb的應(yīng)用回越來越廣泛,其傳輸速...


內(nèi)容介紹
此文檔由會員 dxh2012 發(fā)布摘 要
USB(Universal Serial Bus,通用串行總線)是外圍設(shè)備與計算機(jī)進(jìn)行連接的新型接口總線。自從問世以來,憑借其高速度和高通用性迅速成為個人計算機(jī)與外未設(shè)備相連的標(biāo)準(zhǔn)接口,現(xiàn)在市場上售出的所有PC機(jī)都百分之百的支持USB接口,而且很多外設(shè)只推出USB版本??梢灶A(yù)見,USB的應(yīng)用回越來越廣泛,其傳輸速率和通用性也會越來越高。
固件程序的設(shè)計是USB設(shè)備開發(fā)過程中非常重要的一個環(huán)節(jié),它直接影響到USB設(shè)備的傳輸速度。本文在深入分析USB2.0協(xié)議、海量存儲類規(guī)范和SCSI指令集的基礎(chǔ)上,提出了一種專門針對U盤應(yīng)用的固件設(shè)計方法,重點(diǎn)論述了固件實(shí)現(xiàn)過程中的幾個關(guān)鍵技術(shù),證明USB2.0接口控制芯片的固件設(shè)計達(dá)到了預(yù)期目標(biāo)。
由于USB2.0協(xié)議的主/從式模式,固件的整個流程基于中斷模式實(shí)現(xiàn)。固件程序主要包括三部分:1)初始化單片機(jī)和所有外圍電路;2)中斷服務(wù)程序,完成各個模塊產(chǎn)生的中斷響應(yīng);3)任務(wù)處理子模塊,供中斷服務(wù)程序調(diào)用,完成具體的USB設(shè)備操作。在實(shí)現(xiàn)的過程中,主處理程序完成系統(tǒng)的初始化并輪詢中斷,固件負(fù)責(zé)協(xié)議的解析和處理,不干預(yù)數(shù)據(jù)的傳輸,這樣,保證了快速的數(shù)據(jù)傳輸和較好的軟件結(jié)構(gòu)。
通過對調(diào)試過程和性能測試結(jié)果,我們可以看出,固件能夠控制硬件電路快速的完成各種操作,達(dá)到了預(yù)期的設(shè)計目標(biāo)。
關(guān)鍵詞:通用串行總線;固件;閃存;塊傳
ABSTRACT
Universal Serial Bus(USB)is a new type of serial bus which connects peripherals to computer.Since its advent,USB has rapidly become a standard interface between personal computer(PCs)and peripherals for its high transfer speed and applicability.All PCs on market today support USB interface with no exception,while many peripherals are found with only USB interfaces.It is predictable that USb will be more and more popular with its transfer speed and applicability being increasesd.
Firmware is very important in a USB device project, which affects the transfer speed of USB directly.This dissertation puts forward a new solution on the firmware's design of flash memory disk based on studying USB2.0 protocol, mass storage class and Small Computer System Interface (SCSI) command sets thoroughly. This dissertation describes the key technologies during the realization of firmware being designed.which testifies that the firmware of USB2.0 Interface Controller ASIC achieves the desired sights.
In accordance with the Master-Slave architecture in USB 2.0 protocol, the workflow of the firmware is implemented based on interrupt pattern. The firmware program includes three sections: initialization microcontroller and all the peripheral circuits; interrupt service routine, which triggers interrupts and executes the interrupt;task module, which is called by the ISR.During the procedure of realization, main programme implements the initialization of system and waits for the occurrence of interrupt, the ISR calls the task module to execute the operation. The firmware analyzes the protocols and does not disturb the transfer of data. Thus, this procedure can not only guarantee the high transfer speed and good software structure but also simplify the design and test.
In accordance with the Master-Slave architecture in USB 2.0 protocol, the workflow of the firmware is implemented based on interrupt pattern. The firmware program includes three sections: initialization microcontroller and all the peripheral circuits; interrupt service routine, which triggers interrupts and executes the interrupt;task module, which is called by the ISR.During the procedure of realization, main programme implements the initialization of system and waits for the occurrence of interrupt.The firmware analyzes the protocols and does not disturb the transfer of data. Thus, this procedure can not only guarantee the high transfer speed and good software structure.
Key words:Universal Serial Bus;firmware;flash memory;Bulk-Only transport protocol
目 錄
1 緒論 1
1.1 USB技術(shù)發(fā)展現(xiàn)狀與研究意義 1
1.2 工作目標(biāo) 1
2 協(xié)議分析 2
2.1 USB2.0協(xié)議分析 2
2.1.1 USB的系統(tǒng)結(jié)構(gòu) 2
2.1.2 USB數(shù)據(jù)基本類型 4
2.1.3 USB數(shù)據(jù)傳輸 8
2.1.4 USB設(shè)備 8
2.2海量存儲類規(guī)范介紹 10
2.2.1 Bulk-Only傳輸流程 10
2.2.2 Bulk-Only的幾種傳輸情形 13
2.3 SCSI命令簡介 14
3 內(nèi)置USB2.0控制器的單片機(jī)AT89C5131 17
3.1 AT89C5131特點(diǎn)概述 17
3.2 USB控制器的結(jié)構(gòu)與配置 17
4 USB2.0接口控制芯片固件的設(shè)計與實(shí)現(xiàn) 19
4.1固件設(shè)計方案及工作流程 19
4.1.1固件的設(shè)計思想 19
4.1.2固件的工作流程 19
4.1.3固件的總體劃分 21
4.1.4 USB2.0接口控制芯片固件的實(shí)現(xiàn) 22
4.2 固件主處理層的實(shí)現(xiàn)過程 22
4.2.1系統(tǒng)上電及初始化處理 22
4.2.2 USB標(biāo)準(zhǔn)請求實(shí)現(xiàn)過程 23
5.2.3 描述符表 26
4.3 BULK-ONLY傳輸處理層實(shí)現(xiàn)過程 27
4.4 SCSI指令處理層實(shí)現(xiàn)過程 28
4.4.1 Read(10)命令處理過程 28
5.4.2 Write(10)命令處理過程 29
4.4.3 其他命令的處理 30
4.4.3 其他命令的處理 30
4.5閃存處理層的實(shí)現(xiàn)過程 30
4.5.1 FLASH的擦除操作 31
4.5.2 FLASH的寫入操作 31
4.5.3 FLASH的讀取操作 32
5 U盤系統(tǒng)的虛擬測試 34
5.1 PROTEUS ISIS簡介 34
5.2 KEIL UVISION3簡介 34
5.3 系統(tǒng)虛擬測試步驟 35
5.3.1 生成機(jī)器碼 35
5.3.2 虛擬電路圖的繪制 35
5.3.3 導(dǎo)入程序模擬運(yùn)行 36
6 U盤系統(tǒng)實(shí)物測試 39
結(jié)束語 41
致謝 42
參考文獻(xiàn) 43