久久ER99热精品一区二区-久久精品99国产精品日本-久久精品免费一区二区三区-久久综合九色综合欧美狠狠

新聞中心

EEPW首頁 > 嵌入式系統 > 設計應用 > 嵌入式Linux設備驅動開發之:實驗內容——test驅動

嵌入式Linux設備驅動開發之:實驗內容——test驅動

作者: 時間:2013-09-13 來源:網絡 收藏

本文引用地址:http://cqxgywz.com/article/257106.htm

4.實驗結果

首先在虛擬源碼目錄下編譯并加載驅動模塊。

$makeclean;make

$./test_drv_load

接下來,編譯并運行測試程序

$gcc–otesttest.c

$./test

測試程序運行效果如下:

Inputsomewordstokernel(enter'quit'toexit):Hello,everybody!

Thereadstringisfromkernel:Hello,everybody!/*從內核讀取的數據*/

Inputsomewordstokernel(enter'quit'toexit):Thisisasimpledriver

Thereadstringisfromkernel:Thisisasimpledriver

Inputsomewordstokernel(enter'quit'toexit):quit

Thereadstringisfromkernel:quit

最后,卸載驅動程序

$./test_drv_unload

通過dmesg命令可以查看內核打印的信息:

$dmesg|tail–n10

……

Themajorofthetestdeviceis250/*當加載模塊時打印*/

Thisisopenoperation/*當打開設備時打印*/

Thisisreleaseoperation/*關閉設備時打印*/

Testdeviceuninstalled/*當卸載設備時打印*/

linux操作系統文章專題:linux操作系統詳解(linux不再難懂)

linux相關文章:linux教程



上一頁 1 2 3 4 下一頁

評論


相關推薦

技術專區

關閉