簡易檢索 / 詳目顯示

研究生: 蔡廷鴻
Tyng-Horng Tsai
論文名稱: USB介面韌體及驅動程式之自動產生
An Approach to the Generatorfor USB I/F Firmware and WDM Driver
指導教授: 許孟超
Mon-Chau Shie
口試委員: 阮聖彰
Shanq-Jang Ruan
吳晉賢
Chin-Hsien Wu
林昌鴻
Chang-Hong Lin
學位類別: 碩士
Master
系所名稱: 電資學院 - 電子工程系
Department of Electronic and Computer Engineering
論文出版年: 2010
畢業學年度: 98
語文別: 中文
論文頁數: 72
中文關鍵詞: WDM驅動程式GadgetFSUSB連線嵌入式
外文關鍵詞: WDM Driver, GadgetFS, USB connection, embedded
相關次數: 點閱:156下載:3
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報

在我們的資訊生活中USB裝置一直被廣泛運用,對嵌入式系統的發展人員而言,依研究方向,有時常會需要透過USB介面連接電腦主機與發展裝置。要達到這需求,程式發展人員要了解USB規範、編寫USB裝置程式、編寫主機端的驅動程式及應用程式。

在本論文中,我們結合軟硬體整合開發,建立一個USB裝置的連線。可以分為電腦主機及裝置兩部份來看,主機端需要作業系統上的應用程式及驅動程式,裝置端則需要裝置應用程式及USB Bus硬體驅動程式。

在主機端探討Windows AP啟用WDM驅動程式的方式,了解AP如何開啟裝置、傳送資料。另外還有WDM驅動程式的運作方式,了解WDM Driver在Windows作業系統如何掛載、使用系統資源、進行傳輸。

在裝置端則研究如何使用Embedded Linux內建的USB硬體驅動程式安裝GadgetFS,再用使用者模式的裝置程式以檔案格式形式存取GadgetFS接收、傳送USB匯流排傳送的資料。

本研究編寫了工具軟體以產生WDM驅動程式以及Linux裝置程式,在實際的開發板上驗證,我們已經確認可以使用工具軟體產生的Windows驅動程式及Linux裝置程式建立起USB連線,並且正確無誤的傳送資料。也可以在電腦主機的應用程式及Linux裝置程式加入新的功能,從電腦端傳送控制碼到開發板控制I/O,例如開發板的GPIO、ADC、DAC、LCD模組等等,都可以透過主機經由USB匯流排來控制。


Nowadays, USB devices are widely spread in use at our daily life. According to the demands of research purposes, sometimes embedded system developers need an USB interface connection between the host PC and developing environments. To fulfill this target requirement, developers need to understand USB SPEC., to build up the abilities to program USB Device function and host device driver/application as well.

In this research, we combine the developments of Windows SW and embedded Linux to build up an USB connection. In a host PC, it needs the Windows application and WDM Driver. In device side, it needs the Linux user mode application to implement device behavior and USB HW driver.

In the host, we study the method of how to activate the WDM Driver by a Windows application. Also study how does a Windows application open devices and transmit/receive data. The principle of WDM Driver is also a topic. We research how does the WDM Driver load in Windows OS, and how does it use system resource to communicate with devices.

In the device side, we study how to use the USB Driver of Linux Kernel built-in to install GadgetFS. Then, we mount the GadgetFS by a way of file system from the user mode application to transmit/receive data of USB bus.

The research also edits some utilities to generate the WDM Driver and Linux Device application. By approving on a physical developing board, it is successful to create the USB connection between host and device by the WDM Driver and Linux application which created by utilities. They transmit and receive data from each other accurately. Of course, we could add some more specific functions in the host and Linux application for some other research purposes. Such as GPIO, ADC, DAC, LCD module of the develop board, could control from host via the USB bus.

