Codec Engine System Programming Interface (SPI)  ce-w08
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Engine.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 by Texas Instruments Incorporated.
3  *
4  */
5 
6 /*
7  * Copyright (c) 2013, Texas Instruments Incorporated
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  *
17  * * Redistributions in binary form must reproduce the above copyright
18  * notice, this list of conditions and the following disclaimer in the
19  * documentation and/or other materials provided with the distribution.
20  *
21  * * Neither the name of Texas Instruments Incorporated nor the names of
22  * its contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
38 /*
39  * ======== Engine.h ========
40  */
41 
56 #ifndef Engine_
57 #define Engine_
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 
64 #include <ti/sdo/ce/ServerDefs.h>
65 #include <ti/sdo/ce/ipc/Comm.h>
66 #include <ti/xdais/ialg.h>
67 #include <ti/sdo/ce/node/node.h>
68 
69 #include <stddef.h> /* def of size_t */
70 #include <stdio.h> /* def of FILE * */
71 
74 
90 #define Engine_MODNAME "ti.sdo.ce.Engine"
91 
95 typedef struct Engine_Obj *Engine_Handle;
96 
100 typedef Int Engine_Error;
101 
102 #define Engine_EOK 0
103 #define Engine_EEXIST 1
104 #define Engine_ENOMEM 2
105 #define Engine_EDSPLOAD 3
106 #define Engine_ENOCOMM 4
109 #define Engine_ENOSERVER 5
110 #define Engine_ECOMALLOC 6
111 #define Engine_ERUNTIME 7
112 #define Engine_ECODECCREATE 8
113 #define Engine_ECODECSTART 9
118 #define Engine_EINVAL 10
119 #define Engine_EBADSERVER 11
120 #define Engine_ENOTAVAIL 12
121 #define Engine_EWRONGSTATE 13
122 #define Engine_EINUSE 14
125 #define Engine_ENOTFOUND 15
126 #define Engine_ETIMEOUT 16
133 typedef struct Engine_NodeObj *Engine_Node;
134 
138 #define Engine_FOREVER Comm_FOREVER
139 
148 typedef struct Engine_Attrs {
149  String procId;
153 } Engine_Attrs;
154 
160 typedef struct Engine_AlgInfo {
162  String name;
163  String *typeTab;
164  Bool isLocal;
166 
179 typedef struct Engine_AlgInfo2 {
181  String name;
182  String types;
183  Bool isLocal;
185 
194 extern Engine_Attrs Engine_ATTRS;
198 typedef Int Engine_Ctrl;
199 
200 #define Engine_CEXIT 0
201 #define Engine_MAXSEGNAMELENGTH 32
202 
210 typedef enum Engine_CachedMemType {
215 
216 
217 /*
218  * ======== Engine_AlgDesc ========
219  */
227 typedef struct Engine_AlgDesc {
233  String name;
234 
235  NODE_Uuid uuid;
246 
253  Ptr idmaFxns;
254 
255  String *typeTab;
262  Bool isLocal;
263 
272  Int groupId;
273 
284  Ptr iresFxns;
285 
290 
332  String types;
334 
335 
339 #define Engine_GETALGDESCFXN "GetEngineAlgDesc"
340 
341 /*
342  * ======== Engine_DllAlgDesc ========
343  * An alg that will be dynamically loaded must have a descriptor of this type.
344  */
352 typedef struct Engine_DllAlgDesc {
357 
362  Ptr idmaFxns;
363 
368  Ptr iresFxns;
369 
382  String types;
383 
391 
392 
393 /*
394  * ======== Engine_GetAlgDescFxn ========
395  * A dynamically loaded codec library must supply a function of this type to
396  * get properties of the library's algorithm.
397  */
407 typedef Int (*Engine_GetAlgDescFxn)(Engine_DllAlgDesc *dllAlgDesc);
408 
409 
410 /*
411  * ======== Engine_Desc ========
412  */
420 typedef struct Engine_Desc {
421  String name;
426  String remoteName;
436  String memMap;
467  Int numAlgs;
468  Int heapId;
469 } Engine_Desc;
470 
471 
474 /*
475  * ======== Engine_AlgCreateAttrs ========
476  */
477 typedef struct Engine_AlgCreateAttrs {
478  Bool useExtHeap;
483  Int priority;
485 } Engine_AlgCreateAttrs;
486 
487 
488 /*
489  * ======== Engine_Config ========
490  */
491 typedef struct Engine_Config {
492  Engine_Desc *engineTab;
493  String localEngine;
494 } Engine_Config;
495 
496 /*
497  * ======== Engine_MemStat ========
498  * This structure must match Server_MemStat.
499  */
500 typedef struct Engine_MemStat {
501  Char name[Engine_MAXSEGNAMELENGTH + 1]; /* Name of memory segment */
502  Uint32 base; /* Base address of memory segment */
503  Uint32 size; /* Original size of the memory segment. */
504  Uint32 used; /* Number of bytes used. */
505  Uint32 maxBlockLen; /* Size of the largest contiguous free block. */
506 } Engine_MemStat;
507 
508 /* Default alg create attributes */
509 extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
510 
511 /*
512  * ======== Engine_config ========
513  */
514 extern Engine_Config Engine_config;
515 
519 /*
520  * ======== Engine_addStubFxns ========
521  */
564 extern Engine_Error Engine_addStubFxns(String fxnsName, IALG_Fxns *fxns);
565 
566 /*
567  * ======== Engine_add ========
568  */
606 extern Engine_Error Engine_add(Engine_Desc *pDesc);
607 
608 /*
609  * ======== Engine_addAlg ========
610  */
703 extern Engine_Error Engine_addAlg(String name, Engine_Handle engine,
704  String location, Engine_AlgDesc *pAlgDesc);
705 
706 /*
707  * ======== Engine_removeAlg ========
708  */
734 extern Engine_Error Engine_removeAlg(String name, Engine_Handle engine,
735  String algName);
736 
739 /*
740  * ======== Engine_call ========
741  */
742 extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
743 
744 /*
745  * ======== Engine_callAsync ========
746  */
747 extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
748 
749 /*
750  * ======== Engine_callWait ========
751  */
752 extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
753 
754 /*
755  * ======== Engine_ctrlNode ========
756  */
757 extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
758 
761 /*
762  * ======== Engine_close ========
763  */
779 extern Void Engine_close(Engine_Handle engine);
780 
782 /*
783  * ======== Engine_createNode ========
784  */
810 extern Engine_Node Engine_createNode(Engine_Handle engine, String name,
811  size_t msgSize, IALG_Params *nodeAttrs, Engine_AlgCreateAttrs *attrs);
812 
813 
814 /*
815  * ======== Engine_createNode2 ========
816  */
847 extern Engine_Node Engine_createNode2(Engine_Handle engine, String name,
848  size_t msgSize, IALG_Params *nodeAttrs, Int nodeAttrsSize,
849  Engine_AlgCreateAttrs *attrs);
850 
851 
852 /*
853  * ======== Engine_deleteNode ========
854  */
855 extern Void Engine_deleteNode(Engine_Node node);
856 
857 /*
858  * ======== Engine_getAlgMemRecs ========
859  */
873 extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
874  Int *numRecs);
875 
876 /*
877  * ======== Engine_getAlgNumRecs ========
878  */
890 extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
891 
892 /*
893  * ======== Engine_getConstName ========
894  */
895 extern String Engine_getConstName(Engine_Handle engine, String name,
896  String type);
897 
898 /*
899  * ======== Engine_getFxns ========
900  */
901 extern IALG_Fxns *Engine_getFxns(Engine_Handle svr, String name, String type,
902  Bool *isLocal, Ptr *idmaFxns, Ptr *iresFxns, Int *groupId,
903  Engine_CachedMemType *memType);
904 
905 /*
906  * ======== Engine_getMemId ========
907  */
908 extern Int Engine_getMemId(Engine_Handle engine);
909 
910 /*
911  * ======== Engine_getLocalEngine ========
912  */
913 extern Engine_Handle Engine_getLocalEngine(Void);
914 
915 /*
916  * ======== Engine_getEngine ========
917  */
918 extern Engine_Handle Engine_getEngine(Engine_Node node);
919 
920 /*
921  * ======== Engine_getMemStat ========
922  */
923 extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
924  Engine_MemStat *stat);
925 
926 /*
927  * ======== Engine_getNumMemSegs ========
928  */
929 extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
930 
931 /*
932  * ======== Engine_getNumEngines ========
933  */
934 extern Int Engine_getNumEngines();
935 
936 /*
937  * ======== Engine_getProcId ========
938  */
939 extern String Engine_getProcId(Engine_Handle engine);
940 
941 /*
942  * ======== Engine_hasServer ========
943  */
944 extern Bool Engine_hasServer(Engine_Handle engine);
945 
946 /*
947  * ======== Engine_init ========
948  */
949 extern Void Engine_init(Void);
950 
951 
954 /*
955  * ======== Engine_initAlgDesc ========
956  */
978 extern Void Engine_initAlgDesc(Engine_AlgDesc *pAlgDesc);
979 
980 /*
981  * ======== Engine_initAttrs ========
982  */
990 extern Void Engine_initAttrs(Engine_Attrs *pAttrs);
991 
992 /*
993  * ======== Engine_initDesc ========
994  */
1007 extern Void Engine_initDesc(Engine_Desc *pDesc);
1008 
1011 /*
1012  * ======== Engine_getRemoteVisa ========
1013  */
1014 extern UInt32 Engine_getRemoteVisa(Engine_Node node);
1015 
1016 /*
1017  * ======== Engine_getCodecClassConfig ========
1018  */
1019 extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
1020  String type);
1021 
1022 /*
1023  * ======== Engine_getNodeQueues ========
1024  */
1025 extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut);
1026 
1027 
1028 /*
1029  * ======== Engine_initFromServer ========
1030  */
1031 extern Engine_Error Engine_initFromServer(Engine_Handle engine);
1032 
1033 
1034 /*
1035  * ======== Engine_redefineHeap ========
1036  */
1037 extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
1038  Uint32 base, Uint32 size);
1039 
1040 /*
1041  * ======== Engine_releaseTraceToken ========
1042  */
1043 extern Bool Engine_releaseTraceToken(Server_Handle server);
1044 
1045 /*
1046  * ======== Engine_requestTraceToken ========
1047  */
1048 extern Engine_Error Engine_requestTraceToken(Server_Handle server);
1049 
1050 /*
1051  * ======== Engine_restoreHeap ========
1052  */
1053 extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
1054 
1057 /*
1058  * ======== Engine_open ========
1059  */
1106 extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
1107  Engine_Error *ec);
1108 
1109 /*
1110  * ======== Engine_fwriteTrace ========
1111  */
1137 extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
1138 
1139 /*
1140  * ======== Engine_getAlgInfo ========
1141  */
1176 extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
1177  Int index);
1178 
1179 /*
1180  * ======== Engine_getAlgInfo2 ========
1181  */
1230 extern Engine_Error Engine_getAlgInfo2(String name, Engine_Handle engine,
1231  Engine_AlgInfo2 *algInfo2, Int index);
1232 
1233 
1235 /*
1236  * ======== Engine_getCpuLoad ========
1237  */
1266 extern Int Engine_getCpuLoad(Engine_Handle engine);
1267 
1271 /*
1272  * ======== Engine_getDesc ========
1273  */
1299 extern Engine_Error Engine_getDesc(String name, Engine_Desc *desc);
1300 
1301 /*
1302  * ======== Engine_getLastError ========
1303  */
1318 extern Engine_Error Engine_getLastError(Engine_Handle engine);
1319 
1320 /*
1321  * ======== Engine_getName ========
1322  */
1334 extern String Engine_getName(Engine_Handle engine);
1335 
1336 
1337 /*
1338  * ======== Engine_getNumAlgs ========
1339  */
1363 extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
1364 
1365 /*
1366  * ======== Engine_getNumAlgs2 ========
1367  */
1408 extern Engine_Error Engine_getNumAlgs2(String name, Engine_Handle engine,
1409  Int *numAlgs);
1410 
1411 /*
1412  * ======== Engine_getServer ========
1413  */
1431 extern Server_Handle Engine_getServer(Engine_Handle engine);
1432 
1433 
1434 /*
1435  * ======== Engine_getUsedMem ========
1436  */
1466 extern UInt32 Engine_getUsedMem(Engine_Handle engine);
1467 
1468 
1469 /*
1470  * ======== Engine_remove ========
1471  */
1489 extern Engine_Error Engine_remove(String engineName);
1490 
1491 
1492 /*
1493  * ======== Engine_setDesc ========
1494  */
1532 extern Engine_Error Engine_setDesc(String name, Engine_Desc *desc);
1533 
1534 
1535 /*
1536  * ======== Engine_setTrace ========
1537  */
1560 extern Int Engine_setTrace(Engine_Handle engine, String mask);
1561 
1562 
1565 /*
1566  * ======== Engine_getDesc ========
1567  * Internal for testing.
1568  */
1569 extern Engine_Desc *_Engine_getDesc(Int i);
1570 
1574 
1575 #ifdef __cplusplus
1576 }
1577 #endif
1578 
1579 #endif
1580 /*
1581  * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
1582 
1583  */
1584 
Copyright 2013, Texas Instruments Incorporated