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 
00049 #ifndef Engine_
00050 #define Engine_
00051 
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 
00057 #include <ti/sdo/ce/Server.h>
00058 #include <ti/sdo/ce/ipc/Comm.h>
00059 #include <ti/xdais/ialg.h>
00060 #include <ti/sdo/ce/node/node.h>
00061 
00062 #include <stddef.h> /* def of size_t */
00063 #include <stdio.h>  /* def of FILE * */
00064 
00067 
00076 #define Engine_MODNAME "ti.sdo.ce.Engine"
00077 
00081 typedef struct Engine_Obj *Engine_Handle;
00082 
00086 typedef Int Engine_Error;
00087 
00088 #define Engine_EOK          0   
00089 #define Engine_EEXIST       1   
00090 #define Engine_ENOMEM       2   
00091 #define Engine_EDSPLOAD     3   
00092 #define Engine_ENOCOMM      4   
00095 #define Engine_ENOSERVER    5   
00096 #define Engine_ECOMALLOC    6   
00097 #define Engine_ERUNTIME     7   
00098 #define Engine_ECODECCREATE 8   
00099 #define Engine_ECODECSTART  9   
00104 #define Engine_EINVAL       10  
00105 #define Engine_EBADSERVER   11  
00106 #define Engine_ENOTAVAIL    12  
00107 #define Engine_EWRONGSTATE  13  
00108 #define Engine_EINUSE       14  
00111 #define Engine_ENOTFOUND    15  
00112 #define Engine_ETIMEOUT     16  
00119 typedef struct Engine_NodeObj *Engine_Node;
00120 
00124 #define Engine_FOREVER Comm_FOREVER
00125 
00133 typedef struct Engine_Attrs {
00134     String procId;  
00138 } Engine_Attrs;
00139 
00145 typedef struct Engine_AlgInfo {
00146     Int         algInfoSize;    
00147     String      name;           
00148     String      *typeTab;       
00149     Bool        isLocal;        
00150 } Engine_AlgInfo;
00151 
00155 extern Engine_Attrs Engine_ATTRS;    
00159 typedef Int Engine_Ctrl;
00160 
00161 #define Engine_CEXIT    0
00162 #define Engine_MAXSEGNAMELENGTH 32
00163 
00169 typedef enum Engine_CachedMemType {
00170     Engine_USECACHEDMEM_DEFAULT = -1,  
00171     Engine_USECACHEDMEM_NONCACHED = 0, 
00172     Engine_USECACHEDMEM_CACHED = 1     
00173 } Engine_CachedMemType;
00174 
00175 
00176 /*
00177  *  ======== Engine_AlgDesc ========
00178  */
00179 typedef struct Engine_AlgDesc {
00180     String      name;           
00181     NODE_Uuid   uuid;           
00182     IALG_Fxns   *fxns;          
00183     Ptr         idmaFxns;       
00184     String      *typeTab;       
00185     Bool        isLocal;        
00186     Int         groupId;        
00187     Int         rpcProtocolVersion; 
00188     Ptr         iresFxns;       
00189     Void        *codecClassConfig; 
00190     Engine_CachedMemType memType;  
00191 } Engine_AlgDesc;
00192 
00198 #define Engine_GETALGDESCFXN  "GetEngineAlgDesc"
00199 
00200 /*
00201  *  ======== Engine_DllAlgDesc ========
00202  *  An alg that will be dynamically loaded must have a descriptor of this type.
00203  */
00211 typedef struct Engine_DllAlgDesc {
00215     NODE_Uuid   uuid;
00216 
00220     IALG_Fxns   *fxns;
00221 
00226     Ptr         idmaFxns;
00227 
00239     String      *typeTab;
00240 
00245     Ptr         iresFxns;
00246 
00252     Void        *codecClassConfig;
00253 } Engine_DllAlgDesc;
00254 
00255 
00256 /*
00257  *  ======== Engine_GetAlgDescFxn ========
00258  *  A dynamically loaded codec library must supply a function of this type to
00259  *  get properties of the library's algorithm.
00260  */
00270 typedef Int (*Engine_GetAlgDescFxn)(Engine_DllAlgDesc *dllAlgDesc);
00271 
00272 /*
00273  *  ======== Engine_DllAlgParams ========
00274  *  Dynamically loaded algorithm parameters to pass to Engine_addAlg().
00275  */
00282 typedef struct Engine_DllAlgParams {
00283     String      name;           
00284     Bool        isLocal;        
00285     Int         groupId;        
00286 } Engine_DllAlgParams;
00287 
00288 
00291 /*
00292  *  ======== Engine_AlgCreateAttrs ========
00293  */
00294 typedef struct Engine_AlgCreateAttrs {
00295     Bool            useExtHeap; 
00300     Int             priority;   
00302 } Engine_AlgCreateAttrs;
00303 
00304 /*
00305  *  ======== Engine_Desc ========
00306  */
00307 typedef struct Engine_Desc {
00308     String          name;       
00309     Engine_AlgDesc  *algTab;    
00310     String          remoteName; 
00311     String          linkCfg;    
00312     Int             numAlgs;    
00313     Int             heapId;     
00314 } Engine_Desc;
00315 
00316 /*
00317  *  ======== Engine_Config ========
00318  */
00319 typedef struct Engine_Config {
00320     Engine_Desc *engineTab;
00321     String      localEngine;
00322 } Engine_Config;
00323 
00324 /*
00325  *  ======== Engine_MemStat ========
00326  *  This structure must match Server_MemStat.
00327  */
00328 typedef struct Engine_MemStat {
00329     Char   name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
00330     Uint32 base;           /* Base address of memory segment */
00331     Uint32 size;           /* Original size of the memory segment. */
00332     Uint32 used;           /* Number of bytes used. */
00333     Uint32 maxBlockLen;    /* Size of the largest contiguous free block. */
00334 } Engine_MemStat;
00335 
00336 /* Default alg create attributes */
00337 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
00338 
00339 /*
00340  *  ======== Engine_config ========
00341  */
00342 extern Engine_Config Engine_config;
00343 
00347 /*
00348  *  ======== Engine_add ========
00349  *  TODO: Engine_Desc has a heapId for engine allocs. Should we add this?
00350  */
00372 extern Engine_Error Engine_add(String engineName, String remoteName);
00373 
00374 /*
00375  *  ======== Engine_addAlg ========
00376  */
00403 extern Engine_Error Engine_addAlg(Engine_Handle engine,
00404         String location, Engine_DllAlgParams *pAlgParams);
00405 
00406 /*
00407  *  ======== Engine_removeAlg ========
00408  */
00424 extern Engine_Error Engine_removeAlg(Engine_Handle engine, String name);
00425 
00428 /*
00429  *  ======== Engine_call ========
00430  */
00431 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
00432 
00433 /*
00434  *  ======== Engine_callAsync ========
00435  */
00436 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
00437 
00438 /*
00439  *  ======== Engine_callWait ========
00440  */
00441 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
00442 
00443 /*
00444  *  ======== Engine_ctrlNode ========
00445  */
00446 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
00447 
00450 /*
00451  *  ======== Engine_close ========
00452  */
00467 extern Void Engine_close(Engine_Handle engine);
00468 
00470 /*
00471  *  ======== Engine_createNode ========
00472  */
00498 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
00499     size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
00500 
00501 
00502 /*
00503  *  ======== Engine_createNode2 ========
00504  */
00535 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
00536     size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
00537     Engine_AlgCreateAttrs *attrs);
00538 
00539 
00540 /*
00541  *  ======== Engine_deleteNode ========
00542  */
00543 extern Void Engine_deleteNode(Engine_Node node);
00544 
00545 /*
00546  *  ======== Engine_getAlgMemRecs ========
00547  */
00561 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
00562         Int *numRecs);
00563 
00564 /*
00565  *  ======== Engine_getAlgNumRecs ========
00566  */
00578 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
00579 
00580 /*
00581  *  ======== Engine_getConstName ========
00582  */
00583 extern String Engine_getConstName(Engine_Handle engine, String name,
00584     String type);
00585 
00586 /*
00587  *  ======== Engine_getFxns ========
00588  */
00589 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type,
00590         Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId,
00591         Engine_CachedMemType *memType);
00592 
00593 /*
00594  *  ======== Engine_getMemId ========
00595  */
00596 extern Int Engine_getMemId(Engine_Handle engine);
00597 
00598 /*
00599  *  ======== Engine_getLocalEngine ========
00600  */
00601 extern Engine_Handle Engine_getLocalEngine(Void);
00602 
00603 /*
00604  *  ======== Engine_getEngine ========
00605  */
00606 extern Engine_Handle Engine_getEngine(Engine_Node node);
00607 
00608 /*
00609  *  ======== Engine_getMemStat ========
00610  */
00611 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
00612     Engine_MemStat *stat);
00613 
00614 /*
00615  *  ======== Engine_getNumMemSegs ========
00616  */
00617 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
00618 
00619 /*
00620  *  ======== Engine_getProcId ========
00621  */
00622 extern String Engine_getProcId(Engine_Handle engine);
00623 
00624 /*
00625  *  ======== Engine_hasServer ========
00626  */
00627 extern Bool Engine_hasServer(Engine_Handle engine);
00628 
00629 /*
00630  *  ======== Engine_init ========
00631  */
00632 extern Void Engine_init(Void);
00633 
00634 /*
00635  *  ======== Engine_getRemoteVisa ========
00636  */
00637 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
00638 
00639 /*
00640  *  ======== Engine_getCodecClassConfig ========
00641  */
00642 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
00643     String type);
00644 
00645 /*
00646  *  ======== Engine_getNodeQueues ========
00647  */
00648 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut);
00649 
00650 /*
00651  *  ======== Engine_redefineHeap ========
00652  */
00653 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
00654         Uint32 base, Uint32 size);
00655 
00656 /*
00657  *  ======== Engine_releaseTraceToken ========
00658  */
00659 extern Bool Engine_releaseTraceToken(Server_Handle server);
00660 
00661 /*
00662  *  ======== Engine_requestTraceToken ========
00663  */
00664 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
00665 
00666 /*
00667  *  ======== Engine_restoreHeap ========
00668  */
00669 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
00670 
00673 /*
00674  *  ======== Engine_open ========
00675  */
00718 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
00719     Engine_Error *ec);
00720 
00721 /*
00722  *  ======== Engine_fwriteTrace ========
00723  */
00749 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
00750 
00751 /*
00752  *  ======== Engine_getAlgInfo ========
00753  */
00788 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
00789         Int index);
00790 
00791 /*
00792  *  ======== Engine_getCpuLoad ========
00793  */
00822 extern Int Engine_getCpuLoad(Engine_Handle engine);
00823 
00824 /*
00825  *  ======== Engine_getLastError ========
00826  */
00838 extern Engine_Error Engine_getLastError(Engine_Handle engine);
00839 
00840 /*
00841  *  ======== Engine_getName ========
00842  */
00851 extern String Engine_getName(Engine_Handle engine);
00852 
00853 
00854 /*
00855  *  ======== Engine_getNumAlgs ========
00856  */
00880 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
00881 
00882 /*
00883  *  ======== Engine_getServer ========
00884  */
00899 extern Server_Handle Engine_getServer(Engine_Handle engine);
00900 
00901 
00902 /*
00903  *  ======== Engine_getUsedMem ========
00904  */
00931 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
00932 
00933 
00934 /*
00935  *  ======== Engine_remove ========
00936  */
00951 extern Engine_Error Engine_remove(String engineName);
00952 
00953 
00954 /*
00955  *  ======== Engine_setTrace ========
00956  */
00976 extern Int Engine_setTrace(Engine_Handle engine, String mask);
00977 
00980 #ifdef __cplusplus
00981 }
00982 #endif
00983 
00984 #endif
00985 /*
00986  *  @(#) ti.sdo.ce; 1, 0, 6,433; 2-9-2011 08:54:24; /db/atree/library/trees/ce/ce-q18x/src/ xlibrary
00987 
00988  */
00989 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2011, Texas Instruments Incorporated