The Research and Design of Driver for USB to RS-232 Bridge Controller Based on WindowsXP

Author
LiangJianGuo
Advisor
ZhaoHongWei
School
Jilin University
Major
Applied Computer Technology
Classification
TP311.11 Programming method
Degree
Master's thesis
Year
2006
Downloads
390
Citations
1

Request the full text

Abstract

USB(Universal Serial Bus)is a new type bus connecting PC and peripheralequipments.It was put forward by Compaq、DEC、IBM、Intel、NEC、Microsoft andNorthern Telecom in November,1994 in order to shorting the procedure of connectionbetween PCs and peripheral equipments and makes interface of PC easy to beexpanded.So,more and more peripherals which transfer by traditional RS-232 are tryingto change to USB mode. As a new type of bus protocol,USB make it more efficientand convenient to accomplish the connection between PC and peripherals.So manyRS-232 equipments are facing a trend of converting to USB.It’s very necessary todevelop a transition equipment from USB to RS-232.To accomplish data transfer, necessary correlative sotfware is required as well asUSB-RS232 bridge controller.In order to make PC’s OS (operating system) work inconjunction with the converter,the driver based on the OS for the converter must beinstalled. WindowsXP is the most popular OS on the PC at the present time,andintegrates with enormous driver base.Generally when a new hardware is added,OS canchose a compatible driver for it and install the driver automatically.However,the USB toRS-232 bridge controller is a nonstandard USB equipment and there is not compatibledriver for it in WindowsXP’ dirver base.So, it must be developed by the developer.In 2005,Micro-electronics Institute of CAS accepted the task to researching 《USBto RS232 bridge controller Design》form HS Bureau of ZheJiang province.Under thebackground of aiming at the bridge controller,we make our effort to research and designthe driver for the bridge controller based on the WindowsXP.The dirver provides a interface through which the OS can accesses and operateshardware.It helps accomplish communication between OS and the hardware .And it caninform OS the hardware’s functions. when the software system make a requirement itcan operate the hardware to realize the function by most efficient mode. In the schemeof designing USB-RS232 bridge controller, programing in PC’s application software isbased on RS-232 as well as peripheral equipments. However,the physical connectionfrom PC to peripherals is via USB .And the data format is also USB type.In this paper,bridge controller’s circuit module and WDM(Windows Driver Mode) are analysedfirstly.Then some necessary mechanisms are chose and needful strategys aredefined.With the development toos and debug tools such as WindowsXP DDK,VisualC++6.0,DbgView,SoftICE,we developed virtual COM which realizes the function asperfect as a really serial interface.In the thesis,driver’s framework is designed refering to the WDM(Windows DriverModel).WDM is a driver model which is firmly supported by Microsoft.It can be usedon many operating systerms such as Windows 98/Me/2000/XP.In the long future,WDMis also the most popular driver model on Windows. It has a characteristic ofstratification.For the bridge controller is belong to USB equipment,the drivers stack hasthree parts:Bus Driver,Function Driver and Filter Driver.Bus Driver has four parts:PCIDriver,USB Main controller Driver,USB Bus Driver,Hub Function Driver. These Busdrivers are integrated in the WindowsXP and can be loded derictly. The Function Driveris just the project to be done in this thesis.The Filter Driver which is named“serenum.sys” can check out the enumerated haredware which is connected toRS-232.It is integrated in the OS and can be loded derictly as well as the Bus Driver.In this thesis,some needful mechanisms and schemes are designed.In order to makethe driver work more efficient and the memory is used more safely the memorydistribute strategy is designed.In order to solve the synchronization problem,some coresyn-objects are called .Spinlock and Event are put forward especially. The DPC isdesigned in order that the CPU can work more efficient and some interruptprocedure which are not urgent to be run can be put off.In order to obtain the result ofIRPs which has been transmit to next layer, complete routine is designed and callingstrategy is designed too.There are five parts in the chapter of detailed design . The second and the thirdparts are most important.The first is entry routine.It is called by OS firstly among all ofthe routines in the driver.This ruotine includes all of other routines’ entry points .It isvery important although it can be realized easily.The second is PnP routine.It helps theWindowsXP to check out the new device and direct user to choose the compatibledriver.When the device is removed the OS will be informed and do some measure todeal with it.In this procedure ,the user is not involved.The third is dispatch routinewhich is the most important parts in this thesis.It can deal with all of the requires fromapplication software such as I/O control,read,write.And it can provide the interface forthe user to handle the device.The fourth is power routine.Power management mode forWindows is supported in this driver.The fifth is unload routine. The resource whichdistributed in the entry routine is released in this routine.Two schemes are provided to finish test. First, sending requires from user to thedriver through the application program which has been complied and examining theresult. Secondly, realizing communication between the PC and serial device(mobiletelephone) by FPGA which has been load HDL program. It has been testified that thetransmite process is fluency and accomplish the function requirement.Finally,the thesis introduces the driver installation.The INF file and Register arerefered especially for they are helpful to installation.The driver has accomplished the basic funtion.However,it hasn’t past theHCT(Hardware Compatibility Test) from Microsoft.As a rusult,the driver can’t abtainthe logo attestation from Microsoft.Basing the past achievement,much work need to bedone to make the driver work more perfect in the future research.

