ecos-2.0的开发文档

源代码在线查看: devapi-synchronization.html

软件大小: 1848 K
上传用户: zjwbt
关键词: ecos 2.0 文档
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
				
				
				
				
								>				>				>Synchronization				>
								NAME="GENERATOR"
				CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
				">				REL="HOME"
				TITLE="eCos Reference Manual"
				HREF="ecos-ref.html">				REL="UP"
				TITLE="Device Driver Interface to the Kernel"
				HREF="devapi-device-driver-interface-to-the-kernel.html">				REL="PREVIOUS"
				TITLE="Device Driver Interface to the Kernel"
				HREF="devapi-device-driver-interface-to-the-kernel.html">				REL="NEXT"
				TITLE="SMP Support"
				HREF="devapi-smp-support.html">				>				CLASS="SECTION"
				BGCOLOR="#FFFFFF"
				TEXT="#000000"
				LINK="#0000FF"
				VLINK="#840084"
				ALINK="#0000FF"
				>				CLASS="NAVHEADER"
				>				SUMMARY="Header navigation table"
				WIDTH="100%"
				BORDER="0"
				CELLPADDING="0"
				CELLSPACING="0"
				>				>				COLSPAN="3"
				ALIGN="center"
				>eCos Reference Manual				>				>				>				WIDTH="10%"
				ALIGN="left"
				VALIGN="bottom"
				>				HREF="devapi-device-driver-interface-to-the-kernel.html"
				ACCESSKEY="P"
				>Prev				>				>				WIDTH="80%"
				ALIGN="center"
				VALIGN="bottom"
				>Chapter 18. Device Driver Interface to the Kernel				>				WIDTH="10%"
				ALIGN="right"
				VALIGN="bottom"
				>				HREF="devapi-smp-support.html"
				ACCESSKEY="N"
				>Next				>				>				>				>				ALIGN="LEFT"
				WIDTH="100%">				>				CLASS="SECTION"
				>				CLASS="SECTION"
				>				NAME="DEVAPI-SYNCHRONIZATION">Synchronization				>				>There are three levels of synchronization supported:				>				>				>				TYPE="1"
				>				>				>    Synchronization with ISRs. This normally means disabling
				    interrupts to prevent the ISR running during a critical
				    section. In an SMP environment, this will also require the use of
				    a spinlock to synchronize with ISRs, DSRs or threads running on
				    other CPUs.  This is implemented by the
				    				CLASS="FUNCTION"
				>cyg_drv_isr_lock()				> and
				    				CLASS="FUNCTION"
				>cyg_drv_isr_unlock()				> functions. This
				    mechanism should be used sparingly and for short periods only.
				    For finer grained synchronization, individual spinlocks are also
				    supplied.
				    				>				>				>				>    Synchronization with DSRs. This will be implemented in the kernel
				    by taking the scheduler lock to prevent DSRs running during
				    critical sections. In non-kernel configurations it will be
				    implemented by non-kernel code. This is implemented by the
				    				CLASS="FUNCTION"
				>cyg_drv_dsr_lock()				> and
				    				CLASS="FUNCTION"
				>cyg_drv_dsr_unlock()				> functions. As with ISR
				    synchronization, this mechanism should be used sparingly. Only
				    DSRs and threads may use this synchronization mechanism, ISRs are
				    not allowed to do this.
				    				>				>				>				>    Synchronization with threads. This is implemented with mutexes
				    and condition variables. Only threads may lock the mutexes and
				    wait on the condition variables, although DSRs may signal
				    condition variables.
				    				>				>				>				>Any data that is accessed from more than one level must be protected
				against concurrent access. Data that is accessed by ISRs must be
				protected with the ISR lock, or a spinlock at all times,
								CLASS="emphasis"
				>				CLASS="EMPHASIS"
				>even in ISRs				>				>. Data that is shared between DSRs
				and threads should be protected with the DSR lock. Data that is only
				accessed by threads must be protected with mutexes.				>				>				CLASS="NAVFOOTER"
				>				ALIGN="LEFT"
				WIDTH="100%">				SUMMARY="Footer navigation table"
				WIDTH="100%"
				BORDER="0"
				CELLPADDING="0"
				CELLSPACING="0"
				>				>				WIDTH="33%"
				ALIGN="left"
				VALIGN="top"
				>				HREF="devapi-device-driver-interface-to-the-kernel.html"
				ACCESSKEY="P"
				>Prev				>				>				WIDTH="34%"
				ALIGN="center"
				VALIGN="top"
				>				HREF="ecos-ref.html"
				ACCESSKEY="H"
				>Home				>				>				WIDTH="33%"
				ALIGN="right"
				VALIGN="top"
				>				HREF="devapi-smp-support.html"
				ACCESSKEY="N"
				>Next				>				>				>				>				WIDTH="33%"
				ALIGN="left"
				VALIGN="top"
				>Device Driver Interface to the Kernel				>				WIDTH="34%"
				ALIGN="center"
				VALIGN="top"
				>				HREF="devapi-device-driver-interface-to-the-kernel.html"
				ACCESSKEY="U"
				>Up				>				>				WIDTH="33%"
				ALIGN="right"
				VALIGN="top"
				>SMP Support				>				>				>				>				>				>			

相关资源