aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunita Nadampalli2013-09-03 11:37:10 -0500
committerSaurabh Bipin Chandra2013-09-05 11:09:03 -0500
commitb483e571e0325deb94e6d5872764844d2e0e8563 (patch)
tree951c8ad1a718ad59d0154f5e9510eabb26e31ec4 /packages/codec_engine
parentabd5152ca071e552954571862635666297221177 (diff)
downloadhardware-ti-libdce-b483e571e0325deb94e6d5872764844d2e0e8563.tar.gz
hardware-ti-libdce-b483e571e0325deb94e6d5872764844d2e0e8563.tar.xz
hardware-ti-libdce-b483e571e0325deb94e6d5872764844d2e0e8563.zip
[LIBDCE] Added codec, xdais and xdctools headers
This patch adds codec,xdais and xdctools headers for libdce compilation at HLOS level. Since HLOS code doesn't refer to the tools directly, this patch provides copy for all the required headers. Note# These headers need to be updated for every release if the tools versions are changed. Version Info of the added Headers: Tools: XDC version : xdctools_3_25_02_70 CE version : codec_engine_3_24_00_08 XDAIS version : xdais_7_24_00_04 IVAHD_Codecs: H.264 Dec : 02.00.13.00 MJPEG Dec : 01.00.11.01 MPEG-4 Dec : 01.00.13.00 VC-1 Dec : 01.00.00.11 MPEG-2 Dec : 01.00.12.00 SVC Dec : 00.06.00.00 H.264 Enc : 02.00.06.01 MJPEG Enc : 01.00.02.01 SVC Enc : 00.02.00.05 Change-Id: Id2307e2376d3ba0c13464c1b21cdba53d8f997f2 Signed-off-by: Sunita Nadampalli <sunitan@ti.com>
Diffstat (limited to 'packages/codec_engine')
-rw-r--r--packages/codec_engine/ti/sdo/ce/Engine.h1584
-rw-r--r--packages/codec_engine/ti/sdo/ce/Server.h761
-rw-r--r--packages/codec_engine/ti/sdo/ce/ServerDefs.h76
-rw-r--r--packages/codec_engine/ti/sdo/ce/ipc/Comm.h235
-rw-r--r--packages/codec_engine/ti/sdo/ce/node/node.h209
-rw-r--r--packages/codec_engine/ti/sdo/ce/skel.h137
-rw-r--r--packages/codec_engine/ti/sdo/ce/video2/videnc2.h401
-rw-r--r--packages/codec_engine/ti/sdo/ce/video3/viddec3.h396
-rw-r--r--packages/codec_engine/ti/sdo/ce/visa.h690
9 files changed, 4489 insertions, 0 deletions
diff --git a/packages/codec_engine/ti/sdo/ce/Engine.h b/packages/codec_engine/ti/sdo/ce/Engine.h
new file mode 100644
index 0000000..936c61f
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/Engine.h
@@ -0,0 +1,1584 @@
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
42/**
43 * @file ti/sdo/ce/Engine.h
44 *
45 * @brief The Codec Engine Runtime.
46 *
47 * @remarks Provides the user an interface to
48 * open and manipulate an Engine which can instantiate
49 * and communicate with XDAIS algorithms that run either
50 * on the local CPU or on a "remote" Server.
51 */
52/**
53 * @addtogroup CODECENGINE Codec Engine Runtime
54 */
55
56#ifndef Engine_
57#define Engine_
58
59#ifdef __cplusplus
60extern "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
72/** @ingroup CODECENGINE */
73/*@{*/
74
75/**
76 * @brief Name to pass to Diags_setMask() to enable logging for Engine
77 * functions.
78 *
79 * @par Example Usage:
80 * The following code turns on all Log statements in the Engine
81 * module.
82 * @code
83 * Diags_setMask(Engine_MODNAME "+EX1234567");
84 * @endcode
85 *
86 * @remarks Using Diags_setMask() to enable Engine Logging must be called
87 * after CERuntime_init() (which creates and initializes the
88 * Engine trace mask) to have any effect.
89 */
90#define Engine_MODNAME "ti.sdo.ce.Engine"
91
92/**
93 * @brief Opaque handle to an engine.
94 */
95typedef struct Engine_Obj *Engine_Handle;
96
97/**
98 * @brief Engine error code
99 */
100typedef Int Engine_Error;
101
102#define Engine_EOK 0 /**< Success. */
103#define Engine_EEXIST 1 /**< Name does not exist. */
104#define Engine_ENOMEM 2 /**< Unable to allocate memory. */
105#define Engine_EDSPLOAD 3 /**< Unable to load the DSP. */
106#define Engine_ENOCOMM 4 /**< Unable to create a comm connection to
107 * the DSP.
108 */
109#define Engine_ENOSERVER 5 /**< Unable to locate the server on the DSP. */
110#define Engine_ECOMALLOC 6 /**< Unable to allocate communication buffer. */
111#define Engine_ERUNTIME 7 /**< Internal engine runtime failure. */
112#define Engine_ECODECCREATE 8 /**< Creation of the Codec failed. */
113#define Engine_ECODECSTART 9 /**< Start of the Codec failed. For codecs
114 * which are implemented as a thread, this
115 * implies that the codec thread of execution
116 * failed to start.
117 */
118#define Engine_EINVAL 10 /**< Bad paramater passed to method. */
119#define Engine_EBADSERVER 11 /**< Incompatible server specified. */
120#define Engine_ENOTAVAIL 12 /**< Service not available. */
121#define Engine_EWRONGSTATE 13 /**< Call can not be made at this time. */
122#define Engine_EINUSE 14 /**< Call can't be made at this time because
123 * a required name/resource is in use.
124 */
125#define Engine_ENOTFOUND 15 /**< Entity was not found. */
126#define Engine_ETIMEOUT 16 /**< Timeout-based operation timed out. */
127
128/** @cond INTERNAL */
129
130/**
131 * @brief Opaque handle to a node.
132 */
133typedef struct Engine_NodeObj *Engine_Node;
134
135/**
136 * @brief Special value for timeout parameter of Engine_callWait()
137 */
138#define Engine_FOREVER Comm_FOREVER
139
140/** @endcond */
141
142/**
143 * @brief Attributes of an Engine
144 *
145 * @sa Engine_initAttrs().
146 * @sa Engine_open().
147 */
148typedef struct Engine_Attrs {
149 String procId; /**< id of the processor that runs the server; only
150 * needed in the case that there's more than one
151 * processor that can provide the same server.
152 */
153} Engine_Attrs;
154
155/**
156 * @brief Properties of an Engine algorithm
157 *
158 * @sa Engine_getAlgInfo()
159 */
160typedef struct Engine_AlgInfo {
161 Int algInfoSize; /**< Size of this structure. */
162 String name; /**< Name of algorithm. */
163 String *typeTab; /**< Inheritance hierarchy. */
164 Bool isLocal; /**< If TRUE, run locally. */
165} Engine_AlgInfo;
166
167/**
168 * @brief Properties of an Engine algorithm.
169 *
170 * @remarks This structure is identical to Engine_AlgInfo except that the
171 * @c typeTab array of strings is replaced by a single string
172 * called @c types. The string, @c types, represents a ';'
173 * separated list of inheritance hierarchies of the algorithm,
174 * for example,
175 * "ti.sdo.ce.video.IVIDDEC;ti.sdo.ce.test.xvideo.IVIDE".
176 *
177 * @sa Engine_getAlgInfo2()
178 */
179typedef struct Engine_AlgInfo2 {
180 Int algInfoSize; /**< Size of this structure. */
181 String name; /**< Name of algorithm. */
182 String types; /**< Inheritance hierarchy. */
183 Bool isLocal; /**< If TRUE, run locally. */
184} Engine_AlgInfo2;
185
186/**
187 * @brief Default engine attributes.
188 *
189 * @deprecated Engine_ATTRS is no longer recommended. Please use
190 * Engine_initAttrs() instead.
191 *
192 * @sa Engine_initAttrs()
193 */
194extern Engine_Attrs Engine_ATTRS; /**< Default attrs. */
195
196/** @cond INTERNAL */
197
198typedef Int Engine_Ctrl;
199
200#define Engine_CEXIT 0
201#define Engine_MAXSEGNAMELENGTH 32
202
203/** @endcond */
204
205/**
206 * @brief Engine Cacheable Memory types.
207 *
208 * @enumWarning
209 */
210typedef enum Engine_CachedMemType {
211 Engine_USECACHEDMEM_DEFAULT = -1, /**< Use default cache setting */
212 Engine_USECACHEDMEM_NONCACHED = 0, /**< Use non-cached memory */
213 Engine_USECACHEDMEM_CACHED = 1 /**< Use cached memory */
214} Engine_CachedMemType;
215
216
217/*
218 * ======== Engine_AlgDesc ========
219 */
220/**
221 * @brief Descriptor for an alg. This object can be passed to
222 * @c Engine_addAlg(), to dynamically add an alg to an engine.
223 *
224 * @sa Engine_initAlgDesc()
225 * @sa Engine_addAlg()
226 */
227typedef struct Engine_AlgDesc {
228 /**
229 * @brief The name of the algorithm. This is used by the application
230 * when instantiating an instance of the algorithm through one
231 * of the VISA APIs.
232 */
233 String name;
234
235 NODE_Uuid uuid; /**< Id of alg if running on remote target. No need
236 * to set this field.
237 */
238
239 /**
240 * @brief The address of the XDAIS alg function table.
241 * All XDAIS algorithms must define an IALG_Fxns structure that
242 * contains implementations of the IALG methods. This field
243 * is simply the address of this structure.
244 */
245 IALG_Fxns *fxns;
246
247 /**
248 * @brief The address of the IDMA3_Fxns function table, if the algorithm
249 * uses DMA. If the algorithm does not use DMA, this field should
250 * set to NULL.
251 * @idmaDeprecated
252 */
253 Ptr idmaFxns;
254
255 String *typeTab; /**< inheritance hierarchy - Do not modify. */
256
257 /**
258 * @brief If true, the algorithm will be instantiated on the
259 * "local" CPU. Otherwise the server will create an
260 * instance of the algorithm.
261 */
262 Bool isLocal;
263
264 /**
265 * @brief This id specifies which resource sharing group that this
266 * alg will be placed into. This 'group' concept
267 * is used by the framework to ensure algorithms in the
268 * same group don't pre-empt each other and corrupt the
269 * shared resources.
270 * This parameter will be ignored if @c isLocal is FALSE.
271 */
272 Int groupId;
273
274 Int rpcProtocolVersion; /**< Protocol version. Do not modify */
275
276 /**
277 * @brief Address of the XDAIS alg IRES Interface function table
278 * All XDAIS algorithms that use an IRES resource must define an
279 * IRES_Fxns structure containing the pointers to functions
280 * implementatng the IRES interface.
281 * If the algorithm does not use an IRES resource this field
282 * should be set to NULL.
283 */
284 Ptr iresFxns;
285
286 /**
287 * @brief Codec class configuration data, if any.
288 */
289 Void *codecClassConfig;
290
291 /**
292 * @brief Indicates the type of memory the alg's memory requests will
293 * be allocated from.
294 * The alg's memory will be allocated from cached memory, if
295 * memType = Engine_USECACHEDMEM_CACHED,
296 * from non-cached memory, if
297 * memType = Engine_USECACHEDMEM_NONCACHED,
298 * Otherwise, if
299 * memType = Engine_USECACHEDMEM_DEFAULT,
300 * memory allocations will be determined by the value of
301 * ti_sdo_ce_alg_Algorithm_useCache (cached, if TRUE, non-cached,
302 * if FALSE).
303 *
304 * @sa Engine_CachedMemType
305 */
306 Engine_CachedMemType memType; /**< Memory type for alg's mem reqs. */
307
308 /**
309 * @brief A string idicating the type(s) of algorithm this is.
310 * This should be a ';' separated string of inherited types.
311 * In most cases, @c types will just be set to the VISA type
312 * defined in the Codec Engine algorithm interface header
313 * file included by the algorithm, depending on the XDM interface
314 * the algorithm implements.
315 *
316 * For example, if the algorithm implements the ISPHDEC1
317 * interface as defined by XDM, @c types should be set
318 * to
319 * @c SPHDEC1_VISATYPE
320 * (defined as "ti.sdo.ce.speech1.ISPHDEC1" in the header file
321 * ti/sdo/ce/speech1/sphdec1.h).
322 *
323 * Another example to illustrate multiple typss specified in
324 * @c typss, if the algorithm implements the (made-up)
325 * interface, ti.sdo.ce.test.xvideo.IVIDE, which in turn
326 * implements the IVIDDEC interface, we could then set @c types
327 * to
328 * VIDDEC_VISATYPE";ti.sdo.ce.test.xvideo.IVIDE"
329 * or
330 * "ti.sdo.ce.test.xvideo.IVIDE;"VIDDEC_VISATYPE
331 */
332 String types;
333} Engine_AlgDesc;
334
335
336/**
337 * @brief Name of function that a dynamically loaded codec must supply.
338 */
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 */
345/**
346 * @brief Descriptor for a dynamically loaded alg. A dynamic library
347 * for a codec must export a function that fills in a structure
348 * of this type.
349 *
350 * @sa Engine_GetAlgDescFxn
351 */
352typedef struct Engine_DllAlgDesc {
353 /**
354 * @brief Pointer to codec's IALG_Fxns. This can not be NULL.
355 */
356 IALG_Fxns *fxns;
357
358 /**
359 * @brief Pointer to codec's IDMA3_Fxns table. If the codec does not
360 * use DMA, this should be NULL.
361 */
362 Ptr idmaFxns;
363
364 /**
365 * @brief Pointer to codec's IRES_Fxns function table. This should be
366 * NULL if the codec does not implement the IRES_Fxns.
367 */
368 Ptr iresFxns;
369
370 /**
371 * @brief Inheritance hierarchy of codec. This is a ';' separated
372 * string that lists the interfaces inherited by the code. For
373 * example:
374 *
375 * "ti.sdo.ce.speech1.ISPHDEC1"
376 *
377 * or, in the case where a test IVIDE interface inherits IVIDDEC:
378 *
379 * "ti.sdo.ce.video.IVIDDEC;ti.sdo.ce.test.xvideo.IVIDE"
380 *
381 */
382 String types;
383
384 /**
385 * @brief codec class config data, if any.
386 *
387 * @todo Figure out what this is.
388 */
389 Void *codecClassConfig;
390} Engine_DllAlgDesc;
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 */
398/**
399 * @brief Prototype of function that must be supplied by a dynamic
400 * codec library to fill in a @c Engine_DllAlgDesc structure.
401 *
402 * @remarks This function will be called by @c Engine_addAlg() to fill
403 * in the dynamic codec's descriptor.
404 *
405 * @sa Engine_DllAlgDesc
406 */
407typedef Int (*Engine_GetAlgDescFxn)(Engine_DllAlgDesc *dllAlgDesc);
408
409
410/*
411 * ======== Engine_Desc ========
412 */
413/**
414 * @brief This structure is passed to @c Engine_add(), and contains
415 * parameters to specify an engine.
416 *
417 * @sa Engine_add()
418 * @sa Engine_open()
419 */
420typedef struct Engine_Desc {
421 String name; /**< Name of the Engine
422 *
423 * @remarks This must not be NULL
424 */
425 Engine_AlgDesc *algTab; /**< No longer used, set to NULL */
426 String remoteName; /**< Name of Server image, if applicable
427 *
428 * @remarks If this Engine has no remote
429 * algorithms, this can be NULL.
430 *
431 * @remarks On SysLink-based systems, this
432 * is the name of a file, and is
433 * passed unchanged to
434 * ProcMgr_load().
435 */
436 String memMap; /**< Name of a file containing the slave
437 * memory map
438 *
439 * @remarks If this Engine has no remote
440 * algorithms, this can be NULL.
441 *
442 * @remarks If the remote algorithms are
443 * on a Server whos MMU is not
444 * enabled, this can be NULL.
445 *
446 * @remarks The format of this file matches
447 * the SysLink format described at
448 * http://processors.wiki.ti.com/index.php/SysLink_MMU_Support
449 *
450 * @remarks If useExtLoader is FALSE, this
451 * field can be NULL.
452 */
453 Bool useExtLoader; /**< Indicates whether the Server containing
454 * any remote algorithms will be loaded using
455 * an external loader (e.g. SysLink's
456 * slaveloader)
457 *
458 * @remarks If @c useExtLoader is TRUE,
459 * Engine_open() will not load
460 * the slave.
461 *
462 * @remarks If @c useExtLoader is FALSE,
463 * Engine_open() will load the
464 * Server with the file specified
465 * by @c remoteName.
466 */
467 Int numAlgs; /**< No longer used, set to zero */
468 Int heapId; /**< No longer used, set to zero */
469} Engine_Desc;
470
471
472/** @cond INTERNAL */
473
474/*
475 * ======== Engine_AlgCreateAttrs ========
476 */
477typedef struct Engine_AlgCreateAttrs {
478 Bool useExtHeap; /**< Use a single external heap for alg's
479 * memory requests if TRUE, otherwise attempt
480 * to honor the alg's algAlloc() function for
481 * memory heap assignments.
482 */
483 Int priority; /**< Alg instance priority (-1: use value from
484 * configuration). */
485} Engine_AlgCreateAttrs;
486
487
488/*
489 * ======== Engine_Config ========
490 */
491typedef 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 */
500typedef 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 */
509extern Engine_AlgCreateAttrs Engine_ALGCREATEATTRS;
510
511/*
512 * ======== Engine_config ========
513 */
514extern Engine_Config Engine_config;
515
516/** @endcond */
517
518
519/*
520 * ======== Engine_addStubFxns ========
521 */
522/**
523 * @brief Register stub functions through which a remote algorithm
524 * can be called
525 *
526 * @param[in] fxnsName The name of the stub function table (e.g.
527 * "UNIVERSAL_STUBS")
528 * @param[in] fxns Address of stub function table
529 * (e.g. &UNIVERSAL_STUBS)
530 *
531 * @pre As with all Codec Engine API's, CERuntime_init() must have
532 * previously been called.
533 *
534 * @remarks This service is not necessary if you configure your Engine
535 * at build/config time using Engine.createFromServer().
536 * When using Engine.createFromServer(), the appropriate
537 * alg-specific stubs are added to the system automatically.
538 *
539 * @remarks When on an RTOS (e.g. SYS/BIOS), the stubs registered are
540 * available to all Engines in the system. When on a HLOS
541 * (e.g. Linux, WinCE), the stubs registered are available to
542 * all Engines in the calling application's process.
543 *
544 * @remarks The symbol passed to the @c fxns argument can often be found
545 * in the class-specific VISA header file (e.g. UNIVERSAL_STUBS
546 * is declared in ti/sdo/ce/universal/universal.h).
547 *
548 * @remarks For example, to register "UNIVERSAL_STUBS" for use by an
549 * IUNIVERSAL-compliant algorithm at runtime, you can
550 * do the following:
551 * @code
552 * #include <ti/sdo/ce/Engine.h>
553 * #include <ti/sdo/ce/universal/universal.h>
554 *
555 * Engine_register("UNIVERSAL_STUBS",
556 * (IALG_Fxns *)&UNIVERSAL_STUBS);
557 * @endcode
558 *
559 * @retval Engine_EOK Success.
560 * @retval Engine_ENOMEM Memory allocation failed.
561 *
562 * @sa Engine_open()
563 */
564extern Engine_Error Engine_addStubFxns(String fxnsName, IALG_Fxns *fxns);
565
566/*
567 * ======== Engine_add ========
568 */
569/**
570 * @brief Add an Engine to the database of engines that can be opened with
571 * Engine_open()
572 *
573 * @param[in] pDesc The handle of an Engine Descriptor object.
574 * Before setting the fields of pDesc, it must
575 * first be initialized with @c Engine_initDesc().
576 *
577 * @retval Engine_EINVAL Bad parameter passed, such as @c pDesc = NULL,
578 * or @c pDesc->name = NULL.
579 * @retval Engine_EINUSE An engine with the name @c pDesc->name already
580 * exists.
581 * @retval Engine_ENOMEM A memory allocation failed.
582 * @retval Engine_EOK Success.
583 *
584 * @pre As with all Codec Engine API's, CERuntime_init() must have
585 * previously been called.
586 *
587 * @post If the return value is Engine_EOK, Engine_open() can be
588 * called with @c pDesc->name.
589 *
590 * @par Example Usage:
591 * @code
592 * #include <ti/sdo/ce/Engine.h>
593 *
594 * Engine_Desc desc;
595 *
596 * Engine_initDesc(&desc);
597 *
598 * desc.name = "myEngine";
599 * desc.remoteName = "myServer.x64P";
600 * Engine_add(&desc);
601 * @endcode
602 *
603 * @sa Engine_remove()
604 * @sa Engine_open()
605 */
606extern Engine_Error Engine_add(Engine_Desc *pDesc);
607
608/*
609 * ======== Engine_addAlg ========
610 */
611/**
612 * @brief Dynamically add an algorithm to an Engine.
613 *
614 * @remarks If the Engine has not been opened, the name of the Engine is
615 * used, otherwise, a handle to the opened Engine. If the Engine
616 * has been opened, the added alg will only be accessible to the
617 * caller of this function. Either one or the other, but not
618 * both, of @c name and @c engine should be non-NULL.
619 *
620 * @param[in] name The name of the engine. @c name is
621 * specified in the engine configuration, or
622 * the name of an engine added with
623 * @c Engine_add(). This can only be non-NULL if
624 * the engine is not opened, otherwise, use
625 * an engine handle and set @c name to NULL.
626 * @param[in] engine The handle of an engine returned by
627 * Engine_open(). If @c engine is non-NULL, set
628 * @c name to NULL.
629 * @param[in] location String identifying the location of the
630 * algorithm. Often this is a file name, but for
631 * systems without a file system, it may be a
632 * system-specific string identifier. This may
633 * be NULL if the algorithm is built into the
634 * executable.
635 * @param[in] pAlgDesc Parameters describing the algorithm being
636 * added. Before setting the fields of this
637 * structure, it should first be initialized
638 * with @c Engine_initAlgDesc(), to set all
639 * fields to default values.
640 * If location is non-NULL (a dynamic library),
641 * then the following fields of pAlgDesc must
642 * be specified:
643 * pAlgDesc->name
644 * pAlgDesc->isLocal
645 * pAlgDesc->groupId
646 * All other Engine_AlgDesc fields will be
647 * from the dynamic library.
648 * If location is NULL (not a dynamic library),
649 * the user must set the following fields of
650 * pAlgDesc:
651 * pAlgDesc->name
652 * pAlgDesc->fxns
653 * pAlgDesc->idmaFxns, if applicable
654 * pAlgDesc->iresFxns, if applicable
655 * pAlgDesc->isLocal
656 * pAlgDesc->groupId
657 * pAlgDesc->types
658 *
659 * @pre As with all Codec Engine API's, CERuntime_init() must have
660 * previously been called.
661 *
662 * @pre @c engine is a valid (non-NULL) engine handle which is
663 * in the open state.
664 *
665 * @remarks If there is an existing algorithm in the engine already named
666 * @c name, an error will be returned.
667 *
668 * @retval Engine_EOK Success.
669 * @retval Engine_EINUSE The Engine @c name is non-NULL, and the
670 * Engine is open.
671 * @retval Engine_EINVAL @c pAlgDesc or @c pAlgDesc->name is NULL.
672 * @retval Engine_EINVAL Both @c name and @c engine are NULL. Ensure
673 * one of these is non-NULL.
674 * @retval Engine_EINVAL Both @c name and @c engine are non-NULL.
675 * Ensure that one of these is NULL.
676 * @retval Engine_EEXIST There is no engine with the given name.
677 * @retval Engine_EINUSE The name of the alg in @c pAlgDesc->name is
678 * already in use.
679 * @par Example Usage:
680 * @code
681 * #include <ti/sdo/ce/Engine.h>
682 *
683 * Engine_AlgDesc desc;
684 *
685 * Engine_initAlgDesc(&desc);
686 *
687 * desc.groupId = 2;
688 * desc.isLocal = TRUE;
689 * desc.fxns = &UNIVERSALCOPY_TI_IUNIVERSALCOPY;
690 * desc.idmaFxns = NULL;
691 * desc.iresFxns = NULL;
692 * desc.memType = Engine_USECACHEDMEM_DEFAULT;
693 * desc.types = UNIVERSAL_VISATYPE;
694 *
695 * status = Engine_addAlg("myEngine", NULL, NULL, &desc);
696 *
697 * @endcode
698 *
699 * @sa Engine_initAlgDesc()
700 * @sa Engine_open()
701 * @sa Engine_removeAlg()
702 */
703extern Engine_Error Engine_addAlg(String name, Engine_Handle engine,
704 String location, Engine_AlgDesc *pAlgDesc);
705
706/*
707 * ======== Engine_removeAlg ========
708 */
709/**
710 * @brief Dynamically remove an algorithm that was added to an Engine
711 * with Engine_addAlg().
712 *
713 * @remarks The same values of the parameters @c name and @c engine that
714 * were passed to Engine_addAlg() should be used here. In
715 * particular, if @c name was used to add the alg, all handles to
716 * the engine must be closed before calling Engine_removeAlg().
717 *
718 *
719 * @param[in] name The name of the engine or NULL, that was
720 * passed to Engine_addAlg().
721 * @param[in] engine The handle to an engine, previously acquired
722 * by a call to Engine_open(), or NULL, that was
723 * used in Engine_addAlg().
724 * @param[in] algName Name of the algorithm to remove.
725 *
726 * @retval Engine_EOK Success.
727 * @retval Engine_EEXIST The engine @c name does not exist.
728 * @retval Engine_ENOTFOUND @c algName could not be found in @c engine.
729 * @retval Engine_EINUSE The Engine @c name is still open.
730 *
731 * @sa Engine_open()
732 * @sa Engine_addAlg()
733 */
734extern Engine_Error Engine_removeAlg(String name, Engine_Handle engine,
735 String algName);
736
737/** @cond INTERNAL */
738
739/*
740 * ======== Engine_call ========
741 */
742extern Int Engine_call(Engine_Node node, Comm_Msg *msg);
743
744/*
745 * ======== Engine_callAsync ========
746 */
747extern Int Engine_callAsync(Engine_Node node, Comm_Msg *msg);
748
749/*
750 * ======== Engine_callWait ========
751 */
752extern Int Engine_callWait(Engine_Node node, Comm_Msg *msg, UInt timeout);
753
754/*
755 * ======== Engine_ctrlNode ========
756 */
757extern Int Engine_ctrlNode(Engine_Node node, Comm_Msg *msg, Engine_Ctrl code);
758
759/** @endcond */
760
761/*
762 * ======== Engine_close ========
763 */
764/**
765 * @brief Close an Engine
766 *
767 * @param[in] engine The handle to an engine, previously acquired
768 * by a call to Engine_open().
769 *
770 * @pre @c engine must not be referenced by any algorithm instance
771 * objects; i.e., you must first delete all algorithm instances
772 * associated with @c engine before closing it.
773 *
774 * @pre @c engine is a valid (non-NULL) engine handle which is
775 * in the open state.
776 *
777 * @sa Engine_open()
778 */
779extern Void Engine_close(Engine_Handle engine);
780
781/** @cond INTERNAL */
782/*
783 * ======== Engine_createNode ========
784 */
785/**
786 * @brief Create a remote algorithm
787 *
788 * @param[in] engine The handle to an engine, previously acquired
789 * by a call to Engine_open().
790 * @param[in] name Name of the algorithm to create.
791 * @param[in] msgSize Size of the internal message required to
792 * communicate with the remote algorithm.
793 * @param[in] nodeAttrs Creation parameters for the remote algorithm.
794 * @param[in] attrs Attributes used by the framework for creating
795 * the remote algorithm.
796 *
797 * @pre @c engine is a valid (non-NULL) engine handle which is
798 * in the open state.
799 *
800 * @remarks Engine_createNode2() was added after Engine_createNode() to
801 * support more use cases. Engine_createNode() is a wrapper
802 * around Engine_createNode2(), and is maintained for compatibility.
803 *
804 * @retval NULL Failure
805 * @retval non-NULL A handle to the created remote algorithm.
806 *
807 * @sa Engine_createNode2()
808 * @sa Engine_deleteNode()
809 */
810extern 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 */
817/**
818 * @brief Create a remote algorithm
819 *
820 * @param[in] engine The handle to an engine, previously acquired
821 * by a call to Engine_open().
822 * @param[in] name Name of the algorithm to create.
823 * @param[in] msgSize Size of the internal message required to
824 * communicate with the remote algorithm.
825 * @param[in] nodeAttrs Creation parameters for the remote algorithm.
826 * @param[in] nodeAttrsSize Size of @c nodeAttrs.
827 * @param[in] attrs Attributes used by the framework for creating
828 * the remote algorithm.
829 *
830 * @pre @c engine is a valid (non-NULL) engine handle which is
831 * in the open state.
832 *
833 * @remarks Engine_createNode() is the preferred method to create remote
834 * algorithms. However, some algorithm interfaces incorrectly
835 * fail to provide a size field of type "Int" as the first field
836 * in their creation parameters, which the XDAIS spec defines.
837 * This service allows the creation of remote algorithms where the
838 * size of the creation params is specified "some other way" than
839 * the XDAIS spec defines.
840 *
841 * @retval NULL Failure
842 * @retval non-NULL A handle to the created remote algorithm.
843 *
844 * @sa Engine_createNode()
845 * @sa Engine_deleteNode()
846 */
847extern 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 */
855extern Void Engine_deleteNode(Engine_Node node);
856
857/*
858 * ======== Engine_getAlgMemRecs ========
859 */
860/**
861 * @brief Get the IALG_MemRecs used by an algorithm
862 *
863 * @param[in] node Handle to an algorithm instance.
864 * @param[out] memTab Location to store the IALG_MemRecs.
865 * @param[in] size Maximum number of IALG_MemRecs to put in memTab array.
866 * @param[out] numRecs Actual number of IALG_MemRecs copied into memTab array.
867 *
868 * @retval Engine_EOK Success.
869 * @retval Engine_ERUNTIME Failure.
870 *
871 * @sa Engine_getAlgNumRecs()
872 */
873extern Engine_Error Engine_getAlgMemRecs(Engine_Node node, IALG_MemRec *memTab, Int size,
874 Int *numRecs);
875
876/*
877 * ======== Engine_getAlgNumRecs ========
878 */
879/**
880 * @brief Get the number of IALG_MemRecs used by a remote algorithm
881 *
882 * @param[in] node Handle to an algorithm instance.
883 * @param[out] numRecs Location to store the number of IALG_MemRecs used.
884 *
885 * @retval Engine_EOK Success.
886 * @retval Engine_ERUNTIME Failure.
887 *
888 * @sa Engine_getAlgMemRecs()
889 */
890extern Engine_Error Engine_getAlgNumRecs(Engine_Node node, Int *numRecs);
891
892/*
893 * ======== Engine_getConstName ========
894 */
895extern String Engine_getConstName(Engine_Handle engine, String name,
896 String type);
897
898/*
899 * ======== Engine_getFxns ========
900 */
901extern 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 */
908extern Int Engine_getMemId(Engine_Handle engine);
909
910/*
911 * ======== Engine_getLocalEngine ========
912 */
913extern Engine_Handle Engine_getLocalEngine(Void);
914
915/*
916 * ======== Engine_getEngine ========
917 */
918extern Engine_Handle Engine_getEngine(Engine_Node node);
919
920/*
921 * ======== Engine_getMemStat ========
922 */
923extern Engine_Error Engine_getMemStat(Server_Handle server, Int segNum,
924 Engine_MemStat *stat);
925
926/*
927 * ======== Engine_getNumMemSegs ========
928 */
929extern Engine_Error Engine_getNumMemSegs(Server_Handle server, Int *numSegs);
930
931/*
932 * ======== Engine_getNumEngines ========
933 */
934extern Int Engine_getNumEngines();
935
936/*
937 * ======== Engine_getProcId ========
938 */
939extern String Engine_getProcId(Engine_Handle engine);
940
941/*
942 * ======== Engine_hasServer ========
943 */
944extern Bool Engine_hasServer(Engine_Handle engine);
945
946/*
947 * ======== Engine_init ========
948 */
949extern Void Engine_init(Void);
950
951
952/** @endcond */
953
954/*
955 * ======== Engine_initAlgDesc ========
956 */
957/**
958 * @brief Initialize an Engine_AlgDesc structure with default values.
959 *
960 * @param[in] pAlgDesc Location of Engine_AlgDesc object to initialize.
961 * The fields of pAlgDesc will be set to the following:
962 *
963 * pAlgDesc->name = NULL;
964 * pAlgDesc->uuid.data = 0;
965 * pAlgDesc->fxns = NULL;
966 * pAlgDesc->idmaFxns = NULL;
967 * pAlgDesc->typeTab = NULL;
968 * pAlgDesc->isLocal = TRUE;
969 * pAlgDesc->groupId = 0;
970 * pAlgDesc->rpcProtocolVersion = 0;
971 * pAlgDesc->iresFxns = NULL;
972 * pAlgDesc->codecClassConfig = NULL;
973 * pAlgDesc->memType = Engine_USECACHEDMEM_DEFAULT;
974 * pAlgDesc->types = NULL;
975 *
976 * @sa Engine_addAlg()
977 */
978extern Void Engine_initAlgDesc(Engine_AlgDesc *pAlgDesc);
979
980/*
981 * ======== Engine_initAttrs ========
982 */
983/**
984 * @brief Initialize an Engine_Attrs structure with default values.
985 *
986 * @param[in] pAttrs Location of Engine_Attrs object to initialize.
987 *
988 * @sa Engine_open()
989 */
990extern Void Engine_initAttrs(Engine_Attrs *pAttrs);
991
992/*
993 * ======== Engine_initDesc ========
994 */
995/**
996 * @brief Initialize an Engine_Desc structure with default values.
997 *
998 * @param[in] pDesc Location of Engine_Desc object to initialize.
999 * The fields of pDesc will be set to the following:
1000 *
1001 * pDesc->name = NULL;
1002 * pDesc->remoteName = NULL;
1003 * pDesc->heapId = 0;
1004 *
1005 * @sa Engine_add()
1006 */
1007extern Void Engine_initDesc(Engine_Desc *pDesc);
1008
1009/** @cond INTERNAL */
1010
1011/*
1012 * ======== Engine_getRemoteVisa ========
1013 */
1014extern UInt32 Engine_getRemoteVisa(Engine_Node node);
1015
1016/*
1017 * ======== Engine_getCodecClassConfig ========
1018 */
1019extern Ptr Engine_getCodecClassConfig(Engine_Handle engine, String name,
1020 String type);
1021
1022/*
1023 * ======== Engine_getNodeQueues ========
1024 */
1025extern Void Engine_getNodeQueues(Engine_Node node, Comm_Id *stdIn, Comm_Handle *stdOut);
1026
1027
1028/*
1029 * ======== Engine_initFromServer ========
1030 */
1031extern Engine_Error Engine_initFromServer(Engine_Handle engine);
1032
1033
1034/*
1035 * ======== Engine_redefineHeap ========
1036 */
1037extern Engine_Error Engine_redefineHeap(Server_Handle server, String name,
1038 Uint32 base, Uint32 size);
1039
1040/*
1041 * ======== Engine_releaseTraceToken ========
1042 */
1043extern Bool Engine_releaseTraceToken(Server_Handle server);
1044
1045/*
1046 * ======== Engine_requestTraceToken ========
1047 */
1048extern Engine_Error Engine_requestTraceToken(Server_Handle server);
1049
1050/*
1051 * ======== Engine_restoreHeap ========
1052 */
1053extern Engine_Error Engine_restoreHeap(Server_Handle server, String name);
1054
1055/** @endcond */
1056
1057/*
1058 * ======== Engine_open ========
1059 */
1060/**
1061 * @brief Open an Engine
1062 *
1063 * The handle returned may be used to create one or more instances of an
1064 * algorithm contained in the specified Engine.
1065 *
1066 * An Engine may be opened more than once; each open returns a unique
1067 * handle that can be used to create algorithm instances or get status of the
1068 * Engine.
1069 *
1070 * Engine handles must not be concurrently accessed by multiple threads; each
1071 * thread must either obtain its own handle (via Engine_open()) or explicitly
1072 * serialize access to a shared handle.
1073 *
1074 * @param[in] name The name of the engine to open. @c name is
1075 * specified in the engine configuration.
1076 * @param[in] attrs Attributes for the open engine.
1077 * @param[out] ec Optional output error code
1078 *
1079 * @retval NULL An error has occurred.
1080 * @retval non-NULL The handle to the opened engine.
1081 *
1082 * @pre @c name is a non-NULL string.
1083 *
1084 * @pre @c name is a valid, pre-configured name of an engine.
1085 *
1086 * @pre As with all Codec Engine API's, CERuntime_init() must have
1087 * previously been called.
1088 *
1089 * @post If the return handle is NULL and @c ec is non-NULL, @c *ec
1090 * is set to a non-zero value indicating the cause of the failure.
1091 *
1092 * @post If @c ec is non-NULL, the Engine_Error value is set to one of
1093 * the following values:
1094 * - #Engine_EOK success
1095 * - #Engine_EEXIST name does not exist
1096 * - #Engine_ENOMEM can't allocate memory
1097 * - #Engine_EDSPLOAD can't load the DSP
1098 * - #Engine_ENOCOMM can't create a comm connection to DSP
1099 * - #Engine_ENOSERVER can't locate the server on the DSP
1100 * - #Engine_ECOMALLOC can't allocate communication buffer
1101 *
1102 * @sa Engine_close()
1103 * @sa Engine_add()
1104 * @sa Engine_remove()
1105 */
1106extern Engine_Handle Engine_open(String name, Engine_Attrs *attrs,
1107 Engine_Error *ec);
1108
1109/*
1110 * ======== Engine_fwriteTrace ========
1111 */
1112/**
1113 * @brief Write Server's trace buffer to specifed file stream
1114 *
1115 * @param[in] engine The handle to the opened engine.
1116 *
1117 * @param[in] prefix A string to prepend to each line output; this
1118 * allows one to easily identify trace from the
1119 * server from the application's trace, for
1120 * example.
1121 * @param[in] out A open FILE stream used to output the
1122 * Server's trace characters.
1123 *
1124 * @retval Integer number of characters copied to the specified
1125 * FILE stream.
1126 *
1127 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1128 * is in the open state.
1129 *
1130 * @post In the event a negative value is returned,
1131 * Engine_getLastError() will return one of the following values:
1132 * - #Engine_ERUNTIME Either an internal runtime error
1133 * occured or the underlying server
1134 * error occured.
1135 * - #Engine_EINUSE Server trace resource is already in use.
1136 */
1137extern Int Engine_fwriteTrace(Engine_Handle engine, String prefix, FILE *out);
1138
1139/*
1140 * ======== Engine_getAlgInfo ========
1141 */
1142/**
1143 * @brief Get details of an algorithm configured into an engine
1144 *
1145 * @param[in] name The name of the engine. @c name is
1146 * specified in the engine configuration.
1147 * @param[out] algInfo Structure to store algorithm details. The
1148 * @c algInfoSize field of this structure must
1149 * be set to @c sizeof(Engine_AlgInfo) by the
1150 * application.
1151 * @param[out] index The index of the algorithm to get the information.
1152 *
1153 * @retval Engine_EOK Success.
1154 * @retval Engine_EEXIST There is no engine with the given name.
1155 * @retval Engine_ENOTFOUND @c index is greater than or equal to the
1156 * total number of algorithms configured for
1157 * the engine, or @c index < 0.
1158 * @retval Engine_EINVAL The value of @c algInfoSize passed to this
1159 * function does not match the CE library's
1160 * @c sizeof(Engine_AlgInfo).
1161 *
1162 * @pre @c name is a non-NULL string.
1163 *
1164 * @pre @c algInfo is non-NULL.
1165 *
1166 * @pre As with all Codec Engine API's, CERuntime_init() must have
1167 * previously been called.
1168 *
1169 * @post If @c name is a valid engine name and 0 <= @c index < the
1170 * total number of algorithms configured for the engine, then
1171 * @c algInfo will contain the information for the engine's
1172 * ith (i = @c index) algorithm.
1173 *
1174 * @sa Engine_getNumAlgs()
1175 */
1176extern Engine_Error Engine_getAlgInfo(String name, Engine_AlgInfo *algInfo,
1177 Int index);
1178
1179/*
1180 * ======== Engine_getAlgInfo2 ========
1181 */
1182/**
1183 * @brief Get details of an algorithm.
1184 *
1185 * @param[in] name The name of the engine. @c name is
1186 * specified in the engine configuration. This
1187 * may be NULL if @c engine contains a valid
1188 * engine handle.
1189 * @param[in] engine The handle of an engine returned by Engine_open().
1190 * If this is NULL, only information for a static
1191 * alg can be obtained.
1192 * @param[out] algInfo2 Structure to store algorithm details. The
1193 * @c algInfoSize field of this structure must
1194 * be set to @c sizeof(Engine_AlgInfo2) by the
1195 * application.
1196 * @param[out] index The index of the algorithm to get the information.
1197 *
1198 * @retval Engine_EOK Success.
1199 * @retval Engine_EEXIST There is no engine with the given name.
1200 * @retval Engine_ENOTFOUND @c index is greater than or equal to the
1201 * total number of algorithms configured for
1202 * the engine, or @c index < 0.
1203 * @retval Engine_EINVAL The value of @c algInfoSize passed to this
1204 * function does not match the CE library's
1205 * @c sizeof(Engine_AlgInfo2).
1206 *
1207 * @pre @c name is a non-NULL string or @c engine is non-NULL.
1208 *
1209 * @pre @c algInfo2 is non-NULL.
1210 *
1211 * @pre As with all Codec Engine API's, CERuntime_init() must have
1212 * previously been called.
1213 *
1214 * @post If @c name is a valid engine name and 0 <= @c index < the
1215 * total number of algorithms configured for the engine, then
1216 * @c algInfo2 will contain the information for the engine's
1217 * ith (i = @c index) algorithm.
1218 *
1219 * @remarks This service supports algorithms statically configured into
1220 * an Engine at build/config time, or algorithms that have been
1221 * dynamically added to an opened engine. If the Engine has not
1222 * been opened yet, the name of the Engine is used to get the
1223 * statically configured alg. If the Engine has been opened, the
1224 * Engine handle can be used to get either information for a
1225 * statically configured alg, or a remote alg that was added when
1226 * the server was queried during Engine_open().
1227 *
1228 * @sa Engine_getNumAlgs2().
1229 */
1230extern Engine_Error Engine_getAlgInfo2(String name, Engine_Handle engine,
1231 Engine_AlgInfo2 *algInfo2, Int index);
1232
1233
1234/** @cond INTERNAL */
1235/*
1236 * ======== Engine_getCpuLoad ========
1237 */
1238/**
1239 * @brief Get Server's cpu usage in percent
1240 *
1241 * @deprecated This service has been replaced by Server_getCpuLoad()
1242 * to better indicate that this API is not intended for
1243 * obtaining the current processor's CPU load, rather it
1244 * obtains the CPU load of a remote Server.
1245 *
1246 * @param[in] engine The handle to the opened engine.
1247 *
1248 * @retval integer between 0-100 indicating percentage
1249 * of time the Server is processing measured
1250 * over a period of approximately 1 second. If
1251 * the load is unavailable, a negative value is
1252 * returned.
1253 *
1254 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1255 * is in the open state.
1256 *
1257 * @post In the event a negative value is returned,
1258 * Engine_getLastError() will return one of the following values:
1259 * - #Engine_ERUNTIME Either an internal runtime error
1260 * occured or the underlying server
1261 * error occured.
1262 * - #Engine_ENOTAVAIL The CPU load can not be computed.
1263 *
1264 * @sa Server_getCpuLoad()
1265 */
1266extern Int Engine_getCpuLoad(Engine_Handle engine);
1267
1268/** @endcond */
1269
1270
1271/*
1272 * ======== Engine_getDesc ========
1273 */
1274/**
1275 * @brief Fill in an Engine_Desc structure with the values of the
1276 * Engine descriptor for an Engine.
1277 *
1278 * @param[in] name The name of the Engine. @c name is
1279 * specified in the engine configuration or a
1280 * a name that was passed to @c Engine_add().
1281 * @param[out] desc The structure where the descriptor of the
1282 * Engine specified by @c name will be copied to.
1283 *
1284 * @retval Engine_EOK Success.
1285 * @retval Engine_EEXIST There is no engine with the given name.
1286 *
1287 * @pre @c name is a non-NULL string.
1288 *
1289 * @pre @c desc is non-NULL.
1290 *
1291 * @pre As with all Codec Engine API's, CERuntime_init() must have
1292 * previously been called.
1293 *
1294 * @post If @c name is a valid engine name, then desc will contain
1295 * the descriptor of the engine @c name.
1296 *
1297 * @sa Engine_setDesc().
1298 */
1299extern Engine_Error Engine_getDesc(String name, Engine_Desc *desc);
1300
1301/*
1302 * ======== Engine_getLastError ========
1303 */
1304/**
1305 * @brief Get error code of the last failed operation
1306 *
1307 * @param[in] engine The handle to the opened engine.
1308 *
1309 * @retval error code (Engine_Error) of the last failed
1310 * engine operation.
1311 *
1312 * @pre As with all Codec Engine API's, CERuntime_init() must have
1313 * previously been called.
1314 *
1315 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1316 * is in the open state.
1317 */
1318extern Engine_Error Engine_getLastError(Engine_Handle engine);
1319
1320/*
1321 * ======== Engine_getName ========
1322 */
1323/**
1324 * @brief Get the name of an opened engine
1325 *
1326 * @param[in] engine The handle to the opened engine.
1327 *
1328 * @pre As with all Codec Engine API's, CERuntime_init() must have
1329 * previously been called.
1330 *
1331 * @retval NULL An error has occurred.
1332 * @retval non-NULL The name of the opened engine.
1333 */
1334extern String Engine_getName(Engine_Handle engine);
1335
1336
1337/*
1338 * ======== Engine_getNumAlgs ========
1339 */
1340/**
1341 * @brief Get the number of algorithms configured into an Engine
1342 *
1343 * @param[in] name The name of the Engine. @c name is
1344 * specified in the engine configuration.
1345 * @param[out] numAlgs The number of algorithms that are configured
1346 * in the given engine.
1347 *
1348 * @retval Engine_EOK Success.
1349 * @retval Engine_EEXIST There is no engine with the given name.
1350 *
1351 * @pre @c name is a non-NULL string.
1352 *
1353 * @pre @c numAlgs is non-NULL.
1354 *
1355 * @pre As with all Codec Engine API's, CERuntime_init() must have
1356 * previously been called.
1357 *
1358 * @post If @c name is a valid engine name, then numAlgs will contain
1359 * the number of algorithms configured for the given engine.
1360 *
1361 * @sa Engine_getAlgs().
1362 */
1363extern Engine_Error Engine_getNumAlgs(String name, Int *numAlgs);
1364
1365/*
1366 * ======== Engine_getNumAlgs2 ========
1367 */
1368/**
1369 * @brief Get the number of algorithms statically configured into an engine
1370 * or the total number of algorithms both statically configured and
1371 * dynamically added through server information when the engine was
1372 * opened.
1373 *
1374 * @param[in] name The name of the engine. @c name is
1375 * specified in the engine configuration. @c name
1376 * can be NULL, if @c engine is a valid
1377 * Engine_Handle.
1378 * @param[in] engine The handle of an engine returned by
1379 * Engine_open(). If @c engine is NULL, @c name
1380 * must be non-NULL, and only the number of
1381 * statically configured algorithms will be
1382 * returned in @c numAlgs.
1383 * specified in the engine configuration.
1384 * @param[out] numAlgs The number of algorithms that are configured
1385 * in the given engine.
1386 *
1387 * @retval Engine_EOK Success.
1388 * @retval Engine_EEXIST There is no engine with the given name.
1389 *
1390 * @pre @c name is a non-NULL string or @c engine is non-NULL.
1391 *
1392 * @pre @c numAlgs is non-NULL.
1393 *
1394 * @pre As with all Codec Engine API's, CERuntime_init() must have
1395 * previously been called.
1396 *
1397 * @post If @c name is a valid engine name, then numAlgs will contain
1398 * the number of algorithms configured for the given engine.
1399 *
1400 * @remarks If the engine has a server, but was not configured with
1401 * Engine.createFromServer() number of remote algorithms (if any)
1402 * that were statically configured into the engine, will be
1403 * counted twice: once for the static alg table, and once for
1404 * the information queried from the server.
1405 *
1406 * @sa Engine_getAlgs().
1407 */
1408extern Engine_Error Engine_getNumAlgs2(String name, Engine_Handle engine,
1409 Int *numAlgs);
1410
1411/*
1412 * ======== Engine_getServer ========
1413 */
1414/**
1415 * @brief Get handle to an Engine's Server
1416 *
1417 * This function returns the handle to an Engines server, that can be used
1418 * with Server APIs to obtain information from and control the remote DSP
1419 * server.
1420 *
1421 * @param[in] engine The handle to the opened engine.
1422 *
1423 * @retval Handle to engine's server.
1424 *
1425 * @pre As with all Codec Engine API's, CERuntime_init() must have
1426 * previously been called.
1427 *
1428 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1429 * is in the open state.
1430 */
1431extern Server_Handle Engine_getServer(Engine_Handle engine);
1432
1433
1434/*
1435 * ======== Engine_getUsedMem ========
1436 */
1437/**
1438 * @brief Get Server's total memory usage
1439 *
1440 * @deprecated This service has been replaced by Server_getMemStat()
1441 * to better indicate that this API is not intended for
1442 * obtaining the current processor's memory statistics,
1443 * rather it obtains the memory statistics of a remote
1444 * Server. Also, Server_getMemStat() provides more granularity
1445 * than Engine_getUsedMem().
1446 *
1447 * @param[in] engine The handle to the opened engine.
1448 *
1449 * @retval Total amount of used memory (in MAUs). If the amount is not
1450 * available, 0 is returned and the reason can be retrieved via
1451 * Engine_getLastError().
1452 *
1453 * @pre As with all Codec Engine API's, CERuntime_init() must have
1454 * previously been called.
1455 *
1456 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1457 * is in the open state.
1458 *
1459 * @post in the event that 0 is returned, Engine_getLastError() will
1460 * return one of the following values:
1461 * - #Engine_ERUNTIME Either an internal runtime error
1462 * occured or the underlying server
1463 * error occured.
1464 * - #Engine_ENOTAVAIL The memory usage can not be computed.
1465 */
1466extern UInt32 Engine_getUsedMem(Engine_Handle engine);
1467
1468
1469/*
1470 * ======== Engine_remove ========
1471 */
1472/**
1473 * @brief Remove an engine from the list of engines that can be opened
1474 *
1475 * @param[in] engineName The name of the engine to be removed.
1476 *
1477 * @pre As with all Codec Engine API's, CERuntime_init() must have
1478 * previously been called.
1479 *
1480 * @pre @c engineName is non-NULL.
1481 *
1482 * @retval Engine_EINUSE The engine cannot be removed because
1483 * an instance of it is still opened.
1484 * @retval Engine_EEXIST No engine by this name exists.
1485 * @retval Engine_EOK Success.
1486 *
1487 * @sa Engine_add()
1488 */
1489extern Engine_Error Engine_remove(String engineName);
1490
1491
1492/*
1493 * ======== Engine_setDesc ========
1494 */
1495/**
1496 * @brief Set values for an Engine's descriptor. This function should
1497 * only be called when the Engine has not yet been opened.
1498 *
1499 * @param[in] name The name of the Engine. @c name is
1500 * specified in the engine configuration or a
1501 * a name that was passed to @c Engine_add().
1502 * @param[in] desc The structure where descriptor values for the
1503 * Engine specified by @c name will be copied
1504 * from.
1505 *
1506 * @retval Engine_EOK Success.
1507 * @retval Engine_EEXIST There is no engine with the given name.
1508 * @retval Engine_EINUSE The Engine @c name has already been opened.
1509 *
1510 * @pre @c name is a non-NULL string.
1511 *
1512 * @pre @c desc is non-NULL.
1513 *
1514 * @pre As with all Codec Engine API's, CERuntime_init() must have
1515 * previously been called.
1516 *
1517 * @post If @c name is a valid engine name, then the desscriptor for
1518 * the engine @c name will have been updated with values from
1519 * @c desc.
1520 *
1521 * @remarks Use @c Engine_getDesc() to fill in the descriptor, override
1522 * the fields you want to change, and then pass the descriptor
1523 * to Engine_setDesc().
1524 * Only the following fields of the Engine_Desc are allowed to
1525 * be modified:
1526 * @c memMap
1527 * @c useExtLoader
1528 * @c heapId
1529 *
1530 * @sa Engine_getDesc().
1531 */
1532extern Engine_Error Engine_setDesc(String name, Engine_Desc *desc);
1533
1534
1535/*
1536 * ======== Engine_setTrace ========
1537 */
1538/**
1539 * @brief Set Server's trace mask
1540 *
1541 * @param[in] engine The handle to the opened engine.
1542 * @param[in] mask Trace mask, e.g. "*=01234567"
1543 *
1544 * @retval Engine_ENOSERVER No server for this engine.
1545 * @retval Engine_EINUSE Trace resource is already in use.
1546 * @retval Engine_ERUNTIME Internal runtime error has occurred.
1547 *
1548 * @pre As with all Codec Engine API's, CERuntime_init() must have
1549 * previously been called.
1550 *
1551 * @pre @c engine is a valid (non-NULL) engine handle and the engine
1552 * is in the open state.
1553 *
1554 * @remarks This only sets the trace for a remote server. To change
1555 * the trace mask for the application-side of the framework,
1556 * use Diags_setMask(), or Diags_setMaskMeta().
1557 *
1558 * @sa xdc.runtime.Diags
1559 */
1560extern Int Engine_setTrace(Engine_Handle engine, String mask);
1561
1562
1563/** @cond INTERNAL */
1564
1565/*
1566 * ======== Engine_getDesc ========
1567 * Internal for testing.
1568 */
1569extern Engine_Desc *_Engine_getDesc(Int i);
1570
1571/** @endcond */
1572
1573/*@}*/
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
diff --git a/packages/codec_engine/ti/sdo/ce/Server.h b/packages/codec_engine/ti/sdo/ce/Server.h
new file mode 100644
index 0000000..447c3ef
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/Server.h
@@ -0,0 +1,761 @@
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 * ======== Server.h ========
40 * DSP Server module
41 *
42 * APIs for accessing information from remote server.
43 */
44
45/**
46 * @file ti/sdo/ce/Server.h
47 *
48 * @brief The Codec Engine Server Interface. Provides the user an
49 * inteface to open and manipulate a Server which contains
50 * remote algorithms.
51 */
52/**
53 * @addtogroup ti_sdo_ce_Server Codec Engine Server Interface
54 */
55#ifndef ti_sdo_ce_Server_
56#define ti_sdo_ce_Server_
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62
63#include <ti/sdo/ce/ServerDefs.h>
64#include <ti/sdo/ce/Engine.h>
65#include <ti/sdo/ce/skel.h>
66
67#include <stdio.h> /* def of FILE * */
68
69/** @ingroup ti_sdo_ce_Server */
70/*@{*/
71
72/**
73 * @brief Name to pass to Diags_setMask() to enable logging for Server
74 * functions. For example,
75 * Diags_setMask(Server_MODNAME"+EX1234567");
76 * turns on all Log statements in this module.
77 * Diags_setMask() must be called after initialization to take
78 * effect.
79 */
80#define Server_MODNAME "ti.sdo.ce.Server"
81
82/**
83 * @brief Maximum number of characters used in memory segment names.
84 */
85#define Server_MAXSEGNAMELENGTH 32
86
87/**
88 * @brief Server error code
89 */
90typedef enum Server_Status {
91 Server_EOK = 0, /**< Success. */
92 Server_ENOSERVER = 1, /**< Engine has no server. */
93 Server_ENOMEM = 2, /**< Unable to allocate memory. */
94 Server_ERUNTIME = 3, /**< Internal runtime failure. */
95 Server_EINVAL = 4, /**< Bad value passed to function. */
96 Server_EWRONGSTATE =5, /**< Server is not in the correct state to
97 * execute the requested function. */
98 Server_EINUSE = 6, /**< Server call did not succeed because a
99 * because a required resource is in use. */
100 Server_ENOTFOUND = 7, /**< An entity was not found */
101 Server_EFAIL = 8, /**< Unknown failure */
102 Server_ENOTSUPPORTED = 9 /**< API not supported for given parameters. */
103} Server_Status;
104
105/*
106 * ======== Server_AlgDesc ========
107 */
108typedef struct Server_AlgDesc {
109 /**
110 * @brief The name of the algorithm. This is used by the application
111 * when instantiating an instance of the algorithm through one
112 * of the VISA APIs.
113 */
114 String name;
115
116 /**
117 * @brief The address of the XDAIS alg function table.
118 *
119 * @remarks
120 * All XDAIS algorithms must define an IALG_Fxns structure that
121 * contains implementations of the IALG methods. This field
122 * is simply the address of this structure.
123 */
124 IALG_Fxns *fxns;
125
126 /**
127 * @brief The address of the IDMA3_Fxns function table, if the algorithm
128 * uses DMA. If the algorithm does not use DMA, this field should
129 * set to NULL. Valid for local algorithm only.
130 */
131 Ptr idmaFxns;
132
133 /**
134 * @brief If true, the algorithm will be instantiated on the
135 * "local" CPU. Otherwise the server will create an
136 * instance of the algorithm.
137 */
138 Bool isLocal;
139
140 /**
141 * @brief This id specifies which resource sharing group that this
142 * alg will be placed into.
143 *
144 * @remarks
145 * This 'group' concept is used by the framework for sharing
146 * resources. Algorithms in the same group share resources, and
147 * therefore, must not run at the same time. If you assign the
148 * same groupId to multiple algorithms, these algorithms must
149 * not pre-empt eachother, or the shared resources may be
150 * corrupted.
151 * When server algorithms are configured statically in a .cfg
152 * file, if the @c groupId parameter for the algorithm has
153 * not been set, the configuration process assigns the @c groupId
154 * will be assigned automatically, based on the priority that
155 * the algorithm will run at. However, when Server_addAlg() is
156 * used to dynamically add the algorithm to the server, you must
157 * ensure that the @c groupId is appropriately. If two algorithms
158 * will run at the same time, you must assign them different
159 * group Ids.
160 *
161 * Algorithms in different groups do not share resources.
162 *
163 * @sa http://processors.wiki.ti.com/index.php/Codec_Engine_GroupIds
164 */
165 Int groupId;
166
167 /**
168 * @brief Address of the XDAIS alg IRES Interface function table.
169 *
170 * @remarks
171 * All XDAIS algorithms that use an IRES resource must define an
172 * IRES_Fxns structure containing the pointers to functions
173 * implementatng the IRES interface.
174 * If the algorithm does not use an IRES resource this field
175 * should be set to NULL.
176 */
177 Ptr iresFxns;
178
179 /*
180 * Currently not used.
181 * Codec class configuration data for stub side, if any. We
182 * generate this structure for both sides, although it is
183 * currently only used in the skeletons.
184 */
185 Void *stubsCodecClassConfig;
186
187 /**
188 * @brief Codec class configuration data, if any.
189 */
190 Void *codecClassConfig;
191
192 /*
193 * Currently not used.
194 * Indicates the type of memory the alg's memory requests will
195 * be allocated from.
196 * The alg's memory will be allocated from cached memory, if
197 * memType = Engine_USECACHEDMEM_CACHED,
198 * from non-cached memory, if
199 * memType = Engine_USECACHEDMEM_NONCACHED,
200 * Otherwise, if
201 * memType = Engine_USECACHEDMEM_DEFAULT,
202 * memory allocations will be determined by the value of
203 * ti_sdo_ce_alg_Algorithm_useCache (cached, if TRUE, non-cached,
204 * if FALSE).
205 *
206 * @sa Engine_CachedMemType
207 */
208 Engine_CachedMemType memType; /**< Memory type for alg's mem reqs. */
209
210 /**
211 * @brief A string idicating the type(s) of algorithm this is.
212 * This should be a ';' separated string of inherited types.
213 *
214 * @remarks
215 * In most cases, @c types will just be set to the VISA type
216 * defined in the Codec Engine algorithm interface header
217 * file included by the algorithm, depending on the XDM interface
218 * the algorithm implements.
219 *
220 * For example, if the algorithm implements the ISPHDEC1
221 * interface as defined by XDM, @c types should be set
222 * to
223 * @c SPHDEC1_VISATYPE
224 * (defined as "ti.sdo.ce.speech1.ISPHDEC1" in the header file
225 * ti/sdo/ce/speech1/sphdec1.h).
226 *
227 * Another example to illustrate multiple typss specified in
228 * @c typss, if the algorithm implements the (made-up)
229 * interface, ti.sdo.ce.test.xvideo.IVIDE, which in turn
230 * implements the IVIDDEC interface, we could then set @c types
231 * to
232 * VIDDEC_VISATYPE";ti.sdo.ce.test.xvideo.IVIDE"
233 * or
234 * "ti.sdo.ce.test.xvideo.IVIDE;"VIDDEC_VISATYPE
235 */
236 String types;
237
238 /**
239 * @brief A string idicating the name of the stub functions. This is
240 * needed by remote apps that call Engine_initFromServer().
241 */
242 String stubFxnsName;
243
244 /**
245 * @brief The skel functions needed to invoke the alg remotely
246 */
247 SKEL_Fxns *skelFxns;
248
249 /**
250 * @brief The priority the alg will run at.
251 */
252 Int priority;
253
254 /**
255 * @brief Algorithm stack size.
256 */
257 Int stackSize;
258
259 /*
260 * Currently not used.
261 * Memory heap for algorithm stack.
262 */
263 Int stackSeg;
264} Server_AlgDesc;
265
266/**
267 * @brief Information for a memory heap of a remote DSP server.
268 *
269 * @remarks Sizes are given in DSP data MAUs.
270 * @sa Server_getMemStat().
271 *
272 */
273typedef struct Server_MemStat {
274 Char name[Server_MAXSEGNAMELENGTH + 1]; /**< Name of memory heap. */
275 Uint32 base; /**< Base address of the memory segment. */
276 Uint32 size; /**< Original size of the memory segment. */
277 Uint32 used; /**< Number of bytes used. */
278 Uint32 maxBlockLen; /**< Length of the largest contiguous free block. */
279} Server_MemStat;
280
281
282/*
283 * ======== Server_addAlg ========
284 */
285/**
286 * @brief Dynamically add an algorithm to a Server.
287 *
288 * @param[in] server The handle of a server returned by
289 * Engine_getServer(). Set to NULL when adding
290 * a local algorithm to the server. In the
291 * future, this handle will be used to
292 * dynamically add algorithms to a remote server.
293 * @param[in] location String identifying the location of the
294 * algorithm. Often this is a file name, but for
295 * systems without a file system, it may be a
296 * system-specific string identifier. This may
297 * be NULL if the algorithm is built into the
298 * executable. Currently not supported - set to
299 * NULL.
300 * @param[in] pAlgDesc Parameters describing the algorithm being
301 * added. Before setting the fields of this
302 * structure, it should first be initialized
303 * with @c Server_initAlgDesc(), to set all
304 * fields to default values.
305 *
306 * The user must set the following fields of
307 * pAlgDesc:
308 * pAlgDesc->name
309 * pAlgDesc->fxns
310 * pAlgDesc->idmaFxns, if applicable
311 * pAlgDesc->iresFxns, if applicable
312 *
313 * pAlgDesc->groupId
314 * pAlgDesc->priority
315 * pAlgDesc->stackSize
316 *
317 * pAlgDesc->types
318 * pAlgDesc->stubFxnsName
319 * pAlgDesc->skelFxns
320 *
321 * Currently, adding only local algorithms is
322 * supported, so the default value of TRUE can
323 * be used for:
324 * pAlgDesc->isLocal
325 *
326 * @pre As with all Codec Server API's, CERuntime_init() must have
327 * previously been called.
328 *
329 * @remarks If adding a local algorithm to a server that is built with
330 * BIOS, this function must be called after CERuntime_init()
331 * has been called, but before BIOS_start(). This is necessary
332 * to ensure that the algorithm will be visible to the remote
333 * app that loaded the server.
334 *
335 * @remarks If adding a remote algorithm to a remote server, the server
336 * handle for the opened Engine must be used. The server handle
337 * is obtained by calling Engine_getServer() with the handle of
338 * the opened engine.
339 * In this case, the added algorithm will only be accessible to
340 * the caller of this function.
341 * Adding a remote algorithm is not yet supported.
342 *
343 * @remarks If there is an existing algorithm in the server already named
344 * @c name, an error will be returned.
345 *
346 * @retval Server_EOK Success.
347 * @retval Server_EINVAL @c pAlgDesc or @c pAlgDesc->name is NULL.
348 * @retval Server_EINUSE The name of the alg in @c pAlgDesc->name is
349 * already in use.
350 * @retval Server_ENOTSUPPORTED @c pAlgDesc->isLocal = FALSE is currently
351 * not supported.
352 *
353 * @par Example Usage:
354 * @code
355 * #include <ti/sdo/ce/Server.h>
356 *
357 * Server_AlgDesc desc;
358 *
359 * Server_initAlgDesc(&desc);
360 *
361 * desc.groupId = 2;
362 * desc.isLocal = TRUE;
363 * desc.fxns = &UNIVERSALCOPY_TI_IUNIVERSALCOPY;
364 * desc.idmaFxns = NULL;
365 * desc.iresFxns = NULL;
366 * desc.priority = 2;
367 * desc.stackSize = 0x2000;
368 * desc.types = UNIVERSAL_VISATYPE;
369 * desc.stubFxnsName = "UNIVERSAL_STUBS";
370 * desc.skelFxns = &UNIVERSAL_SKEL;
371 *
372 * status = Server_addAlg(NULL, NULL, &desc);
373 *
374 * @endcode
375 *
376 * @sa Server_AlgDesc
377 * @sa Server_initAlgDesc()
378 * @sa Engine_getServer()
379 */
380extern Server_Status Server_addAlg(Server_Handle server, String location,
381 Server_AlgDesc *pAlgDesc);
382
383
384/*
385 * ======== Server_connectTrace ========
386 */
387/**
388 * @brief Connect to server for purposes of collecting
389 * trace and/or LOG data.
390 *
391 * @param[in] server Server handle obtained from Engine_getServer().
392 *
393 * @param[in] token Address to store connection token. This token
394 * should be specified in the companion call to
395 * Server_disconnectTrace().
396 *
397 * @retval Server_EOK Success, trace token was acquired.
398 * @retval Server_EINUSE A connection for server trace is already
399 * established.
400 * @retval Server_ERUNTIME An internal runtime error occurred.
401 *
402 * @pre @c server is non-NULL.
403 * @pre @c token is non-NULL.
404 *
405 * @sa Server_disconnectTrace().
406 *
407 */
408extern Server_Status Server_connectTrace(Server_Handle server, Int * token);
409
410/*
411 * ======== Server_disconnectTrace ========
412 */
413/**
414 * @brief Disconnect from server when finished collecting
415 * trace and/or LOG data.
416 *
417 * @param[in] server Server handle obtained from Engine_getServer().
418 *
419 * @param[in] token Connection token (as obtained from earlier,
420 * companion call to Server_connectTrace()).
421 *
422 * @retval Server_EOK Success.
423 * @retval Server_ERUNTIME An internal runtime error occurred.
424 *
425 * @pre @c server is non-NULL.
426 *
427 * @sa Server_connectTrace().
428 *
429 */
430extern Server_Status Server_disconnectTrace(Server_Handle server, Int token);
431
432/*
433 * ======== Server_fwriteTrace ========
434 */
435/**
436 * @brief Write Server's trace buffer to specifed file stream
437 *
438 * @param[in] server Server handle, obtained from Engine_getServer().
439 *
440 * @param[in] prefix A string to prepend to each line output; this
441 * allows one to easily identify trace from the
442 * server from the application's trace, for
443 * example.
444 * @param[in] out An open FILE stream used to output the
445 * Server's trace characters.
446 *
447 * @retval Integer number of characters copied to the specified
448 * FILE stream.
449 *
450 * @pre @c server is non-NULL.
451 * @pre @c Corresponding engine is in the open state.
452 *
453 * @post In the event a negative value is returned,
454 * Engine_getLastError() will return the value:
455 * - #Engine_ERUNTIME Either an internal runtime error
456 * occured or the underlying server
457 * error occured.
458 */
459extern Int Server_fwriteTrace(Server_Handle server, String prefix, FILE *out);
460
461/*
462 * ======== Server_getCpuLoad ========
463 */
464/**
465 * @brief Get Server's CPU usage in percent.
466 *
467 * @param[in] server Server handle, obtained from Engine_getServer().
468 *
469 * @retval Integer between 0-100 indicating percentage
470 * of time the Server is processing measured
471 * over a period of approximately 1 second. If
472 * the load is unavailable, a negative value is
473 * returned.
474 *
475 * @pre @c server is non-NULL.
476 *
477 * @post In the event a negative value is returned,
478 * Engine_getLastError() will return one of the following values:
479 * - #Engine_ERUNTIME Either an internal runtime error
480 * occured or an underlying server
481 * error occured.
482 * - #Engine_EINVAL The Server handle is not valid.
483 *
484 */
485extern Int Server_getCpuLoad(Server_Handle server);
486
487/*
488 * ======== Server_getMemStat ========
489 */
490/**
491 * @brief Get information on a memory heap segment of a remote DSP server.
492 *
493 * @param[in] server Server handle obtained from Engine_getServer().
494 * @param[in] segNum The heap number of a segment on the DSP.
495 * @param[out] memStat Structure to store memory segment information.
496 *
497 * @retval Server_EOK Success.
498 * @retval Server_ENOTFOUND @c segNum is out of range.
499 * @retval Server_ERUNTIME Internal runtime error occurred.
500 *
501 * @pre @c server is non-NULL.
502 * @pre @c memStat is non-NULL.
503 *
504 * @post On success, memStat will contain information about the memory
505 * heap @c segNum on the DSP.
506 *
507 * @sa Server_getNumMemSegs().
508 *
509 * @remarks This API only returns statistics for BIOS HeapMem heaps
510 * that have been statically configured into the server.
511 */
512extern Server_Status Server_getMemStat(Server_Handle server, Int segNum,
513 Server_MemStat *memStat);
514
515/*
516 * ======== Server_getNumMemSegs ========
517 */
518/**
519 * @brief Get the number of memory heap segments of a remote DSP server.
520 *
521 * @param[in] server Server handle obtained from Engine_getServer().
522 * @param[out] numSegs The number of heap segments of the DSP server.
523 *
524 * @retval Server_EOK Success.
525 * @retval Server_ERUNTIME Internal runtime error occurred.
526 * @retval Server_ENOSERVER Engine has no server.
527 *
528 * @pre @c server is non-NULL.
529 * @pre @c numSegs is non-NULL.
530 *
531 * @post On success, numSegs will contain the number of memory heaps
532 * on the DSP.
533 *
534 * @sa Server_getMemStat().
535 *
536 * @remarks This API returns only the number of BIOS HeapMem heaps that
537 * have been statically configured into the server.
538 */
539extern Server_Status Server_getNumMemSegs(Server_Handle server, Int *numSegs);
540
541/** @cond INTERNAL */
542/*
543 * ======== Server_init ========
544 */
545extern Void Server_init(Void);
546/** @endcond */
547
548/*
549 * ======== Server_initAlgDesc ========
550 */
551/**
552 * @brief Initialize an Server_AlgDesc structure with default values.
553 *
554 * @param[in] pAlgDesc Location of Server_AlgDesc object to initialize.
555 * The fields of pAlgDesc will be set to the following:
556 * @code
557 * pAlgDesc->name = NULL;
558 * pAlgDesc->uuid.data = 0;
559 * pAlgDesc->fxns = NULL;
560 * pAlgDesc->idmaFxns = NULL;
561 * pAlgDesc->typeTab = NULL;
562 * pAlgDesc->isLocal = TRUE;
563 * pAlgDesc->groupId = 0;
564 * pAlgDesc->iresFxns = NULL;
565 * pAlgDesc->codecClassConfig = NULL;
566 * pAlgDesc->priority = 1;
567 * pAlgDesc->stackSize = 1024;
568 * pAlgDesc->types = NULL;
569 * pAlgDesc->stubFxnsName = NULL;
570 * pAlgDesc->skelFxns = NULL;
571 *
572 * Unused fields below are initialized to the
573 * following:
574 *
575 * pAlgDesc->rpcProtocolVersion = 0;
576 * pAlgDesc->memType = Engine_USECACHEDMEM_DEFAULT;
577 * pAlgDesc->stackSeg = 0;
578 *
579 * @endcode
580 *
581 * @sa Server_addAlg()
582 */
583extern Void Server_initAlgDesc(Server_AlgDesc *pAlgDesc);
584
585/*
586 * ======== Server_redefineHeap ========
587 */
588/**
589 * @brief Set the base address and size of a remote DSP server heap.
590 *
591 * @remarks
592 * This API is used to move and/or resize a named heap of the remote DSP
593 * server. The address passed to this API is a DSP address and the
594 * memory from @c base to @c base + @c size must be contiguous in physical
595 * memory. The size of the heap should be given in DSP MADUs (minimum
596 * addressable data units).
597 * The name of the heap can be at most #Server_MAXSEGNAMELENGTH
598 * characters long.
599 *
600 * For example, in the case of DM644x, suppose that an application wants
601 * to allocate a block of memory on the GPP to be used by the DSP server
602 * for the memory segment named "DDRALGHEAP". A block of physically
603 * contiguous memory could be obtained by Memory_alloc() and the
604 * corresponding DSP address obtained with
605 * Memory_getBufferPhysicalAddress(). This DSP address and the size
606 * of the block could then be passed to Server_redefineHeap().
607 * For example:
608 *
609 * @code
610 * Server_redefineHeap(server, "DDRALGHEAP", base, size);
611 * @endcode
612 *
613 * This function can only be called when there is no memory currently
614 * allocated in the heap (since the heap cannot be changed if it is being
615 * used).
616 *
617 * @param[in] server Server handle obtained from Engine_getServer().
618 * @param[in] name Name of heap to be redefined.
619 * @param[in] base Base address for algorithm heap.
620 * @param[in] size Size (DSP MADUs) of new heap.
621 *
622 * @retval Server_EOK Success.
623 * @retval Server_ERUNTIME Internal runtime error occurred.
624 * @retval Server_ENOTFOUND No heap with the specified name was found.
625 * @retval Server_EINVAL Changing to the new base and size would
626 * cause an overlap with another heap.
627 * @retval Server_EINUSE Memory is currently allocated in the heap.
628 *
629 * @pre @c server is non-NULL.
630 * @pre @c base is a DSP address of a physically contiguous
631 * block of memory.
632 * @pre @c base is aligned on an 8-byte boundary.
633 *
634 * @post On success, the server's algorithm heap base will have been
635 * set to @c base, and the size will have been set to @c size.
636 *
637 * @sa Server_restoreHeap().
638 *
639 * @remarks This API is not supported in Codec Engine 3.20.
640 */
641extern Server_Status Server_redefineHeap(Server_Handle server, String name,
642 Uint32 base, Uint32 size);
643
644#if 0
645/*
646 * ======== Server_removeAlg ========
647 */
648/*
649 * Currently not implemented.
650 *
651 * @brief Dynamically remove an algorithm that was added to a Server
652 * with Server_addAlg().
653 *
654 * @remarks The same values of the parameters @c name and @c server that
655 * were passed to Server_addAlg() should be used here. In
656 * particular, if @c name was used to add the alg, all handles to
657 * the engine named @c name must be closed before calling
658 * Server_removeAlg().
659 *
660 *
661 * @param[in] name The name of the engine or NULL, that was
662 * passed to Server_addAlg(). Set to NULL for now.
663 * Currently, only the default "local" engine is
664 * supported.
665 * @param[in] server The handle to a server, previously acquired
666 * by a call to Engine_getServer(), or NULL.
667 * Set to NULL for now. In the future, this will
668 * be used to dynamically remove remote
669 * algorithms from a server.
670 * @param[in] algName Name of the algorithm to remove.
671 *
672 * @retval Server_EOK Success.
673 * @retval Server_ENOTFOUND The server's underlying engine, @c name,
674 * does not exist.
675 * @retval Server_ENOTFOUND @c algName could not be found in the
676 * server's underlying engine table.
677 * @retval Server_EINUSE The server's underlying engine, @c name,
678 * is still open.
679 *
680 * @sa Server_addAlg()
681 */
682extern Server_Status Server_removeAlg(String name, Server_Handle server,
683 String algName);
684#endif
685
686/*
687 * ======== Server_restoreHeap ========
688 */
689/**
690 * @brief Set the base address and size of a remote DSP server heap
691 * back to their original values.
692 *
693 * This function resets the base address and size of a named heap of
694 * the remote server, back to their values before the first call to
695 * Server_redefineHeap() was made. The name of the heap can be at most
696 * #Server_MAXSEGNAMELENGTH characters long, otherwise this function
697 * will return #Server_ENOTFOUND.
698 *
699 * As with Server_redefineHeap(), this function can only be called when
700 * no memory is currently allocated from the heap (as the heap cannot be
701 * changed if it is being used).
702 *
703 * @param[in] server Server handle obtained through Engine_getServer().
704 * @param[in] name Name of the heap to be restored.
705 *
706 * @retval Server_EOK Success.
707 * @retval Server_ERUNTIME Internal runtime error occurred.
708 * @retval Server_ENOTFOUND No heap with the specified name was found.
709 * @retval Server_EINVAL Changing back to the original base and size
710 * would cause an overlap with another heap.
711 * @retval Server_EINUSE Memory is currently allocated in the heap.
712 *
713 * @pre @c server is non-NULL.
714 *
715 * @post On success, the server's algorithm heap base and size will
716 * have been reset to their original value.
717 *
718 * @sa Server_redefineHeap().
719 *
720 * @remarks This API is not supported in Codec Engine 3.20.
721 */
722extern Server_Status Server_restoreHeap(Server_Handle server, String name);
723
724/*
725 * ======== Server_setTrace ========
726 */
727/**
728 * @brief Set Server's trace mask
729 *
730 * @param[in] server Server handle obtained through Engine_getServer().
731 * @param[in] mask Trace mask, e.g. "*=01234567"
732 *
733 * @retval Server_EOK Success.
734 * @retval Server_EINUSE A connection for server trace is already
735 * established.
736 * @retval Server_ENOSERVER No server for the engine.
737 * @retval Server_ERUNTIME Internal runtime error occurred.
738 *
739 * @pre @c server is non-NULL.
740 * @pre @c Corresponding engine is in the open state.
741 *
742 * @remarks This only sets the trace for a remote server. To change
743 * the trace mask for the application-side of the framework,
744 * use Diags_setMask or Diags_setMaskMeta.
745 *
746 * @sa xdc.runtime.Diags
747 */
748extern Int Server_setTrace(Server_Handle server, String mask);
749
750/*@}*/ /* ingroup */
751
752#ifdef __cplusplus
753}
754#endif
755
756#endif
757/*
758 * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
759
760 */
761
diff --git a/packages/codec_engine/ti/sdo/ce/ServerDefs.h b/packages/codec_engine/ti/sdo/ce/ServerDefs.h
new file mode 100644
index 0000000..ec773e0
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/ServerDefs.h
@@ -0,0 +1,76 @@
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 * ======== ServerDefs.h ========
40 * Defs for Server module
41 */
42
43/**
44 * @file ti/sdo/ce/ServerDefs.h
45 *
46 * @brief The Codec Engine Server Definitions.
47 */
48/**
49 * @addtogroup ti_sdo_ce_Server Codec Engine Server Interface
50 */
51#ifndef ti_sdo_ce_ServerDefs_
52#define ti_sdo_ce_ServerDefs_
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58
59/**
60 * @brief Opaque handle to the server for an engine.
61 */
62typedef struct Server_Obj *Server_Handle;
63
64
65/*@}*/ /* ingroup */
66
67#ifdef __cplusplus
68}
69#endif
70
71#endif
72/*
73 * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:03; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
74
75 */
76
diff --git a/packages/codec_engine/ti/sdo/ce/ipc/Comm.h b/packages/codec_engine/ti/sdo/ce/ipc/Comm.h
new file mode 100644
index 0000000..2e3877c
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/ipc/Comm.h
@@ -0,0 +1,235 @@
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 * ======== Comm.h ========
40 */
41#ifndef ti_sdo_ce_ipc_Comm_
42#define ti_sdo_ce_ipc_Comm_
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 * @brief Name to pass to Diags_setMask() to enable logging for Comm
50 * functions. For example,
51 * Diags_setMask(Comm_MODNAME"+EX1234567");
52 * turns on all Log statements in this module.
53 * Diags_setMask() must be called after initialization to take
54 * effect.
55 */
56#define Comm_MODNAME "ti.sdo.ce.ipc.Comm"
57
58#define Comm_GTNAME "OC"
59
60/*
61 * ======== Comm_MSGSIZE ========
62 * Maximum size of communication buffers, defined by the configuration
63 * parameter in Global.xdc.
64 */
65extern UInt32 Comm_MSGSIZE;
66
67typedef UInt32 Comm_Id;
68
69/*
70 * ======== Comm_Handle ========
71 */
72typedef struct Comm_Obj *Comm_Handle;
73
74/*
75 * ======== Comm_QType ========
76 */
77typedef enum {
78 Comm_PEND,
79 Comm_CALL
80} Comm_QType;
81
82/*
83 * ======== Comm_CallFxn ========
84 */
85typedef Void (*Comm_CallFxn)(Ptr callHandle);
86
87/*
88 * ======== Comm_Attrs ========
89 */
90typedef struct Comm_Attrs {
91 Comm_QType type;
92 Ptr callHandle;
93 Comm_CallFxn callFxn;
94} Comm_Attrs;
95
96extern Comm_Attrs Comm_ATTRS; /* default attrs */
97
98/*
99 * ======== Comm_MsgHeader ========
100 * Comm header must be defined, but its fields are irrelevant for the user
101 * Note: this header must be larger than all underlying msgq implementations
102 * (which require a header to maintain message control/transport information)
103 */
104typedef struct Comm_MsgHeader {
105 UInt32 reserved[2]; /* reserved[0] doubles as "next" in the linked list */
106 UInt32 size; /* UInt32 msgSize; */
107 UInt16 reserved1; /* UInt16 flags; */
108 UInt16 msgId; /* UInt16 msgId; */
109 UInt16 reserved3; /* UInt16 dstId; */
110 UInt16 reserved4; /* UInt16 dstProc; */
111 UInt16 reserved5; /* UInt16 replyId; */
112 UInt16 reserved6; /* UInt16 replyProc; */
113 UInt16 reserved7; /* UInt16 srcProc; */
114 UInt16 reserved8; /* UInt16 heapId; */
115 UInt16 reserved9; /* UInt16 seqNum; */
116 UInt32 reserved10; /* UInt32 reserved; */
117} Comm_MsgHeader, *Comm_Msg;
118
119/*
120 * ======== Comm_INVALIDMSGQ ========
121 */
122#define Comm_INVALIDMSGQ 0xFFFF
123#define Comm_INVALIDHANDLE NULL
124
125/*
126 * ======== error status codes ========
127 */
128#define Comm_EOK 0
129#define Comm_EFAIL 1
130#define Comm_ETIMEOUT 2
131
132/*
133 * ======== timeout values ========
134 */
135#define Comm_FOREVER ((UInt)-1)
136#define Comm_POLL ((UInt)0)
137
138/*
139 * ======== Comm_locate ========
140 * Locate an existing communication queue
141 */
142extern Int Comm_locate(String queueName, Comm_Id *msgqId);
143
144/*
145 * ======== Comm_alloc ========
146 * Allocate a message that can be sent to a communication queue
147 */
148extern Int Comm_alloc(UInt16 poolId, Comm_Msg *msg, UInt16 size);
149
150/*
151 * ======== Comm_free ========
152 * Free a previously allocated (Comm_alloc) message
153 */
154extern Int Comm_free(Comm_Msg msg);
155
156/*
157 * ======== Comm_put ========
158 * Send message to specified communication queue
159 */
160extern Int Comm_put(Comm_Id msgqId, Comm_Msg msg);
161
162/*
163 * ======== Comm_get ========
164 * Recieve a message from the specified queue
165 */
166extern Int Comm_get(Comm_Handle comm, Comm_Msg *msg, UInt timeout);
167
168/*
169 * ======== Comm_getMsgSize ========
170 * Get size of the specified message
171 */
172extern Int Comm_getMsgSize(Comm_Msg msg);
173
174/*
175 * ======== Comm_getSrcQueue ========
176 * Get id of sender queue from message
177 */
178extern Int Comm_getSendersId(Comm_Msg msg, Comm_Id *msgqId);
179
180/*
181 * ======== Comm_getId ========
182 * Get MessageQ_QueueId from MessageQ_Handle
183 */
184extern Comm_Id Comm_getId(Comm_Handle comm);
185
186/*
187 * ======== Comm_staticMsgInit ========
188 * Initialize fields of a static Comm_Msg.
189 */
190extern Void Comm_staticMsgInit(Comm_Msg msg, UInt32 size);
191
192/*
193 * ======== Comm_setSrcQueue ========
194 * Put id of sender queue into message
195 */
196extern Void Comm_setReplyToHandle(Comm_Msg msg, Comm_Handle comm);
197
198/*
199 * ======== Comm_create ========
200 * Create a new communication queue
201 */
202extern Comm_Handle Comm_create(String queueName, Comm_Attrs *myAttrs);
203
204/*
205 * ======== Comm_delete ========
206 * its evil twin, the delete() function
207 */
208extern Void Comm_delete(Comm_Handle msgq);
209
210/*
211 * ======== Comm_init ========
212 */
213extern Bool Comm_init(Void);
214
215/*
216 * ======== Comm_exit ========
217 */
218extern Void Comm_exit(Void);
219
220/*
221 * ======== Comm_release ========
222 */
223extern Int Comm_release(Comm_Id msgqId);
224
225
226#ifdef __cplusplus
227}
228#endif
229
230#endif
231/*
232 * @(#) ti.sdo.ce.ipc; 2, 0, 1,3; 6-13-2013 00:15:57; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
233
234 */
235
diff --git a/packages/codec_engine/ti/sdo/ce/node/node.h b/packages/codec_engine/ti/sdo/ce/node/node.h
new file mode 100644
index 0000000..b71b9d1
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/node/node.h
@@ -0,0 +1,209 @@
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 * ======== node.h ========
40 * NODE module definitions.
41 */
42/**
43 * @file ti/sdo/ce/node/node.h
44 *
45 * @brief The Codec Engine Internal NODE API.
46 */
47/**
48 * @addtogroup ti_sdo_ce_NODE CE NODE API
49 */
50
51#ifndef ti_sdo_ce_node_NODE_
52#define ti_sdo_ce_node_NODE_
53
54#include <ti/sdo/ce/ipc/Comm.h>
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60/** @ingroup ti_sdo_ce_NODE */
61/*@{*/
62
63/** @cond INTERNAL */
64
65#define NODE_FOREVER (UInt)-1 /* infinite timeout (Comm_FOREVER) */
66#define NODE_TOGPP 0 /* GPP is the destination for message */
67
68typedef struct NODE_Obj *NODE_EnvPtr; /* pointer to a node's environment */
69
70typedef struct NODE_Config {
71 Int OBJSEG; /* allocate node instances from this MEM seg id */
72 Int MSGQPOOLID; /* Segment to allocate message frames */
73 Int FIXEDMSGSIZE; /* if >0, size NODE must use with Comm_alloc */
74} NODE_Config;
75
76extern NODE_Config *NODE;
77
78/*
79 * ======== NODE_Cmd ========
80 */
81typedef struct NODE_Cmd {
82 Int id;
83 UArg arg1;
84 UArg arg2;
85} NODE_Cmd;
86
87#define NODE_CCALL 0 /* "normal" call command id */
88#define NODE_CEXIT 1 /* exit command id */
89
90/*
91 * ======== NODE_MsgHeader ========
92 */
93typedef struct NODE_MsgHeader {
94 Comm_MsgHeader header;
95 NODE_Cmd cmd;
96} NODE_MsgHeader;
97
98/*
99 * ======== NODE_Msg ========
100 */
101typedef struct NODE_MsgHeader *NODE_Msg;
102
103/**
104 * @brief NODE error code
105 */
106typedef Int NODE_Status;
107
108#define NODE_EOK 0 /**< Success. */
109#define NODE_EOUTOFMEMORY 1 /**< Unable to allocate memory. */
110#define NODE_ERESOURCE 2 /**< Unable to obtain a necessary resource. */
111#define NODE_ETASK 3 /**< Unable to create a task. */
112#define NODE_EFAIL 4 /**< General error. */
113
114/* The Node UUID structure */
115typedef struct NODE_Uuid {
116 UInt32 data;
117} NODE_Uuid;
118
119/*
120 * ======== NODE_allocMsgBuf ========
121 * Allocate a data buffer whose descriptor will be passed to the GPP within
122 * a message.
123 *
124 * Parameters:
125 * node: Node's environment.
126 * size: Size of buffer, in DSP MAUs.
127 * align: Buffer alignment.
128 *
129 * Returns:
130 * On Success: Address of the allocated buffer.
131 * On Failure: NULL.
132 *
133 */
134extern Ptr NODE_allocMsgBuf(NODE_EnvPtr node, UInt size, UInt align);
135
136
137/*
138 * ======== NODE_freeMsgBuf ========
139 * Free a data buffer previously allocated with NODE_allocMsgBuf.
140 *
141 * Parameters:
142 * node: Node's environment.
143 * addr: Address of the data buffer.
144 * size: Size of the allocated buffer, in DSP MAUs.
145 *
146 * Returns:
147 * On Success: TRUE.
148 * On Failure: FALSE. A failure occurs when the specified address does
149 * not reside in the memory segment used for allocations by
150 * NODE_allocMsgBuf().
151 *
152 */
153extern Bool NODE_freeMsgBuf(NODE_EnvPtr node, Ptr addr, UInt size);
154
155
156/*
157 * ======== NODE_getPri ========
158 * Retrieve the task priority of a node.
159 *
160 * Parameters:
161 * node: Node's environment.
162 *
163 * Returns:
164 * taksPriority: the task priority set for the node
165 *
166 * Constraints:
167 * none
168 *
169 * Requires:
170 * node != NULL
171 *
172 */
173extern UInt NODE_getPri(NODE_EnvPtr node);
174
175/*
176 * ======== NODE_init ========
177 */
178extern Void NODE_init(Void);
179
180/*
181 * ======== NODE_exit ========
182 */
183extern Void NODE_exit(Void);
184
185/*
186 * ======== NODE_uuidMatch ========
187 *
188 * Determine whether a uuid matches another.
189 *
190 */
191static inline Bool NODE_uuidMatch(NODE_Uuid *uuid1, NODE_Uuid *uuid2)
192{
193 return (uuid1->data == uuid2->data);
194}
195
196/** @endcond */
197
198/*@}*/
199
200#ifdef __cplusplus
201}
202#endif
203
204#endif
205/*
206 * @(#) ti.sdo.ce.node; 1, 0, 0,3; 6-13-2013 00:16:28; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
207
208 */
209
diff --git a/packages/codec_engine/ti/sdo/ce/skel.h b/packages/codec_engine/ti/sdo/ce/skel.h
new file mode 100644
index 0000000..58cde54
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/skel.h
@@ -0,0 +1,137 @@
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 * ======== skel.h ========
40 */
41/**
42 * @file ti/sdo/ce/skel.h
43 *
44 * @brief The Codec Engine System Programming Interface (SPI) for
45 * skeleton developers.
46 */
47/**
48 * @addtogroup ti_sdo_ce_SKEL CE Skeleton SPI
49 */
50
51#ifndef ti_sdo_ce_SKEL_
52#define ti_sdo_ce_SKEL_
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58#include <ti/sdo/ce/visa.h>
59
60/** @ingroup ti_sdo_ce_SKEL */
61/*@{*/
62
63/**
64 * @brief Prototype for a skeleton's call() implementation
65 *
66 * @param[in] handle A handle to the current skeleton.
67 * @param[in] msg A message sent by the algorithm's stub
68 */
69typedef VISA_Status (*SKEL_CALLFXN)(VISA_Handle handle, VISA_Msg msg);
70
71/**
72 * @brief Prototype for a skeleton's create() API.
73 *
74 * @param[in] reserved Reserved.
75 * @param[in] name Name of the algorithm to create.
76 * @param[in] params Creation parameters for the algorithm.
77 *
78 * @retval NULL Error, unable to create the algorithm.
79 * @retval non-NULL Handle to the successfully created algorithm.
80 */
81typedef VISA_Handle (*SKEL_CREATEFXN)(Void *reserved, String name,
82 Void *params);
83
84/**
85 * @brief Prototype for a skeleton's destroy() API.
86 *
87 * @param[in] handle A handle to the current skeleton.
88 * @param[in] msg A message sent by the algorithm's stub
89 */
90typedef Void (*SKEL_DESTROYFXN)(VISA_Handle handle);
91
92
93/*
94 * ======== SKEL_Fxns ========
95 */
96/**
97 * @brief Table of functions defining the interface of a skeleton.
98 */
99typedef struct SKEL_Fxns {
100 SKEL_CALLFXN call; /**< A skeleton's "call" implementation. */
101 SKEL_CREATEFXN apiCreate; /**< A skeleton's "create" API. */
102 SKEL_DESTROYFXN apiDestroy; /**< A skeleton's "destroy" API. */
103} SKEL_Fxns;
104
105/** @cond INTERNAL */
106
107/**
108 * @brief Cache policies for managing i/o buffers.
109 */
110#define SKEL_LOCALBUFFERINVWB 0
111#define SKEL_WBINVALL 1
112#define SKEL_CACHENONE 2
113
114/**
115 * @brief Cache policy that will be used by all skeletons for managing
116 * i/o buffers. This is auto-generated by Server.xdt.
117 */
118extern Int ti_sdo_ce_Server_skelCachingPolicy;
119
120#define SKEL_cachingPolicy ti_sdo_ce_Server_skelCachingPolicy
121
122
123/** @endcond */
124
125
126/*@}*/
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* _SKEL_ */
133/*
134 * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:04; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
135
136 */
137
diff --git a/packages/codec_engine/ti/sdo/ce/video2/videnc2.h b/packages/codec_engine/ti/sdo/ce/video2/videnc2.h
new file mode 100644
index 0000000..9f4041c
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/video2/videnc2.h
@@ -0,0 +1,401 @@
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 * ======== videnc2.h ========
40 */
41/**
42 * @file ti/sdo/ce/video2/videnc2.h
43 *
44 * @brief The VIDENC2 video encoder interface. Provides the user an
45 * interface to create and interact with XDAIS algorithms that are
46 * compliant with the XDM-defined IVIDENC2 video encoder
47 * interface.
48 */
49/**
50 * @defgroup ti_sdo_ce_video2_VIDENC2 VIDENC2 - Video Encoder Interface
51 *
52 * This is the VIDENC2 video encoder interface. Several of the data
53 * types in this API are specified by the XDM IVIDENC2 interface; please see
54 * the XDM documentation for those details.
55 */
56
57#ifndef ti_sdo_ce_video2_VIDENC2_
58#define ti_sdo_ce_video2_VIDENC2_
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64#include <ti/xdais/dm/xdm.h>
65#include <ti/xdais/dm/ividenc2.h>
66
67#include <ti/sdo/ce/Engine.h>
68#include <ti/sdo/ce/visa.h>
69#include <ti/sdo/ce/skel.h>
70
71/** @ingroup ti_sdo_ce_video2_VIDENC2 */
72/*@{*/
73
74#define VIDENC2_EOK IVIDENC2_EOK /**< @copydoc IVIDENC2_EOK */
75#define VIDENC2_EFAIL IVIDENC2_EFAIL /**< @copydoc IVIDENC2_EFAIL */
76
77/** @copydoc IVIDENC2_EUNSUPPORTED */
78#define VIDENC2_EUNSUPPORTED IVIDENC2_EUNSUPPORTED
79
80#define VIDENC2_ETIMEOUT VISA_ETIMEOUT /**< @copydoc VISA_ETIMEOUT */
81#define VIDENC2_FOREVER VISA_FOREVER /**< @copydoc VISA_FOREVER */
82
83
84/**
85 * @brief The VISA type
86 */
87#define VIDENC2_VISATYPE "ti.sdo.ce.video2.IVIDENC2"
88
89/**
90 * @brief Name of stub functions. Use this name when registering the
91 * VIDENC2_STUBS functions with Engine_addStubFxns.
92 *
93 * @sa Engine_addStubFxns
94 */
95#define VIDENC2_STUBSNAME "VIDENC2_STUBS"
96
97
98/**
99 * @brief Opaque handle to a VIDENC2 codec.
100 */
101typedef VISA_Handle VIDENC2_Handle;
102
103/* The following are just wrapper typedefs */
104
105/** @copydoc IVIDENC2_Params */
106typedef struct IVIDENC2_Params VIDENC2_Params;
107
108/** @copydoc IVIDENC2_InArgs */
109typedef IVIDENC2_InArgs VIDENC2_InArgs;
110
111/** @copydoc IVIDENC2_OutArgs */
112typedef IVIDENC2_OutArgs VIDENC2_OutArgs;
113
114/** @copydoc IVIDENC2_Cmd */
115typedef IVIDENC2_Cmd VIDENC2_Cmd;
116
117/** @copydoc IVIDENC2_DynamicParams */
118typedef IVIDENC2_DynamicParams VIDENC2_DynamicParams;
119
120/** @copydoc IVIDENC2_Status */
121typedef IVIDENC2_Status VIDENC2_Status;
122
123/** @cond INTERNAL */
124
125/**
126 * @brief An implementation of the skel interface; the skeleton side
127 * of the stubs.
128 */
129extern SKEL_Fxns VIDENC2_SKEL;
130
131/**
132 * @brief Implementation of the IVIDENC interface that is run remotely.
133 */
134extern IVIDENC2_Fxns VIDENC2_STUBS;
135
136/** @endcond */
137
138/**
139 * @brief Definition of IVIDENC2 codec class configurable parameters
140 *
141 * @sa VISA_getCodecClassConfig()
142 */
143typedef struct IVIDENC2_CodecClassConfig {
144 Bool manageInBufsPlaneDescCache[IVIDEO_MAX_NUM_PLANES];
145 Bool manageInBufsMetaPlaneDescCache[IVIDEO_MAX_NUM_METADATA_PLANES];
146 Bool manageOutBufsCache[XDM_MAX_IO_BUFFERS];
147} IVIDENC2_CodecClassConfig;
148
149
150/*
151 * ======== VIDENC2_control ========
152 */
153/**
154 * @brief Execute the control() method in this instance of a video
155 * encoder algorithm.
156 *
157 * @param[in] handle Handle to a created video encoder instance.
158 * @param[in] id Command id for XDM control operation.
159 * @param[in] params Runtime control parameters used for encoding.
160 * @param[out] status Status info upon completion of encode operation.
161 *
162 * @pre @c handle is a valid (non-NULL) video encoder handle
163 * and the video encoder is in the created state.
164 *
165 * @retval #VIDENC2_EOK Success.
166 * @retval #VIDENC2_EFAIL Failure.
167 * @retval #VIDENC2_EUNSUPPORTED The requested operation
168 * is not supported.
169 *
170 * @remark This is a blocking call, and will return after the control
171 * command has been executed.
172 *
173 * @remark If an error is returned, @c status->extendedError may
174 * indicate further details about the error. See
175 * #VIDENC2_Status::extendedError for details.
176 *
177 * @sa VIDENC2_create()
178 * @sa VIDENC2_delete()
179 * @sa IVIDENC2_Fxns::process()
180 */
181extern Int32 VIDENC2_control(VIDENC2_Handle handle, VIDENC2_Cmd id,
182 VIDENC2_DynamicParams *params, VIDENC2_Status *status);
183
184
185/*
186 * ======== VIDENC2_create ========
187 */
188/**
189 * @brief Create an instance of a video encoder algorithm.
190 *
191 * Instance handles must not be concurrently accessed by multiple threads;
192 * each thread must either obtain its own handle (via VIDENC2_create()) or
193 * explicitly serialize access to a shared handle.
194 *
195 * @param[in] e Handle to an opened engine.
196 * @param[in] name String identifier of the type of video encoder
197 * to create.
198 * @param[in] params Creation parameters.
199 *
200 * @retval NULL An error has occurred.
201 * @retval non-NULL The handle to the newly created video encoder
202 * instance.
203 *
204 * @remarks @c params is optional. If it's not supplied, codec-specific
205 * default params will be used.
206 *
207 * @remark Depending on the configuration of the engine opened, this
208 * call may create a local or remote instance of the video
209 * encoder.
210 *
211 * @codecNameRemark
212 *
213 * @sa Engine_open()
214 * @sa VIDENC2_delete()
215 */
216extern VIDENC2_Handle VIDENC2_create(Engine_Handle e, String name,
217 VIDENC2_Params *params);
218
219
220/*
221 * ======== VIDENC2_delete ========
222 */
223/**
224 * @brief Delete the instance of a video encoder algorithm.
225 *
226 * @param[in] handle Handle to a created video encoder instance.
227 *
228 * @remark Depending on the configuration of the engine opened, this
229 * call may delete a local or remote instance of the video
230 * encoder.
231 *
232 * @pre @c handle is a valid (non-NULL) handle which is
233 * in the created state.
234 *
235 * @post All resources allocated as part of the VIDENC2_create()
236 * operation (memory, DMA channels, etc.) are freed.
237 *
238 * @sa VIDENC2_create()
239 */
240extern Void VIDENC2_delete(VIDENC2_Handle handle);
241
242
243/*
244 * ======== VIDENC2_process ========
245 */
246/**
247 * @brief Execute the process() method in this instance of a video
248 * encoder algorithm.
249 *
250 * @param[in] handle Handle to a created video encoder instance.
251 * @param[in] inBufs A buffer descriptor containing input buffers.
252 * @param[out] outBufs A buffer descriptor containing output buffers.
253 * @param[in] inArgs Input Arguments.
254 * @param[out] outArgs Output Arguments.
255 *
256 * @pre @c handle is a valid (non-NULL) video encoder handle
257 * and the video encoder is in the created state.
258 *
259 * @retval #VIDENC2_EOK Success.
260 * @retval #VIDENC2_EFAIL Failure.
261 * @retval #VIDENC2_EUNSUPPORTED The requested operation
262 * is not supported.
263 *
264 * @remark Since the VIDENC2 decoder contains support for asynchronous
265 * buffer submission and retrieval, this API becomes known as
266 * synchronous in nature.
267 *
268 * @remark This is a blocking call, and will return after the data
269 * has been encoded.
270 *
271 * @remark The buffers supplied to VIDENC2_process() may have constraints
272 * put on them. For example, in dual-processor, shared memory
273 * architectures, where the codec is running on a remote
274 * processor, the buffers may need to be physically contiguous.
275 * Additionally, the remote processor may place restrictions on
276 * buffer alignment.
277 *
278 * @remark If an error is returned, @c outArgs->extendedError may
279 * indicate further details about the error. See
280 * #VIDENC2_OutArgs::extendedError for details.
281 *
282 * @sa VIDENC2_create()
283 * @sa VIDENC2_delete()
284 * @sa VIDENC2_control()
285 * @sa VIDENC2_processAsync()
286 * @sa VIDENC2_processWait()
287 * @sa IVIDENC2_Fxns::process() - the reflected algorithm interface,
288 * which may contain further usage
289 * details.
290 */
291extern Int32 VIDENC2_process(VIDENC2_Handle handle, IVIDEO2_BufDesc *inBufs,
292 XDM2_BufDesc *outBufs, VIDENC2_InArgs *inArgs,
293 VIDENC2_OutArgs *outArgs);
294
295
296/*
297 * ======== VIDENC2_processAsync ========
298 */
299/**
300 * @brief Perform asynchronous submission to this instance of a video
301 * decoder algorithm.
302 *
303 * @param[in] handle Handle to a created video decoder instance.
304 * @param[in] inBufs A buffer descriptor containing input buffers.
305 * @param[out] outBufs A buffer descriptor containing output buffers.
306 * @param[in] inArgs Input Arguments.
307 * @param[out] outArgs Output Arguments.
308 *
309 * @pre @c handle is a valid (non-NULL) video decoder handle
310 * and the video decoder is in the created state.
311 *
312 * @retval #VIDENC2_EOK Success.
313 * @retval #VIDENC2_EFAIL Failure.
314 * @retval #VIDENC2_EUNSUPPORTED Unsupported request.
315 *
316 * @remark This API is the asynchronous counterpart to the process()
317 * method. It allows for buffer and argument submission without
318 * waiting for retrieval. A response is retrieved using the
319 * VIDENC2_processWait() API.
320 *
321 * @remark The buffers supplied to VIDENC2_processAsync() may have
322 * constraints put on them. For example, in dual-processor,
323 * shared memory architectures, where the codec is running on a
324 * remote processor, the buffers may need to be physically
325 * contiguous. Additionally, the remote processor may place
326 * restrictions on buffer alignment.
327 *
328 * @sa VIDENC2_create()
329 * @sa VIDENC2_delete()
330 * @sa VIDENC2_control()
331 * @sa VIDENC2_process()
332 * @sa VIDENC2_processWait()
333 * @sa IVIDENC2_Fxns::process()
334 */
335extern XDAS_Int32 VIDENC2_processAsync(VIDENC2_Handle handle,
336 IVIDEO2_BufDesc *inBufs, XDM2_BufDesc *outBufs,
337 IVIDENC2_InArgs *inArgs, IVIDENC2_OutArgs *outArgs);
338
339
340/*
341 * ======== VIDENC2_processWait ========
342 */
343/**
344 * @brief Wait for a return message from a previous invocation of
345 * VIDENC2_processAsync() in this instance of an video decoder
346 * algorithm.
347 *
348 * @param[in] handle Handle to a created video decoder instance.
349 * @param[in] inBufs A buffer descriptor containing input buffers.
350 * @param[out] outBufs A buffer descriptor containing output buffers.
351 * @param[in] inArgs Input Arguments.
352 * @param[out] outArgs Output Arguments.
353 * @param[in] timeout Amount of "time" to wait (from 0 -> #VIDENC2_FOREVER)
354 *
355 * @pre @c handle is a valid (non-NULL) video decoder handle
356 * and the video decoder is in the created state.
357 *
358 * @retval #VIDENC2_EOK Success.
359 * @retval #VIDENC2_EFAIL Failure.
360 * @retval #VIDENC2_EUNSUPPORTED Unsupported request.
361 * @retval #VIDENC2_ETIMEOUT Operation timed out.
362 *
363 * @remark This is a blocking call, and will return after the data
364 * has been decoded.
365 *
366 * @remark "Polling" is supported by using a timeout of 0. Waiting
367 * forever is supported by using a timeout of #VIDENC2_FOREVER.
368 *
369 * @remark There must have previously been an invocation of the
370 * VIDENC2_processAsync() API.
371 *
372 * @remark The buffers supplied to VIDENC2_processAsync() may have
373 * constraints put on them. For example, in dual-processor,
374 * shared memory architectures, where the codec is running on a
375 * remote processor, the buffers may need to be physically
376 * contiguous. Additionally, the remote processor may place
377 * restrictions on buffer alignment.
378 *
379 * @sa VIDENC2_create()
380 * @sa VIDENC2_delete()
381 * @sa VIDENC2_control()
382 * @sa VIDENC2_process()
383 * @sa VIDENC2_processAsync()
384 */
385extern XDAS_Int32 VIDENC2_processWait(VIDENC2_Handle handle,
386 IVIDEO2_BufDesc *inBufs, XDM2_BufDesc *outBufs, IVIDENC2_InArgs *inArgs,
387 IVIDENC2_OutArgs *outArgs, UInt timeout);
388
389
390/*@}*/
391
392#ifdef __cplusplus
393}
394#endif
395
396#endif
397/*
398 * @(#) ti.sdo.ce.video2; 1, 0, 3,3; 6-13-2013 00:20:38; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
399
400 */
401
diff --git a/packages/codec_engine/ti/sdo/ce/video3/viddec3.h b/packages/codec_engine/ti/sdo/ce/video3/viddec3.h
new file mode 100644
index 0000000..0272755
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/video3/viddec3.h
@@ -0,0 +1,396 @@
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 * ======== viddec3.h ========
40 */
41/**
42 * @file ti/sdo/ce/video3/viddec3.h
43 *
44 * @brief The VIDDEC3 video decoder interface. Provides the user an
45 * interface to create and interact with XDAIS algorithms that are
46 * compliant with the XDM-defined IVIDDEC3 video decoder
47 * interface.
48 */
49/**
50 * @defgroup ti_sdo_ce_video3_VIDDEC3 VIDDEC3 - Video Decoder Interface
51 *
52 * This is the VIDDEC3 video decoder interface. Several of the data
53 * types in this API are specified by the XDM IVIDDEC3 interface; please see
54 * the XDM documentation for those details.
55 */
56
57#ifndef ti_sdo_ce_video3_VIDDEC3_
58#define ti_sdo_ce_video3_VIDDEC3_
59
60#ifdef __cplusplus
61extern "C" {
62#endif
63
64#include <ti/xdais/dm/xdm.h>
65#include <ti/xdais/dm/ividdec3.h>
66
67#include <ti/sdo/ce/Engine.h>
68#include <ti/sdo/ce/visa.h>
69#include <ti/sdo/ce/skel.h>
70
71/** @ingroup ti_sdo_ce_video3_VIDDEC3 */
72/*@{*/
73
74#define VIDDEC3_EOK IVIDDEC3_EOK /**< @copydoc IVIDDEC3_EOK */
75#define VIDDEC3_EFAIL IVIDDEC3_EFAIL /**< @copydoc IVIDDEC3_EFAIL */
76
77/**< @copydoc IVIDDEC3_EUNSUPPORTED */
78#define VIDDEC3_EUNSUPPORTED IVIDDEC3_EUNSUPPORTED
79
80#define VIDDEC3_ETIMEOUT VISA_ETIMEOUT /**< @copydoc VISA_ETIMEOUT */
81#define VIDDEC3_FOREVER VISA_FOREVER /**< @copydoc VISA_FOREVER */
82
83/**
84 * @brief The VISA type
85 */
86#define VIDDEC3_VISATYPE "ti.sdo.ce.video3.IVIDDEC3"
87
88/**
89 * @brief Name of stub functions. Use this name when registering the
90 * VIDDEC3_STUBS functions with Engine_addStubFxns.
91 *
92 * @sa Engine_addStubFxns
93 */
94#define VIDDEC3_STUBSNAME "VIDDEC3_STUBS"
95
96
97/**
98 * @brief Opaque handle to a VIDDEC3 codec.
99 */
100typedef VISA_Handle VIDDEC3_Handle;
101
102/** @copydoc IVIDDEC3_Params */
103typedef struct IVIDDEC3_Params VIDDEC3_Params;
104
105/** @copydoc IVIDDEC3_InArgs */
106typedef IVIDDEC3_InArgs VIDDEC3_InArgs;
107
108/** @copydoc IVIDDEC3_OutArgs */
109typedef IVIDDEC3_OutArgs VIDDEC3_OutArgs;
110
111/** @copydoc IVIDDEC3_Cmd */
112typedef IVIDDEC3_Cmd VIDDEC3_Cmd;
113
114/** @copydoc IVIDDEC3_DynamicParams */
115typedef IVIDDEC3_DynamicParams VIDDEC3_DynamicParams;
116
117/** @copydoc IVIDDEC3_Status */
118typedef IVIDDEC3_Status VIDDEC3_Status;
119
120
121/** @cond INTERNAL */
122
123/**
124 * @brief An implementation of the skel interface; the skeleton side
125 * of the stubs.
126 */
127extern SKEL_Fxns VIDDEC3_SKEL;
128
129/**
130 * @brief Implementation of the IVIDDEC3 interface that is run remotely.
131 */
132extern IVIDDEC3_Fxns VIDDEC3_STUBS;
133
134/** @endcond */
135
136/**
137 * @brief Definition of IVIDDEC3 codec class configurable parameters
138 *
139 * @sa VISA_getCodecClassConfig()
140 */
141typedef struct IVIDDEC3_CodecClassConfig {
142 Bool manageInBufsCache [ XDM_MAX_IO_BUFFERS ];
143 Bool manageOutBufsCache [ XDM_MAX_IO_BUFFERS ];
144} IVIDDEC3_CodecClassConfig;
145
146
147/*
148 * ======== VIDDEC3_control ========
149 */
150/**
151 * @brief Execute the control() method in this instance of a video
152 * decoder algorithm.
153 *
154 * @param[in] handle Handle to a created video decoder instance.
155 * @param[in] id Command id for XDM control operation.
156 * @param[in] params Runtime control parameters used for decoding.
157 * @param[out] status Status info upon completion of decode operation.
158 *
159 * @pre @c handle is a valid (non-NULL) video decoder handle
160 * and the video decoder is in the created state.
161 *
162 * @retval #VIDDEC3_EOK Success.
163 * @retval #VIDDEC3_EFAIL Failure.
164 * @retval #VIDDEC3_EUNSUPPORTED Unsupported request.
165 *
166 * @remark This is a blocking call, and will return after the control
167 * command has been executed.
168 *
169 * @remark If an error is returned, @c status->extendedError may
170 * indicate further details about the error. See #XDM_ErrorBit
171 * for details.
172 *
173 * @sa VIDDEC3_create()
174 * @sa VIDDEC3_delete()
175 * @sa IVIDDEC3_Fxns::process()
176 */
177extern Int32 VIDDEC3_control(VIDDEC3_Handle handle, VIDDEC3_Cmd id,
178 VIDDEC3_DynamicParams *params, VIDDEC3_Status *status);
179
180
181/*
182 * ======== VIDDEC3_create ========
183 */
184/**
185 * @brief Create an instance of a video decoder algorithm.
186 *
187 * Instance handles must not be concurrently accessed by multiple threads;
188 * each thread must either obtain its own handle (via VIDDEC3_create) or
189 * explicitly serialize access to a shared handle.
190 *
191 * @param[in] e Handle to an opened engine.
192 * @param[in] name String identifier of the type of video decoder
193 * to create.
194 * @param[in] params Creation parameters.
195 *
196 * @retval NULL An error has occurred.
197 * @retval non-NULL The handle to the newly created video decoder
198 * instance.
199 *
200 * @remark @c params is optional. If it's not supplied, codec-specific
201 * default params will be used.
202 *
203 * @remark Depending on the configuration of the engine opened, this
204 * call may create a local or remote instance of the video
205 * decoder.
206 *
207 * @codecNameRemark
208 *
209 * @sa Engine_open()
210 * @sa VIDENC3_delete()
211 */
212extern VIDDEC3_Handle VIDDEC3_create(Engine_Handle e, String name,
213 VIDDEC3_Params *params);
214
215
216/*
217 * ======== VIDDEC3_delete ========
218 */
219/**
220 * @brief Delete the instance of a video decoder algorithm.
221 *
222 * @param[in] handle Handle to a created video decoder instance.
223 *
224 * @remark Depending on the configuration of the engine opened, this
225 * call may delete a local or remote instance of the video
226 * decoder.
227 *
228 * @pre @c handle is a valid (non-NULL) handle which is
229 * in the created state.
230 *
231 * @post All resources allocated as part of the VIDDEC3_create()
232 * operation (memory, DMA channels, etc.) are freed.
233 *
234 * @sa VIDDEC3_create()
235 */
236extern Void VIDDEC3_delete(VIDDEC3_Handle handle);
237
238
239/*
240 * ======== VIDDEC3_process ========
241 */
242/**
243 * @brief Execute the process() method in this instance of a video
244 * decoder algorithm.
245 *
246 * @param[in] handle Handle to a created video decoder instance.
247 * @param[in] inBufs A buffer descriptor containing input buffers.
248 * @param[out] outBufs A buffer descriptor containing output buffers.
249 * @param[in] inArgs Input Arguments.
250 * @param[out] outArgs Output Arguments.
251 *
252 * @pre @c handle is a valid (non-NULL) video decoder handle
253 * and the video decoder is in the created state.
254 *
255 * @retval #VIDDEC3_EOK Success.
256 * @retval #VIDDEC3_EFAIL Failure.
257 * @retval #VIDDEC3_EUNSUPPORTED Unsupported request.
258 *
259 * @remark Since the VIDDEC3 decoder contains support for asynchronous
260 * buffer submission and retrieval, this API becomes known as
261 * synchronous in nature.
262 *
263 * @remark This is a blocking call, and will return after the data
264 * has been decoded.
265 *
266 * @remark The buffers supplied to VIDDEC3_process() may have constraints
267 * put on them. For example, in dual-processor, shared memory
268 * architectures, where the codec is running on a remote
269 * processor, the buffers may need to be physically contiguous.
270 * Additionally, the remote processor may place restrictions on
271 * buffer alignment.
272 *
273 * @remark If an error is returned, @c outArgs->extendedError may
274 * indicate further details about the error. See #XDM_ErrorBit
275 * for details.
276 *
277 * @sa VIDDEC3_create()
278 * @sa VIDDEC3_delete()
279 * @sa VIDDEC3_control()
280 * @sa VIDDEC3_processAsync()
281 * @sa VIDDEC3_processWait()
282 * @sa IVIDDEC3_Fxns::process()
283 */
284extern Int32 VIDDEC3_process(VIDDEC3_Handle handle, XDM2_BufDesc *inBufs,
285 XDM2_BufDesc *outBufs, VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs);
286
287
288#if 0 /* async not yet supported */
289
290/*
291 * ======== VIDDEC3_processAsync ========
292 */
293/**
294 * @brief Perform asynchronous submission to this instance of a video
295 * decoder algorithm.
296 *
297 * @param[in] handle Handle to a created video decoder instance.
298 * @param[in] inBufs A buffer descriptor containing input buffers.
299 * @param[out] outBufs A buffer descriptor containing output buffers.
300 * @param[in] inArgs Input Arguments.
301 * @param[out] outArgs Output Arguments.
302 *
303 * @pre @c handle is a valid (non-NULL) video decoder handle
304 * and the video decoder is in the created state.
305 *
306 * @retval #VIDDEC3_EOK Success.
307 * @retval #VIDDEC3_EFAIL Failure.
308 * @retval #VIDDEC3_EUNSUPPORTED Unsupported request.
309 *
310 * @remark This API is the asynchronous counterpart to the process()
311 * method. It allows for buffer and argument submission without
312 * waiting for retrieval. A response is retrieved using the
313 * VIDDEC3_processWait() API.
314 *
315 * @remark The buffers supplied to VIDDEC3_processAsync() may have
316 * constraints put on them. For example, in dual-processor,
317 * shared memory architectures, where the codec is running on a
318 * remote processor, the buffers may need to be physically
319 * contiguous. Additionally, the remote processor may place
320 * restrictions on buffer alignment.
321 *
322 * @sa VIDDEC3_create()
323 * @sa VIDDEC3_delete()
324 * @sa VIDDEC3_control()
325 * @sa VIDDEC3_process()
326 * @sa VIDDEC3_processWait()
327 * @sa IVIDDEC3_Fxns::process()
328 */
329extern XDAS_Int32 VIDDEC3_processAsync(VIDDEC3_Handle handle,
330 XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs,
331 VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs);
332
333/*
334 * ======== VIDDEC3_processWait ========
335 */
336/**
337 * @brief Wait for a return message from a previous invocation of
338 * VIDDEC3_processAsync() in this instance of an video decoder
339 * algorithm.
340 *
341 * @param[in] handle Handle to a created video decoder instance.
342 * @param[in] inBufs A buffer descriptor containing input buffers.
343 * @param[out] outBufs A buffer descriptor containing output buffers.
344 * @param[in] inArgs Input Arguments.
345 * @param[out] outArgs Output Arguments.
346 * @param[in] timeout Amount of "time" to wait (from 0 -> VIDDEC3_FOREVER)
347 *
348 * @pre @c handle is a valid (non-NULL) video decoder handle
349 * and the video decoder is in the created state.
350 *
351 * @retval #VIDDEC3_EOK Success.
352 * @retval #VIDDEC3_EFAIL Failure.
353 * @retval #VIDDEC3_EUNSUPPORTED Unsupported request.
354 * @retval #VIDDEC3_ETIMEOUT Operation timed out.
355 *
356 * @remark This is a blocking call, and will return after the data
357 * has been decoded.
358 *
359 * @remark "Polling" is supported by using a timeout of 0. Waiting
360 * forever is supported by using a timeout of VIDDEC3_EFOREVER.
361 *
362 * @remark There must have previously been an invocation of the
363 * VIDDEC3_processAsync() API.
364 *
365 * @remark The buffers supplied to VIDDEC3_processAsync() may have
366 * constraints put on them. For example, in dual-processor,
367 * shared memory architectures, where the codec is running on a
368 * remote processor, the buffers may need to be physically
369 * contiguous. Additionally, the remote processor may place
370 * restrictions on buffer alignment.
371 *
372 * @sa VIDDEC3_create()
373 * @sa VIDDEC3_delete()
374 * @sa VIDDEC3_control()
375 * @sa VIDDEC3_process()
376 * @sa VIDDEC3_processAsync()
377 */
378extern XDAS_Int32 VIDDEC3_processWait(VIDDEC3_Handle handle,
379 XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs,
380 VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs, UInt timeout);
381
382#endif
383
384
385/*@}*/ /* ingroup */
386
387#ifdef __cplusplus
388}
389#endif
390
391#endif
392/*
393 * @(#) ti.sdo.ce.video3; 1, 0, 0,3; 6-13-2013 00:21:02; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
394
395 */
396
diff --git a/packages/codec_engine/ti/sdo/ce/visa.h b/packages/codec_engine/ti/sdo/ce/visa.h
new file mode 100644
index 0000000..820a734
--- /dev/null
+++ b/packages/codec_engine/ti/sdo/ce/visa.h
@@ -0,0 +1,690 @@
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 * ======== visa.h ========
40 */
41/**
42 * @file ti/sdo/ce/visa.h
43 *
44 * @brief The Codec Engine System Programming Interface. Provides
45 * system developers with services necessary to implement
46 * stubs and skeletons.
47 */
48/**
49 * @addtogroup ti_sdo_ce_VISA_GEN VISA - Alg-independent user APIs
50 *
51 * Codec Engine Algorithm-independent shared definitions and services.
52 */
53/**
54 * @addtogroup ti_sdo_ce_VISA_STUB VISA - CE Stub SPIs
55 *
56 * Codec Engine System Programming Interface (SPI) for stub implementors.
57 */
58/**
59 * @addtogroup ti_sdo_ce_VISA_API VISA - CE interface SPIs
60 *
61 * Codec Engine System Programming Interface (SPI) for class interface
62 * implementors.
63 */
64
65#ifndef ti_sdo_ce_VISA_
66#define ti_sdo_ce_VISA_
67
68#include <stddef.h> /* for size_t */
69
70#include <ti/sdo/ce/node/node.h>
71#include <ti/xdais/ialg.h>
72#include <ti/sdo/ce/Engine.h>
73
74#ifdef __cplusplus
75extern "C" {
76#endif
77
78/**
79 * @brief VISA result data type
80 * @ingroup ti_sdo_ce_VISA_GEN
81 */
82typedef Int VISA_Status;
83
84/**
85 * @brief Success.
86 * @ingroup ti_sdo_ce_VISA_GEN
87 */
88#define VISA_EOK 0
89
90/**
91 * @brief Internal runtime error.
92 * @ingroup ti_sdo_ce_VISA_GEN
93 */
94#define VISA_ERUNTIME -1
95
96/**
97 * @brief General system error.
98 * @ingroup ti_sdo_ce_VISA_GEN
99 */
100#define VISA_EFAIL -2
101
102/**
103 * @brief The API is not suported for the given system configuration.
104 * @ingroup ti_sdo_ce_VISA_GEN
105 */
106#define VISA_EUNSUPPORTED -3
107
108/**
109 * @brief Timeout occurred.
110 * @ingroup ti_sdo_ce_VISA_GEN
111 */
112#define VISA_ETIMEOUT -100
113
114/**
115 * @brief Special value for timeout parameter indicating never timeout.
116 * @ingroup ti_sdo_ce_VISA_GEN
117 */
118#define VISA_FOREVER Engine_FOREVER
119
120/**
121 * @brief Name to pass to Diags_setMask() to enable logging for VISA
122 * functions. For example,
123 * Diags_setMask(VISA_MODNAME"+EX1234567");
124 * turns on all Log statements in this module.
125 * Diags_setMask() must be called after initialization to take
126 * effect.
127 */
128#define VISA_MODNAME "ti.sdo.ce.VISA"
129
130/**
131 * @brief Opaque handle to a node.
132 */
133typedef struct VISA_Obj *VISA_Handle;
134
135/**
136 * @brief VISA message header.
137 *
138 * @ingroup ti_sdo_ce_VISA_STUB
139 *
140 * @remarks This must be the first field in a message
141 */
142typedef struct VISA_MsgHeader {
143 NODE_MsgHeader header;
144 Int cmd; /**< Command id */
145 VISA_Status status; /**< Return status */
146} VISA_MsgHeader;
147
148/*
149 * ======== VISA_Msg ========
150 */
151typedef VISA_MsgHeader *VISA_Msg;
152
153/*
154 * ======== VISA_allocMsg ========
155 */
156/**
157 * @brief Obtain an algorithm instance's message.
158 *
159 * @ingroup ti_sdo_ce_VISA_STUB
160 *
161 * @param[in] visa Handle to an algorithm instance.
162 *
163 * @retval NULL General system error
164 * @retval non-NULL The remote algorithm's message.
165 *
166 * @remarks This is typically called by an algorithm class' stub.
167 *
168 * @sa VISA_allocMsg()
169 */
170extern VISA_Msg VISA_allocMsg(VISA_Handle visa);
171
172/*
173 * ======== VISA_call ========
174 */
175/**
176 * @brief Invoke the operation specified in the message and wait for
177 * it to complete.
178 *
179 * @ingroup ti_sdo_ce_VISA_STUB
180 *
181 * @param[in] visa Handle to an algorithm instance.
182 * @param[out] msg The remote algorithm's message,
183 * to be sent to the skeleton.
184 *
185 * @remarks This is typically called by an algorithm class' stub.
186 *
187 * @retval VISA_EOK Success
188 * @retval VISA_ERUNTIME General system error
189 *
190 * @sa VISA_callAsync()
191 */
192extern VISA_Status VISA_call(VISA_Handle visa, VISA_Msg *msg);
193
194/*
195 * ======== VISA_callAsync ========
196 */
197/**
198 * @brief Invoke the operation specified in the message and return
199 * without waiting for it to complete.
200 *
201 * @ingroup ti_sdo_ce_VISA_STUB
202 *
203 * @param[in] visa Handle to an algorithm instance.
204 * @param[out] msg The remote algorithm's message,
205 * to be sent to the skeleton.
206 *
207 * @remarks This is typically called by an algorithm class' stub.
208 *
209 * @retval VISA_EOK Success
210 * @retval VISA_ERUNTIME General system error
211 *
212 * @sa VISA_wait()
213 * @sa VISA_call()
214 */
215extern VISA_Status VISA_callAsync(VISA_Handle visa, VISA_Msg *msg);
216
217/*
218 * ======== VISA_wait ========
219 */
220/**
221 * @brief Wait for the oldest operation from a command specified with
222 * VISA_callAsync() to complete.
223 *
224 * @ingroup ti_sdo_ce_VISA_STUB
225 *
226 * @param[in] visa Handle to an algorithm instance.
227 * @param[out] msg Placeholder for the remote algorithm's return message,
228 * retrieved from the skeleton.
229 * @param[in] timeout Amount of "time" to wait ("time" depends on underlying
230 * mechanism, such as that used with MSGQ_Get()).
231 *
232 * @remarks This is typically called by an algorithm class' stub.
233 *
234 * @retval VISA_EOK Success
235 * @retval VISA_ERUNTIME General system error
236 * @retval VISA_ETIMEOUT Operation timed out
237 *
238 * @sa VISA_callAsync()
239 */
240extern VISA_Status VISA_wait(VISA_Handle visa, VISA_Msg *msg, UInt timeout);
241
242/*
243 * ======== VISA_freeMsg ========
244 */
245/**
246 * @brief Release an algorithm instance's message.
247 *
248 * @ingroup ti_sdo_ce_VISA_STUB
249 *
250 * @param[in] visa Handle to an algorithm instance.
251 * @param[in] msg Message to free, obtained through a call to
252 * VISA_allocMsg().
253 *
254 * @retval NULL General system error
255 * @retval non-NULL The remote algorithm's message.
256 *
257 * @remarks This is typically called by an algorithm class' stub.
258 *
259 * @sa VISA_allocMsg()
260 */
261extern Void VISA_freeMsg(VISA_Handle visa, VISA_Msg msg);
262
263
264/** @ingroup ti_sdo_ce_VISA_API */
265/*@{*/
266
267/*
268 * ======== VISA_create ========
269 */
270/**
271 * @brief Create a new instance of an algorithm.
272 *
273 * @param[in] engine Handle to an engine in which the algorithm has been
274 * configured.
275 * @param[in] name Name of the algorithm to create. @c name is
276 * specified in the engine configuration.
277 * @param[in] params Creation parameters.
278 * @param[in] msgSize Size of the message which will be allocated in
279 * the event that this algorithm is configured to
280 * run remotely.
281 * @param[in] type String name of the "type" of algorithm.
282 *
283 * @retval NULL General failure.
284 * @retval non-NULL Handle to an algorithm instance.
285 *
286 * @remarks @c type <b>must</b> match the package/module name of the
287 * interface which the algorithm implements. For example, the VISA
288 * interface shipped with CE to support XDM video
289 * decoders is named "ti.sdo.ce.video.IVIDDEC". That is,
290 * the module IVIDDEC is in the package "ti.sdo.ce.video".
291 * You will, by definition, find a file named IVIDDEC.xdc in the
292 * ti.sdo.ce.video package.
293 *
294 * @remarks When calling VISA_create(), a string comparison is done
295 * between the @c type parameter and the actual name of the
296 * module (described in the previous paragraph). If these strings
297 * don't match exactly, VISA_create() will fail.
298 *
299 * @sa VISA_delete()
300 */
301extern VISA_Handle VISA_create(Engine_Handle engine, String name,
302 IALG_Params *params, size_t msgSize, String type);
303
304/*
305 * ======== VISA_delete ========
306 */
307/**
308 * @brief Delete an instance of an algorithm.
309 *
310 * @param[in] visa Handle to an algorithm instance to delete.
311 *
312 * @sa VISA_create()
313 */
314extern Void VISA_delete(VISA_Handle visa);
315
316
317/*
318 * ======== VISA_create2 ========
319 */
320/**
321 * @brief Create a new instance of an algorithm.
322 *
323 * @param[in] engine Handle to an engine in which the algorithm has been
324 * configured.
325 * @param[in] name Name of the algorithm to create. @c name is
326 * specified in the engine configuration.
327 * @param[in] params Creation parameters.
328 * @param[in] paramsSize Size of @c params.
329 * @param[in] msgSize Size of the message which will be allocated in
330 * the event that this algorithm is configured to
331 * run remotely.
332 * @param[in] type String name of the "type" of algorithm.
333 *
334 * @retval NULL General failure.
335 * @retval non-NULL Handle to an algorithm instance.
336 *
337 * @remarks @c type <b>must</b> match the package/module name of the
338 * interface which the algorithm implements. For example, the VISA
339 * interface shipped with CE to support XDM video
340 * decoders is named "ti.sdo.ce.video.IVIDDEC". That is,
341 * the module IVIDDEC is in the package "ti.sdo.ce.video".
342 * You will, by definition, find a file named IVIDDEC.xdc in the
343 * ti.sdo.ce.video package.
344 *
345 * @remarks When calling VISA_create2(), a string comparison is done
346 * between the @c type parameter and the actual name of the
347 * module (described in the previous paragraph). If these strings
348 * don't match exactly, VISA_create2() will fail.
349 *
350 * @remarks VISA_create() is the preferred method to create algorithms.
351 * VISA_create2() is provided to enable creation of algorithms
352 * which violate the XDAIS spec and do <b>not</b> have a @c size
353 * field of type "Int" as the first field of @c params.
354 *
355 * @sa VISA_create()
356 * @sa VISA_delete()
357 */
358extern VISA_Handle VISA_create2(Engine_Handle engine, String name,
359 IALG_Params *params, Int paramsSize, size_t msgSize, String type);
360
361
362/*
363 * ======== VISA_enter ========
364 */
365/**
366 * @brief Enter an algorithm's critical section. This must be called
367 * before any of the algorithm's IALG_Fxns are invoked.
368 *
369 * @param[in] visa Handle to an algorithm instance.
370 *
371 * @remarks This is typically called by an algorithm class' application API.
372 *
373 * @remarks This call has the same semantics as IALG's activate fxn.
374 *
375 * @sa VISA_exit()
376 */
377extern Void VISA_enter(VISA_Handle visa);
378
379/*
380 * ======== VISA_exit ========
381 */
382/**
383 * @brief Leave an algorithm's critical section. This must be called
384 * after the API has completed calling an algorithm's IALG_Fxns.
385 *
386 * @param[in] visa Handle to an algorithm instance.
387 *
388 * @remarks This call has the same semantics as IALG's de-activate fxn.
389 *
390 * @sa VISA_enter()
391 */
392extern Void VISA_exit(VISA_Handle visa);
393
394/*
395 * ======== VISA_getAlgHandle ========
396 */
397/**
398 * @brief Obtains an algorithm's handle. This is the handle required
399 * to be passed to the algorithm's IALG_Fxns.
400 *
401 * @param[in] visa Handle to an algorithm instance.
402 *
403 * @retval NULL General system error
404 * @retval non-NULL The remote algorithm's message.
405 *
406 * @remarks This is typically called by an algorithm class' application API.
407 *
408 * @sa VISA_getAlgFxns()
409 */
410extern Ptr VISA_getAlgHandle(VISA_Handle visa);
411
412/*
413 * ======== VISA_getAlgorithmHandle ========
414 */
415/**
416 * @brief Obtains an algorithm's handle. If the algorithm is local, this is the
417 * handle that can be passed to Algorithm APIs, not to the IALG_Fxns.
418 *
419 * @param[in] visa Handle to an algorithm instance.
420 *
421 * @retval NULL General system error
422 * @retval non-NULL The Algorithm handle.
423 *
424 * @remarks This is used internally.
425 *
426 * @sa VISA_getAlgHandle()
427 */
428extern Ptr VISA_getAlgorithmHandle(VISA_Handle visa);
429
430/*
431 * ======== VISA_getAlgFxns ========
432 */
433/**
434 * @brief Get implementation functions for this algorithm
435 *
436 * @param[in] visa Handle to an algorithm instance.
437 *
438 * @retval NULL An error has occurred.
439 * @retval non-NULL The algorithm's IALG_Fxns.
440 *
441 * @remarks This is typically called by an algorithm class' application API.
442 *
443 * @remarks Both local and remote implementations return a non-NULL
444 * pointer. However, the IALG_Fxns functions may be NULL.
445 *
446 * @remarks In the case of a local algorithm, the algorithm's IALG_Fxns
447 * returned. In the case of a remote algorithm, its stubs are
448 * returned. In either case, the handle passed as the first arg
449 * to the IALG_Fxns must be the value returned by
450 * VISA_getAlgHandle().
451 *
452 * @sa VISA_getAlgHandle()
453 */
454extern IALG_Fxns *VISA_getAlgFxns(VISA_Handle visa);
455
456/*@}*/ /* ingroup */
457
458/*
459 * ======== VISA_getAlgMemRecs ========
460 */
461/**
462 * @brief Get the IALG_MemRec memory assigned to an algorithm instance
463 *
464 * @ingroup ti_sdo_ce_VISA_GEN
465 *
466 * @param[in] visa Handle to an algorithm instance.
467 * @param[out] memTab Location to store the IALG_MemRecs.
468 * @param[in] size Maximum number of IALG_MemRecs to put in memTab array.
469 * @param[out] numRecs Actual number of IALG_MemRecs copied into memTab array.
470 *
471 * @remarks Any algorithm instance handle (e.g. VIDDEC2_Handle,
472 * AUDDEC1_Handle, etc), can be cast to a @c visa handle.
473 *
474 * @par Example:
475 *
476 * @code
477 * AUDDEC1_Handle decoder;
478 *
479 * decoder = AUDDEC1_create(...);
480 *
481 * ... likely use VISA_getAlgNumRecs() to alloc enough mem...
482 *
483 * VISA_getAlgMemRecs((VISA_Handle)decoder, ...);
484 * @endcode
485 *
486 * @retval #VISA_EOK Success.
487 * @retval #VISA_EFAIL Failure.
488 *
489 * @sa VISA_getAlgNumRecs()
490 */
491extern VISA_Status VISA_getAlgMemRecs(VISA_Handle visa, IALG_MemRec *memTab,
492 Int size, Int *numRecs);
493
494/*
495 * ======== VISA_getAlgNumRecs ========
496 */
497/**
498 * @brief Get the number of IALG_MemRecs assigned to an algorithm.
499 *
500 * @ingroup ti_sdo_ce_VISA_GEN
501 *
502 * @param[in] visa Handle to an algorithm instance.
503 * @param[out] numRecs Location to store the number of IALG_MemRecs used.
504 *
505 * @remarks Any algorithm instance handle (e.g. VIDDEC2_Handle,
506 * AUDDEC1_Handle, etc), can be cast to a @c visa handle.
507 *
508 * @par Example:
509 *
510 * @code
511 * Int numRecs;
512 * AUDDEC1_Handle decoder;
513 *
514 * decoder = AUDDEC1_create(...);
515 *
516 * VISA_getAlgNumRecs((VISA_Handle)decoder, &numRecs);
517 * @endcode
518 *
519 * @retval #VISA_EOK Success.
520 * @retval #VISA_EFAIL Failure.
521 *
522 * @sa VISA_getAlgMemRecs()
523 */
524extern VISA_Status VISA_getAlgNumRecs(VISA_Handle visa, Int *numRecs);
525
526
527/*
528 * ======== VISA_getContext ========
529 */
530/**
531 * @brief Get optional context parameter.
532 *
533 * @ingroup ti_sdo_ce_VISA_STUB
534 *
535 * @param[in] visa Handle to an algorithm instance.
536 * @param[out] pContext Location to store context.
537 *
538 * @pre @c visa <b>must</b> be a valid algorithm instance handle.
539 *
540 * @pre @c pContext <b>must</b> be a valid pointer.
541 *
542 * @remarks The VISA_setContext() / VISA_getContext() pair does <b>not</b>
543 * work across processors. That is, the context can only be
544 * stored and retrieved on the local processor.
545 *
546 * @sa VISA_setContext()
547 */
548extern Void VISA_getContext(VISA_Handle visa, UInt32 * pContext);
549
550/*
551 * ======== VISA_getCodecClassConfig ========
552 */
553/**
554 * @brief Get codec-specific values for the VISA class-specific
555 * (or codec-specific if the codec doesn't extend VISA) stub-and/
556 * or-skeleton configuration data (that some classes have)
557 *
558 * @ingroup ti_sdo_ce_VISA_GEN
559 *
560 * @param[in] visa Handle to an algorithm instance.
561 *
562 * @retval address of the codec class config data structure, or NULL if
563 * codec class config data not defined for the codec; the format
564 * of the structure is class-specific, and the data in it is codec-
565 * specific
566 *
567 * @pre @c visa <b>must</b> be a valid algorithm instance handle.
568 */
569extern Ptr VISA_getCodecClassConfig(VISA_Handle visa);
570
571
572/*
573 * ======== VISA_getMaxMsgSize ========
574 */
575/**
576 * @brief Returns max size of messages allocated by VISA_allocMsg()
577 *
578 * @ingroup ti_sdo_ce_VISA_GEN
579 *
580 * @retval maxMsgSize Max size of messages allocated by
581 * VISA_allocMsg()
582 *
583 * @remarks This is typically called by an algorithm class' stub.
584 *
585 * @sa VISA_allocMsg()
586 */
587extern UInt VISA_getMaxMsgSize(VISA_Handle visa);
588
589/*
590 * ======== _VISA_init ========
591 */
592/**
593 * @brief Ininitilize VISA module.
594 *
595 * @ingroup ti_sdo_ce_VISA_GEN
596 *
597 * @remarks This is typically called by CERuntime_init().
598 *
599 * @sa _VISA_exit()
600 */
601extern Void _VISA_init(Void);
602
603/*
604 * ======== _VISA_exit ========
605 */
606/**
607 * @brief Exit VISA module.
608 *
609 * @ingroup ti_sdo_ce_VISA_GEN
610 *
611 * @remarks This is typically called by CERuntime_exit().
612 *
613 * @sa _VISA_init()
614 */
615extern Void _VISA_exit(Void);
616
617
618/*
619 * Semi-internal variable generatd by Settings.xdt - used in the following
620 * inline
621 */
622extern Bool VISA_checked;
623
624/*
625 * ======== VISA_isChecked ========
626 */
627/**
628 * @brief Indicates whether VISA libraries were built with
629 * debug + additional checking enabled
630 *
631 * @ingroup ti_sdo_ce_VISA_GEN
632 *
633 * @retval false VISA libraries with no debug/checking are used
634 * @retval true VISA libraries with debug/checking are used
635 *
636 * @remarks This is typically called by an algorithm class' stub.
637 *
638 * @sa VISA_allocMsg()
639 */
640static inline Bool VISA_isChecked(Void)
641{
642 return (VISA_checked);
643}
644
645/*
646 * ======== VISA_setContext ========
647 */
648/**
649 * @brief Set optional context parameter.
650 *
651 * @ingroup ti_sdo_ce_VISA_STUB
652 *
653 * @param[in] visa Handle to an algorithm instance.
654 * @param[in] context Context.
655 *
656 * @pre @c visa <b>must</b> be a valid algorithm instance handle.
657 *
658 * @remarks The VISA_setContext() / VISA_getContext() pair does <b>not</b>
659 * work across processors. That is, the context can only be
660 * stored and retrieved on the local processor.
661 *
662 * @sa VISA_getContext()
663 */
664extern Void VISA_setContext(VISA_Handle visa, UInt32 context);
665
666/*
667 * ======== VISA_isLocal ========
668 */
669/**
670 * @brief Indicates whether VISA codecs run on a remote or local CPU.
671 *
672 * @ingroup ti_sdo_ce_VISA_GEN
673 *
674 * @retval FALSE VISA codecs run on remote CPU
675 * @retval TRUE VISA codecs run on local CPU
676 *
677 * @remarks This is typically called by an algorithm class' stub.
678 */
679extern Bool VISA_isLocal(VISA_Handle visa);
680
681#ifdef __cplusplus
682}
683#endif
684
685#endif
686/*
687 * @(#) ti.sdo.ce; 1, 0, 6,3; 6-13-2013 00:10:04; /db/atree/library/trees/ce/ce-w08/src/ xlibrary
688
689 */
690