⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 introduction_to_device_drivers.html

📁 ADI 公司blackfin系列的用户使用文挡。
💻 HTML
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>  <title></title>  <link rel="stylesheet" media="screen" type="text/css" href="./style.css" />  <link rel="stylesheet" media="screen" type="text/css" href="./design.css" />  <link rel="stylesheet" media="print" type="text/css" href="./print.css" />  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><h2><a name="device_drivers_introduction" id="device_drivers_introduction">Device Drivers, Introduction</a></h2><div class="level2"><p> Following the &ldquo;everything is a file&rdquo; Unix&trade; tradition,  device drivers are used to allow user code access to kernel functions controlling  a number of peripheral components.</p><p>There are 3 classes for device drivers </p><ul><li class="level1"><div class="li"> character drivers</div></li><li class="level1"><div class="li"> block drivers</div></li><li class="level1"><div class="li"> network drivers</div></li></ul><p> Character drivers are widely use for a number of simple and more sophisticated applications. These range from simple led flashers to IEEE1394 ( firewire ) and USB drivers.</p><p>Block drivers interface to the file system and are used to mount things like disk partitions. They differ from simple character drivers in that access to the device data is usually <strong>buffered</strong> by the kernel.</p><p>Network drivers have a different structure and are closely connected with the network stacks that can be built into the kernel. They use ports and sockets to route data packets within, as well as to and from the system.</p><p>The user is normally not allowed to execute kernel code or access Input/Output (I/O) devices. When this functionality is required an application should use a device driver. They are quite easy to build and very fast to run so consider creating a device driver for all your I/O needs.</p><p>A device driver can be a module or it can be statically linked into the kernel.  An appropriate kernel registration function is executed during the module init process. </p><p>(Replacing the simple <strong>printk</strong> used in the module example.)</p><p>This function passes pointers to one or more functions internal to the driver and may include some other parameters.</p><p>A device driver will register the following components:</p><ul><li class="level1"><div class="li"> a fops table</div></li><li class="level1"><div class="li"> a Major Number</div></li><li class="level1"><div class="li"> a Device Class (block or char)</div></li><li class="level1"><div class="li"> a name</div></li></ul><p>Special files called <strong>device nodes</strong> are created on a file system that hold the class, Major and Minor number of a particular device.</p><p>The device driver registers a number of <strong>callback</strong> functions that are used to extend the default behaviour of the kernel when accessing these <strong>device nodes</strong>. These functions are recorded in a <strong>file operations</strong> table.</p><p>The <strong>open</strong> system call retrieves that Major number and then looks for a device registered by the Major number in the device table to recover the fops table for the device.</p><p>This information is then recorded in a special <strong>per process</strong> table called the file descriptor table. The process uses a simple integer index (fd) to access the file descripter table entry after it has been opened.</p><p>[../images/ddfig1.gif] <img src="images/smileys/fixme.gif" align="middle" alt="FIXME" /></p></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -