00001 00037 /* 00038 * ============================================================================ 00039 * 00040 * Copyright (c) 2008-2012, Texas Instruments Incorporated 00041 * 00042 * Redistribution and use in source and binary forms, with or without 00043 * modification, are permitted provided that the following conditions 00044 * are met: 00045 * 00046 * * Redistributions of source code must retain the above copyright 00047 * notice, this list of conditions and the following disclaimer. 00048 * 00049 * * Redistributions in binary form must reproduce the above copyright 00050 * notice, this list of conditions and the following disclaimer in the 00051 * documentation and/or other materials provided with the distribution. 00052 * 00053 * * Neither the name of Texas Instruments Incorporated nor the names of 00054 * its contributors may be used to endorse or promote products derived 00055 * from this software without specific prior written permission. 00056 * 00057 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00058 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00059 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00060 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00061 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00062 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00063 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00064 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00065 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00066 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00067 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00068 * Contact information for paper mail: 00069 * Texas Instruments 00070 * Post Office Box 655303 00071 * Dallas, Texas 75265 00072 * Contact information: 00073 * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm? 00074 * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact 00075 * ============================================================================ 00076 * 00077 */ 00078 00079 00080 00081 #ifndef __IGATEPROVIDER_H__ 00082 #define __IGATEPROVIDER_H__ 00083 00084 #include <ti/syslink/utils/Trace.h> 00085 00086 #if defined (__cplusplus) 00087 extern "C" { 00088 #endif 00089 00090 00091 /* ----------------------------------------------------------------------------- 00092 * Macros 00093 * ----------------------------------------------------------------------------- 00094 */ 00096 #define IGateProvider_NULL (IGateProvider_Handle)0xFFFFFFFF 00097 00105 #define IGateProvider_Q_BLOCKING 1 00106 00114 #define IGateProvider_Q_PREEMPTING 2 00115 00120 #define IGateProvider_SuperObject \ 00121 IGateProvider_ENTER enter; \ 00122 IGateProvider_LEAVE leave 00123 00124 00128 #define IGateProvider_ObjectInitializer(x,y) \ 00129 ((IGateProvider_Handle)(x))->enter = (IGateProvider_ENTER)y##_enter; \ 00130 ((IGateProvider_Handle)(x))->leave = (IGateProvider_LEAVE)y##_leave; 00131 00132 /* ----------------------------------------------------------------------------- 00133 * Defines 00134 * ----------------------------------------------------------------------------- 00135 */ 00137 typedef IArg (*IGateProvider_ENTER) (Void *); 00138 00140 typedef Void (*IGateProvider_LEAVE) (Void *, IArg); 00141 00142 00143 /* ----------------------------------------------------------------------------- 00144 * Structs & Enums 00145 * ----------------------------------------------------------------------------- 00146 */ 00150 typedef struct IGateProvider_Object { 00151 IGateProvider_SuperObject; 00152 } IGateProvider_Object, *IGateProvider_Handle; 00153 00154 00155 /* ----------------------------------------------------------------------------- 00156 * APIs 00157 * ----------------------------------------------------------------------------- 00158 */ 00179 static inline IArg IGateProvider_enter (IGateProvider_Handle handle) 00180 { 00181 IArg key = 0; 00182 00183 GT_assert (curTrace, ((IGateProvider_Object *) handle != NULL)); 00184 if (handle != 0x0 && handle != IGateProvider_NULL) { //fix 00185 key = (handle->enter) ((void *)handle); 00186 } 00187 return key; 00188 } 00189 00190 00207 static inline Void IGateProvider_leave (IGateProvider_Handle handle, IArg key) 00208 { 00209 GT_assert (curTrace, ((IGateProvider_Object *) handle != NULL)); 00210 if (handle != 0x0 && handle != IGateProvider_NULL) //fix 00211 (handle->leave) ((void *)handle, key); 00212 } 00213 00214 00215 #if defined (__cplusplus) 00216 } 00217 #endif /* defined (__cplusplus) */ 00218 00219 00220 #endif /* ifndef __IGATEPROVIDER_H__ */ 00221