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. -->
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="Synchronization"
26 HREF="devapi-synchronization.html"><LINK
28 TITLE="Device Driver Models"
29 HREF="devapi-device-driver-models.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="devapi-synchronization.html"
65 >Chapter 18. Device Driver Interface to the Kernel</TD
71 HREF="devapi-device-driver-models.html"
85 NAME="DEVAPI-SMP-SUPPORT">SMP Support</H1
87 >Some eCos targets contain support for Symmetric Multi-Processing (SMP)
88 configurations, where more than one CPU may be present. This option
89 has a number of ramifications for the way in which device drivers must
90 be written if they are to be SMP-compatible. </P
92 >Since it is possible for the ISR, DSR and thread components of a
93 device driver to execute on different CPUs, it is important that
94 SMP-compatible device drivers use the driver API routines correctly.</P
96 >Synchronization between threads and DSRs continues to require that the
97 thread-side code use <TT
99 >cyg_drv_dsr_lock()</TT
103 >cyg_drv_dsr_unlock()</TT
104 > to protect access to shared
105 data. While it is not strictly necessary for DSR code to claim the DSR
106 lock, since DSRs are run with it claimed already, it is good practice
109 >Synchronization between ISRs and DSRs or threads requires that access
110 to sensitive data be protected, in all places, by calls to
113 >cyg_drv_isr_lock()</TT
117 >cyg_drv_isr_unlock()</TT
118 >. Disabling or masking
119 interrupts is not adequate, since the thread or DSR may be running on
120 a different CPU and interrupt enable/disable only work on the current
123 >The ISR lock, for SMP systems, not only disables local interrupts, but
124 also acquires a spinlock to protect against concurrent access from
125 other CPUs. This is necessary because ISRs are not run with the
126 scheduler lock claimed. Hence they can run in parallel with the other
127 components of the device driver.</P
129 >The ISR lock provided by the driver API is just a shared spinlock that
130 is available for use by all drivers. If a driver needs to implement a
131 finer grain of locking, it can use private spinlocks, accessed via the
134 >cyg_drv_spinlock_*()</TT
142 SUMMARY="Footer navigation table"
153 HREF="devapi-synchronization.html"
171 HREF="devapi-device-driver-models.html"
187 HREF="devapi-device-driver-interface-to-the-kernel.html"
195 >Device Driver Models</TD