Linux Device Drivers (3rd) - Study Notes

Chapter 9/10 "Short"


# hardware interrupts and installed handlers.
cat /proc/interrupts
cat /proc/stat


Methold 1:
=======
# install modules
insmod short.ko
lsmod | grep short

# create device node
# <250> is the major NO. which output from the 1st command
cat /proc/devices | grep short
mknod /dev/short0 c 250 0
mknod /dev/short1 c 250 1
ls /dev/ | grep short

# verify
echo  -n "any string"  > /dev/short0


Methold 2:
=======
# install/remove modules by using scripts
./short_load
./short_unload


Linux space & context

In fact, in Linux, we can generalize that each processor is doing one of three things at any given moment:

  • In kernel-space, in process context, executing on behalf of a specific process

  • In kernel-space, in interrupt context, not associated with a process, handling an interrupt

  • In user-space, executing user code in a process

device driver

The software that handles or manages a hardware controller is known as a device driver.

posted @ 2011-05-04 16:36  bambreeze  阅读(199)  评论(0编辑  收藏  举报