Home | History | Annotate | Download | only in src
      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 /**
     34  *  @file  omx_rpc_skel.c
     35  *         This file contains methods that provides the functionality for
     36  *         the OpenMAX1.1 DOMX Framework RPC Skeleton implementations.
     37  *
     38  *  @path \WTSD_DucatiMMSW\framework\domx\omx_rpc\src
     39  *
     40  *  @rev 1.0
     41  */
     42 
     43 /*==============================================================
     44  *! Revision History
     45  *! ============================
     46  *! 29-Mar-2010 Abhishek Ranka : Revamped DOMX implementation
     47  *!
     48  *! 19-August-2009 B Ravi Kiran ravi.kiran (at) ti.com: Initial Version
     49  *================================================================*/
     50 
     51 /******************************************************************
     52  *   INCLUDE FILES
     53  ******************************************************************/
     54 
     55 #include <stdio.h>
     56 #include <string.h>
     57 
     58 #include <timm_osal_interfaces.h>
     59 #include <OMX_TI_Common.h>
     60 
     61 #include "omx_rpc.h"
     62 #include "omx_proxy_common.h"
     63 #include "omx_rpc_skel.h"
     64 #include "omx_rpc_utils.h"
     65 #include "omx_rpc_internal.h"
     66 
     67 /* FUNCTION LIST*/
     68 /*
     69 RPC_OMX_ERRORTYPE RPC_SKEL_EmptyBufferDone(uint32_t size, uint32_t *data)
     70 RPC_OMX_ERRORTYPE RPC_SKEL_FillBufferDone(uint32_t size, uint32_t *data)
     71 RPC_OMX_ERRORTYPE RPC_SKEL_EventHandler(uint32_t size, uint32_t *data)
     72 */
     73 
     74 
     75 /* ===========================================================================*/
     76 /**
     77  * @name RPC_SKEL_FillBufferDone()
     78  * @brief Skeleton for OMX_AllocateBuffer()
     79  * @param size   : Size of the incoming RCM message (parameter used in the RCM alloc call)
     80  * @param *data  : Pointer to the RCM message/buffer received
     81  * @return RPC_OMX_ErrorNone = Successful
     82  * @sa TBD
     83  *
     84  */
     85 /* ===========================================================================*/
     86 RPC_OMX_ERRORTYPE RPC_SKEL_EmptyBufferDone(void *data)
     87 {
     88 
     89 	OMX_HANDLETYPE hComp;
     90 	RPC_OMX_ERRORTYPE tRPCError = RPC_OMX_ErrorNone;
     91 	OMX_U32 nfilledLen = 0;
     92 	OMX_U32 nOffset = 0;
     93 	OMX_U32 nFlags = 0;
     94 	OMX_U32 bufferHdr;
     95 	OMX_COMPONENTTYPE *pHandle = NULL;
     96 	PROXY_COMPONENT_PRIVATE *pCompPrv = NULL;
     97 	OMX_U32 nPos = 0;
     98 	//RPC_OMX_MESSAGE *recdMsg;
     99 	OMX_U8 *pMsgBody = NULL;
    100 	//recdMsg = (RPC_OMX_MESSAGE *) (data);
    101 
    102 	pMsgBody = data;	//&recdMsg->msgBody[0];
    103 
    104 	DOMX_ENTER("");
    105 
    106 	//Marshalled:[>hComp|>bufferHdr|>nFilledLen|>nOffset|>nFlags]
    107 
    108 	RPC_GETFIELDVALUE(pMsgBody, nPos, hComp, OMX_HANDLETYPE);
    109 	pHandle = (OMX_COMPONENTTYPE *) hComp;
    110 	pCompPrv = (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
    111 
    112 	RPC_GETFIELDVALUE(pMsgBody, nPos, bufferHdr, OMX_U32);
    113 
    114 	RPC_GETFIELDVALUE(pMsgBody, nPos, nfilledLen, OMX_U32);
    115 	RPC_GETFIELDVALUE(pMsgBody, nPos, nOffset, OMX_U32);
    116 	RPC_GETFIELDVALUE(pMsgBody, nPos, nFlags, OMX_U32);
    117 
    118 	tRPCError =
    119 	    pCompPrv->proxyEmptyBufferDone(hComp, bufferHdr, nfilledLen,
    120 	    nOffset, nFlags);
    121 
    122 	DOMX_EXIT("");
    123 	return tRPCError;
    124 }
    125 
    126 /* ===========================================================================*/
    127 /**
    128  * @name RPC_SKEL_FillBufferDone()
    129  * @brief Skeleton for OMX_AllocateBuffer()
    130  * @param size   : Size of the incoming RCM message (parameter used in the RCM alloc call)
    131  * @param *data  : Pointer to the RCM message/buffer received
    132  * @return RPC_OMX_ErrorNone = Successful
    133  * @sa TBD
    134  *
    135  */
    136 /* ===========================================================================*/
    137 RPC_OMX_ERRORTYPE RPC_SKEL_FillBufferDone(void *data)
    138 {
    139 
    140 	OMX_HANDLETYPE hComp;
    141 	RPC_OMX_ERRORTYPE tRPCError = RPC_OMX_ErrorNone;
    142 	OMX_U32 nfilledLen = 0;
    143 	OMX_U32 nOffset = 0;
    144 	OMX_U32 nFlags = 0;
    145 	OMX_TICKS nTimeStamp;
    146 	OMX_U32 bufferHdr;
    147 	OMX_COMPONENTTYPE *pHandle = NULL;
    148 	PROXY_COMPONENT_PRIVATE *pCompPrv = NULL;
    149 	OMX_U32 nPos = 0;
    150 	//RPC_OMX_MESSAGE *recdMsg;
    151 	OMX_U8 *pMsgBody = NULL;
    152 	OMX_HANDLETYPE hMarkTargetComponent = NULL;
    153 	OMX_PTR pMarkData = NULL;
    154 	//recdMsg = (RPC_OMX_MESSAGE *) (data);
    155 
    156 	pMsgBody = data;	//&recdMsg->msgBody[0];
    157 
    158 	DOMX_ENTER("");
    159 
    160 	//Marshalled:[>hComp|>bufferHdr|>nFilledLen|>nOffset|>nFlags|>nTimeStamp]
    161 
    162 	RPC_GETFIELDVALUE(pMsgBody, nPos, hComp, OMX_HANDLETYPE);
    163 	pHandle = (OMX_COMPONENTTYPE *) hComp;
    164 	pCompPrv = (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
    165 
    166 	RPC_GETFIELDVALUE(pMsgBody, nPos, bufferHdr, OMX_U32);
    167 	RPC_GETFIELDVALUE(pMsgBody, nPos, nfilledLen, OMX_U32);
    168 	RPC_GETFIELDVALUE(pMsgBody, nPos, nOffset, OMX_U32);
    169 	RPC_GETFIELDVALUE(pMsgBody, nPos, nFlags, OMX_U32);
    170 	RPC_GETFIELDVALUE(pMsgBody, nPos, nTimeStamp, OMX_TICKS);
    171 	RPC_GETFIELDVALUE(pMsgBody, nPos, hMarkTargetComponent,
    172 	    OMX_HANDLETYPE);
    173 	RPC_GETFIELDVALUE(pMsgBody, nPos, pMarkData, OMX_PTR);
    174 
    175 	tRPCError =
    176 	    pCompPrv->proxyFillBufferDone(hComp, bufferHdr, nfilledLen,
    177 	    nOffset, nFlags, nTimeStamp, hMarkTargetComponent, pMarkData);
    178 
    179 	DOMX_EXIT("");
    180 	return tRPCError;
    181 }
    182 
    183 
    184 
    185 /* ===========================================================================*/
    186 /**
    187  * @name RPC_SKEL_EventHandler()
    188  * @brief Skeleton for OMX_AllocateBuffer()
    189  * @param size   : Size of the incoming RCM message (parameter used in the RCM alloc call)
    190  * @param *data  : Pointer to the RCM message/buffer received
    191  * @return RPC_OMX_ErrorNone = Successful
    192  * @sa TBD
    193  *
    194  */
    195 /* ===========================================================================*/
    196 RPC_OMX_ERRORTYPE RPC_SKEL_EventHandler(void *data)
    197 {
    198 	OMX_HANDLETYPE hComp;
    199 	RPC_OMX_ERRORTYPE tRPCError = RPC_OMX_ErrorNone;
    200 	OMX_COMPONENTTYPE *pHandle = NULL;
    201 	PROXY_COMPONENT_PRIVATE *pCompPrv = NULL;
    202 	OMX_EVENTTYPE eEvent;
    203 	OMX_U32 nData1;
    204 	OMX_U32 nData2;
    205 	OMX_PTR pEventData;
    206 	OMX_U32 nPos = 0;
    207 	//RPC_OMX_MESSAGE *recdMsg;
    208 	OMX_U8 *pMsgBody = NULL;
    209 	//recdMsg = (RPC_OMX_MESSAGE *) (data);
    210 	pMsgBody = data;	//&recdMsg->msgBody[0];
    211 
    212 	DOMX_ENTER("");
    213 
    214 	//Marshalled:[>hComp|>eEvent|>nData1|>nData2|>pEventData]
    215 
    216 	RPC_GETFIELDVALUE(pMsgBody, nPos, hComp, OMX_HANDLETYPE);
    217 	pHandle = (OMX_COMPONENTTYPE *) hComp;
    218 	pCompPrv = (PROXY_COMPONENT_PRIVATE *) pHandle->pComponentPrivate;
    219 
    220 	RPC_GETFIELDVALUE(pMsgBody, nPos, eEvent, OMX_EVENTTYPE);
    221 	RPC_GETFIELDVALUE(pMsgBody, nPos, nData1, OMX_U32);
    222 	RPC_GETFIELDVALUE(pMsgBody, nPos, nData2, OMX_U32);
    223 	RPC_GETFIELDVALUE(pMsgBody, nPos, pEventData, OMX_PTR);
    224 
    225 	DOMX_DEBUG
    226 	    ("\n**__**Got eventhandler from Remote Core succesffuly - values are : **__**");
    227 	DOMX_DEBUG
    228 	    ("hComp :0x%x,eEvent: 0x%x,nData1: 0x%x,nData2: 0x%x,pEventData: 0x%x",
    229 	    hComp, eEvent, nData1, nData2, pEventData);
    230 	DOMX_DEBUG("Just Before Entering Proxy Event handler call");
    231 
    232 	tRPCError =
    233 	    pCompPrv->proxyEventHandler(hComp, pCompPrv->pILAppData, eEvent,
    234 	    nData1, nData2, pEventData);
    235 
    236 	DOMX_EXIT("");
    237 	return tRPCError;
    238 
    239 }
    240 
    241 /* ===========================================================================*/
    242 /**
    243  * @name EMPTY-SKEL
    244  * @brief
    245  * @param
    246  * @return
    247  *
    248  */
    249 /* ===========================================================================*/
    250 RPC_OMX_ERRORTYPE RPC_SKEL_GetHandle(uint32_t size, uint32_t * data)
    251 {
    252 	return RPC_OMX_ErrorNone;
    253 }
    254 
    255 RPC_OMX_ERRORTYPE RPC_SKEL_SetParameter(uint32_t size, uint32_t * data)
    256 {
    257 	return RPC_OMX_ErrorNone;
    258 }
    259 
    260 RPC_OMX_ERRORTYPE RPC_SKEL_GetParameter(uint32_t size, uint32_t * data)
    261 {
    262 	return RPC_OMX_ErrorNone;
    263 }
    264 
    265 RPC_OMX_ERRORTYPE RPC_SKEL_FreeHandle(uint32_t size, uint32_t * data)
    266 {
    267 	return RPC_OMX_ErrorNone;
    268 }
    269 
    270 RPC_OMX_ERRORTYPE RPC_SKEL_EmptyThisBuffer(uint32_t size, uint32_t * data)
    271 {
    272 	return RPC_OMX_ErrorNone;
    273 }
    274 
    275 RPC_OMX_ERRORTYPE RPC_SKEL_FillThisBuffer(uint32_t size, uint32_t * data)
    276 {
    277 	return RPC_OMX_ErrorNone;
    278 }
    279 
    280 RPC_OMX_ERRORTYPE RPC_SKEL_UseBuffer(uint32_t size, uint32_t * data)
    281 {
    282 	return RPC_OMX_ErrorNone;
    283 }
    284 
    285 RPC_OMX_ERRORTYPE RPC_SKEL_FreeBuffer(uint32_t size, uint32_t * data)
    286 {
    287 	return RPC_OMX_ErrorNone;
    288 }
    289 
    290 RPC_OMX_ERRORTYPE RPC_SKEL_SetConfig(uint32_t size, uint32_t * data)
    291 {
    292 	return RPC_OMX_ErrorNone;
    293 }
    294 
    295 RPC_OMX_ERRORTYPE RPC_SKEL_GetConfig(uint32_t size, uint32_t * data)
    296 {
    297 	return RPC_OMX_ErrorNone;
    298 }
    299 
    300 RPC_OMX_ERRORTYPE RPC_SKEL_GetState(uint32_t size, uint32_t * data)
    301 {
    302 	return RPC_OMX_ErrorNone;
    303 }
    304 
    305 RPC_OMX_ERRORTYPE RPC_SKEL_SendCommand(uint32_t size, uint32_t * data)
    306 {
    307 	return RPC_OMX_ErrorNone;
    308 }
    309 
    310 RPC_OMX_ERRORTYPE RPC_SKEL_GetComponentVersion(uint32_t size, uint32_t * data)
    311 {
    312 	return RPC_OMX_ErrorNone;
    313 }
    314 
    315 RPC_OMX_ERRORTYPE RPC_SKEL_GetExtensionIndex(uint32_t size, uint32_t * data)
    316 {
    317 	return RPC_OMX_ErrorNone;
    318 }
    319 
    320 RPC_OMX_ERRORTYPE RPC_SKEL_AllocateBuffer(uint32_t size, uint32_t * data)
    321 {
    322 	return RPC_OMX_ErrorNone;
    323 }
    324 
    325 RPC_OMX_ERRORTYPE RPC_SKEL_ComponentTunnelRequest(uint32_t size,
    326     uint32_t * data)
    327 {
    328 	return RPC_OMX_ErrorNone;
    329 }
    330