基于飛思卡爾MCU的USB設備協(xié)議棧的研究與實現(xiàn)
發(fā)布時間:2019-06-21 11:04
【摘要】:隨著USB協(xié)議規(guī)范的不斷完善和USB接口的眾多優(yōu)點,現(xiàn)在越來越多的數(shù)碼設備都采用USB接口與主機進行數(shù)據傳輸,如只需傳輸小數(shù)據量的鼠標、游戲柄設備,需要傳輸大數(shù)據量的U盤、數(shù)碼照相機、數(shù)碼攝像機等設備,USB接口的“觸角”幾乎已經伸向每一種計算機的外設。在當前的USB應用中,主機大多還是由PC擔任,而PC端的USB驅動已經非常成熟,很多PC端的操作系統(tǒng)中就包含了絕大多數(shù)的USB設備類的驅動程序。但是形形色色的USB設備端的驅動和協(xié)議棧卻非常缺乏。本文正是出于這樣的考慮,基于FreeScale S08系列MCU設計了一個通用的USB設備協(xié)議棧,這樣可以大大減少USB設備開發(fā)人員的工作的量,有效的縮短開發(fā)周期,降低開發(fā)風險,保證開發(fā)質量。 本文首先介紹了USB接口的應用現(xiàn)狀,并對其數(shù)據傳輸原理做了較為詳細的闡述,包括USB系統(tǒng)的拓撲結構、主/從機傳輸?shù)臄?shù)據流結構、USB傳輸中用到的數(shù)據模型和數(shù)據結構以及USB2.0規(guī)范中的三種常用的傳輸方式等內容。 其后是本文的重點,在介紹了本協(xié)議棧設計的基本框架結構和思路之后,開始闡述各層各部分功能是如何用C語言實現(xiàn)的,各層之間是如何傳遞數(shù)據的,各層之間是如何通過回調函數(shù)相互傳遞消息的,建立了哪些數(shù)據結構,設置了哪些全局變量,以及如何本協(xié)議棧的用戶應該如何使用本協(xié)議棧。 最后,在Freescale HCS08JS16平臺上分析了如何管理USB設備控制器的內存,并通過跟蹤設備驅動中最重要的枚舉過程對本協(xié)議棧進行了驗證,分析了設備各種描述符的返回過程。同時對協(xié)議棧中存在的問題及需要改進的技術做了論述,并展望了USB接口的應用前景。
[Abstract]:With the continuous improvement of USB protocol specification and the many advantages of USB interface, more and more digital devices use USB interface to transmit data to host computer, such as mouse with small amount of data, handle device, U disk, digital camera, digital camera and other devices that need to transmit large amount of data. The "tentacles" of USB interface have extended to the peripherals of almost every kind of computer. In the current USB applications, most of the hosts are still PC, and the USB driver on the PC side has been very mature. Most of the USB device drivers are included in many PC operating systems. However, all kinds of USB device drivers and protocol stacks are very scarce. In this paper, based on FreeScale S08 series MCU, a general USB device protocol stack is designed, which can greatly reduce the amount of work of USB device developers, effectively shorten the development cycle, reduce the development risk and ensure the development quality. In this paper, the application status of USB interface is introduced, and its data transmission principle is described in detail, including the topology of USB system, the data flow structure of master / slave transmission, the data model and data structure used in USB transmission, and three common transmission modes in USB2.0 specification. After introducing the basic framework structure and train of thought of this protocol stack design, this paper begins to explain how the functions of each layer are realized in C language, how to transfer data between layers, how to transfer messages to each other through callback functions, what data structures are established, which global variables are set up, and how the users of this protocol stack should use this protocol stack. Finally, how to manage the memory of USB device controller is analyzed on Freescale HCS08JS16 platform, and the protocol stack is verified by tracking the most important enumerating process in device driver, and the return process of various descriptive characters of the device is analyzed. At the same time, the problems existing in the protocol stack and the technologies that need to be improved are discussed, and the application prospect of USB interface is prospected.
【學位授予單位】:安徽大學
【學位級別】:碩士
【學位授予年份】:2012
【分類號】:TP334.7
本文編號:2504029
[Abstract]:With the continuous improvement of USB protocol specification and the many advantages of USB interface, more and more digital devices use USB interface to transmit data to host computer, such as mouse with small amount of data, handle device, U disk, digital camera, digital camera and other devices that need to transmit large amount of data. The "tentacles" of USB interface have extended to the peripherals of almost every kind of computer. In the current USB applications, most of the hosts are still PC, and the USB driver on the PC side has been very mature. Most of the USB device drivers are included in many PC operating systems. However, all kinds of USB device drivers and protocol stacks are very scarce. In this paper, based on FreeScale S08 series MCU, a general USB device protocol stack is designed, which can greatly reduce the amount of work of USB device developers, effectively shorten the development cycle, reduce the development risk and ensure the development quality. In this paper, the application status of USB interface is introduced, and its data transmission principle is described in detail, including the topology of USB system, the data flow structure of master / slave transmission, the data model and data structure used in USB transmission, and three common transmission modes in USB2.0 specification. After introducing the basic framework structure and train of thought of this protocol stack design, this paper begins to explain how the functions of each layer are realized in C language, how to transfer data between layers, how to transfer messages to each other through callback functions, what data structures are established, which global variables are set up, and how the users of this protocol stack should use this protocol stack. Finally, how to manage the memory of USB device controller is analyzed on Freescale HCS08JS16 platform, and the protocol stack is verified by tracking the most important enumerating process in device driver, and the return process of various descriptive characters of the device is analyzed. At the same time, the problems existing in the protocol stack and the technologies that need to be improved are discussed, and the application prospect of USB interface is prospected.
【學位授予單位】:安徽大學
【學位級別】:碩士
【學位授予年份】:2012
【分類號】:TP334.7
【參考文獻】
相關期刊論文 前1條
1 晁建剛 ,魏安陽 ,邱淑范;通用串行總線(USB)設備的驅動[J];電子技術應用;2001年05期
相關碩士學位論文 前3條
1 宋鵬;嵌入式系統(tǒng)中USB接口技術應用研究與開發(fā)[D];揚州大學;2005年
2 卞廷波;USB Mass Storage類設備固件的設計與實現(xiàn)[D];電子科技大學;2006年
3 曹國飛;嵌入式USB主機接口的設計[D];哈爾濱理工大學;2006年
,本文編號:2504029
本文鏈接:http://sikaile.net/kejilunwen/jisuanjikexuelunwen/2504029.html
最近更新
教材專著