<!-- 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
|
>Synchronization Levels</TITLE
|
>Synchronization Levels</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="Device Driver Interface to the Kernel"
|
TITLE="Device Driver Interface to the Kernel"
|
HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
|
HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
|
REL="PREVIOUS"
|
REL="PREVIOUS"
|
TITLE="Device Driver Models"
|
TITLE="Device Driver Models"
|
HREF="devapi-device-driver-models.html"><LINK
|
HREF="devapi-device-driver-models.html"><LINK
|
REL="NEXT"
|
REL="NEXT"
|
TITLE="The API"
|
TITLE="The API"
|
HREF="devapi-api.html"></HEAD
|
HREF="devapi-api.html"></HEAD
|
><BODY
|
><BODY
|
CLASS="SECTION"
|
CLASS="SECTION"
|
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="devapi-device-driver-models.html"
|
HREF="devapi-device-driver-models.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"
|
>Chapter 18. Device Driver Interface to the Kernel</TD
|
>Chapter 18. Device Driver Interface to the Kernel</TD
|
><TD
|
><TD
|
WIDTH="10%"
|
WIDTH="10%"
|
ALIGN="right"
|
ALIGN="right"
|
VALIGN="bottom"
|
VALIGN="bottom"
|
><A
|
><A
|
HREF="devapi-api.html"
|
HREF="devapi-api.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="SECTION"
|
CLASS="SECTION"
|
><H1
|
><H1
|
CLASS="SECTION"
|
CLASS="SECTION"
|
><A
|
><A
|
NAME="DEVAPI-SYNCHRONIZATION-LEVELS">Synchronization Levels</H1
|
NAME="DEVAPI-SYNCHRONIZATION-LEVELS">Synchronization Levels</H1
|
><P
|
><P
|
>Since it would be dangerous for an ISR or DSR to make a call
|
>Since it would be dangerous for an ISR or DSR to make a call
|
that might reschedule the current thread (by trying to lock a mutex
|
that might reschedule the current thread (by trying to lock a mutex
|
for example) all functions in this API have an associated synchronization
|
for example) all functions in this API have an associated synchronization
|
level. These levels are:</P
|
level. These levels are:</P
|
><P
|
><P
|
></P
|
></P
|
><DIV
|
><DIV
|
CLASS="VARIABLELIST"
|
CLASS="VARIABLELIST"
|
><DL
|
><DL
|
><DT
|
><DT
|
>Thread</DT
|
>Thread</DT
|
><DD
|
><DD
|
><P
|
><P
|
> This function may only be called from within threads. This is
|
> This function may only be called from within threads. This is
|
usually the client code that makes calls into the device driver.
|
usually the client code that makes calls into the device driver.
|
In a non-kernel configuration, this will be code running at the
|
In a non-kernel configuration, this will be code running at the
|
default non-interrupt level.
|
default non-interrupt level.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
>DSR</DT
|
>DSR</DT
|
><DD
|
><DD
|
><P
|
><P
|
> This function may be called by either DSR or thread code.
|
> This function may be called by either DSR or thread code.
|
</P
|
</P
|
></DD
|
></DD
|
><DT
|
><DT
|
>ISR</DT
|
>ISR</DT
|
><DD
|
><DD
|
><P
|
><P
|
> This function may be called from ISR, DSR or thread code.
|
> This function may be called from ISR, DSR or thread code.
|
</P
|
</P
|
></DD
|
></DD
|
></DL
|
></DL
|
></DIV
|
></DIV
|
><P
|
><P
|
>The following table shows, for each API function, the levels
|
>The following table shows, for each API function, the levels
|
at which is may be called:</P
|
at which is may be called:</P
|
><TABLE
|
><TABLE
|
BORDER="5"
|
BORDER="5"
|
BGCOLOR="#E0E0F0"
|
BGCOLOR="#E0E0F0"
|
WIDTH="70%"
|
WIDTH="70%"
|
><TR
|
><TR
|
><TD
|
><TD
|
><PRE
|
><PRE
|
CLASS="PROGRAMLISTING"
|
CLASS="PROGRAMLISTING"
|
> Callable from:
|
> Callable from:
|
Function ISR DSR Thread
|
Function ISR DSR Thread
|
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
|
|
cyg_drv_isr_lock X X X
|
cyg_drv_isr_lock X X X
|
cyg_drv_isr_unlock X X X
|
cyg_drv_isr_unlock X X X
|
cyg_drv_spinlock_init X
|
cyg_drv_spinlock_init X
|
cyg_drv_spinlock_destroy X
|
cyg_drv_spinlock_destroy X
|
cyg_drv_spinlock_spin X X X
|
cyg_drv_spinlock_spin X X X
|
cyg_drv_spinlock_clear X X X
|
cyg_drv_spinlock_clear X X X
|
cyg_drv_spinlock_try X X X
|
cyg_drv_spinlock_try X X X
|
cyg_drv_spinlock_test X X X
|
cyg_drv_spinlock_test X X X
|
cyg_drv_spinlock_spin_intsave X X X
|
cyg_drv_spinlock_spin_intsave X X X
|
cyg_drv_spinlock_clear_intsave X X X
|
cyg_drv_spinlock_clear_intsave X X X
|
cyg_drv_dsr_lock X X
|
cyg_drv_dsr_lock X X
|
cyg_drv_dsr_unlock X X
|
cyg_drv_dsr_unlock X X
|
cyg_drv_mutex_init X
|
cyg_drv_mutex_init X
|
cyg_drv_mutex_destroy X
|
cyg_drv_mutex_destroy X
|
cyg_drv_mutex_lock X
|
cyg_drv_mutex_lock X
|
cyg_drv_mutex_trylock X
|
cyg_drv_mutex_trylock X
|
cyg_drv_mutex_unlock X
|
cyg_drv_mutex_unlock X
|
cyg_drv_mutex_release X
|
cyg_drv_mutex_release X
|
cyg_drv_cond_init X
|
cyg_drv_cond_init X
|
cyg_drv_cond_destroy X
|
cyg_drv_cond_destroy X
|
cyg_drv_cond_wait X
|
cyg_drv_cond_wait X
|
cyg_drv_cond_signal X X
|
cyg_drv_cond_signal X X
|
cyg_drv_cond_broadcast X X
|
cyg_drv_cond_broadcast X X
|
cyg_drv_interrupt_create X
|
cyg_drv_interrupt_create X
|
cyg_drv_interrupt_delete X
|
cyg_drv_interrupt_delete X
|
cyg_drv_interrupt_attach X X X
|
cyg_drv_interrupt_attach X X X
|
cyg_drv_interrupt_detach X X X
|
cyg_drv_interrupt_detach X X X
|
cyg_drv_interrupt_mask X X X
|
cyg_drv_interrupt_mask X X X
|
cyg_drv_interrupt_unmask X X X
|
cyg_drv_interrupt_unmask X X X
|
cyg_drv_interrupt_acknowledge X X X
|
cyg_drv_interrupt_acknowledge X X X
|
cyg_drv_interrupt_configure X X X
|
cyg_drv_interrupt_configure X X X
|
cyg_drv_interrupt_level X X X
|
cyg_drv_interrupt_level X X X
|
cyg_drv_interrupt_set_cpu X X X
|
cyg_drv_interrupt_set_cpu X X X
|
cyg_drv_interrupt_get_cpu X X X </PRE
|
cyg_drv_interrupt_get_cpu X X X </PRE
|
></TD
|
></TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></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="devapi-device-driver-models.html"
|
HREF="devapi-device-driver-models.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-api.html"
|
HREF="devapi-api.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"
|
>Device Driver Models</TD
|
>Device Driver Models</TD
|
><TD
|
><TD
|
WIDTH="34%"
|
WIDTH="34%"
|
ALIGN="center"
|
ALIGN="center"
|
VALIGN="top"
|
VALIGN="top"
|
><A
|
><A
|
HREF="devapi-device-driver-interface-to-the-kernel.html"
|
HREF="devapi-device-driver-interface-to-the-kernel.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"
|
>The API</TD
|
>The API</TD
|
></TR
|
></TR
|
></TABLE
|
></TABLE
|
></DIV
|
></DIV
|
></BODY
|
></BODY
|
></HTML
|
></HTML
|
|
|