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

📄 devapi-device-driver-interface-to-the-kernel.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/).                           --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission is obtained from the copyright holder.               --><HTML><HEAD><TITLE>Device Driver Interface to the Kernel</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="I/O Package (Device Drivers)"HREF="io.html"><LINKREL="PREVIOUS"TITLE="Serial testing with ser_filter"HREF="io-serial-testing-with-serfilter.html"><LINKREL="NEXT"TITLE="Synchronization"HREF="devapi-synchronization.html"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="io-serial-testing-with-serfilter.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="devapi-synchronization.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="DEVAPI-DEVICE-DRIVER-INTERFACE-TO-THE-KERNEL">Chapter 18. Device Driver Interface to the Kernel</H1><DIVCLASS="TOC"><DL><DT><B>Table of Contents</B></DT><DT><AHREF="devapi-device-driver-interface-to-the-kernel.html#DEVAPI-INTERRUPT-MODEL">Interrupt Model</A></DT><DT><AHREF="devapi-synchronization.html">Synchronization</A></DT><DT><AHREF="devapi-smp-support.html">SMP Support</A></DT><DT><AHREF="devapi-device-driver-models.html">Device Driver Models</A></DT><DT><AHREF="devapi-synchronization-levels.html">Synchronization Levels</A></DT><DT><AHREF="devapi-api.html">The API</A></DT></DL></DIV><P>This chapter describes the API that device drivers may useto interact with the kernel and HAL. It is primarily concerned withthe control and management of interrupts and the synchronization ofISRs, DSRs and threads.</P><P>The same API will be present in configurations where the kernelis not present. In this case the functions will be supplied by codeacting directly on the HAL.</P><DIVCLASS="SECTION"><H1CLASS="SECTION"><ANAME="DEVAPI-INTERRUPT-MODEL">Interrupt Model</H1><P><SPANCLASS="emphasis"><ICLASS="EMPHASIS">eCos</I></SPAN> presents a three level interrupt model todevice drivers. This consists of Interrupt Service Routines (ISRs) that are invokedin response to a hardware interrupt; DeferredService Routines (DSRs) that are invoked in response to a request byan ISR; and threads that are the clients of the driver. </P><P>Hardware interrupts are delivered with minimal intervention to anISR. The HAL decodes the hardware source of the interrupt and callsthe ISR of the attached interrupt object. This ISR may manipulate thehardware but is only allowed to make a restricted set of calls on thedriver API. When it returns, an ISR may request that its DSR should bescheduled to run.</P><P>A DSR will be run when it is safe to do so without interfering withthe scheduler. Most of the time the DSR will run immediately after theISR, but if the current thread is in the scheduler, it will be delayeduntil the thread is finished. A DSR is allowed to make a larger set ofdriver API calls, including, in particular, being able to call<TTCLASS="FUNCTION">cyg_drv_cond_signal()</TT> to wake up waitingthreads.</P><P>Finally, threads are able to make all API calls and in particular areallowed to wait on mutexes and condition variables. </P><P>For a device driver to receive interrupts it must first define ISR andDSR routines as shown below, and then call<TTCLASS="FUNCTION">cyg_drv_interrupt_create()</TT>.  Using the handlereturned, the driver must then call<TTCLASS="FUNCTION">cyg_drv_interrupt_attach()</TT> to actually attach theinterrupt to the hardware vector.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="io-serial-testing-with-serfilter.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="devapi-synchronization.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Serial testing with ser_filter</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="io.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Synchronization</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

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