Courses on operating system design device drivers

 

Experiment No.

Design special courses four

topic

Device Drivers

Purpose

1. Concept

2. Design

3. implementation - coding

4. realization - compiled debugging

Content Experiments

Perfect example of a program character device, so as to meet the following functions:

  . I mounting device reads out the character string from the device number for your school;

  . Ii device supports every write characters not more than 1,024, the excess is discarded;

  . Iii latest user can read characters written to the device;

  . Iv not be opened before the device turns off a plurality of times;

  . V equipment support system calls ioctl (int d, int req, ...), req = 0x909090, remove the string written device;

Write your own test program to verify the above function

Report Content Requirements

(1) program implements methods and ideas

(2) testing and results

Report Text

(1)

 

 

Compile

2.4: gcc -c rwbuf.c -I/usr/src/linux/include -D__KERNEL__  -DMODULE -Wall

2.6: Create Makefile, which reads:

   obj-m := rwbuf.o

   Then use:

   Into the driver source code directory, execute:

       make -C kernel source directory M = `pwd` modules

Installation and uninstallation:
the mknod / dev / 60 0 c rwbuf create the device file

2.4: insmod rwbuf.o install device drivers

2.6 insmod rwbuf.ko

/ Sbin / rmmod rwbuf unload device drivers

 

(2)

 

 

 

 

 

 

 

 

 

Reproduced in: https: //www.cnblogs.com/ku1274755259/p/11108908.html

Guess you like

Origin blog.csdn.net/weixin_33901843/article/details/94527242