Table of contents

Chapter 1 Introduction 10-19 1.1 device driver concept 11 1.2 research and development status at home and abroad 11-12 1.3 RS-232 serial Line Interface Overview 12-14 1.4 Universal Serial Bus (USB) Summary 14-18 1.5 In this paper, research background and work content 18-19 Chapter 2 USB to RS-232 bridge hardware design 19-29 2.1 overall system structure 19-22 2.2 USB interface design 22-23 < br /> 2.2.1 USB interface overall structure 22-23 2.2.2 SIE function 23 2.3 UART design 23-25 ?? 2.3.1 UART overall structure of 23-24 2.3.2 UART's, function 24-25 2.4 the BUFFER design 25-26 2.5 the FIFO of design 2.5.1 FIFO 26-29 overall structure 27 2.5.2 FIFOs function 27-29 Chapter 3 bridge the driver model analysis and implementation mechanism 29-51 3.1 WINDOWS-driven model of Introduction 29-33 3.1.1 Windows Driver Model 29-30 3.1.2 WDM driver model Introduction 30-33 3.2 based WDM the bridge driver model framework designed 33-37 3.2.1 bridges or driver stack structure of design 33-34 3.2.2 bridge driver framework design 34-36 the 3.2.3 data stream transmission scheme 36-37 <br / > 3.3 to establish development programs 37-38 3.3.1 select development mode 37-38 3.3.2 development tools 38 3.4 I / O request packet (IRP) 38-41 3.4.1 IRP Overview 38-40 3.4.2 IRP transfer strategy 40-41 <br / > 3.5 USB data processing 41-43 3.5.1 establish a USB request block 41 3.5.2 USB bus driver interface 41-42 <br / > 3.5.3 call USBDI interface functions and 42-43 3.6 memory allocation strategy 43-44 3.6.1 memory allocation principles 43 3.6 .2 bridge driver memory allocation strategy 43-44 3.7 solve the synchronization problem 44-47 3.7.1 spinlock 44-45 <br / > 3.7.2 Event 45-47 3.8 using deferred procedure calls nbsp and complete routine 47-48 3.9; 48-51 3.9. 1 set completion routine 48-49 3.9.2 call completion routine 49-51 Chapter 4 bridge drivers focus on routine design 51 -69 4.1 driver entry routine 51-53 4.1.1 driver object 51-52 4.1.2 driver entry routine 52-53 4.2 plug and play routine strategy 53-59 4.2.1 USB to RS-232 bridge add enumeration process 53-54 4.2.2 AddDevice routine design the 54-55 4.2.3 boot device 55-56 the 4.2.4 registration application interface 56 -57 4.2.5 stop removing equipment 57-59 4.3 dispatch routine strategy the 59-68 4.3.1 to open the device 60 4.3.2 Close equipment 60 4.3.3 device control request processing 60-62 4.3.4 read and write queue 62-64 < br /> 4.3.5 read operation the 64-66 4.3.6 writes 66-67 the 4.3.7 USB underlying operating 67-68 4.4 power management routines the 4.5 uninstall routine 68 the drive 68-69 Chapter 5 test and install 69-73 5.1 driving test 69-70 5.1.1 Writing test applications are found; 69-70 5.1.2 FPGA and mobile communications joint test 70 5.2 driver installation 70-73 5.2.1 INF file 71 5.2.2 system registry 71 5.2.3 installation steps 71-73 Chapter 6 Summary and Outlook 73-74 Ref. 74-76 summary 76-79 <br / > ABSTRACT 79-82 Acknowledgements 82-83 instructor and author 83