00001 /** ============================================================================ 00002 * @file mpcsdefs.h 00003 * 00004 * @path $(DSPLINK)/dsp/inc/ 00005 * 00006 * @brief Global definitions for MPCS module. 00007 * 00008 * @ver 1.65.00.03 00009 * ============================================================================ 00010 * @copyright Copyright (C) 2002-2009, Texas Instruments Incorporated - 00011 * http://www.ti.com/ 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions 00015 * are met: 00016 * 00017 * * Redistributions of source code must retain the above copyright 00018 * notice, this list of conditions and the following disclaimer. 00019 * 00020 * * Redistributions in binary form must reproduce the above copyright 00021 * notice, this list of conditions and the following disclaimer in the 00022 * documentation and/or other materials provided with the distribution. 00023 * 00024 * * Neither the name of Texas Instruments Incorporated nor the names of 00025 * its contributors may be used to endorse or promote products derived 00026 * from this software without specific prior written permission. 00027 * 00028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00029 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00030 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00031 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00032 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00035 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00036 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00037 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00038 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 * ============================================================================ 00040 */ 00041 00042 00043 #if !defined (MPCSDEFS_H) 00044 #define MPCSDEFS_H 00045 00046 00047 /* ----------------------------------- DSP/BIOS LINK Headers */ 00048 #include <dsplink.h> 00049 00050 00051 #if defined (__cplusplus) 00052 extern "C" { 00053 #endif /* defined (__cplusplus) */ 00054 00055 00056 /** ============================================================================ 00057 * @const MPCS_INVALID_ID 00058 * 00059 * @brief Invalid value for identifier(s) used by the MPCS component 00060 * ============================================================================ 00061 */ 00062 #define MPCS_INVALID_ID (Uint32) -1 00063 00064 /** ============================================================================ 00065 * @const MPCS_RESV_LOCKNAME 00066 * 00067 * @brief Special reserved name prefix of the MPCS object(s) which are not 00068 * stored in the entries table of the MPCS region. 00069 * ============================================================================ 00070 */ 00071 #define MPCS_RESV_LOCKNAME "DSPLINK_MPCS_RESV" 00072 00073 /** ============================================================================ 00074 * @const MPCS_RESV_LOCKNAMELEN 00075 * 00076 * @brief String length of the special reserved name prefix of the MPCS 00077 * object(s) which are not stored in entries table of the MPCS region. 00078 * ============================================================================ 00079 */ 00080 #define MPCS_RESV_LOCKNAMELEN 17 00081 00082 00083 /** ============================================================================ 00084 * @name MPCS_Attrs 00085 * 00086 * @brief This structure defines the attributes for creation of MPCS object. 00087 * 00088 * @param poolId 00089 * ID of the pool from which the MPCS object is to be allocated. 00090 * This must be provided when the memory for the MPCS object is to 00091 * be allocated internally by the MPCS component. 00092 * ============================================================================ 00093 */ 00094 typedef struct MPCS_Attrs_tag { 00095 Uint16 poolId ; 00096 } MPCS_Attrs ; 00097 00098 /** ============================================================================ 00099 * @name MPCS_ProcObj 00100 * 00101 * @brief This structure defines an object for a single processor used by the 00102 * Multiprocessing Critical Section object. 00103 * 00104 * @param localLock 00105 * Local lock to be used for protection on specific processor. 00106 * The value stored also depends on the Operating System being used 00107 * @param flag 00108 * Flags indicating whether the shared resource is being 00109 * claimed by the processor. 00110 * @param freeObject 00111 * Contains information about whether the object was allocated 00112 * internally, and needs to be freed at the time of MPCS delete. 00113 * @param conflicts 00114 * Number of conflicts happened in MPCS Enter. 00115 * Defined only when profiling is enabled. 00116 * @param numCalls 00117 * Number of calls made to MPCS Enter. 00118 * Defined only when profiling is enabled. 00119 * @param priority 00120 * Store priority of current task in MPCS-enter. 00121 * Restore priority while exiting MPCS in MPCS_leave. 00122 * @param mpcsEntryAddr 00123 * Address of shared region MPCS_entry for debugging 00124 * ============================================================================ 00125 */ 00126 typedef struct MPCS_ProcObj_tag { 00127 Uint32 localLock ; 00128 Uint16 flag ; 00129 Uint16 freeObject ; 00130 Uint32 mpcsEntryAddr ; 00131 #if defined (DDSP_PROFILE) 00132 Uint16 conflicts ; 00133 Uint16 numCalls ; 00134 #endif 00135 #if defined (DSP_TSK_MODE) 00136 Uint32 localFlag ; 00137 #endif 00138 #if defined (DSP_SWI_MODE) 00139 Uint32 priority ; 00140 #endif 00141 } MPCS_ProcObj ; 00142 00143 /** ============================================================================ 00144 * @name MPCS_ShObj 00145 * 00146 * @brief This structure defines the shared Multiprocessor Critical Section 00147 * object, which is used for protecting a specific critical section 00148 * between multiple processors. The memory for this object is 00149 * accessible to the two processors using the MPCS object. 00150 * 00151 * @param gppMpcsObj 00152 * MPCS object for the GPP processor. 00153 * @param gppPadding 00154 * Padding for alignment, depending on the platform. 00155 * @param dspMpcsObj 00156 * MPCS object for the DSP processor. 00157 * @param dspPadding 00158 * Padding for alignment, depending on the platform. 00159 * @param localFlag 00160 * Flag is used to identify the SEM object created during 00161 * MPCS create phase or open phase 00162 * @param turn 00163 * Indicates the processor that owns the turn to enter the critical 00164 * section. 00165 * @param padding 00166 * Padding for alignment, depending on the platform. 00167 * ============================================================================ 00168 */ 00169 typedef struct MPCS_ShObj_tag { 00170 volatile MPCS_ProcObj gppMpcsObj ; 00171 ADD_PADDING (gppPadding, MPCSOBJ_PROC_PADDING) 00172 volatile MPCS_ProcObj dspMpcsObj ; 00173 /*Padding required for alignment of MPCS object for L2 cache in 16-bit 00174 words.*/ 00175 ADD_PADDING (dspPadding, MPCSOBJ_PROC_PADDING) 00176 volatile Uint16 turn ; 00177 ADD_PADDING (padding, MPCS_TURN_PADDING) 00178 } MPCS_ShObj ; 00179 00180 /** ============================================================================ 00181 * @name MPCS_Obj 00182 * 00183 * @brief Multiprocessor Critical Section object, which is used for protecting 00184 * a specific critical section between multiple processors. 00185 * For the DSP-side, this is the same as the shared MPCS object. 00186 * ============================================================================ 00187 */ 00188 typedef MPCS_ShObj MPCS_Obj ; 00189 00190 /** ============================================================================ 00191 * @name MPCS_Handle 00192 * 00193 * @brief Handle to the MPCS object. 00194 * ============================================================================ 00195 */ 00196 typedef MPCS_Obj * MPCS_Handle ; 00197 00198 /** ============================================================================ 00199 * @name MPCS_Entry 00200 * 00201 * @brief Global entry structure for an MPCS object. Every MPCS object in the 00202 * system is identified through information present in the entry 00203 * structure. 00204 * 00205 * @param ownerProcId 00206 * ID of the processor that created the MPCS object. 00207 * @param poolId 00208 * ID of the pool used to allocate the MPCS object. 00209 * @param physAddress 00210 * Physical address of the MPCS object. 00211 * @param name 00212 * Unique system wide name used for identifying the MPCS object. 00213 * @param padding 00214 * Padding for alignment, depending on the platform. 00215 * ============================================================================ 00216 */ 00217 typedef struct MPCS_Entry_tag { 00218 Uint16 ownerProcId ; 00219 Uint16 poolId ; 00220 Ptr physAddress ; 00221 Char name [DSP_MAX_STRLEN] ; 00222 ADD_PADDING (padding, MPCS_ENTRY_PADDING) 00223 } MPCS_Entry ; 00224 00225 00226 /** ============================================================================ 00227 * @name MPCS_Ctrl 00228 * 00229 * @brief This structure defines the control structure required by the 00230 * MPCS component. It contains information about all MPCS objects 00231 * shared between the GPP and a specific DSP. 00232 * 00233 * @param isInitialized 00234 * Indicates whether the MPCS region has been initialized. 00235 * @param dspId 00236 * ID of the DSP with which the MPCS region is shared. 00237 * @param maxEntries 00238 * Maximum number of MPCS instances supported by the MPCS. 00239 * @param ipsId 00240 * ID of the IPS to be used (if any). A value of -1 indicates that 00241 * no IPS is required by the MPCS. 00242 * @param ipsEventNo 00243 * IPS Event number associated with MPCS (if any). A value of -1 00244 * indicates that no IPS is required by the MPCS. 00245 * @param dspAddrEntry 00246 * Pointer to array in DSP address space of MPCS objects that can 00247 * be created. 00248 * @param padding 00249 * Padding for alignment, depending on the platform. 00250 * @param lockObj 00251 * MPCS lock object to provide mutually exclusive access to the 00252 * MPCS region. 00253 * ============================================================================ 00254 */ 00255 typedef struct MPCS_Ctrl_tag { 00256 Uint32 isInitialized ; 00257 Uint32 dspId ; 00258 Uint32 maxEntries ; 00259 Uint32 ipsId ; 00260 Uint32 ipsEventNo ; 00261 MPCS_Entry * dspAddrEntry ; 00262 ADD_PADDING (padding, MPCS_CTRL_PADDING) 00263 MPCS_ShObj lockObj ; 00264 } MPCS_Ctrl ; 00265 00266 00267 #if defined (__cplusplus) 00268 } 00269 #endif /* defined (__cplusplus) */ 00270 00271 00272 #endif /* if !defined (MPCSDEFS_H) */