diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ti/framework/dce/dce.c | 811 | ||||
-rw-r--r-- | src/ti/framework/dce/dce_priv.h | 90 | ||||
-rw-r--r-- | src/ti/framework/dce/dce_rpc.h | 80 | ||||
-rw-r--r-- | src/ti/framework/dce/package.bld | 83 | ||||
-rw-r--r-- | src/ti/framework/dce/package.xdc | 47 | ||||
-rw-r--r-- | src/ti/framework/dce/package.xs | 81 | ||||
-rw-r--r-- | src/ti/utils/osal/trace.h | 69 |
7 files changed, 1261 insertions, 0 deletions
diff --git a/src/ti/framework/dce/dce.c b/src/ti/framework/dce/dce.c new file mode 100644 index 0000000..0b7093d --- /dev/null +++ b/src/ti/framework/dce/dce.c | |||
@@ -0,0 +1,811 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | #include <stdlib.h> | ||
34 | #include <stdint.h> | ||
35 | #include <string.h> | ||
36 | #include <stdio.h> | ||
37 | #include <ti/grcm/RcmServer.h> | ||
38 | #include <ti/grcm/RcmTypes.h> | ||
39 | #include <ti/ipc/mm/MmServiceMgr.h> | ||
40 | #include <ti/ipc/mm/MmRpc.h> | ||
41 | #include <ti/ipc/MultiProc.h> | ||
42 | #include <ti/ipc/rpmsg/RPMessage.h> | ||
43 | #include <ti/ipc/rpmsg/NameMap.h> | ||
44 | #include <ti/pm/IpcPower.h> | ||
45 | #include <ti/sdo/ce/global/CESettings.h> | ||
46 | #include <ti/sdo/ce/CERuntime.h> | ||
47 | #include <ti/sdo/ce/Engine.h> | ||
48 | #include <ti/sdo/ce/video2/viddec2.h> | ||
49 | #include <ti/sdo/ce/universal/universal.h> | ||
50 | #include <ti/sdo/fc/global/FCSettings.h> | ||
51 | #include <ti/sdo/fc/utils/fcutils.h> | ||
52 | #include <ti/sysbios/BIOS.h> | ||
53 | #include <ti/sysbios/hal/Cache.h> | ||
54 | #include <ti/sysbios/knl/Task.h> | ||
55 | #include <ti/xdais/dm/xdm.h> | ||
56 | #include <xdc/cfg/global.h> | ||
57 | #include <xdc/runtime/System.h> | ||
58 | #include <xdc/runtime/Diags.h> | ||
59 | #include <xdc/runtime/Memory.h> | ||
60 | #include <xdc/runtime/IHeap.h> | ||
61 | #include <xdc/runtime/knl/Thread.h> | ||
62 | #include <xdc/std.h> | ||
63 | |||
64 | #include "dce_priv.h" | ||
65 | #include "dce_rpc.h" | ||
66 | |||
67 | static uint32_t suspend_initialised = 0; | ||
68 | uint32_t dce_debug = DCE_DEBUG_LEVEL; | ||
69 | |||
70 | #define SERVER_NAME "rpmsg-dce-dsp" | ||
71 | #define MEMORYSTATS_DEBUG | ||
72 | |||
73 | #define MmRpc_NUM_PARAMETERS(size) \ | ||
74 | (size / sizeof(MmType_Param)) | ||
75 | |||
76 | /* dce_inv, dce_clean needs to be modified to expect buffers */ | ||
77 | /* without headers (relevant for GLP */ | ||
78 | static void dce_inv(void *ptr) | ||
79 | { | ||
80 | if( ptr ) { | ||
81 | Cache_inv(ptr, P2H(ptr)->size, Cache_Type_ALL, TRUE); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | static void dce_clean(void *ptr) | ||
86 | { | ||
87 | if( ptr ) { | ||
88 | Cache_wbInv(ptr, P2H(ptr)->size, Cache_Type_ALL, TRUE); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | typedef void * (*CreateFxn)(Engine_Handle, String, void *); | ||
93 | typedef Int32 (*ControlFxn)(void *, int, void *, void *); | ||
94 | typedef Int32 (*ProcessFxn)(void *, void *, void *, void *, void *); | ||
95 | typedef Int32 (*RelocFxn)(void *, uint8_t *ptr, uint32_t len); | ||
96 | typedef void (*DeleteFxn)(void *); | ||
97 | |||
98 | /* DCE Server static function declarations */ | ||
99 | static Int32 engine_open(UInt32 size, UInt32 *data); | ||
100 | static Int32 engine_close(UInt32 size, UInt32 *data); | ||
101 | |||
102 | /* VIDDEC2 Decoder Server static function declarations */ | ||
103 | static VIDDEC2_Handle viddec2_create(Engine_Handle engine, String name, VIDDEC2_Params *params); | ||
104 | static int viddec2_reloc(VIDDEC2_Handle handle, uint8_t *ptr, uint32_t len); | ||
105 | static int viddec2_control(VIDDEC2_Handle handle, VIDDEC2_Cmd id, VIDDEC2_DynamicParams *dynParams, | ||
106 | VIDDEC2_Status *status ); | ||
107 | static int viddec2_process(VIDDEC2_Handle handle, XDM1_BufDesc *inBufs, | ||
108 | XDM_BufDesc *outBufs, VIDDEC2_InArgs *inArgs, VIDDEC2_OutArgs *outArgs ); | ||
109 | static int viddec2_delete(VIDDEC2_Handle handle); | ||
110 | |||
111 | static struct { | ||
112 | CreateFxn create; | ||
113 | ControlFxn control; | ||
114 | ProcessFxn process; | ||
115 | DeleteFxn delete; | ||
116 | RelocFxn reloc; /* handle buffer relocation table */ | ||
117 | } codec_fxns[] = | ||
118 | { | ||
119 | [OMAP_DCE_VIDDEC2] = | ||
120 | { | ||
121 | (CreateFxn)viddec2_create, (ControlFxn)viddec2_control, | ||
122 | (ProcessFxn)viddec2_process, (DeleteFxn)viddec2_delete, | ||
123 | (RelocFxn)viddec2_reloc, | ||
124 | }, | ||
125 | }; | ||
126 | |||
127 | |||
128 | /* Static version string buffer. | ||
129 | * Note: codec version can be large. For example, h264vdec needs more than | ||
130 | * 58 characters, or the query will fail. */ | ||
131 | #define VERSION_SIZE 128 | ||
132 | static char version_buffer[VERSION_SIZE]; | ||
133 | |||
134 | /* the following callbacks are needed for suspend/resume | ||
135 | * on the linux side. | ||
136 | * - FC_suspend() waits for all algorithms to get deactivated and | ||
137 | * and takes care of the resources acquired. | ||
138 | * - FC_resume() does nothing for now, but we add it just in case | ||
139 | * it gets populated in the future versions of framework components. | ||
140 | * | ||
141 | * Forced off mode during video decode/encode is not supported. */ | ||
142 | #if 0 | ||
143 | static void dce_suspend() | ||
144 | { | ||
145 | INFO("Preparing for suspend..."); | ||
146 | FC_suspend(); | ||
147 | } | ||
148 | |||
149 | static void dce_resume() | ||
150 | { | ||
151 | INFO("Restoring after suspend..."); | ||
152 | FC_resume(); | ||
153 | } | ||
154 | #endif | ||
155 | |||
156 | static void get_universal_version(UNIVERSAL_Handle h, char *buffer, unsigned size) | ||
157 | { | ||
158 | UNIVERSAL_DynamicParams params = | ||
159 | { | ||
160 | .size = sizeof(UNIVERSAL_DynamicParams), | ||
161 | }; | ||
162 | |||
163 | UNIVERSAL_Status status = | ||
164 | { | ||
165 | .size = sizeof(UNIVERSAL_Status), | ||
166 | .data = | ||
167 | { | ||
168 | .numBufs = 1, | ||
169 | .descs[0].buf = (XDAS_Int8 *)buffer, | ||
170 | .descs[0].bufSize = (XDAS_Int32)size, | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | XDAS_Int32 s; | ||
175 | |||
176 | memset(buffer, 0, size); | ||
177 | s = UNIVERSAL_control(h, XDM_GETVERSION, ¶ms, &status); | ||
178 | |||
179 | if( s != IUNIVERSAL_EOK ) { | ||
180 | ERROR("Unknown version Error = %d:: buffer = %p size = %d", s, buffer, size); | ||
181 | } | ||
182 | } | ||
183 | |||
184 | // VIDDEC2_create wrapper, to display version string in the trace. | ||
185 | static VIDDEC2_Handle viddec2_create(Engine_Handle engine, String name, VIDDEC2_Params *params) | ||
186 | { | ||
187 | UNIVERSAL_Handle h; | ||
188 | |||
189 | DEBUG(">> engine=%08x, name=%s, params=%p", engine, name, params); | ||
190 | |||
191 | h = UNIVERSAL_create(engine, name, (IUNIVERSAL_Params*)params); | ||
192 | |||
193 | get_universal_version(h, version_buffer, VERSION_SIZE); | ||
194 | |||
195 | INFO("Created codec %s: version %s", name, version_buffer); | ||
196 | |||
197 | return ((VIDDEC2_Handle)h); | ||
198 | } | ||
199 | |||
200 | /* needs to be updated when XDM_MOVEBUFS added in XDC tools */ | ||
201 | static int viddec2_reloc(VIDDEC2_Handle handle, uint8_t *ptr, uint32_t len) | ||
202 | { | ||
203 | return (-1); // TODO | ||
204 | |||
205 | } | ||
206 | |||
207 | static int viddec2_control(VIDDEC2_Handle handle, VIDDEC2_Cmd id, VIDDEC2_DynamicParams *dynParams, | ||
208 | VIDDEC2_Status *status ) | ||
209 | { | ||
210 | int ret = 0; | ||
211 | UNIVERSAL_DynamicParams udynParam; | ||
212 | UNIVERSAL_Status ustatus; | ||
213 | |||
214 | udynParam.size = sizeof(UNIVERSAL_DynamicParams); | ||
215 | ustatus.size = sizeof(UNIVERSAL_Status); | ||
216 | //System_printf("command id is %d\n", id); | ||
217 | |||
218 | if(id == XDM_GETVERSION){ | ||
219 | ustatus.data.numBufs = 1; | ||
220 | ustatus.data.descs[0].buf = status->data.buf; | ||
221 | ustatus.data.descs[0].bufSize = status->data.bufSize; | ||
222 | } | ||
223 | |||
224 | ret = UNIVERSAL_control((UNIVERSAL_Handle)handle, (UNIVERSAL_Cmd)id, | ||
225 | &udynParam, &ustatus); | ||
226 | |||
227 | /*universal copy supports only XDM_GETVERSION cmd id */ | ||
228 | /*This is to return success to VIDDEC2 application in case of other cmd ids */ | ||
229 | if(ret == IUNIVERSAL_EFAIL)ret = IUNIVERSAL_EOK; | ||
230 | |||
231 | return ret; | ||
232 | } | ||
233 | |||
234 | static int viddec2_process(VIDDEC2_Handle handle, XDM1_BufDesc *inBufs, | ||
235 | XDM_BufDesc *outBufs, VIDDEC2_InArgs *inArgs, VIDDEC2_OutArgs *outArgs ) | ||
236 | { | ||
237 | int ret = 0; | ||
238 | XDM1_BufDesc inBuf, outBuf; | ||
239 | UNIVERSAL_InArgs inArg; | ||
240 | UNIVERSAL_OutArgs outArg; | ||
241 | |||
242 | inArg.size = sizeof(UNIVERSAL_InArgs); | ||
243 | outArg.size = sizeof(UNIVERSAL_OutArgs); | ||
244 | outArg.extendedError = 0; | ||
245 | //System_printf("Before VIDDEC2 process\n"); | ||
246 | |||
247 | //System_printf("outptr = 0x%x, size = %d\n",outBufs->bufs[0],outBufs->bufSizes[0]); | ||
248 | inBuf.numBufs = 1; | ||
249 | outBuf.numBufs = 1; | ||
250 | inBuf.descs[0].buf = inBufs->descs[0].buf; | ||
251 | inBuf.descs[0].bufSize = inBufs->descs[0].bufSize; | ||
252 | |||
253 | outBuf.descs[0].buf = outBufs->bufs[0]; | ||
254 | outBuf.descs[0].bufSize = outBufs->bufSizes[0]; | ||
255 | |||
256 | ret = UNIVERSAL_process((UNIVERSAL_Handle)handle, &inBuf, &outBuf, NULL, | ||
257 | &inArg, &outArg); | ||
258 | |||
259 | //System_printf("After VIDDEC2 process\n"); | ||
260 | return ret; | ||
261 | } | ||
262 | |||
263 | static int viddec2_delete(VIDDEC2_Handle handle) | ||
264 | { | ||
265 | //System_printf("Deleting VIDDEC2\n"); | ||
266 | UNIVERSAL_delete((UNIVERSAL_Handle)handle); | ||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | |||
271 | /* | ||
272 | * RPC message handlers | ||
273 | */ | ||
274 | static int connect(void *msg) | ||
275 | { | ||
276 | //dce_connect *req = msg; | ||
277 | //DEBUG(">> chipset_id=0x%x, debug=%d", req->chipset_id, req->debug); | ||
278 | |||
279 | if( dce_debug >= MAX_DEBUG_LEVEL ) { | ||
280 | DEBUG("Enable FC, CE and IPC traces"); | ||
281 | |||
282 | FCSettings_init(); | ||
283 | Diags_setMask(FCSETTINGS_MODNAME "+12345678LEXAIZFS"); | ||
284 | |||
285 | CESettings_init(); | ||
286 | Diags_setMask(CESETTINGS_MODNAME "+12345678LEXAIZFS"); | ||
287 | |||
288 | /* | ||
289 | * Enable use of runtime Diags_setMask per module: | ||
290 | * | ||
291 | * Codes: E = ENTRY, X = EXIT, L = LIFECYCLE, F = INFO, S = STATUS | ||
292 | */ | ||
293 | Diags_setMask("ti.ipc.rpmsg.RPMessage=EXLFS"); | ||
294 | Diags_setMask("ti.ipc.rpmsg.VirtQueue=EXLFS"); | ||
295 | } | ||
296 | |||
297 | CERuntime_init(); | ||
298 | |||
299 | if( !suspend_initialised ) { | ||
300 | |||
301 | /* registering sysbios-rpmsg callbacks for suspend/resume */ | ||
302 | // IpcPower_registerCallback(IpcPower_Event_SUSPEND, (IpcPower_CallbackFuncPtr)dce_suspend, 0); | ||
303 | // IpcPower_registerCallback(IpcPower_Event_RESUME, (IpcPower_CallbackFuncPtr)dce_resume, 0); | ||
304 | suspend_initialised++; | ||
305 | } | ||
306 | |||
307 | DEBUG("<<"); | ||
308 | |||
309 | return (0); | ||
310 | } | ||
311 | |||
312 | /* | ||
313 | * Engine_open: | ||
314 | */ | ||
315 | static Int32 engine_open(UInt32 size, UInt32 *data) | ||
316 | { | ||
317 | MmType_Param *payload = (MmType_Param *)data; | ||
318 | dce_engine_open *engine_open_msg = (dce_engine_open *)payload[0].data; | ||
319 | Engine_Handle eng_handle = NULL; | ||
320 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
321 | |||
322 | DEBUG(">> engine_open"); | ||
323 | if( num_params != 1 ) { | ||
324 | ERROR("Invalid number of params sent"); | ||
325 | return (-1); | ||
326 | } | ||
327 | |||
328 | dce_inv(engine_open_msg); | ||
329 | |||
330 | eng_handle = Engine_open(engine_open_msg->name, engine_open_msg->engine_attrs, &engine_open_msg->error_code); | ||
331 | DEBUG("<< engine=%08x, ec=%d", eng_handle, engine_open_msg->error_code); | ||
332 | |||
333 | dce_clean(engine_open_msg); | ||
334 | |||
335 | return ((Int32)eng_handle); | ||
336 | } | ||
337 | |||
338 | /* | ||
339 | * Engine_close: | ||
340 | */ | ||
341 | static Int32 engine_close(UInt32 size, UInt32 *data) | ||
342 | { | ||
343 | MmType_Param *payload = (MmType_Param *)data; | ||
344 | Engine_Handle eng_handle = (Engine_Handle)payload[0].data; | ||
345 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
346 | |||
347 | if( num_params != 1 ) { | ||
348 | ERROR("invalid number of params sent"); | ||
349 | return (-1); | ||
350 | } | ||
351 | |||
352 | Engine_close(eng_handle); | ||
353 | DEBUG("<<"); | ||
354 | |||
355 | return (0); | ||
356 | } | ||
357 | |||
358 | /* | ||
359 | * codec_create | ||
360 | */ | ||
361 | static Int32 codec_create(UInt32 size, UInt32 *data) | ||
362 | { | ||
363 | MmType_Param *payload = (MmType_Param *)data; | ||
364 | Uint32 codec_id = (Uint32)payload[0].data; | ||
365 | Engine_Handle engine = (Engine_Handle)payload[1].data; | ||
366 | char *codec_name = (char *)payload[2].data; | ||
367 | void *static_params = (void *)payload[3].data; | ||
368 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
369 | void *codec_handle; | ||
370 | |||
371 | #ifdef MEMORYSTATS_DEBUG | ||
372 | Memory_Stats stats; | ||
373 | #endif | ||
374 | DEBUG(">> codec_create"); | ||
375 | |||
376 | if( num_params != 4 ) { | ||
377 | ERROR("invalid number of params sent"); | ||
378 | return (-1); | ||
379 | } | ||
380 | |||
381 | if(codec_id != OMAP_DCE_VIDDEC2){ | ||
382 | ERROR("invalid codec id sent"); | ||
383 | return (-1); | ||
384 | } | ||
385 | |||
386 | dce_inv(static_params); | ||
387 | |||
388 | codec_handle = (void *)codec_fxns[codec_id].create(engine, codec_name, static_params); | ||
389 | |||
390 | DEBUG("<< codec_handle=%08x", codec_handle); | ||
391 | |||
392 | dce_clean(static_params); | ||
393 | |||
394 | #ifdef MEMORYSTATS_DEBUG | ||
395 | Memory_getStats(NULL, &stats); | ||
396 | INFO("Total: %d\tFree: %d\tLargest: %d", stats.totalSize, | ||
397 | stats.totalFreeSize, stats.largestFreeSize); | ||
398 | #endif | ||
399 | return ((Int32)codec_handle); | ||
400 | } | ||
401 | |||
402 | /* | ||
403 | * codec_control | ||
404 | */ | ||
405 | static int codec_control(UInt32 size, UInt32 *data) | ||
406 | { | ||
407 | MmType_Param *payload = (MmType_Param *)data; | ||
408 | Uint32 codec_id = (Uint32)payload[0].data; | ||
409 | void *codec_handle = (Engine_Handle)payload[1].data; | ||
410 | uint32_t cmd_id = (Uint32)payload[2].data; | ||
411 | void *dyn_params = (void *)payload[3].data; | ||
412 | void *status = (void *)payload[4].data; | ||
413 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
414 | Int32 ret = 0; | ||
415 | |||
416 | |||
417 | DEBUG(">> codec_control"); | ||
418 | |||
419 | if( num_params != 5 ) { | ||
420 | ERROR("invalid number of params sent"); | ||
421 | return (-1); | ||
422 | } | ||
423 | |||
424 | if(codec_id != OMAP_DCE_VIDDEC2){ | ||
425 | ERROR("invalid codec id sent"); | ||
426 | return (-1); | ||
427 | } | ||
428 | |||
429 | dce_inv(dyn_params); | ||
430 | dce_inv(status); | ||
431 | |||
432 | ret = (uint32_t) codec_fxns[codec_id].control(codec_handle, cmd_id, dyn_params, status); | ||
433 | |||
434 | DEBUG("<< result=%d", ret); | ||
435 | |||
436 | dce_clean(dyn_params); | ||
437 | dce_clean(status); | ||
438 | |||
439 | return (ret); | ||
440 | } | ||
441 | |||
442 | /* | ||
443 | * codec get version | ||
444 | */ | ||
445 | static int codec_get_version(UInt32 size, UInt32 *data) | ||
446 | { | ||
447 | MmType_Param *payload = (MmType_Param *)data; | ||
448 | Uint32 codec_id = (Uint32)payload[0].data; | ||
449 | void *codec_handle = (Engine_Handle)payload[1].data; | ||
450 | void *dyn_params = (void *)payload[2].data; | ||
451 | void *status = (void *)payload[3].data; | ||
452 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
453 | void *version_buf = NULL; | ||
454 | Int32 ret = 0; | ||
455 | |||
456 | DEBUG(">> codec_get_version"); | ||
457 | |||
458 | if( num_params != 4 ) { | ||
459 | ERROR("invalid number of params sent"); | ||
460 | return (-1); | ||
461 | } | ||
462 | |||
463 | if(codec_id != OMAP_DCE_VIDDEC2){ | ||
464 | ERROR("invalid codec id sent"); | ||
465 | return (-1); | ||
466 | } | ||
467 | |||
468 | version_buf = (void *)(H2P((MemHeader *)((IVIDDEC2_Status *)status)->data.buf)); | ||
469 | |||
470 | dce_inv(dyn_params); | ||
471 | dce_inv(status); | ||
472 | dce_inv(version_buf); | ||
473 | |||
474 | ret = (uint32_t) codec_fxns[codec_id].control(codec_handle, XDM_GETVERSION, dyn_params, status); | ||
475 | |||
476 | DEBUG("<< result=%d", ret); | ||
477 | |||
478 | dce_clean(dyn_params); | ||
479 | dce_clean(status); | ||
480 | dce_clean(version_buf); | ||
481 | |||
482 | return (ret); | ||
483 | } | ||
484 | |||
485 | /* Notes about serialization of process command: | ||
486 | * | ||
487 | * Since codec_process code on kernel side is doing buffer mapping/unmapping, | ||
488 | * and keeping track of codec's locked buffers, it is necessary for it to | ||
489 | * look into the contents of some of the parameter structs, and in some cases | ||
490 | * re-write them. For this reason inArgs/outBufs/inBufs are serialized within | ||
491 | * the rpmsg rather than just passed by pointer. | ||
492 | |||
493 | XDAS_Int32 VIDDEC3_process(VIDDEC3_Handle handle, XDM1_BufDesc *inBufs, | ||
494 | XDM_BufDesc *outBufs, VIDDEC3_InArgs *inArgs, VIDDEC3_OutArgs *outArgs); | ||
495 | |||
496 | REQ: | ||
497 | struct dce_rpc_hdr hdr -> 4 | ||
498 | codec_id -> 4 | ||
499 | codec -> 4 | ||
500 | reloc length -> 1 (length/4) | ||
501 | inArgs length -> 1 (length/4) | ||
502 | outBufs length -> 1 (length/4) | ||
503 | inBufs length -> 1 (length/4) | ||
504 | VIDDEC3_OutArgs *outArgs -> 4 (pass by pointer) | ||
505 | reloc table -> 12 * nreloc (typically <= 16) | ||
506 | VIDDEC3_InArgs inArgs -> 12 (need inputID from userspace) | ||
507 | XDM_BufDesc outBufs -> 44 (4 + 2 * 20) | ||
508 | XDM1_BufDesc inBufs -> 24 (4 + 1 * 20) | ||
509 | ------------------------------- | ||
510 | 99 | ||
511 | |||
512 | RSP | ||
513 | struct dce_rpc_hdr hdr -> 4 | ||
514 | result -> 4 | ||
515 | inBufs length -> 1 (length/4) | ||
516 | XDAS_Int32 freeBufID[] -> 4*n (n typically 0 or 2, but could be up to 20) | ||
517 | ------------------------------- | ||
518 | 9-89 | ||
519 | Note: freeBufID[] duplicates what is returned in outArgs, but avoids | ||
520 | needing to create kernel mappings of these objects which are to big | ||
521 | to copy inline. Also it avoids differences between VIDDEC3/VIDDENC2. | ||
522 | |||
523 | |||
524 | XDAS_Int32 VIDENC2_process(VIDENC2_Handle handle, IVIDEO2_BufDesc *inBufs, | ||
525 | XDM2_BufDesc *outBufs, IVIDENC2_InArgs *inArgs, IVIDENC2_OutArgs *outArgs); | ||
526 | |||
527 | REQ: | ||
528 | struct dce_rpc_hdr hdr -> 4 | ||
529 | codec_id -> 4 | ||
530 | codec -> 4 | ||
531 | reloc length -> 1 (length/4) | ||
532 | inArgs length -> 1 (length/4) | ||
533 | outBufs length -> 1 (length/4) | ||
534 | inBufs length -> 1 (length/4) | ||
535 | VIDENC2_OutArgs *outArgs -> 4 (pass by pointer) | ||
536 | reloc table -> ??? | ||
537 | VIDENC2_InArgs inArgs -> 12 (need inputID from userspace) | ||
538 | XDM2_BufDesc outBufs -> 24 (4 + 1 * 20) | ||
539 | IVIDEO2_BufDesc inBufs -> 252 | ||
540 | ------------------------------- | ||
541 | 307 | ||
542 | |||
543 | RSP | ||
544 | struct dce_rpc_hdr hdr -> 4 | ||
545 | result -> 4 | ||
546 | inBufs length -> 1 (length/4) | ||
547 | XDAS_Int32 freeBufID[] -> 4*n (n typically 0 or 2, but could be up to 20) | ||
548 | ------------------------------- | ||
549 | 9-89 | ||
550 | */ | ||
551 | |||
552 | static int codec_process(UInt32 size, UInt32 *data) | ||
553 | { | ||
554 | MmType_Param *payload = (MmType_Param *)data; | ||
555 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
556 | Uint32 codec_id = (Uint32) payload[0].data; | ||
557 | Uint32 codec = (Uint32) payload[1].data; | ||
558 | void *inBufs = (void *) payload[2].data; | ||
559 | void *outBufs = (void *) payload[3].data; | ||
560 | void *inArgs = (void *) payload[4].data; | ||
561 | void *outArgs = (void *) payload[5].data; | ||
562 | void *outBufptr = (void *)payload[6].data; | ||
563 | Int32 ret = 0; | ||
564 | void *outBufSize = NULL; | ||
565 | |||
566 | DEBUG(">> codec_process"); | ||
567 | |||
568 | if( num_params != 7 ) { | ||
569 | ERROR("invalid number of params sent"); | ||
570 | return (-1); | ||
571 | } | ||
572 | |||
573 | if(codec_id != OMAP_DCE_VIDDEC2){ | ||
574 | ERROR("invalid codec id sent"); | ||
575 | return (-1); | ||
576 | } | ||
577 | |||
578 | outBufSize = (void *)(H2P((MemHeader *)((XDM_BufDesc *)outBufs)->bufSizes)); | ||
579 | |||
580 | dce_inv(inBufs); | ||
581 | dce_inv(outBufs); | ||
582 | dce_inv(inArgs); | ||
583 | dce_inv(outArgs); | ||
584 | dce_inv(outBufptr); | ||
585 | dce_inv(outBufSize); | ||
586 | |||
587 | DEBUG(">> codec=%p, inBufs=%p, outBufs=%p, inArgs=%p, outArgs=%p codec_id=%d", | ||
588 | codec, inBufs, outBufs, inArgs, outArgs, codec_id); | ||
589 | |||
590 | ret = codec_fxns[codec_id].process((void *)codec, inBufs, outBufs, inArgs, outArgs); | ||
591 | |||
592 | |||
593 | DEBUG("<< ret=%d extendedError=%08x", ret, ((VIDDEC3_OutArgs *)outArgs)->extendedError); | ||
594 | |||
595 | dce_clean(inBufs); | ||
596 | dce_clean(outBufs); | ||
597 | dce_clean(inArgs); | ||
598 | dce_clean(outArgs); | ||
599 | dce_clean(outBufptr); | ||
600 | dce_clean(outBufSize); | ||
601 | |||
602 | return ((Int32)ret); | ||
603 | } | ||
604 | |||
605 | /* | ||
606 | * codec delete | ||
607 | */ | ||
608 | |||
609 | static int codec_delete(UInt32 size, UInt32 *data) | ||
610 | { | ||
611 | MmType_Param *payload = (MmType_Param *)data; | ||
612 | Uint32 num_params = MmRpc_NUM_PARAMETERS(size); | ||
613 | Uint32 codec_id = (Uint32) payload[0].data; | ||
614 | Uint32 codec = (Uint32) payload[1].data; | ||
615 | |||
616 | #ifdef MEMORYSTATS_DEBUG | ||
617 | Memory_Stats stats; | ||
618 | #endif | ||
619 | |||
620 | DEBUG(">> codec_delete"); | ||
621 | |||
622 | if( num_params != 2 ) { | ||
623 | ERROR("invalid number of params sent"); | ||
624 | return (-1); | ||
625 | } | ||
626 | |||
627 | if(codec_id != OMAP_DCE_VIDDEC2){ | ||
628 | ERROR("invalid codec id sent"); | ||
629 | return (-1); | ||
630 | } | ||
631 | |||
632 | codec_fxns[codec_id].delete((void *)codec); | ||
633 | |||
634 | #ifdef MEMORYSTATS_DEBUG | ||
635 | Memory_getStats(NULL, &stats); | ||
636 | INFO("Total: %d\tFree: %d\tLargest: %d", stats.totalSize, | ||
637 | stats.totalFreeSize, stats.largestFreeSize); | ||
638 | #endif | ||
639 | |||
640 | DEBUG("<<"); | ||
641 | |||
642 | return (0); | ||
643 | } | ||
644 | |||
645 | /* the server create parameters, must be in persistent memory */ | ||
646 | static RcmServer_Params rpc_Params; | ||
647 | |||
648 | /* DCE Server skel function array */ | ||
649 | static RcmServer_FxnDesc DCEServerFxnAry[] = | ||
650 | { | ||
651 | { "engine_open", (RcmServer_MsgFxn) engine_open }, | ||
652 | { "engine_close", (RcmServer_MsgFxn) engine_close }, | ||
653 | { "codec_create", (RcmServer_MsgFxn) codec_create }, | ||
654 | { "codec_control", (RcmServer_MsgFxn) codec_control }, | ||
655 | { "codec_get_version", (RcmServer_MsgFxn) codec_get_version }, | ||
656 | { "codec_process", (RcmServer_MsgFxn) codec_process }, | ||
657 | { "codec_delete", (RcmServer_MsgFxn) codec_delete } | ||
658 | }; | ||
659 | |||
660 | /* DCE Server skel function table */ | ||
661 | #define DCEServerFxnAryLen (sizeof(DCEServerFxnAry) / sizeof(DCEServerFxnAry[0])) | ||
662 | |||
663 | static const RcmServer_FxnDescAry DCEServer_fxnTab = | ||
664 | { | ||
665 | DCEServerFxnAryLen, | ||
666 | DCEServerFxnAry | ||
667 | }; | ||
668 | |||
669 | static MmType_FxnSig DCEServer_sigAry[] = | ||
670 | { | ||
671 | { "engine_open", 2, | ||
672 | { | ||
673 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
674 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 } | ||
675 | } }, | ||
676 | { "engine_close", 2, | ||
677 | { | ||
678 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
679 | { MmType_Dir_In, MmType_Param_U32, 1 } | ||
680 | |||
681 | } }, | ||
682 | { "codec_create", 5, | ||
683 | { | ||
684 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
685 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
686 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
687 | { MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
688 | { MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 } | ||
689 | } }, | ||
690 | { "codec_control", 6, | ||
691 | { | ||
692 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
693 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
694 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
695 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
696 | { MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
697 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 } | ||
698 | } }, | ||
699 | { "codec_get_version", 5, | ||
700 | { | ||
701 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
702 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
703 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
704 | { MmType_Dir_In, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
705 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 } | ||
706 | } }, | ||
707 | |||
708 | { "codec_process", 8, | ||
709 | { | ||
710 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
711 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
712 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
713 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
714 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
715 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
716 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 }, | ||
717 | { MmType_Dir_Bi, MmType_PtrType(MmType_Param_VOID), 1 } | ||
718 | } }, | ||
719 | |||
720 | { "codec_delete", 3, | ||
721 | { | ||
722 | { MmType_Dir_Out, MmType_Param_S32, 1 }, // return | ||
723 | { MmType_Dir_In, MmType_Param_U32, 1 }, | ||
724 | { MmType_Dir_In, MmType_Param_U32, 1 } | ||
725 | } } | ||
726 | }; | ||
727 | |||
728 | static MmType_FxnSigTab dce_fxnSigTab = | ||
729 | { | ||
730 | MmType_NumElem(DCEServer_sigAry), DCEServer_sigAry | ||
731 | }; | ||
732 | |||
733 | Void dce_SrvDelNotification(Void) | ||
734 | { | ||
735 | DEBUG("dce_SrvDelNotification: Nothing to cleanup\n"); | ||
736 | } | ||
737 | |||
738 | static void dce_main(uint32_t arg0, uint32_t arg1) | ||
739 | { | ||
740 | int err = 0; | ||
741 | dce_connect dce_connect_msg; | ||
742 | |||
743 | err = MmServiceMgr_init(); // MmServiceMgr_init() will always return MmServiceMgr_S_SUCCESS. | ||
744 | |||
745 | // setup the RCM Server create params | ||
746 | RcmServer_Params_init(&rpc_Params); | ||
747 | rpc_Params.priority = Thread_Priority_ABOVE_NORMAL; | ||
748 | rpc_Params.stackSize = 0x1000; | ||
749 | rpc_Params.fxns.length = DCEServer_fxnTab.length; | ||
750 | rpc_Params.fxns.elem = DCEServer_fxnTab.elem; | ||
751 | |||
752 | // Get the Service Manager handle | ||
753 | err = MmServiceMgr_register(SERVER_NAME, &rpc_Params, &dce_fxnSigTab, dce_SrvDelNotification); | ||
754 | |||
755 | if( err < 0 ) { | ||
756 | DEBUG("failed to start " SERVER_NAME " \n"); | ||
757 | //err = -1; | ||
758 | } else { | ||
759 | DEBUG(SERVER_NAME " running through MmServiceMgr"); | ||
760 | } | ||
761 | |||
762 | // Question to IPC team: where is the call to OmapRpc_deleteChannel(handle). The OmapRpc_createChannel is part of MmServiceMgr_register | ||
763 | // missing the call to OmapRpc_deleteChannel(handle). | ||
764 | MmServiceMgr_exit(); | ||
765 | |||
766 | DEBUG("deleted " SERVER_NAME); | ||
767 | |||
768 | /* Read the register for ID_CODE to figure out the correct configuration: */ | ||
769 | /* CONTROL_STD_FUSE_ID_CODE[31:0] ID_CODE STD_FUSE_IDCODE */ | ||
770 | /* physical address: 0x4A00 2204 Address offset: 0x204 */ | ||
771 | #ifdef OMAP5430_ES10 | ||
772 | dce_connect_msg.chipset_id = 0x5430; | ||
773 | #elif OMAP5432_ES20 | ||
774 | dce_connect_msg.chipset_id = 0x5432; | ||
775 | #elif VAYU_ES10 | ||
776 | dce_connect_msg.chipset_id = 0x5436; | ||
777 | #endif | ||
778 | dce_connect_msg.debug = dce_debug; | ||
779 | connect(&dce_connect_msg); | ||
780 | |||
781 | return; | ||
782 | } | ||
783 | |||
784 | /* | ||
785 | * dce init : Startup Function | ||
786 | */ | ||
787 | Bool dce_init(void) | ||
788 | { | ||
789 | Task_Params params; | ||
790 | |||
791 | INFO("Creating DCE server thread..."); | ||
792 | |||
793 | |||
794 | /* Create DCE task. */ | ||
795 | Task_Params_init(¶ms); | ||
796 | params.instance->name = "dce-server"; | ||
797 | params.priority = Thread_Priority_ABOVE_NORMAL; | ||
798 | Task_create(dce_main, ¶ms, NULL); | ||
799 | |||
800 | return (TRUE); | ||
801 | } | ||
802 | |||
803 | /* | ||
804 | * dce deinit | ||
805 | */ | ||
806 | |||
807 | void dce_deinit(void) | ||
808 | { | ||
809 | DEBUG("dce_deinit"); | ||
810 | } | ||
811 | |||
diff --git a/src/ti/framework/dce/dce_priv.h b/src/ti/framework/dce/dce_priv.h new file mode 100644 index 0000000..1e46955 --- /dev/null +++ b/src/ti/framework/dce/dce_priv.h | |||
@@ -0,0 +1,90 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | #ifndef __DCE_PRIV_H__ | ||
34 | #define __DCE_PRIV_H__ | ||
35 | #include <ti/utils/osal/trace.h> | ||
36 | |||
37 | #if defined(CORE0) || defined(CORE1) | ||
38 | # define SERVER | ||
39 | Bool dce_init(void); | ||
40 | #else | ||
41 | # define CLIENT | ||
42 | #endif | ||
43 | |||
44 | #ifdef SERVER | ||
45 | /* these acquire/release functions should be implemented by the platform, | ||
46 | * ie. to use OMX RM if integrated with OMX build, or use directly slpm | ||
47 | * and/or register programming otherwise. These are called from dce.c | ||
48 | * before/after the process() call | ||
49 | */ | ||
50 | void ivahd_acquire(void); | ||
51 | void ivahd_release(void); | ||
52 | void ivahd_init(uint32_t chipset_id); | ||
53 | void ivahd_boot(); | ||
54 | #endif | ||
55 | |||
56 | #ifndef DIM | ||
57 | # define DIM(a) (sizeof((a)) / sizeof((a)[0])) | ||
58 | #endif | ||
59 | |||
60 | |||
61 | #ifndef TRUE | ||
62 | # define TRUE 1 | ||
63 | #endif | ||
64 | #ifndef FALSE | ||
65 | # define FALSE 0 | ||
66 | #endif | ||
67 | #ifndef NULL | ||
68 | # define NULL ((void *)0) | ||
69 | #endif | ||
70 | |||
71 | typedef struct MemHeader { | ||
72 | uint32_t size; | ||
73 | void *ptr; /* when used for BIOS heap blocks, just a raw ptr */ | ||
74 | int32_t dma_buf_fd; /* shared dma buf fd */ | ||
75 | uint32_t region; /* mem region the buffer allocated from */ | ||
76 | /* internal meta data for the buffer */ | ||
77 | uint32_t offset; /* offset for the actual data with in the buffer */ | ||
78 | int32_t map_fd; /* mmapped fd */ | ||
79 | void * handle; /*custom handle for the HLOS memallocator*/ | ||
80 | } MemHeader; | ||
81 | |||
82 | #define P2H(p) (&(((MemHeader *)(p))[-1])) | ||
83 | #define H2P(h) ((void *)&(h)[1]) | ||
84 | |||
85 | #ifndef __packed | ||
86 | # define __packed __attribute__((packed)) | ||
87 | #endif | ||
88 | |||
89 | #endif /* __DCE_PRIV_H__ */ | ||
90 | |||
diff --git a/src/ti/framework/dce/dce_rpc.h b/src/ti/framework/dce/dce_rpc.h new file mode 100644 index 0000000..e3f2a2f --- /dev/null +++ b/src/ti/framework/dce/dce_rpc.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | #ifndef __DCE_RPC_H__ | ||
34 | #define __DCE_RPC_H__ | ||
35 | |||
36 | /* RPC layer types.. these define the payload of messages between IPUMM | ||
37 | * and MPU. This should be kept in sync between firmware build and | ||
38 | * driver. | ||
39 | * | ||
40 | * TODO: xxx_control(XDM_GETVERSION) is a bit awkward to deal with, because | ||
41 | * this seems to be the one special case where status->data is used.. | ||
42 | * possibly we should define a special ioctl and msg to handle this case. | ||
43 | */ | ||
44 | |||
45 | /* Message-Ids: | ||
46 | */ | ||
47 | typedef enum dce_rpc_call { | ||
48 | DCE_RPC_ENGINE_OPEN = 0, | ||
49 | DCE_RPC_ENGINE_CLOSE, | ||
50 | DCE_RPC_CODEC_CREATE, | ||
51 | DCE_RPC_CODEC_CONTROL, | ||
52 | DCE_RPC_CODEC_GET_VERSION, | ||
53 | DCE_RPC_CODEC_PROCESS, | ||
54 | DCE_RPC_CODEC_DELETE | ||
55 | } dce_rpc_call; | ||
56 | |||
57 | |||
58 | |||
59 | #define MAX_NAME_LENGTH 32 | ||
60 | |||
61 | typedef enum dce_codec_type { | ||
62 | OMAP_DCE_VIDDEC3 = 1, | ||
63 | OMAP_DCE_VIDENC2 = 2, | ||
64 | OMAP_DCE_VIDDEC2 = 3 | ||
65 | } dce_codec_type; | ||
66 | |||
67 | /* Structures of RPC */ | ||
68 | typedef struct dce_connect { | ||
69 | uint32_t chipset_id; | ||
70 | uint32_t debug; | ||
71 | } dce_connect; | ||
72 | |||
73 | typedef struct dce_engine_open { | ||
74 | char name[MAX_NAME_LENGTH]; /* engine name (in) */ | ||
75 | Engine_Attrs *engine_attrs; /* engine attributes (in) */ | ||
76 | Engine_Error error_code; /* error code (out) */ | ||
77 | } dce_engine_open; | ||
78 | |||
79 | #endif /* __DCE_RPC_H__ */ | ||
80 | |||
diff --git a/src/ti/framework/dce/package.bld b/src/ti/framework/dce/package.bld new file mode 100644 index 0000000..70d7c3d --- /dev/null +++ b/src/ti/framework/dce/package.bld | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | /* | ||
33 | * ======== package.bld ======== | ||
34 | */ | ||
35 | /* explicit references to global objects */ | ||
36 | var Build = xdc.useModule('xdc.bld.BuildEnvironment'); | ||
37 | var Pkg = xdc.useModule('xdc.bld.PackageContents'); | ||
38 | var commonBld = xdc.loadCapsule("../build/common.bld"); | ||
39 | |||
40 | /* clean lib folder */ | ||
41 | //Pkg.generatedFiles.$add("lib/"); | ||
42 | //Pkg.libDir = "package/"; | ||
43 | var compileOpts = "-DDSP --gcc " | ||
44 | |||
45 | |||
46 | /* | ||
47 | * Export everything necessary to build this package with (almost) no | ||
48 | * generated files. | ||
49 | */ | ||
50 | //Pkg.attrs.exportAll = true; | ||
51 | |||
52 | var LIB_NAME = "lib/" + Pkg.name; | ||
53 | var objList = ["dce.c"]; | ||
54 | |||
55 | |||
56 | var profiles = commonBld.getProfiles(arguments); | ||
57 | /* If no profiles were assigned, build for release */ | ||
58 | if (profiles.length == 0) { | ||
59 | profiles[0] = "release"; | ||
60 | } | ||
61 | |||
62 | coreNames = commonBld.getCores(arguments); | ||
63 | |||
64 | if (coreNames.length==0) { | ||
65 | /* select default as dsp */ | ||
66 | commonBld.buildLibs(objList, null, arguments, compileOpts,"dsp"); | ||
67 | } | ||
68 | else { | ||
69 | for (var j = 0; j < coreNames.length; j++) { | ||
70 | var coreName = coreNames[j]; | ||
71 | |||
72 | /* skip core if not supported */ | ||
73 | if (!commonBld.supportsCore(coreName, null)) { | ||
74 | continue; | ||
75 | } | ||
76 | |||
77 | /* generate makefiles */ | ||
78 | commonBld.buildLibs(objList, null, arguments, compileOpts, coreName); | ||
79 | print("built for coreName =" + coreName); | ||
80 | } | ||
81 | print("end of For loop ************"); | ||
82 | } | ||
83 | |||
diff --git a/src/ti/framework/dce/package.xdc b/src/ti/framework/dce/package.xdc new file mode 100644 index 0000000..fd76ea3 --- /dev/null +++ b/src/ti/framework/dce/package.xdc | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | /* | ||
33 | * ======== package.xdc ======== | ||
34 | * | ||
35 | */ | ||
36 | |||
37 | requires ti.sdo.ce; | ||
38 | requires ti.sdo.ce.video2; | ||
39 | requires ti.sdo.ce.universal; | ||
40 | requires ti.sdo.fc.utils; | ||
41 | |||
42 | /*! | ||
43 | * ======== ti.dce ======== | ||
44 | */ | ||
45 | |||
46 | package ti.framework.dce [1,0,0,0] { | ||
47 | } | ||
diff --git a/src/ti/framework/dce/package.xs b/src/ti/framework/dce/package.xs new file mode 100644 index 0000000..55b6693 --- /dev/null +++ b/src/ti/framework/dce/package.xs | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011-2012, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | /* | ||
34 | * ======== package.xs ======== | ||
35 | * | ||
36 | */ | ||
37 | |||
38 | |||
39 | /* | ||
40 | * ======== init ======== | ||
41 | */ | ||
42 | function init() | ||
43 | { | ||
44 | /* | ||
45 | * install a SYS/BIOS startup function | ||
46 | * it will be called during BIOS_start() | ||
47 | */ | ||
48 | var BIOS = xdc.useModule('ti.sysbios.BIOS'); | ||
49 | BIOS.addUserStartupFunction('&dce_init'); | ||
50 | } | ||
51 | |||
52 | |||
53 | |||
54 | /* | ||
55 | * ======== Package.getLibs ======== | ||
56 | * This function is called when a program's configuration files are | ||
57 | * being generated and it returns the name of a library appropriate | ||
58 | * for the program's configuration. | ||
59 | */ | ||
60 | |||
61 | function getLibs(prog) | ||
62 | { | ||
63 | var pkg = this; | ||
64 | var commonBld = xdc.loadCapsule("build/common.bld"); | ||
65 | var dir = xdc.getPackageBase("src.ti.framework.dce"); | ||
66 | var lib = commonBld.commonGetLibs(prog, true, pkg, dir); | ||
67 | return lib; | ||
68 | |||
69 | } | ||
70 | |||
71 | /* | ||
72 | * ======== package.close ======== | ||
73 | */ | ||
74 | function close() | ||
75 | { | ||
76 | |||
77 | if (xdc.om.$name != 'cfg') { | ||
78 | return; | ||
79 | } | ||
80 | } | ||
81 | |||
diff --git a/src/ti/utils/osal/trace.h b/src/ti/utils/osal/trace.h new file mode 100644 index 0000000..8f97b77 --- /dev/null +++ b/src/ti/utils/osal/trace.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010, Texas Instruments Incorporated | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * | ||
9 | * * Redistributions of source code must retain the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer. | ||
11 | * | ||
12 | * * Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * | ||
16 | * * Neither the name of Texas Instruments Incorporated nor the names of | ||
17 | * its contributors may be used to endorse or promote products derived | ||
18 | * from this software without specific prior written permission. | ||
19 | * | ||
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | ||
27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
30 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
31 | */ | ||
32 | |||
33 | #ifndef __IPU_TRACE_H__ | ||
34 | #define __IPU_TRACE_H__ | ||
35 | |||
36 | #include <stdlib.h> | ||
37 | #include <stdint.h> | ||
38 | #include <string.h> | ||
39 | #include <stdio.h> | ||
40 | |||
41 | extern uint32_t dce_debug; | ||
42 | |||
43 | /********************* MACROS ************************/ | ||
44 | /* Need to make it OS specific and support different trace levels */ | ||
45 | |||
46 | /* set desired trace level: | ||
47 | * 1 - error | ||
48 | * 2 - error, debug | ||
49 | * 3 - error, debug, info (very verbose) | ||
50 | * 4 - error, info, debug, verbose (very very verbose) | ||
51 | */ | ||
52 | #ifdef DCE_DEBUG_ENABLE | ||
53 | #define ERROR(FMT, ...) TRACE(1, "ERROR: " FMT, ##__VA_ARGS__) | ||
54 | #define DEBUG(FMT, ...) TRACE(2, "DEBUG: " FMT, ##__VA_ARGS__) | ||
55 | #define INFO(FMT, ...) TRACE(3, "INFO: " FMT, ##__VA_ARGS__) | ||
56 | #define VERB(FMT, ...) TRACE(4, "INFO: " FMT, ##__VA_ARGS__) | ||
57 | #else | ||
58 | #define ERROR(FMT, ...) | ||
59 | #define DEBUG(FMT, ...) | ||
60 | #define INFO(FMT, ...) | ||
61 | #define VERB(FMT, ...) | ||
62 | #endif | ||
63 | |||
64 | #define MAX_DEBUG_LEVEL (4) | ||
65 | #define TRACE(lvl, FMT, ...) do { if((lvl) <= dce_debug ) { \ | ||
66 | System_printf("%s:%d:\t%s\t" FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); \ | ||
67 | } } while( 0 ) | ||
68 | |||
69 | #endif /* __IPU_TRACE_H__ */ | ||