朱恩亮,趙臘才,茹 偉,胡宇凡
(中航工業(yè)西安航空計(jì)算技術(shù)研究所 民用機(jī)載電子設(shè)備研究室,陜西 西安 710068)
Linux環(huán)境下USB設(shè)備驅(qū)動(dòng)程序設(shè)計(jì)
朱恩亮,趙臘才,茹偉,胡宇凡
(中航工業(yè)西安航空計(jì)算技術(shù)研究所 民用機(jī)載電子設(shè)備研究室,陜西 西安710068)
摘要在介紹Linux設(shè)備驅(qū)動(dòng)程序、USB邏輯組織的基礎(chǔ)上,針對(duì)某數(shù)據(jù)采集系統(tǒng)與PC機(jī)之間的USB通信實(shí)時(shí)性要求高、數(shù)據(jù)帶寬高的特點(diǎn),采用URB并結(jié)合DMA的方法,開(kāi)展Linux環(huán)境下USB設(shè)備驅(qū)動(dòng)程序的設(shè)計(jì)。通過(guò)讀取大容量數(shù)據(jù)對(duì)驅(qū)動(dòng)程序進(jìn)行測(cè)試,單個(gè)USB端點(diǎn)數(shù)據(jù)讀取速度可達(dá)30 MB/s,能滿足系統(tǒng)需求。
關(guān)鍵詞Linux;字符設(shè)備驅(qū)動(dòng);USB邏輯組織;USB設(shè)備驅(qū)動(dòng)
Development of USB Device Drivers of Linux
ZHU Enliang,ZHAO Lacai,RU Wei,HU Yufan
(Civilian Vehicle-borne Electronic Devices Research Section,AVIC Xi’an Aeronautic Computing
Technique Research Institute,Xi’an 710068,China)
AbstractLinux platform is widely used now while the requirements of device driver based on this platform are needed by more and more developers.A URB combining with DMA development method for the real-time and high bandwidth USB communication between a data collection system and a PC is provided after a brief introduction to Linux device drivers and USB logical organization.The system requirements can be satisfied by this development method after large capacity data reading test of the driver.The reading speed of a single USB endpoint reaches 30 MB/s.
KeywordsLinux;character device driver;USB logical organization;USB device driver
Linux平臺(tái)上的設(shè)備驅(qū)動(dòng)程序采用模塊化設(shè)計(jì)方式,使得硬件設(shè)備能響應(yīng)各個(gè)內(nèi)部編程接口[1-2]。這些編程接口使得設(shè)備對(duì)用戶而言將變得透明,用戶無(wú)需關(guān)注設(shè)備的工作細(xì)節(jié),其只需通過(guò)系統(tǒng)調(diào)用接口即可訪問(wèn)硬件設(shè)備。在Linux平臺(tái)下,將系統(tǒng)調(diào)用與設(shè)備具體操作相關(guān)聯(lián)的組件即為驅(qū)動(dòng)程序[3]。
某數(shù)據(jù)采集系統(tǒng)與計(jì)算機(jī)(PC)之間的USB通信邏輯架構(gòu)如圖1所示,PC通過(guò)USB接口實(shí)時(shí)獲取數(shù)據(jù)采集系統(tǒng)所采集的多路圖像數(shù)據(jù),并存儲(chǔ)在網(wǎng)絡(luò)服務(wù)器硬盤(pán)上。系統(tǒng)要求該采集系統(tǒng)與PC之間數(shù)據(jù)傳輸速率不低于20 MB/s。一般USB設(shè)備驅(qū)動(dòng)主要用于解決對(duì)設(shè)備存儲(chǔ)區(qū)的訪問(wèn)、對(duì)設(shè)備進(jìn)行簡(jiǎn)單的控制,對(duì)數(shù)據(jù)傳輸?shù)膶?shí)時(shí)性和帶寬要求不高,本文的目的是解決Linux環(huán)境下USB設(shè)備實(shí)時(shí)、高速數(shù)據(jù)傳輸問(wèn)題[4]。

圖1 數(shù)據(jù)采集系統(tǒng)與PC之間的USB通信邏輯架構(gòu)……p>