Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Gate.h

Go to the documentation of this file.
00001 /** 
00002  *  @file   Gate.h
00003  *
00004  *  @brief      Critical section support.
00005  *
00006  *  Gates are used by clients to protect concurrent access to critical
00007  *  data structures.  Critical data structures are those that must be
00008  *  updated by at most one thread at a time.  All code that needs access
00009  *  to a critical data structure "enters" a gate (that's associated with the
00010  *  data structure) prior to accessing the data, modifies the data structure,
00011  *  then "leaves" the gate.
00012  *
00013  *  A gate is responsible for ensuring that at most one thread at a time
00014  *  can enter and execute "inside" the gate.  There are several
00015  *  implementations of gates, with different system executation times and
00016  *  latency tradoffs.  In addition, some gates must not be entered by certain
00017  *  thread types; e.g., a gate that is implemented via a "blocking" semaphore
00018  *  must not be called by an interrupt service routine (ISR).
00019  *
00020  *  A module can be declared "gated" by adding the `@Gated` attribute to the
00021  *  module's XDC spec file.  A "gated" module is assigned a module-level gate
00022  *  at the configuration time, and that gate is then used to protect critical
00023  *  sections in the module's target code. A module-level gate is an instance of
00024  *  a module implementing `{@link IGateProvider}` interface. However, gated
00025  *  modules do not access their module-level gates directly. They use this
00026  *  module to access transparently their module-level gate.
00027  *
00028  *  Application code that is not a part of any module also has a
00029  *  module-level gate, configured through the module `{@link Main}`.
00030  *
00031  *  Each gated module can optionally create gates on an adhoc basis at
00032  *  runtime using the same gate module that was used to create the module
00033  *  level gate.
00034  *
00035  *  Gates that work by disabling all preemption while inside a gate can be
00036  *  used to protect data structures accessed by ISRs and other
00037  *  threads.  But, if the time required to update the data structure is not
00038  *  a small constant, this type of gate may violate a system's real-time
00039  *  requirements.
00040  *
00041  *  Gates have two orthogonal attributes: "blocking" and "preemptible".
00042  *  In general, gates that are "blocking" can not be use by code that is
00043  *  called by ISRs and gates that are not "preemptible" should only be used to
00044  *  to protect data manipulated by code that has small constant execution
00045  *  time.
00046  *
00047  *
00048  *  @ver        02.00.00.68_beta1
00049  *  
00050  *  ============================================================================
00051  *  
00052  *  Copyright (c) 2008-2009, Texas Instruments Incorporated
00053  *
00054  *  Redistribution and use in source and binary forms, with or without
00055  *  modification, are permitted provided that the following conditions
00056  *  are met:
00057  *  
00058  *  *  Redistributions of source code must retain the above copyright
00059  *     notice, this list of conditions and the following disclaimer.
00060  *  
00061  *  *  Redistributions in binary form must reproduce the above copyright
00062  *     notice, this list of conditions and the following disclaimer in the
00063  *     documentation and/or other materials provided with the distribution.
00064  *  
00065  *  *  Neither the name of Texas Instruments Incorporated nor the names of
00066  *     its contributors may be used to endorse or promote products derived
00067  *     from this software without specific prior written permission.
00068  *  
00069  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00070  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00071  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00072  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00073  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00074  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00075  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00076  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00077  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00078  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00079  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00080  *  Contact information for paper mail:
00081  *  Texas Instruments
00082  *  Post Office Box 655303
00083  *  Dallas, Texas 75265
00084  *  Contact information: 
00085  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
00086  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
00087  *  ============================================================================
00088  *  
00089  */
00090 
00091 
00092 #ifndef GATE_H_0xAF6F
00093 #define GATE_H_0xAF6F
00094 
00095 #include <ti/syslink/utils/IGateProvider.h>
00096 
00097 #if defined (__cplusplus)
00098 extern "C" {
00099 #endif
00100 
00101 extern IGateProvider_Handle Gate_systemHandle;
00102 
00103 /* =============================================================================
00104  *  APIs
00105  * =============================================================================
00106  */
00107 /* Function to enter a Gate */
00108 IArg  Gate_enterSystem (void);
00109 
00110 /* Function to leave a Gate */
00111 Void Gate_leaveSystem (IArg key);
00112 
00113 #if defined (__cplusplus)
00114 }
00115 #endif /* defined (__cplusplus) */
00116 
00117 #endif /* GATE_H_0xAF6F */

Generated on Mon Mar 14 11:59:45 2011 for Syslink by  doxygen 1.4.4