Server.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  *  ======== Server.h ========
00035  *  DSP Server module
00036  *
00037  *  APIs for accessing information from remote server.
00038  */
00039 
00050 #ifndef ti_sdo_ce_Server_
00051 #define ti_sdo_ce_Server_
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 
00058 #include <ti/sdo/ce/ServerDefs.h>
00059 #include <ti/sdo/ce/Engine.h>
00060 #include <ti/sdo/ce/skel.h>
00061 
00062 #include <stdio.h>  /* def of FILE * */
00063 
00066 
00075 #define Server_MODNAME "ti.sdo.ce.Server"
00076 
00080 #define Server_MAXSEGNAMELENGTH 32
00081 
00085 typedef enum Server_Status {
00086     Server_EOK       = 0,      
00087     Server_ENOSERVER = 1,      
00088     Server_ENOMEM    = 2,      
00089     Server_ERUNTIME  = 3,      
00090     Server_EINVAL    = 4,      
00091     Server_EWRONGSTATE =5,     
00093     Server_EINUSE    = 6,      
00095     Server_ENOTFOUND = 7,      
00096     Server_EFAIL     = 8,      
00097     Server_ENOTSUPPORTED = 9   
00098 } Server_Status;
00099 
00100 /*
00101  *  ======== Server_AlgDesc ========
00102  */
00103 typedef struct Server_AlgDesc {
00109     String      name;
00110 
00119     IALG_Fxns   *fxns;
00120 
00126     Ptr         idmaFxns;
00127 
00133     Bool        isLocal;
00134 
00160     Int         groupId;
00161 
00172     Ptr         iresFxns;
00173 
00174     /*
00175      *  Currently not used.
00176      *           Codec class configuration data for stub side, if any.  We
00177      *           generate this structure for both sides, although it is
00178      *           currently only used in the skeletons.
00179      */
00180     Void        *stubsCodecClassConfig;
00181 
00185     Void        *codecClassConfig;
00186 
00187     /*
00188      *  Currently not used.
00189      *          Indicates the type of memory the alg's memory requests will
00190      *          be allocated from.
00191      *          The alg's memory will be allocated from cached memory, if
00192      *              memType = Engine_USECACHEDMEM_CACHED,
00193      *          from non-cached memory, if
00194      *              memType = Engine_USECACHEDMEM_NONCACHED,
00195      *          Otherwise, if
00196      *              memType = Engine_USECACHEDMEM_DEFAULT,
00197      *          memory allocations will be determined by the value of
00198      *          ti_sdo_ce_alg_Algorithm_useCache (cached, if TRUE, non-cached,
00199      *          if FALSE).
00200      *
00201      *  @sa  Engine_CachedMemType
00202      */
00203     Engine_CachedMemType memType;  
00231     String      types;
00232 
00237     String      stubFxnsName;
00238 
00242     SKEL_Fxns   *skelFxns;
00243 
00247     Int         priority;
00248 
00252     Int         stackSize;
00253 
00254     /*
00255      *  Currently not used.
00256      *          Memory heap for algorithm stack.
00257      */
00258     Int         stackSeg;
00259 } Server_AlgDesc;
00260 
00268 typedef struct Server_MemStat {
00269     Char   name[Server_MAXSEGNAMELENGTH + 1]; 
00270     Uint32 base;           
00271     Uint32 size;           
00272     Uint32 used;           
00273     Uint32 maxBlockLen;    
00274 } Server_MemStat;
00275 
00276 
00277 /*
00278  *  ======== Server_addAlg ========
00279  */
00375 extern Server_Status Server_addAlg(Server_Handle server, String location,
00376         Server_AlgDesc *pAlgDesc);
00377 
00378 
00379 /*
00380  *  ======== Server_connectTrace ========
00381  */
00403 extern Server_Status Server_connectTrace(Server_Handle server, Int * token);
00404 
00405 /*
00406  *  ======== Server_disconnectTrace ========
00407  */
00425 extern Server_Status Server_disconnectTrace(Server_Handle server, Int token);
00426 
00427 /*
00428  *  ======== Server_fwriteTrace ========
00429  */
00454 extern Int Server_fwriteTrace(Server_Handle server, String prefix, FILE *out);
00455 
00456 /*
00457  *  ======== Server_getCpuLoad ========
00458  */
00480 extern Int Server_getCpuLoad(Server_Handle server);
00481 
00482 /*
00483  *  ======== Server_getMemStat ========
00484  */
00507 extern Server_Status Server_getMemStat(Server_Handle server, Int segNum,
00508         Server_MemStat *memStat);
00509 
00510 /*
00511  *  ======== Server_getNumMemSegs ========
00512  */
00534 extern Server_Status Server_getNumMemSegs(Server_Handle server, Int *numSegs);
00535 
00537 /*
00538  *  ======== Server_init ========
00539  */
00540 extern Void Server_init(Void);
00543 /*
00544  *  ======== Server_initAlgDesc ========
00545  */
00578 extern Void Server_initAlgDesc(Server_AlgDesc *pAlgDesc);
00579 
00580 /*
00581  *  ======== Server_redefineHeap ========
00582  */
00636 extern Server_Status Server_redefineHeap(Server_Handle server, String name,
00637         Uint32 base, Uint32 size);
00638 
00639 #if 0
00640 /*
00641  *  ======== Server_removeAlg ========
00642  */
00643 /*
00644  *  Currently not implemented.
00645  *
00646  *  @brief      Dynamically remove an algorithm that was added to a Server
00647  *              with Server_addAlg().
00648  *
00649  *  @remarks    The same values of the parameters @c name and @c server that
00650  *              were passed to Server_addAlg() should be used here.  In
00651  *              particular, if @c name was used to add the alg, all handles to
00652  *              the engine named @c name must be closed before calling
00653  *              Server_removeAlg().
00654  *
00655  *
00656  *  @param[in]  name            The name of the engine or NULL, that was
00657  *                              passed to Server_addAlg(). Set to NULL for now.
00658  *                              Currently, only the default "local" engine is
00659  *                              supported.
00660  *  @param[in]  server          The handle to a server, previously acquired
00661  *                              by a call to Engine_getServer(), or NULL.
00662  *                              Set to NULL for now.  In the future, this will
00663  *                              be used to dynamically remove remote
00664  *                              algorithms from a server.
00665  *  @param[in]  algName         Name of the algorithm to remove.
00666  *
00667  *  @retval     Server_EOK          Success.
00668  *  @retval     Server_ENOTFOUND    The server's underlying engine, @c name,
00669  *                                  does not exist.
00670  *  @retval     Server_ENOTFOUND    @c algName could not be found in the
00671  *                                  server's underlying engine table.
00672  *  @retval     Server_EINUSE       The server's underlying engine, @c name,
00673  *                                  is still open.
00674  *
00675  *  @sa         Server_addAlg()
00676  */
00677 extern Server_Status Server_removeAlg(String name, Server_Handle server,
00678         String algName);
00679 #endif
00680 
00681 /*
00682  *  ======== Server_restoreHeap ========
00683  */
00717 extern Server_Status Server_restoreHeap(Server_Handle server, String name);
00718 
00719 /*
00720  *  ======== Server_setTrace ========
00721  */
00743 extern Int Server_setTrace(Server_Handle server, String mask);
00744   /* ingroup */
00746 
00747 #ifdef __cplusplus
00748 }
00749 #endif
00750 
00751 #endif
00752 /*
00753  *  @(#) ti.sdo.ce; 1, 0, 6,1; 8-14-2012 12:59:44; /db/atree/library/trees/ce/ce-u07/src/ xlibrary
00754 
00755  */
00756 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2012, Texas Instruments Incorporated