論文摘要 i Abstract ii 誌謝 iii 目錄 iv 圖索引 vi 表索引 viii 1.緒論 1 1.1.研究動機 1 1.2.研究目標 1 1.3.研究背景 2 1.3.1.嵌入式系統平台 2 1.3.2.嵌入式系統軟體環境 3 1.3.3.主機端系統開發環境 4 1.3.4.系統開發 4 2.系統開發相關 6 2.1.WDM (Windows Driver Model) 定義 6 2.1.1.Windows 作業系統環境 6 2.1.2.驅動程式層次 9 2.2.PnP Devices Driver 13 2.2.1.I/O Request Package (IRP)13 2.2.2.Win XP WDM運作概述 13 2.2.3.PnP Device 安裝 16 2.3.驅動程式函式 19 2.3.1.組成函式 19 2.3.2.資料型態 21 2.4.USB 介面 23 2.4.1.USB 介紹 23 2.4.2.USB 硬體架構 24 2.4.3.USB 傳輸 26 2.4.4.USB 列舉(enumeration) 28 3.主機與裝置的連接 33 3.1.Windows AP 33 3.1.1.初始化裝置 33 3.1.2.讀寫裝置 34 3.1.3.結束裝置存取 35 3.2.WDM Driver 36 3.2.1.DriverEntry API 36 3.2.2.AddDevice API 37 3.2.3.StartDevice API 39 3.2.4.Read/Write 40 3.3.GadgetFS 41 3.3.1.編譯GadgetFS Driver 41 3.3.2.User Mode裝置應用程式流程 42 3.3.3.User Mode AP EndPoint程式流程43 3.3.4.產生工具 45 4.實驗結果 46 4.1.系統實驗 46 4.1.1.系統實驗硬體介紹 47 4.1.2.硬體規格 48 4.1.3.系統實驗流程 50 5.結論與未來方向 62 5.1.參考文獻 63

[1] Compaq, Intel, Microsoft, NEC,
“Universal Serial Bus Specification Revision 1.1,” Sep. 23, 1998
[2] 張帆、史彩成等編著,“Windows Device Driver Programming 驅動程式設計”,
博碩文化,2009年6月
[3] David A. Solomon, “The Windows NT Kernel Architecture,” COMPUTER, Oct, 1998
[4] 蔡孟哲,“WDM Driver程式設計實務”,碁峰資訊,2004
[5] Mohamad (Hani) Atassi, “Microsoft Windows Driver Model (WDM),”
Submitted to Dr.Dessis R. Hafemann, Winter Quarter,
2001-2002 CS-384 Section 1, January 28, 2002
[6] 周德凱, “微軟視窗系統之USB裝置驅動程式整合開發環境”, 南台科技大學碩士論文, Jul. 2007
[7] Walter Oney , “PROGRAMMING THE MICROSOFT WINDOWS DRIVER MODEL”
2nd Edition, Microsoft Press
[8] 張眾函, “微軟視窗系統之USB裝置驅動程式產生器之研製”, 南台科技大學碩士論文, Jun. 2006
[9] 葛湘達, “WDM驅動程式設計手冊”, 碁峰資訊, 2000
[10] Compaq, Hewlett-Packard, Intel, Lucent, Microsoft, NEC, Philips,
“Universal Serial Bus Specification Rev 2.0,” April 27, 2000
[11] PLX Technology, “NET2272 USB 2.0 Peripheral Controller,”
Data Book Version 1.6, April 2005
[12] Pat Villani原著,“API環境下的WIN32程式環境”,全華科技圖書,2005年4月
[13] Abraham Silberschatz, Peter B. Galvin, Greg Gagne,
“Operating System Concepts,” John Wiley & Sons (Asia) Pte Ltd, 2010
[14] Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman,
“Linux Device Drivers, Third Edition,”
O’Reilly & Associates, Inc., May, 2006
[15] 陳俊宏,“Embedded Linux嵌入式系統實作演練 第二版”,學貫行銷,2006年
[16] Karim Yaghmour, “Building Embedded Linux Systems,”
O’Reilly & Associates, Inc., 2003
[17] Christopher Hallinan, “Embedded Linux Primer,”
Prentice Hall Professional Technical Reference, 2007
[18] 位元文化編著,“Linux C/C++ 入門進階”,文魁資訊,2004年
[19] Todd Meadors, “Linux Shell Script Programming,”
COURSE TECHNOLOGY INC., Mar. 2003
[20] 楊玄彰,鄧姚文,“Visual C++ 6 超級手冊”,碁峰資訊,1999年5月初版
[21] HP, Intel, Microsoft, NEC, ST-NXP, TI,
“Universal Serial Bus 3.0 Specification Revision 1.0”, Nov. 12, 2008

QR CODE