Engine.h

Go to the documentation of this file.
00001 /* 
00002  * Copyright (c) 2010, 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 
00071 #define Engine_GTNAME "CE"
00072 
00076 typedef struct Engine_Obj *Engine_Handle;
00077 
00081 typedef Int Engine_Error;
00082 
00083 #define Engine_EOK          0   
00084 #define Engine_EEXIST       1   
00085 #define Engine_ENOMEM       2   
00086 #define Engine_EDSPLOAD     3   
00087 #define Engine_ENOCOMM      4   
00090 #define Engine_ENOSERVER    5   
00091 #define Engine_ECOMALLOC    6   
00092 #define Engine_ERUNTIME     7   
00093 #define Engine_ECODECCREATE 8   
00094 #define Engine_ECODECSTART  9   
00099 #define Engine_EINVAL       10  
00100 #define Engine_EBADSERVER   11  
00101 #define Engine_ENOTAVAIL    12  
00102 #define Engine_EWRONGSTATE  13  
00103 #define Engine_EINUSE       14  
00106 #define Engine_ENOTFOUND    15  
00107 #define Engine_ETIMEOUT     16  
00114 typedef struct Engine_NodeObj *Engine_Node;
00115 
00119 #define Engine_FOREVER Comm_FOREVER
00120 
00128 typedef struct Engine_Attrs {
00129     String procId;  
00133 } Engine_Attrs;
00134 
00140 typedef struct Engine_AlgInfo {
00141     Int         algInfoSize;    
00142     String      name;           
00143     String      *typeTab;       
00144     Bool        isLocal;        
00145 } Engine_AlgInfo;
00146 
00150 extern Engine_Attrs Engine_ATTRS;    
00154 typedef Int Engine_Ctrl;
00155 
00156 #define Engine_CEXIT    0
00157 #define Engine_MAXSEGNAMELENGTH 32
00158 
00164 typedef enum Engine_CachedMemType {
00165     Engine_USECACHEDMEM_DEFAULT = -1,  
00166     Engine_USECACHEDMEM_NONCACHED = 0, 
00167     Engine_USECACHEDMEM_CACHED = 1     
00168 } Engine_CachedMemType;
00169 
00170 
00171 /*
00172  *  ======== Engine_AlgDesc ========
00173  */
00174 typedef struct Engine_AlgDesc {
00175     String      name;           
00176     NODE_Uuid   uuid;           
00177     IALG_Fxns   *fxns;          
00178     Ptr         idmaFxns;       
00179     String      *typeTab;       
00180     Bool        isLocal;        
00181     Int         groupId;        
00182     Int         rpcProtocolVersion; 
00183     Ptr         iresFxns;       
00184     Void        *codecClassConfig; 
00185     Engine_CachedMemType memType;  
00186 } Engine_AlgDesc;
00187 
00188 /*
00189  *  ======== Engine_AlgCreateAttrs ========
00190  */
00191 typedef struct Engine_AlgCreateAttrs {
00192     Bool            useExtHeap; 
00197     Int             priority;   
00199 } Engine_AlgCreateAttrs;
00200 
00201 /*
00202  *  ======== Engine_Desc ========
00203  */
00204 typedef struct Engine_Desc {
00205     String          name;       
00206     Engine_AlgDesc  *algTab;    
00207     String          remoteName; 
00208     String          linkCfg;    
00209     Int             numAlgs;    
00211 } Engine_Desc;
00212 
00213 /*
00214  *  ======== Engine_Config ========
00215  */
00216 typedef struct Engine_Config {
00217     Engine_Desc *engineTab;
00218     String      localEngine;
00219 } Engine_Config;
00220 
00221 /*
00222  *  ======== Engine_MemStat ========
00223  *  This structure must match Server_MemStat.
00224  */
00225 typedef struct Engine_MemStat {
00226     Char   name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
00227     Uint32 base;           /* Base address of memory segment */
00228     Uint32 size;           /* Original size of the memory segment. */
00229     Uint32 used;           /* Number of bytes used. */
00230     Uint32 maxBlockLen;    /* Size of the largest contiguous free block. */
00231 } Engine_MemStat;
00232 
00233 /* Default alg create attributes */
00234 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
00235 
00236 /*
00237  *  ======== Engine_config ========
00238  */
00239 extern Engine_Config Engine_config;
00240 
00241 /*
00242  *  ======== Engine_call ========
00243  */
00244 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
00245 
00246 /*
00247  *  ======== Engine_callAsync ========
00248  */
00249 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
00250 
00251 /*
00252  *  ======== Engine_callWait ========
00253  */
00254 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
00255 
00256 /*
00257  *  ======== Engine_ctrlNode ========
00258  */
00259 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
00260 
00263 /*
00264  *  ======== Engine_close ========
00265  */
00280 extern Void Engine_close(Engine_Handle engine);
00281 
00283 /*
00284  *  ======== Engine_createNode ========
00285  */
00311 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
00312     size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
00313 
00314 
00315 /*
00316  *  ======== Engine_createNode2 ========
00317  */
00348 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
00349     size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
00350     Engine_AlgCreateAttrs *attrs);
00351 
00352 
00353 /*
00354  *  ======== Engine_deleteNode ========
00355  */
00356 extern Void Engine_deleteNode(Engine_Node node);
00357 
00358 /*
00359  *  ======== Engine_getAlgMemRecs ========
00360  */
00374 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
00375         Int *numRecs);
00376 
00377 /*
00378  *  ======== Engine_getAlgNumRecs ========
00379  */
00391 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
00392 
00393 /*
00394  *  ======== Engine_getConstName ========
00395  */
00396 extern String Engine_getConstName(Engine_Handle engine, String name,
00397     String type);
00398 
00399 /*
00400  *  ======== Engine_getFxns ========
00401  */
00402 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type,
00403         Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId,
00404         Engine_CachedMemType *memType);
00405 
00406 /*
00407  *  ======== Engine_getMemId ========
00408  */
00409 extern Int Engine_getMemId(Engine_Handle engine);
00410 
00411 /*
00412  *  ======== Engine_getLocalEngine ========
00413  */
00414 extern Engine_Handle Engine_getLocalEngine(Void);
00415 
00416 /*
00417  *  ======== Engine_getEngine ========
00418  */
00419 extern Engine_Handle Engine_getEngine(Engine_Node node);
00420 
00421 /*
00422  *  ======== Engine_getMemStat ========
00423  */
00424 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
00425     Engine_MemStat *stat);
00426 
00427 /*
00428  *  ======== Engine_getNumMemSegs ========
00429  */
00430 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
00431 
00432 /*
00433  *  ======== Engine_hasServer ========
00434  */
00435 extern Bool Engine_hasServer(Engine_Handle engine);
00436 
00437 /*
00438  *  ======== Engine_init ========
00439  */
00440 extern Void Engine_init(Void);
00441 
00442 /*
00443  *  ======== Engine_getRemoteVisa ========
00444  */
00445 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
00446 
00447 /*
00448  *  ======== Engine_getCodecClassConfig ========
00449  */
00450 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
00451     String type);
00452 
00453 /*
00454  *  ======== Engine_getNodeQueues ========
00455  */
00456 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Queue *stdIn,
00457         Comm_Queue *stdOut);
00458 
00459 /*
00460  *  ======== Engine_redefineHeap ========
00461  */
00462 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
00463         Uint32 base, Uint32 size);
00464 
00465 /*
00466  *  ======== Engine_releaseTraceToken ========
00467  */
00468 extern Bool Engine_releaseTraceToken(Server_Handle server);
00469 
00470 /*
00471  *  ======== Engine_requestTraceToken ========
00472  */
00473 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
00474 
00475 /*
00476  *  ======== Engine_restoreHeap ========
00477  */
00478 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
00479 
00482 /*
00483  *  ======== Engine_open ========
00484  */
00527 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
00528     Engine_Error *ec);
00529 
00530 /*
00531  *  ======== Engine_fwriteTrace ========
00532  */
00558 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
00559 
00560 /*
00561  *  ======== Engine_getAlgInfo ========
00562  */
00597 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
00598         Int index);
00599 
00600 /*
00601  *  ======== Engine_getCpuLoad ========
00602  */
00631 extern Int Engine_getCpuLoad(Engine_Handle engine);
00632 
00633 /*
00634  *  ======== Engine_getLastError ========
00635  */
00647 extern Engine_Error Engine_getLastError(Engine_Handle engine);
00648 
00649 /*
00650  *  ======== Engine_getName ========
00651  */
00660 extern String Engine_getName(Engine_Handle engine);
00661 
00662 
00663 /*
00664  *  ======== Engine_getNumAlgs ========
00665  */
00689 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
00690 
00691 /*
00692  *  ======== Engine_getServer ========
00693  */
00708 extern Server_Handle Engine_getServer(Engine_Handle engine);
00709 
00710 
00711 /*
00712  *  ======== Engine_getUsedMem ========
00713  */
00740 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
00741 
00742 
00743 /*
00744  *  ======== Engine_setTrace ========
00745  */
00765 extern Int Engine_setTrace(Engine_Handle engine, String mask);
00766 
00769 #ifdef __cplusplus
00770 }
00771 #endif
00772 
00773 #endif
00774 /*
00775  *  @(#) ti.sdo.ce; 1, 0, 6,410; 6-19-2010 19:51:24; /db/atree/library/trees/ce/ce-o16x/src/
00776  */
00777 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2010, Texas Instruments Incorporated