Engine.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2012, 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 
00404 /*
00405  *  ======== Engine_Desc ========
00406  */
00414 typedef struct Engine_Desc {
00415     String name;            
00419     Engine_AlgDesc *algTab; 
00420     String remoteName;      
00430     String memMap;          
00447     Bool useExtLoader;      
00461     Int numAlgs;            
00462     Int heapId;             
00463 } Engine_Desc;
00464 
00465 
00468 /*
00469  *  ======== Engine_AlgCreateAttrs ========
00470  */
00471 typedef struct Engine_AlgCreateAttrs {
00472     Bool            useExtHeap; 
00477     Int             priority;   
00479 } Engine_AlgCreateAttrs;
00480 
00481 
00482 /*
00483  *  ======== Engine_Config ========
00484  */
00485 typedef struct Engine_Config {
00486     Engine_Desc *engineTab;
00487     String      localEngine;
00488 } Engine_Config;
00489 
00490 /*
00491  *  ======== Engine_MemStat ========
00492  *  This structure must match Server_MemStat.
00493  */
00494 typedef struct Engine_MemStat {
00495     Char   name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
00496     Uint32 base;           /* Base address of memory segment */
00497     Uint32 size;           /* Original size of the memory segment. */
00498     Uint32 used;           /* Number of bytes used. */
00499     Uint32 maxBlockLen;    /* Size of the largest contiguous free block. */
00500 } Engine_MemStat;
00501 
00502 /* Default alg create attributes */
00503 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
00504 
00505 /*
00506  *  ======== Engine_config ========
00507  */
00508 extern Engine_Config Engine_config;
00509 
00513 /*
00514  *  ======== Engine_addStubFxns ========
00515  */
00558 extern Engine_Error Engine_addStubFxns(String fxnsName, IALG_Fxns *fxns);
00559 
00560 /*
00561  *  ======== Engine_add ========
00562  */
00600 extern Engine_Error Engine_add(Engine_Desc *pDesc);
00601 
00602 /*
00603  *  ======== Engine_addAlg ========
00604  */
00697 extern Engine_Error Engine_addAlg(String name, Engine_Handle engine,
00698         String location, Engine_AlgDesc *pAlgDesc);
00699 
00700 /*
00701  *  ======== Engine_removeAlg ========
00702  */
00728 extern Engine_Error Engine_removeAlg(String name, Engine_Handle engine,
00729         String algName);
00730 
00733 /*
00734  *  ======== Engine_call ========
00735  */
00736 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
00737 
00738 /*
00739  *  ======== Engine_callAsync ========
00740  */
00741 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
00742 
00743 /*
00744  *  ======== Engine_callWait ========
00745  */
00746 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
00747 
00748 /*
00749  *  ======== Engine_ctrlNode ========
00750  */
00751 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
00752 
00755 /*
00756  *  ======== Engine_close ========
00757  */
00773 extern Void Engine_close(Engine_Handle engine);
00774 
00776 /*
00777  *  ======== Engine_createNode ========
00778  */
00804 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
00805     size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
00806 
00807 
00808 /*
00809  *  ======== Engine_createNode2 ========
00810  */
00841 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
00842     size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
00843     Engine_AlgCreateAttrs *attrs);
00844 
00845 
00846 /*
00847  *  ======== Engine_deleteNode ========
00848  */
00849 extern Void Engine_deleteNode(Engine_Node node);
00850 
00851 /*
00852  *  ======== Engine_getAlgMemRecs ========
00853  */
00867 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
00868         Int *numRecs);
00869 
00870 /*
00871  *  ======== Engine_getAlgNumRecs ========
00872  */
00884 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
00885 
00886 /*
00887  *  ======== Engine_getConstName ========
00888  */
00889 extern String Engine_getConstName(Engine_Handle engine, String name,
00890     String type);
00891 
00892 /*
00893  *  ======== Engine_getFxns ========
00894  */
00895 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type,
00896         Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId,
00897         Engine_CachedMemType *memType);
00898 
00899 /*
00900  *  ======== Engine_getMemId ========
00901  */
00902 extern Int Engine_getMemId(Engine_Handle engine);
00903 
00904 /*
00905  *  ======== Engine_getLocalEngine ========
00906  */
00907 extern Engine_Handle Engine_getLocalEngine(Void);
00908 
00909 /*
00910  *  ======== Engine_getEngine ========
00911  */
00912 extern Engine_Handle Engine_getEngine(Engine_Node node);
00913 
00914 /*
00915  *  ======== Engine_getMemStat ========
00916  */
00917 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
00918     Engine_MemStat *stat);
00919 
00920 /*
00921  *  ======== Engine_getNumMemSegs ========
00922  */
00923 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
00924 
00925 /*
00926  *  ======== Engine_getNumEngines ========
00927  */
00928 extern Int Engine_getNumEngines();
00929 
00930 /*
00931  *  ======== Engine_getProcId ========
00932  */
00933 extern String Engine_getProcId(Engine_Handle engine);
00934 
00935 /*
00936  *  ======== Engine_hasServer ========
00937  */
00938 extern Bool Engine_hasServer(Engine_Handle engine);
00939 
00940 /*
00941  *  ======== Engine_init ========
00942  */
00943 extern Void Engine_init(Void);
00944 
00945 
00948 /*
00949  *  ======== Engine_initAlgDesc ========
00950  */
00972 extern Void Engine_initAlgDesc(Engine_AlgDesc *pAlgDesc);
00973 
00974 /*
00975  *  ======== Engine_initAttrs ========
00976  */
00984 extern Void Engine_initAttrs(Engine_Attrs *pAttrs);
00985 
00986 /*
00987  *  ======== Engine_initDesc ========
00988  */
01001 extern Void Engine_initDesc(Engine_Desc *pDesc);
01002 
01005 /*
01006  *  ======== Engine_getRemoteVisa ========
01007  */
01008 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
01009 
01010 /*
01011  *  ======== Engine_getCodecClassConfig ========
01012  */
01013 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
01014     String type);
01015 
01016 /*
01017  *  ======== Engine_getNodeQueues ========
01018  */
01019 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut);
01020 
01021 
01022 /*
01023  *  ======== Engine_initFromServer ========
01024  */
01025 extern Engine_Error Engine_initFromServer(Engine_Handle engine);
01026 
01027 
01028 /*
01029  *  ======== Engine_redefineHeap ========
01030  */
01031 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
01032         Uint32 base, Uint32 size);
01033 
01034 /*
01035  *  ======== Engine_releaseTraceToken ========
01036  */
01037 extern Bool Engine_releaseTraceToken(Server_Handle server);
01038 
01039 /*
01040  *  ======== Engine_requestTraceToken ========
01041  */
01042 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
01043 
01044 /*
01045  *  ======== Engine_restoreHeap ========
01046  */
01047 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
01048 
01051 /*
01052  *  ======== Engine_open ========
01053  */
01100 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
01101         Engine_Error *ec);
01102 
01103 /*
01104  *  ======== Engine_fwriteTrace ========
01105  */
01131 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
01132 
01133 /*
01134  *  ======== Engine_getAlgInfo ========
01135  */
01170 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
01171         Int index);
01172 
01173 /*
01174  *  ======== Engine_getAlgInfo2 ========
01175  */
01224 extern Engine_Error Engine_getAlgInfo2(String name, Engine_Handle engine,
01225         Engine_AlgInfo2 *algInfo2, Int index);
01226 
01227 
01229 /*
01230  *  ======== Engine_getCpuLoad ========
01231  */
01260 extern Int Engine_getCpuLoad(Engine_Handle engine);
01261 
01265 /*
01266  *  ======== Engine_getDesc ========
01267  */
01293 extern Engine_Error Engine_getDesc(String name, Engine_Desc *desc);
01294 
01295 /*
01296  *  ======== Engine_getLastError ========
01297  */
01312 extern Engine_Error Engine_getLastError(Engine_Handle engine);
01313 
01314 /*
01315  *  ======== Engine_getName ========
01316  */
01328 extern String Engine_getName(Engine_Handle engine);
01329 
01330 
01331 /*
01332  *  ======== Engine_getNumAlgs ========
01333  */
01357 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
01358 
01359 /*
01360  *  ======== Engine_getNumAlgs2 ========
01361  */
01402 extern Engine_Error Engine_getNumAlgs2(String name, Engine_Handle engine,
01403         Int *numAlgs);
01404 
01405 /*
01406  *  ======== Engine_getServer ========
01407  */
01425 extern Server_Handle Engine_getServer(Engine_Handle engine);
01426 
01427 
01428 /*
01429  *  ======== Engine_getUsedMem ========
01430  */
01460 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
01461 
01462 
01463 /*
01464  *  ======== Engine_remove ========
01465  */
01483 extern Engine_Error Engine_remove(String engineName);
01484 
01485 
01486 /*
01487  *  ======== Engine_setDesc ========
01488  */
01526 extern Engine_Error Engine_setDesc(String name, Engine_Desc *desc);
01527 
01528 
01529 /*
01530  *  ======== Engine_setTrace ========
01531  */
01554 extern Int Engine_setTrace(Engine_Handle engine, String mask);
01555 
01556 
01559 /*
01560  *  ======== Engine_getDesc ========
01561  *  Internal for testing.
01562  */
01563 extern Engine_Desc *_Engine_getDesc(Int i);
01564 
01568 
01569 #ifdef __cplusplus
01570 }
01571 #endif
01572 
01573 #endif
01574 /*
01575  *  @(#) ti.sdo.ce; 1, 0, 6,1; 1-17-2012 23:09:32; /db/atree/library/trees/ce/ce-t03/src/ xlibrary
01576 
01577  */
01578 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2012, Texas Instruments Incorporated