1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE slides SYSTEM "/usr/share/xml/docbook/custom/slides/3.3.1/schema/dtd/slides-full.dtd">
7 <title>Linux Device Drivers</title>
8 <author><firstname>Thadeu</firstname><surname>Cascardo</surname></author>
12 <title>Introduction</title>
14 Devices in POSIX Systems are files in /dev directory. As with any files
15 in POSIX, they may be opened, closed, read from, written to, seeked,
20 Examples of device files:
26 /dev/sda - A SCSI block device
31 /dev/ttyS0 - A Serial terminal device
39 <title>POSIX I/O calls</title>
41 POSIX systems have some standard calls for I/O. Since devices are files,
42 these same system calls are used to work with devices. We are gonna work
43 with the following calls:
70 The open system call opens a file. When working with devices, that's
71 when some initialization should be done. Some devices may be opened only
75 int open (char * filename, int flags);
78 flags may be O_RDONLY, O_WRONLY, O_RDWR and many others, some not
79 important for devices.
85 fd = open ("/dev/ttyS0", O_RDWR);