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 
00159 /*
00160  *  ======== Engine_AlgDesc ========
00161  */
00162 typedef struct Engine_AlgDesc {
00163     String      name;           
00164     NODE_Uuid   uuid;           
00165     IALG_Fxns   *fxns;          
00166     Ptr         idmaFxns;       
00167     String      *typeTab;       
00168     Bool        isLocal;        
00169     Int         groupId;        
00170     Int         rpcProtocolVersion; 
00171     Ptr         iresFxns;       
00172     Void        *codecClassConfig; 
00173 } Engine_AlgDesc;
00174 
00175 /*
00176  *  ======== Engine_AlgCreateAttrs ========
00177  */
00178 typedef struct Engine_AlgCreateAttrs {
00179     Bool            useExtHeap; 
00184     Int             priority;   
00186 } Engine_AlgCreateAttrs;
00187 
00188 /*
00189  *  ======== Engine_Desc ========
00190  */
00191 typedef struct Engine_Desc {
00192     String          name;       
00193     Engine_AlgDesc  *algTab;    
00194     String          remoteName; 
00195     String          linkCfg;    
00196     Int             numAlgs;    
00198 } Engine_Desc;
00199 
00200 /*
00201  *  ======== Engine_Config ========
00202  */
00203 typedef struct Engine_Config {
00204     Engine_Desc *engineTab;
00205     String      localEngine;
00206 } Engine_Config;
00207 
00208 /*
00209  *  ======== Engine_MemStat ========
00210  *  This structure must match Server_MemStat.
00211  */
00212 typedef struct Engine_MemStat {
00213     Char   name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
00214     Uint32 base;           /* Base address of memory segment */
00215     Uint32 size;           /* Original size of the memory segment. */
00216     Uint32 used;           /* Number of bytes used. */
00217     Uint32 maxBlockLen;    /* Size of the largest contiguous free block. */
00218 } Engine_MemStat;
00219 
00220 /* Default alg create attributes */
00221 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
00222 
00223 /*
00224  *  ======== Engine_config ========
00225  */
00226 extern Engine_Config Engine_config;
00227 
00228 /*
00229  *  ======== Engine_call ========
00230  */
00231 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
00232 
00233 /*
00234  *  ======== Engine_callAsync ========
00235  */
00236 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
00237 
00238 /*
00239  *  ======== Engine_callWait ========
00240  */
00241 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
00242 
00243 /*
00244  *  ======== Engine_ctrlNode ========
00245  */
00246 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
00247 
00250 /*
00251  *  ======== Engine_close ========
00252  */
00267 extern Void Engine_close(Engine_Handle engine);
00268 
00270 /*
00271  *  ======== Engine_createNode ========
00272  */
00298 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
00299     size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
00300 
00301 
00302 /*
00303  *  ======== Engine_createNode2 ========
00304  */
00335 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
00336     size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
00337     Engine_AlgCreateAttrs *attrs);
00338 
00339 
00340 /*
00341  *  ======== Engine_deleteNode ========
00342  */
00343 extern Void Engine_deleteNode(Engine_Node node);
00344 
00345 /*
00346  *  ======== Engine_getAlgMemRecs ========
00347  */
00361 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
00362         Int *numRecs);
00363 
00364 /*
00365  *  ======== Engine_getAlgNumRecs ========
00366  */
00378 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
00379 
00380 /*
00381  *  ======== Engine_getConstName ========
00382  */
00383 extern String Engine_getConstName(Engine_Handle engine, String name,
00384     String type);
00385 
00386 /*
00387  *  ======== Engine_getFxns ========
00388  */
00389 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name,
00390     String type, Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId);
00391 
00392 /*
00393  *  ======== Engine_getMemId ========
00394  */
00395 extern Int Engine_getMemId(Engine_Handle engine);
00396 
00397 /*
00398  *  ======== Engine_getLocalEngine ========
00399  */
00400 extern Engine_Handle Engine_getLocalEngine(Void);
00401 
00402 /*
00403  *  ======== Engine_getEngine ========
00404  */
00405 extern Engine_Handle Engine_getEngine(Engine_Node node);
00406 
00407 /*
00408  *  ======== Engine_getMemStat ========
00409  */
00410 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
00411     Engine_MemStat *stat);
00412 
00413 /*
00414  *  ======== Engine_getNumMemSegs ========
00415  */
00416 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
00417 
00418 /*
00419  *  ======== Engine_hasServer ========
00420  */
00421 extern Bool Engine_hasServer(Engine_Handle engine);
00422 
00423 /*
00424  *  ======== Engine_init ========
00425  */
00426 extern Void Engine_init(Void);
00427 
00428 /*
00429  *  ======== Engine_getRemoteVisa ========
00430  */
00431 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
00432 
00433 /*
00434  *  ======== Engine_getCodecClassConfig ========
00435  */
00436 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
00437     String type);
00438 
00439 /*
00440  *  ======== Engine_getNodeQueues ========
00441  */
00442 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Queue *stdIn,
00443         Comm_Queue *stdOut);
00444 
00445 /*
00446  *  ======== Engine_redefineHeap ========
00447  */
00448 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
00449         Uint32 base, Uint32 size);
00450 
00451 /*
00452  *  ======== Engine_releaseTraceToken ========
00453  */
00454 extern Bool Engine_releaseTraceToken(Server_Handle server);
00455 
00456 /*
00457  *  ======== Engine_requestTraceToken ========
00458  */
00459 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
00460 
00461 /*
00462  *  ======== Engine_restoreHeap ========
00463  */
00464 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
00465 
00468 /*
00469  *  ======== Engine_open ========
00470  */
00513 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
00514     Engine_Error *ec);
00515 
00516 /*
00517  *  ======== Engine_fwriteTrace ========
00518  */
00544 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
00545 
00546 /*
00547  *  ======== Engine_getAlgInfo ========
00548  */
00583 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
00584         Int index);
00585 
00586 /*
00587  *  ======== Engine_getCpuLoad ========
00588  */
00617 extern Int Engine_getCpuLoad(Engine_Handle engine);
00618 
00619 /*
00620  *  ======== Engine_getLastError ========
00621  */
00633 extern Engine_Error Engine_getLastError(Engine_Handle engine);
00634 
00635 /*
00636  *  ======== Engine_getName ========
00637  */
00646 extern String Engine_getName(Engine_Handle engine);
00647 
00648 
00649 /*
00650  *  ======== Engine_getNumAlgs ========
00651  */
00675 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
00676 
00677 /*
00678  *  ======== Engine_getServer ========
00679  */
00694 extern Server_Handle Engine_getServer(Engine_Handle engine);
00695 
00696 
00697 /*
00698  *  ======== Engine_getUsedMem ========
00699  */
00726 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
00727 
00728 
00729 /*
00730  *  ======== Engine_setTrace ========
00731  */
00751 extern Int Engine_setTrace(Engine_Handle engine, String mask);
00752 
00755 #ifdef __cplusplus
00756 }
00757 #endif
00758 
00759 #endif
00760 /*
00761  *  @(#) ti.sdo.ce; 1, 0, 6,399; 5-7-2010 13:01:08; /db/atree/library/trees/ce/ce-o11x/src/
00762  */
00763 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2010, Texas Instruments Incorporated