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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [devapi-synchronization.html] - Blame information for rev 581

Go to most recent revision | 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
>Synchronization</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="Device Driver Interface to the Kernel"
26
HREF="devapi-device-driver-interface-to-the-kernel.html"><LINK
27
REL="NEXT"
28
TITLE="SMP Support"
29
HREF="devapi-smp-support.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-device-driver-interface-to-the-kernel.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-smp-support.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-SYNCHRONIZATION">Synchronization</H1
86
><P
87
>There are three levels of synchronization supported:</P
88
><P
89
></P
90
><OL
91
TYPE="1"
92
><LI
93
><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
99
    <TT
100
CLASS="FUNCTION"
101
>cyg_drv_isr_lock()</TT
102
> and
103
    <TT
104
CLASS="FUNCTION"
105
>cyg_drv_isr_unlock()</TT
106
> functions. This
107
    mechanism should be used sparingly and for short periods only.
108
    For finer grained synchronization, individual spinlocks are also
109
    supplied.
110
    </P
111
></LI
112
><LI
113
><P
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
118
    <TT
119
CLASS="FUNCTION"
120
>cyg_drv_dsr_lock()</TT
121
> and
122
    <TT
123
CLASS="FUNCTION"
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.
129
    </P
130
></LI
131
><LI
132
><P
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
136
    condition variables.
137
    </P
138
></LI
139
></OL
140
><P
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,
144
<SPAN
145
CLASS="emphasis"
146
><I
147
CLASS="EMPHASIS"
148
>even in ISRs</I
149
></SPAN
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
153
></DIV
154
><DIV
155
CLASS="NAVFOOTER"
156
><HR
157
ALIGN="LEFT"
158
WIDTH="100%"><TABLE
159
SUMMARY="Footer navigation table"
160
WIDTH="100%"
161
BORDER="0"
162
CELLPADDING="0"
163
CELLSPACING="0"
164
><TR
165
><TD
166
WIDTH="33%"
167
ALIGN="left"
168
VALIGN="top"
169
><A
170
HREF="devapi-device-driver-interface-to-the-kernel.html"
171
ACCESSKEY="P"
172
>Prev</A
173
></TD
174
><TD
175
WIDTH="34%"
176
ALIGN="center"
177
VALIGN="top"
178
><A
179
HREF="ecos-ref.html"
180
ACCESSKEY="H"
181
>Home</A
182
></TD
183
><TD
184
WIDTH="33%"
185
ALIGN="right"
186
VALIGN="top"
187
><A
188
HREF="devapi-smp-support.html"
189
ACCESSKEY="N"
190
>Next</A
191
></TD
192
></TR
193
><TR
194
><TD
195
WIDTH="33%"
196
ALIGN="left"
197
VALIGN="top"
198
>Device Driver Interface to the Kernel</TD
199
><TD
200
WIDTH="34%"
201
ALIGN="center"
202
VALIGN="top"
203
><A
204
HREF="devapi-device-driver-interface-to-the-kernel.html"
205
ACCESSKEY="U"
206
>Up</A
207
></TD
208
><TD
209
WIDTH="33%"
210
ALIGN="right"
211
VALIGN="top"
212
>SMP Support</TD
213
></TR
214
></TABLE
215
></DIV
216
></BODY
217
></HTML
218
>

powered by: WebSVN 2.1.0

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