基于飞思卡尔MCU的USB设备协议栈的研究与实现
发布时间:2019-06-21 11:04
【摘要】:随着USB协议规范的不断完善和USB接口的众多优点,现在越来越多的数码设备都采用USB接口与主机进行数据传输,如只需传输小数据量的鼠标、游戏柄设备,需要传输大数据量的U盘、数码照相机、数码摄像机等设备,USB接口的“触角”几乎已经伸向每一种计算机的外设。在当前的USB应用中,主机大多还是由PC担任,而PC端的USB驱动已经非常成熟,很多PC端的操作系统中就包含了绝大多数的USB设备类的驱动程序。但是形形色色的USB设备端的驱动和协议栈却非常缺乏。本文正是出于这样的考虑,基于FreeScale S08系列MCU设计了一个通用的USB设备协议栈,这样可以大大减少USB设备开发人员的工作的量,有效的缩短开发周期,降低开发风险,保证开发质量。 本文首先介绍了USB接口的应用现状,并对其数据传输原理做了较为详细的阐述,包括USB系统的拓扑结构、主/从机传输的数据流结构、USB传输中用到的数据模型和数据结构以及USB2.0规范中的三种常用的传输方式等内容。 其后是本文的重点,在介绍了本协议栈设计的基本框架结构和思路之后,开始阐述各层各部分功能是如何用C语言实现的,各层之间是如何传递数据的,各层之间是如何通过回调函数相互传递消息的,建立了哪些数据结构,设置了哪些全局变量,以及如何本协议栈的用户应该如何使用本协议栈。 最后,在Freescale HCS08JS16平台上分析了如何管理USB设备控制器的内存,并通过跟踪设备驱动中最重要的枚举过程对本协议栈进行了验证,分析了设备各种描述符的返回过程。同时对协议栈中存在的问题及需要改进的技术做了论述,并展望了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 宋鹏;嵌入式系统中USB接口技术应用研究与开发[D];扬州大学;2005年
2 卞廷波;USB Mass Storage类设备固件的设计与实现[D];电子科技大学;2006年
3 曹国飞;嵌入式USB主机接口的设计[D];哈尔滨理工大学;2006年
,本文编号:2504029
本文链接:https://www.wllwen.com/kejilunwen/jisuanjikexuelunwen/2504029.html