OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [devapi-device-driver-interface-to-the-kernel.html] - Diff between revs 28 and 174

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 28 Rev 174
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
<!-- This material may be distributed only subject to the terms      -->
<!-- This material may be distributed only subject to the terms      -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- and conditions set forth in the Open Publication License, v1.0  -->
<!-- or later (the latest version is presently available at          -->
<!-- or later (the latest version is presently available at          -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- http://www.opencontent.org/openpub/).                           -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- Distribution of the work or derivative of the work in any       -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- standard (paper) book form is prohibited unless prior           -->
<!-- permission is obtained from the copyright holder.               -->
<!-- permission is obtained from the copyright holder.               -->
<HTML
<HTML
><HEAD
><HEAD
><TITLE
><TITLE
>Device Driver Interface to the Kernel</TITLE
>Device Driver Interface to the Kernel</TITLE
><meta name="MSSmartTagsPreventParsing" content="TRUE">
><meta name="MSSmartTagsPreventParsing" content="TRUE">
<META
<META
NAME="GENERATOR"
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
"><LINK
REL="HOME"
REL="HOME"
TITLE="eCos Reference Manual"
TITLE="eCos Reference Manual"
HREF="ecos-ref.html"><LINK
HREF="ecos-ref.html"><LINK
REL="UP"
REL="UP"
TITLE="I/O Package (Device Drivers)"
TITLE="I/O Package (Device Drivers)"
HREF="io.html"><LINK
HREF="io.html"><LINK
REL="PREVIOUS"
REL="PREVIOUS"
TITLE="Serial testing with ser_filter"
TITLE="Serial testing with ser_filter"
HREF="io-serial-testing-with-serfilter.html"><LINK
HREF="io-serial-testing-with-serfilter.html"><LINK
REL="NEXT"
REL="NEXT"
TITLE="Synchronization"
TITLE="Synchronization"
HREF="devapi-synchronization.html"></HEAD
HREF="devapi-synchronization.html"></HEAD
><BODY
><BODY
CLASS="CHAPTER"
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
BGCOLOR="#FFFFFF"
TEXT="#000000"
TEXT="#000000"
LINK="#0000FF"
LINK="#0000FF"
VLINK="#840084"
VLINK="#840084"
ALINK="#0000FF"
ALINK="#0000FF"
><DIV
><DIV
CLASS="NAVHEADER"
CLASS="NAVHEADER"
><TABLE
><TABLE
SUMMARY="Header navigation table"
SUMMARY="Header navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TH
><TH
COLSPAN="3"
COLSPAN="3"
ALIGN="center"
ALIGN="center"
>eCos Reference Manual</TH
>eCos Reference Manual</TH
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="left"
ALIGN="left"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="io-serial-testing-with-serfilter.html"
HREF="io-serial-testing-with-serfilter.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="80%"
WIDTH="80%"
ALIGN="center"
ALIGN="center"
VALIGN="bottom"
VALIGN="bottom"
></TD
></TD
><TD
><TD
WIDTH="10%"
WIDTH="10%"
ALIGN="right"
ALIGN="right"
VALIGN="bottom"
VALIGN="bottom"
><A
><A
HREF="devapi-synchronization.html"
HREF="devapi-synchronization.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
></TABLE
></TABLE
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"></DIV
WIDTH="100%"></DIV
><DIV
><DIV
CLASS="CHAPTER"
CLASS="CHAPTER"
><H1
><H1
><A
><A
NAME="DEVAPI-DEVICE-DRIVER-INTERFACE-TO-THE-KERNEL">Chapter 18. Device Driver Interface to the Kernel</H1
NAME="DEVAPI-DEVICE-DRIVER-INTERFACE-TO-THE-KERNEL">Chapter 18. Device Driver Interface to the Kernel</H1
><DIV
><DIV
CLASS="TOC"
CLASS="TOC"
><DL
><DL
><DT
><DT
><B
><B
>Table of Contents</B
>Table of Contents</B
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-device-driver-interface-to-the-kernel.html#DEVAPI-INTERRUPT-MODEL"
HREF="devapi-device-driver-interface-to-the-kernel.html#DEVAPI-INTERRUPT-MODEL"
>Interrupt Model</A
>Interrupt Model</A
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-synchronization.html"
HREF="devapi-synchronization.html"
>Synchronization</A
>Synchronization</A
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-smp-support.html"
HREF="devapi-smp-support.html"
>SMP Support</A
>SMP Support</A
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-device-driver-models.html"
HREF="devapi-device-driver-models.html"
>Device Driver Models</A
>Device Driver Models</A
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-synchronization-levels.html"
HREF="devapi-synchronization-levels.html"
>Synchronization Levels</A
>Synchronization Levels</A
></DT
></DT
><DT
><DT
><A
><A
HREF="devapi-api.html"
HREF="devapi-api.html"
>The API</A
>The API</A
></DT
></DT
></DL
></DL
></DIV
></DIV
><P
><P
>This chapter describes the API that device drivers may use
>This chapter describes the API that device drivers may use
to interact with the kernel and HAL. It is primarily concerned with
to interact with the kernel and HAL. It is primarily concerned with
the control and management of interrupts and the synchronization of
the control and management of interrupts and the synchronization of
ISRs, DSRs and threads.</P
ISRs, DSRs and threads.</P
><P
><P
>The same API will be present in configurations where the kernel
>The same API will be present in configurations where the kernel
is not present. In this case the functions will be supplied by code
is not present. In this case the functions will be supplied by code
acting directly on the HAL.</P
acting directly on the HAL.</P
><DIV
><DIV
CLASS="SECTION"
CLASS="SECTION"
><H1
><H1
CLASS="SECTION"
CLASS="SECTION"
><A
><A
NAME="DEVAPI-INTERRUPT-MODEL">Interrupt Model</H1
NAME="DEVAPI-INTERRUPT-MODEL">Interrupt Model</H1
><P
><P
><SPAN
><SPAN
CLASS="emphasis"
CLASS="emphasis"
><I
><I
CLASS="EMPHASIS"
CLASS="EMPHASIS"
>eCos</I
>eCos</I
></SPAN
></SPAN
> presents a three level interrupt model to
> presents a three level interrupt model to
device drivers. This consists of Interrupt Service Routines (ISRs) that are invoked
device drivers. This consists of Interrupt Service Routines (ISRs) that are invoked
in response to a hardware interrupt; Deferred
in response to a hardware interrupt; Deferred
Service Routines (DSRs) that are invoked in response to a request by
Service Routines (DSRs) that are invoked in response to a request by
an ISR; and threads that are the clients of the driver. </P
an ISR; and threads that are the clients of the driver. </P
><P
><P
>Hardware interrupts are delivered with minimal intervention to an
>Hardware interrupts are delivered with minimal intervention to an
ISR. The HAL decodes the hardware source of the interrupt and calls
ISR. The HAL decodes the hardware source of the interrupt and calls
the ISR of the attached interrupt object. This ISR may manipulate the
the ISR of the attached interrupt object. This ISR may manipulate the
hardware but is only allowed to make a restricted set of calls on the
hardware but is only allowed to make a restricted set of calls on the
driver API. When it returns, an ISR may request that its DSR should be
driver API. When it returns, an ISR may request that its DSR should be
scheduled to run.</P
scheduled to run.</P
><P
><P
>A DSR will be run when it is safe to do so without interfering with
>A DSR will be run when it is safe to do so without interfering with
the scheduler. Most of the time the DSR will run immediately after the
the scheduler. Most of the time the DSR will run immediately after the
ISR, but if the current thread is in the scheduler, it will be delayed
ISR, but if the current thread is in the scheduler, it will be delayed
until the thread is finished. A DSR is allowed to make a larger set of
until the thread is finished. A DSR is allowed to make a larger set of
driver API calls, including, in particular, being able to call
driver API calls, including, in particular, being able to call
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_drv_cond_signal()</TT
>cyg_drv_cond_signal()</TT
> to wake up waiting
> to wake up waiting
threads.</P
threads.</P
><P
><P
>Finally, threads are able to make all API calls and in particular are
>Finally, threads are able to make all API calls and in particular are
allowed to wait on mutexes and condition variables. </P
allowed to wait on mutexes and condition variables. </P
><P
><P
>For a device driver to receive interrupts it must first define ISR and
>For a device driver to receive interrupts it must first define ISR and
DSR routines as shown below, and then call
DSR routines as shown below, and then call
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_drv_interrupt_create()</TT
>cyg_drv_interrupt_create()</TT
>.  Using the handle
>.  Using the handle
returned, the driver must then call
returned, the driver must then call
<TT
<TT
CLASS="FUNCTION"
CLASS="FUNCTION"
>cyg_drv_interrupt_attach()</TT
>cyg_drv_interrupt_attach()</TT
> to actually attach the
> to actually attach the
interrupt to the hardware vector.</P
interrupt to the hardware vector.</P
></DIV
></DIV
></DIV
></DIV
><DIV
><DIV
CLASS="NAVFOOTER"
CLASS="NAVFOOTER"
><HR
><HR
ALIGN="LEFT"
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
SUMMARY="Footer navigation table"
WIDTH="100%"
WIDTH="100%"
BORDER="0"
BORDER="0"
CELLPADDING="0"
CELLPADDING="0"
CELLSPACING="0"
CELLSPACING="0"
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="io-serial-testing-with-serfilter.html"
HREF="io-serial-testing-with-serfilter.html"
ACCESSKEY="P"
ACCESSKEY="P"
>Prev</A
>Prev</A
></TD
></TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="ecos-ref.html"
HREF="ecos-ref.html"
ACCESSKEY="H"
ACCESSKEY="H"
>Home</A
>Home</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="devapi-synchronization.html"
HREF="devapi-synchronization.html"
ACCESSKEY="N"
ACCESSKEY="N"
>Next</A
>Next</A
></TD
></TD
></TR
></TR
><TR
><TR
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="left"
ALIGN="left"
VALIGN="top"
VALIGN="top"
>Serial testing with ser_filter</TD
>Serial testing with ser_filter</TD
><TD
><TD
WIDTH="34%"
WIDTH="34%"
ALIGN="center"
ALIGN="center"
VALIGN="top"
VALIGN="top"
><A
><A
HREF="io.html"
HREF="io.html"
ACCESSKEY="U"
ACCESSKEY="U"
>Up</A
>Up</A
></TD
></TD
><TD
><TD
WIDTH="33%"
WIDTH="33%"
ALIGN="right"
ALIGN="right"
VALIGN="top"
VALIGN="top"
>Synchronization</TD
>Synchronization</TD
></TR
></TR
></TABLE
></TABLE
></DIV
></DIV
></BODY
></BODY
></HTML
></HTML
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.