1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
12 >Synchronization</TITLE
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="Device Driver Interface to the Kernel"
23 HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
25 TITLE="Device Driver Interface to the Kernel"
26 HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
29 HREF="devapi-smp-support.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="devapi-device-driver-interface-to-the-kernel.html"
65 >Chapter 18. Device Driver Interface to the Kernel</TD
71 HREF="devapi-smp-support.html"
85 NAME="DEVAPI-SYNCHRONIZATION">Synchronization</H1
87 >There are three levels of synchronization supported:</P
94 > Synchronization with ISRs. This normally means disabling
95 interrupts to prevent the ISR running during a critical
96 section. In an SMP environment, this will also require the use of
97 a spinlock to synchronize with ISRs, DSRs or threads running on
98 other CPUs. This is implemented by the
101 >cyg_drv_isr_lock()</TT
105 >cyg_drv_isr_unlock()</TT
107 mechanism should be used sparingly and for short periods only.
108 For finer grained synchronization, individual spinlocks are also
114 > Synchronization with DSRs. This will be implemented in the kernel
115 by taking the scheduler lock to prevent DSRs running during
116 critical sections. In non-kernel configurations it will be
117 implemented by non-kernel code. This is implemented by the
120 >cyg_drv_dsr_lock()</TT
124 >cyg_drv_dsr_unlock()</TT
125 > functions. As with ISR
126 synchronization, this mechanism should be used sparingly. Only
127 DSRs and threads may use this synchronization mechanism, ISRs are
128 not allowed to do this.
133 > Synchronization with threads. This is implemented with mutexes
134 and condition variables. Only threads may lock the mutexes and
135 wait on the condition variables, although DSRs may signal
141 >Any data that is accessed from more than one level must be protected
142 against concurrent access. Data that is accessed by ISRs must be
143 protected with the ISR lock, or a spinlock at all times,
150 >. Data that is shared between DSRs
151 and threads should be protected with the DSR lock. Data that is only
152 accessed by threads must be protected with mutexes.</P
159 SUMMARY="Footer navigation table"
170 HREF="devapi-device-driver-interface-to-the-kernel.html"
188 HREF="devapi-smp-support.html"
198 >Device Driver Interface to the Kernel</TD
204 HREF="devapi-device-driver-interface-to-the-kernel.html"