Engine.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2011, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  * 
00032  */
00033 /*
00034  *  ======== Engine.h ========
00035  */
00036 
00051 #ifndef Engine_
00052 #define Engine_
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 
00059 #include <ti/sdo/ce/Server.h>
00060 #include <ti/sdo/ce/ipc/Comm.h>
00061 #include <ti/xdais/ialg.h>
00062 #include <ti/sdo/ce/node/node.h>
00063 
00064 #include <stddef.h> /* def of size_t */
00065 #include <stdio.h>  /* def of FILE * */
00066 
00069 
00085 #define Engine_MODNAME "ti.sdo.ce.Engine"
00086 
00090 typedef struct Engine_Obj *Engine_Handle;
00091 
00095 typedef Int Engine_Error;
00096 
00097 #define Engine_EOK          0   
00098 #define Engine_EEXIST       1   
00099 #define Engine_ENOMEM       2   
00100 #define Engine_EDSPLOAD     3   
00101 #define Engine_ENOCOMM      4   
00104 #define Engine_ENOSERVER    5   
00105 #define Engine_ECOMALLOC    6   
00106 #define Engine_ERUNTIME     7   
00107 #define Engine_ECODECCREATE 8   
00108 #define Engine_ECODECSTART  9   
00113 #define Engine_EINVAL       10  
00114 #define Engine_EBADSERVER   11  
00115 #define Engine_ENOTAVAIL    12  
00116 #define Engine_EWRONGSTATE  13  
00117 #define Engine_EINUSE       14  
00120 #define Engine_ENOTFOUND    15  
00121 #define Engine_ETIMEOUT     16  
00128 typedef struct Engine_NodeObj *Engine_Node;
00129 
00133 #define Engine_FOREVER Comm_FOREVER
00134 
00143 typedef struct Engine_Attrs {
00144     String procId;  
00148 } Engine_Attrs;
00149 
00155 typedef struct Engine_AlgInfo {
00156     Int         algInfoSize;    
00157     String      name;           
00158     String      *typeTab;       
00159     Bool        isLocal;        
00160 } Engine_AlgInfo;
00161 
00174 typedef struct Engine_AlgInfo2 {
00175     Int         algInfoSize;    
00176     String      name;           
00177     String      types;          
00178     Bool        isLocal;        
00179 } Engine_AlgInfo2;
00180 
00189 extern Engine_Attrs Engine_ATTRS;    
00193 typedef Int Engine_Ctrl;
00194 
00195 #define Engine_CEXIT    0
00196 #define Engine_MAXSEGNAMELENGTH 32
00197 
00205 typedef enum Engine_CachedMemType {
00206     Engine_USECACHEDMEM_DEFAULT = -1,  
00207     Engine_USECACHEDMEM_NONCACHED = 0, 
00208     Engine_USECACHEDMEM_CACHED = 1     
00209 } Engine_CachedMemType;
00210 
00211 
00212 /*
00213  *  ======== Engine_AlgDesc ========
00214  */
00222 typedef struct Engine_AlgDesc {
00228     String      name;
00229 
00230     NODE_Uuid   uuid;   
00240     IALG_Fxns   *fxns;
00241 
00247     Ptr         idmaFxns;
00248 
00249     String      *typeTab;       
00256     Bool        isLocal;
00257 
00266     Int         groupId;
00267 
00268     Int         rpcProtocolVersion; 
00278     Ptr         iresFxns;
00279 
00283     Void        *codecClassConfig;
00284 
00300     Engine_CachedMemType memType;  
00326     String      types;
00327 } Engine_AlgDesc;
00328 
00329 
00333 #define Engine_GETALGDESCFXN  "GetEngineAlgDesc"
00334 
00335 /*
00336  *  ======== Engine_DllAlgDesc ========
00337  *  An alg that will be dynamically loaded must have a descriptor of this type.
00338  */
00346 typedef struct Engine_DllAlgDesc {
00350     IALG_Fxns   *fxns;
00351 
00356     Ptr         idmaFxns;
00357 
00362     Ptr         iresFxns;
00363 
00376     String      types;
00377 
00383     Void        *codecClassConfig;
00384 } Engine_DllAlgDesc;
00385 
00386 
00387 /*
00388  *  ======== Engine_GetAlgDescFxn ========
00389  *  A dynamically loaded codec library must supply a function of this type to
00390  *  get properties of the library's algorithm.
00391  */
00401 typedef Int (*Engine_GetAlgDescFxn)(Engine_DllAlgDesc *dllAlgDesc);
00402 
00403 
00406 /*
00407  *  ======== Engine_AlgCreateAttrs ========
00408  */
00409 typedef struct Engine_AlgCreateAttrs {
00410     Bool            useExtHeap; 
00415     Int             priority;   
00417 } Engine_AlgCreateAttrs;
00418 
00419 /*
00420  *  ======== Engine_Desc ========
00421  */
00428 typedef struct Engine_Desc {
00432     String          name;
00433 
00434     Engine_AlgDesc  *algTab;    
00441     String          remoteName;
00442 
00443     String          memMap;     
00454     Bool            useExtLoader;
00455     Int             numAlgs;    
00461     Int             heapId;
00462 } Engine_Desc;
00463 
00464 /*
00465  *  ======== Engine_Config ========
00466  */
00467 typedef struct Engine_Config {
00468     Engine_Desc *engineTab;
00469     String      localEngine;
00470 } Engine_Config;
00471 
00472 /*
00473  *  ======== Engine_MemStat ========
00474  *  This structure must match Server_MemStat.
00475  */
00476 typedef struct Engine_MemStat {
00477     Char   name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
00478     Uint32 base;           /* Base address of memory segment */
00479     Uint32 size;           /* Original size of the memory segment. */
00480     Uint32 used;           /* Number of bytes used. */
00481     Uint32 maxBlockLen;    /* Size of the largest contiguous free block. */
00482 } Engine_MemStat;
00483 
00484 /* Default alg create attributes */
00485 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
00486 
00487 /*
00488  *  ======== Engine_config ========
00489  */
00490 extern Engine_Config Engine_config;
00491 
00495 /*
00496  *  ======== Engine_addStubFxns ========
00497  */
00540 extern Engine_Error Engine_addStubFxns(String fxnsName, IALG_Fxns *fxns);
00541 
00542 /*
00543  *  ======== Engine_add ========
00544  */
00582 extern Engine_Error Engine_add(Engine_Desc *pDesc);
00583 
00584 /*
00585  *  ======== Engine_addAlg ========
00586  */
00679 extern Engine_Error Engine_addAlg(String name, Engine_Handle engine,
00680         String location, Engine_AlgDesc *pAlgDesc);
00681 
00682 /*
00683  *  ======== Engine_removeAlg ========
00684  */
00710 extern Engine_Error Engine_removeAlg(String name, Engine_Handle engine,
00711         String algName);
00712 
00715 /*
00716  *  ======== Engine_call ========
00717  */
00718 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
00719 
00720 /*
00721  *  ======== Engine_callAsync ========
00722  */
00723 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
00724 
00725 /*
00726  *  ======== Engine_callWait ========
00727  */
00728 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
00729 
00730 /*
00731  *  ======== Engine_ctrlNode ========
00732  */
00733 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
00734 
00737 /*
00738  *  ======== Engine_close ========
00739  */
00755 extern Void Engine_close(Engine_Handle engine);
00756 
00758 /*
00759  *  ======== Engine_createNode ========
00760  */
00786 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
00787     size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
00788 
00789 
00790 /*
00791  *  ======== Engine_createNode2 ========
00792  */
00823 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
00824     size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
00825     Engine_AlgCreateAttrs *attrs);
00826 
00827 
00828 /*
00829  *  ======== Engine_deleteNode ========
00830  */
00831 extern Void Engine_deleteNode(Engine_Node node);
00832 
00833 /*
00834  *  ======== Engine_getAlgMemRecs ========
00835  */
00849 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
00850         Int *numRecs);
00851 
00852 /*
00853  *  ======== Engine_getAlgNumRecs ========
00854  */
00866 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
00867 
00868 /*
00869  *  ======== Engine_getConstName ========
00870  */
00871 extern String Engine_getConstName(Engine_Handle engine, String name,
00872     String type);
00873 
00874 /*
00875  *  ======== Engine_getFxns ========
00876  */
00877 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type,
00878         Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId,
00879         Engine_CachedMemType *memType);
00880 
00881 /*
00882  *  ======== Engine_getMemId ========
00883  */
00884 extern Int Engine_getMemId(Engine_Handle engine);
00885 
00886 /*
00887  *  ======== Engine_getLocalEngine ========
00888  */
00889 extern Engine_Handle Engine_getLocalEngine(Void);
00890 
00891 /*
00892  *  ======== Engine_getEngine ========
00893  */
00894 extern Engine_Handle Engine_getEngine(Engine_Node node);
00895 
00896 /*
00897  *  ======== Engine_getMemStat ========
00898  */
00899 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
00900     Engine_MemStat *stat);
00901 
00902 /*
00903  *  ======== Engine_getNumMemSegs ========
00904  */
00905 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
00906 
00907 /*
00908  *  ======== Engine_getNumEngines ========
00909  */
00910 extern Int Engine_getNumEngines();
00911 
00912 /*
00913  *  ======== Engine_getProcId ========
00914  */
00915 extern String Engine_getProcId(Engine_Handle engine);
00916 
00917 /*
00918  *  ======== Engine_hasServer ========
00919  */
00920 extern Bool Engine_hasServer(Engine_Handle engine);
00921 
00922 /*
00923  *  ======== Engine_init ========
00924  */
00925 extern Void Engine_init(Void);
00926 
00927 
00930 /*
00931  *  ======== Engine_initAlgDesc ========
00932  */
00954 extern Void Engine_initAlgDesc(Engine_AlgDesc *pAlgDesc);
00955 
00956 /*
00957  *  ======== Engine_initAttrs ========
00958  */
00966 extern Void Engine_initAttrs(Engine_Attrs *pAttrs);
00967 
00968 /*
00969  *  ======== Engine_initDesc ========
00970  */
00983 extern Void Engine_initDesc(Engine_Desc *pDesc);
00984 
00987 /*
00988  *  ======== Engine_getRemoteVisa ========
00989  */
00990 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
00991 
00992 /*
00993  *  ======== Engine_getCodecClassConfig ========
00994  */
00995 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
00996     String type);
00997 
00998 /*
00999  *  ======== Engine_getNodeQueues ========
01000  */
01001 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut);
01002 
01003 
01004 /*
01005  *  ======== Engine_initFromServer ========
01006  */
01007 extern Engine_Error Engine_initFromServer(Engine_Handle engine);
01008 
01009 
01010 /*
01011  *  ======== Engine_redefineHeap ========
01012  */
01013 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
01014         Uint32 base, Uint32 size);
01015 
01016 /*
01017  *  ======== Engine_releaseTraceToken ========
01018  */
01019 extern Bool Engine_releaseTraceToken(Server_Handle server);
01020 
01021 /*
01022  *  ======== Engine_requestTraceToken ========
01023  */
01024 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
01025 
01026 /*
01027  *  ======== Engine_restoreHeap ========
01028  */
01029 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
01030 
01033 /*
01034  *  ======== Engine_open ========
01035  */
01082 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
01083         Engine_Error *ec);
01084 
01085 /*
01086  *  ======== Engine_fwriteTrace ========
01087  */
01113 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
01114 
01115 /*
01116  *  ======== Engine_getAlgInfo ========
01117  */
01152 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
01153         Int index);
01154 
01155 /*
01156  *  ======== Engine_getAlgInfo2 ========
01157  */
01206 extern Engine_Error Engine_getAlgInfo2(String name, Engine_Handle engine,
01207         Engine_AlgInfo2 *algInfo2, Int index);
01208 
01209 
01211 /*
01212  *  ======== Engine_getCpuLoad ========
01213  */
01242 extern Int Engine_getCpuLoad(Engine_Handle engine);
01243 
01247 /*
01248  *  ======== Engine_getDesc ========
01249  */
01275 extern Engine_Error Engine_getDesc(String name, Engine_Desc *desc);
01276 
01277 /*
01278  *  ======== Engine_getLastError ========
01279  */
01294 extern Engine_Error Engine_getLastError(Engine_Handle engine);
01295 
01296 /*
01297  *  ======== Engine_getName ========
01298  */
01310 extern String Engine_getName(Engine_Handle engine);
01311 
01312 
01313 /*
01314  *  ======== Engine_getNumAlgs ========
01315  */
01339 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
01340 
01341 /*
01342  *  ======== Engine_getNumAlgs2 ========
01343  */
01384 extern Engine_Error Engine_getNumAlgs2(String name, Engine_Handle engine,
01385         Int *numAlgs);
01386 
01387 /*
01388  *  ======== Engine_getServer ========
01389  */
01407 extern Server_Handle Engine_getServer(Engine_Handle engine);
01408 
01409 
01410 /*
01411  *  ======== Engine_getUsedMem ========
01412  */
01442 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
01443 
01444 
01445 /*
01446  *  ======== Engine_remove ========
01447  */
01465 extern Engine_Error Engine_remove(String engineName);
01466 
01467 
01468 /*
01469  *  ======== Engine_setDesc ========
01470  */
01508 extern Engine_Error Engine_setDesc(String name, Engine_Desc *desc);
01509 
01510 
01511 /*
01512  *  ======== Engine_setTrace ========
01513  */
01536 extern Int Engine_setTrace(Engine_Handle engine, String mask);
01537 
01538 
01541 /*
01542  *  ======== Engine_getDesc ========
01543  *  Internal for testing.
01544  */
01545 extern Engine_Desc *_Engine_getDesc(Int i);
01546 
01550 
01551 #ifdef __cplusplus
01552 }
01553 #endif
01554 
01555 #endif
01556 /*
01557  *  @(#) ti.sdo.ce; 1, 0, 6,474; 12-2-2011 14:50:30; /db/atree/library/trees/ce/ce-s25x/src/ xlibrary
01558 
01559  */
01560 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2011, Texas Instruments Incorporated