00001 /** ============================================================================ 00002 * @file mpcsdefs.h 00003 * 00004 * @path $(DSPLINK)/gpp/inc/usr/ 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 #include <archdefs.h> 00050 00051 #if defined (DDSP_PROFILE) 00052 #include <profile.h> 00053 #endif 00054 00055 00056 #if defined (__cplusplus) 00057 extern "C" { 00058 #endif /* defined (__cplusplus) */ 00059 00060 00061 /** ============================================================================ 00062 * @const MPCS_INVALID_ID 00063 * 00064 * @brief Invalid value for identifier(s) used by the MPCS component 00065 * ============================================================================ 00066 */ 00067 #define MPCS_INVALID_ID (Uint32) -1l 00068 00069 /** ============================================================================ 00070 * @const MPCS_RESV_LOCKNAME 00071 * 00072 * @brief Special reserved name prefix of the MPCS object(s) which are not 00073 * stored in the entries table of the MPCS region. 00074 * ============================================================================ 00075 */ 00076 #define MPCS_RESV_LOCKNAME "DSPLINK_MPCS_RESV" 00077 00078 /** ============================================================================ 00079 * @const MPCS_RESV_LOCKNAMELEN 00080 * 00081 * @brief String length of the special reserved name prefix of the MPCS 00082 * object(s) which are not stored in entries table of the MPCS region. 00083 * ============================================================================ 00084 */ 00085 #define MPCS_RESV_LOCKNAMELEN 17u 00086 00087 00088 /** ============================================================================ 00089 * @name MPCS_Attrs 00090 * 00091 * @brief This structure defines the attributes for creation of MPCS object. 00092 * 00093 * @param poolId 00094 * ID of the pool used to allocate the MPCS object. 00095 * ============================================================================ 00096 */ 00097 typedef struct MPCS_Attrs_tag { 00098 Uint16 poolId ; 00099 } MPCS_Attrs ; 00100 00101 /** ============================================================================ 00102 * @name MPCS_ShObj 00103 * 00104 * @brief Forward declaration of MPCS_ShObj. 00105 * ============================================================================ 00106 */ 00107 typedef struct MPCS_ShObj_tag MPCS_ShObj ; 00108 00109 /** ============================================================================ 00110 * @name MPCS_Object 00111 * 00112 * @brief Forward declaration of MPCS_Object. 00113 * ============================================================================ 00114 */ 00115 typedef struct MPCS_Object_tag MPCS_Object ; 00116 00117 /** ============================================================================ 00118 * @name MPCS_Handle 00119 * 00120 * @brief Handle to the MPCS object. 00121 * ============================================================================ 00122 */ 00123 typedef Void * MPCS_Handle ; 00124 00125 00126 /** ============================================================================ 00127 * @name MPCS_ProcObj 00128 * 00129 * @brief This structure defines an object for a single processor used by the 00130 * Multiprocessing Critical Section object. 00131 * 00132 * @param localLock 00133 * Local lock to be used for protection on specific processor. 00134 * The value stored also depends on the Operating System being used 00135 * @param flag 00136 * Flags indicating whether the shared resource is being 00137 * claimed by the processor. 00138 * @param freeObject 00139 * Contains information about whether the object was allocated 00140 * internally, and needs to be freed at the time of MPCS delete. 00141 * @param conflicts 00142 * Number of conflicts happened in MPCS Enter. 00143 * Defined only when profiling is enabled. 00144 * @param numCalls 00145 * Number of calls made to MPCS Enter. 00146 * Defined only when profiling is enabled. 00147 * @param priority 00148 * Store priority of current task in MPCS-enter. 00149 * Restore priority while exiting MPCS in MPCS_leave. 00150 * @param mpcsEntryAddr 00151 * Address of shared region MPCS_entry for debugging 00152 * ============================================================================ 00153 */ 00154 typedef struct MPCS_ProcObj_tag { 00155 Uint32 localLock ; 00156 Uint16 flag ; 00157 Uint16 freeObject ; 00158 Uint32 mpcsEntryAddr ; 00159 #if defined (DDSP_PROFILE) 00160 Uint16 conflicts ; 00161 Uint16 numCalls ; 00162 #endif 00163 #if defined (GPP_TSK_MODE) 00164 Uint32 localFlag ; 00165 #endif 00166 #if defined (GPP_SWI_MODE) 00167 Uint32 priority ; 00168 #endif 00169 } MPCS_ProcObj ; 00170 00171 /** ============================================================================ 00172 * @name MPCS_ShObj_tag 00173 * 00174 * @brief This structure defines the shared Multiprocessor Critical Section 00175 * object, which is used for protecting a specific critical section 00176 * between multiple processors. The memory for this object is 00177 * accessible to the two processors using the MPCS object. 00178 * 00179 * @param gppMpcsObj 00180 * MPCS object for the GPP processor. 00181 * @param gppPadding 00182 * Padding for alignment, depending on the platform. 00183 * @param dspMpcsObj 00184 * MPCS object for the DSP processor. 00185 * @param dspPadding 00186 * Padding for alignment, depending on the platform. 00187 * @param turn 00188 * Indicates the processor that owns the turn to enter the critical 00189 * section. 00190 * @param padding 00191 * Padding for alignment, depending on the platform. 00192 * ============================================================================ 00193 */ 00194 struct MPCS_ShObj_tag { 00195 volatile MPCS_ProcObj gppMpcsObj ; 00196 ADD_PADDING (gppPadding, MPCSOBJ_PROC_PADDING) 00197 volatile MPCS_ProcObj dspMpcsObj ; 00198 ADD_PADDING (dspPadding, MPCSOBJ_PROC_PADDING) 00199 00200 volatile Uint16 turn ; 00201 ADD_PADDING (padding, MPCS_TURN_PADDING) 00202 } ; 00203 00204 /** ============================================================================ 00205 * @name MPCS_Entry 00206 * 00207 * @brief Global entry structure for an MPCS object. Every MPCS object in the 00208 * system is identified through information present in the entry 00209 * structure. 00210 * 00211 * @param ownerProcId 00212 * ID of the processor that created the MPCS object. 00213 * @param poolId 00214 * ID of the pool used to allocate the MPCS object. 00215 * @param physAddress 00216 * Physical address of the MPCS object. 00217 * @param name 00218 * Unique system wide name used for identifying the MPCS object. 00219 * @param padding 00220 * Padding for alignment, depending on the platform. 00221 * ============================================================================ 00222 */ 00223 typedef struct MPCS_Entry_tag { 00224 Uint16 ownerProcId ; 00225 Uint16 poolId ; 00226 Pvoid physAddress ; 00227 Char8 name [DSP_MAX_STRLEN] ; 00228 ADD_PADDING (padding, MPCS_ENTRY_PADDING) 00229 } MPCS_Entry ; 00230 00231 /** ============================================================================ 00232 * @name MPCS_Ctrl 00233 * 00234 * @brief This structure defines the control structure required by the 00235 * MPCS component. It contains information about all MPCS objects 00236 * shared between the GPP and a specific DSP. 00237 * 00238 * @param isInitialized 00239 * Indicates whether the MPCS region has been initialized. 00240 * @param dspId 00241 * ID of the DSP with which the MPCS region is shared. 00242 * @param maxEntries 00243 * Maximum number of MPCS instances supported by the MPCS. 00244 * @param ipsId 00245 * ID of the IPS to be used (if any). A value of -1 indicates that 00246 * no IPS is required by the MPCS. 00247 * @param ipsEventNo 00248 * IPS Event number associated with MPCS (if any). A value of -1 00249 * indicates that no IPS is required by the MPCS. 00250 * @param dspAddrEntry 00251 * Pointer to array in DSP address space of MPCS objects that can 00252 * be created. 00253 * @param padding 00254 * Padding for alignment, depending on the platform. 00255 * @param lockObj 00256 * MPCS lock object to provide mutually exclusive access to the 00257 * MPCS region. 00258 * ============================================================================ 00259 */ 00260 typedef struct MPCS_Ctrl_tag { 00261 Uint32 isInitialized ; 00262 Uint32 dspId ; 00263 Uint32 maxEntries ; 00264 Uint32 ipsId ; 00265 Uint32 ipsEventNo ; 00266 MPCS_Entry * dspAddrEntry ; 00267 ADD_PADDING (padding, MPCS_CTRL_PADDING) 00268 MPCS_ShObj lockObj ; 00269 } MPCS_Ctrl ; 00270 00271 /** ============================================================================ 00272 * @name MPCS_MemInfo 00273 * 00274 * @brief Contains memory information for the MPCS component. 00275 * 00276 * @param procId 00277 * ID of the processor with which the MPCS region is shared 00278 * @param physAddr 00279 * Physical address of the memory region for RingIO 00280 * @param kernAddr 00281 * Kernel address of the memory region for RingIO 00282 * @param userAddr 00283 * User address of the memory region for RingIO 00284 * @param size 00285 * Size of the memory region for RingIO 00286 * ============================================================================ 00287 */ 00288 typedef struct MPCS_MemInfo_tag { 00289 ProcessorId procId ; 00290 Uint32 physAddr ; 00291 Uint32 kernAddr ; 00292 Uint32 userAddr ; 00293 Uint32 size ; 00294 } MPCS_MemInfo ; 00295 00296 00297 #if defined (__cplusplus) 00298 } 00299 #endif /* defined (__cplusplus) */ 00300 00301 00302 #endif /* if !defined (MPCSDEFS_H) */