... mappings, for a buffer
that will last the lifetime of the driver.
PCI _DMA_ TODEVICE
PCI _DMA_ FROMDEVICE
PCI _DMA_ BIDIRECTIONAL
PCI _DMA_ NONE
These symbols are used to tell the streaming mapping functions ...
struct file *vm_file;
Chapter 13 :mmap and DMA
This chapter delves into the area of Linux memory management, with an
emphasis on techniques that are useful to t...
... is a virtual address and is mapped to
physical addresses through a complex structure of so-called page tables (see
"Page Tables" in Chapter 13, "mmap and DMA& quot;). When an invalid ... identifies a command to be
performed and (optionally) another argument, usually a pointer.
As an alternative to using the /proc filesystem, you can implement a few
ioctl commands t...
...
/etc/modules.conf). The commands accept the specification of integer and
string values on the command line. Thus, if your module were to provide an
integer parameter called skull_ival and a string parameter ... imposes a
performance penalty. [13]
to use your driver at the same time. Most devices are capable of interrupting
the processor; interrupt handlers run asynchronously and c...
... (unused)
es1370 34832 1
Both the return value from request_module and the /proc/modules file
(described in "Initialization and Shutdown" in Chapter 2, "Building and
Running ... used primarily by
the hot-plug subsystem (i.e., for USB devices and such) to perform module
loading and configuration tasks when a new device is attached to the system.
Its prototype i...
... Chapter 13, "mmap and DMA& quot; explains what we left out
from the previous treatment of memory management: mmap and direct
memory access (DMA) . At this point, everything about char and block ... vendors, by making a
Linux driver available for their products, can add the large and growing
Linux user base to their potential markets. And the open source nature of the
C...
...
sequential or random-access device, one device or many, and so on.
To make scull be useful as a template for writing real drivers for real
devices, we'll show you how to implement several device ... /dev/$ {device} [0-3]
major=`awk "\\$2==\"$module\" {print \\$1}"
/proc/devices`
mknod /dev/$ {device} 0 c $major 0
mknod /dev/$ {device} 1 c $major 1
m...
... handle than ioctl. Nonetheless,
sometimes it's a useful approach to device control and is used by tty's and
other devices. We'll describe it later in this chapter in " ;Device ... the ioctl system call offers a device
specific entry point for the driver to handle "commands.'' ioctl is device
specific in that, unlike read and other methods, it...
... kernel functions udelay and mdelay serve this purpose.[27] Their
prototypes are
[27] The u in udelay represents the Greek letter mu and stands for micro.
#include < ;linux/ delay.h>
void ... most useful when writing interrupt handlers, and we'll see them
again in "Tasklets and Bottom-Half Processing", in Chapter 9, "Interrupt
Handling". Kernel timer...
... to
"Memory Management in Linux& quot; in Chapter 13, "mmap and DMA& quot;.
The Real Story of kmalloc
The kmalloc allocation engine is a powerful tool, and easily learned because
of ... "The mmap Device
Operation" in Chapter 13, "mmap and DMA& quot;.
To allocate pages, the following functions are available:
get_zeroed_page
Returns a pointer to a ne...
... easy to
use.
I/O Ports and I/O Memory
Every peripheral device is controlled by writing and reading its registers.
Most of the time a device has several registers, and they are accessed at ... misc-progs/inp.c and misc-progs/outp.c are a minimal
tool for reading and writing ports from the command line, in user space.
They expect to be installed under multiple names (i.e., i...