OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [devapi-smp-support.html] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 28 unneback
<!-- 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.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>SMP Support</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="Device Driver Interface to the Kernel"
23
HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
24
REL="PREVIOUS"
25
TITLE="Synchronization"
26
HREF="devapi-synchronization.html"><LINK
27
REL="NEXT"
28
TITLE="Device Driver Models"
29
HREF="devapi-device-driver-models.html"></HEAD
30
><BODY
31
CLASS="SECTION"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="devapi-synchronization.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
>Chapter 18. Device Driver Interface to the Kernel</TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="devapi-device-driver-models.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="SECTION"
82
><H1
83
CLASS="SECTION"
84
><A
85
NAME="DEVAPI-SMP-SUPPORT">SMP Support</H1
86
><P
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
91
><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
95
><P
96
>Synchronization between threads and DSRs continues to require that the
97
thread-side code use <TT
98
CLASS="FUNCTION"
99
>cyg_drv_dsr_lock()</TT
100
> and
101
<TT
102
CLASS="FUNCTION"
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
107
to do so.</P
108
><P
109
>Synchronization between ISRs and DSRs or threads requires that access
110
to sensitive data be protected, in all places, by calls to
111
<TT
112
CLASS="FUNCTION"
113
>cyg_drv_isr_lock()</TT
114
> and
115
<TT
116
CLASS="FUNCTION"
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
121
CPU.</P
122
><P
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
128
><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
132
<TT
133
CLASS="FUNCTION"
134
>cyg_drv_spinlock_*()</TT
135
> functions.</P
136
></DIV
137
><DIV
138
CLASS="NAVFOOTER"
139
><HR
140
ALIGN="LEFT"
141
WIDTH="100%"><TABLE
142
SUMMARY="Footer navigation table"
143
WIDTH="100%"
144
BORDER="0"
145
CELLPADDING="0"
146
CELLSPACING="0"
147
><TR
148
><TD
149
WIDTH="33%"
150
ALIGN="left"
151
VALIGN="top"
152
><A
153
HREF="devapi-synchronization.html"
154
ACCESSKEY="P"
155
>Prev</A
156
></TD
157
><TD
158
WIDTH="34%"
159
ALIGN="center"
160
VALIGN="top"
161
><A
162
HREF="ecos-ref.html"
163
ACCESSKEY="H"
164
>Home</A
165
></TD
166
><TD
167
WIDTH="33%"
168
ALIGN="right"
169
VALIGN="top"
170
><A
171
HREF="devapi-device-driver-models.html"
172
ACCESSKEY="N"
173
>Next</A
174
></TD
175
></TR
176
><TR
177
><TD
178
WIDTH="33%"
179
ALIGN="left"
180
VALIGN="top"
181
>Synchronization</TD
182
><TD
183
WIDTH="34%"
184
ALIGN="center"
185
VALIGN="top"
186
><A
187
HREF="devapi-device-driver-interface-to-the-kernel.html"
188
ACCESSKEY="U"
189
>Up</A
190
></TD
191
><TD
192
WIDTH="33%"
193
ALIGN="right"
194
VALIGN="top"
195
>Device Driver Models</TD
196
></TR
197
></TABLE
198
></DIV
199
></BODY
200
></HTML
201
>

powered by: WebSVN 2.1.0

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