Home | History | Annotate | Download | only in inc
      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_internal.h
     35  *         This file contains methods that provides the functionality for
     36  *         the OpenMAX1.1 DOMX Framework RPC.
     37  *
     38  *  @path \WTSD_DucatiMMSW\framework\domx\omx_rpc\inc
     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 #ifndef OMXRPC_INTERNAL_H
     53 #define OMXRPC_INTERNAL_H
     54 
     55 #ifdef __cplusplus
     56 extern "C"
     57 {
     58 #endif				/* __cplusplus */
     59 
     60 /******************************************************************
     61  *   INCLUDE FILES
     62  ******************************************************************/
     63 /* ----- system and platform files ----------------------------*/
     64 #include <pthread.h>
     65 
     66 #include <OMX_Component.h>
     67 #include <OMX_Core.h>
     68 #include <OMX_Audio.h>
     69 #include <OMX_Video.h>
     70 #include <OMX_Types.h>
     71 #include <OMX_Index.h>
     72 #include <OMX_TI_Index.h>
     73 #include <OMX_TI_Common.h>
     74 
     75 /*-------program files ----------------------------------------*/
     76 #include "omx_rpc.h"
     77 
     78 
     79 /******************************************************************
     80  *   DEFINES - CONSTANTS
     81  ******************************************************************/
     82 /* *********************** OMX RPC DEFINES***********************************/
     83 
     84 /*This defines the maximum number of remote functions that can be registered*/
     85 #define RPC_OMX_MAX_FUNCTION_LIST 21
     86 /*Packet size for each message*/
     87 #define RPC_PACKET_SIZE 0xF0
     88 
     89 
     90 
     91 /*******************************************************************************
     92 * Enumerated Types
     93 *******************************************************************************/
     94 
     95 	typedef enum OMX_RPC_CORE_TYPE
     96 	{
     97 		OMX_RPC_CORE_TESLA = 0,
     98 		OMX_RPC_CORE_APPM3 = 1,
     99 		OMX_RPC_CORE_SYSM3 = 2,
    100 		RPC_CORE_CHIRON = 3,
    101 		OMX_RPC_CORE_MAX = 4
    102 	} OMX_RPC_CORE_TYPE;
    103 
    104 
    105 
    106 /*===============================================================*/
    107 /** RPC_OMX_FXN_IDX_TYPE   : A unique function index for each OMX function
    108  */
    109 /*===============================================================*/
    110 	typedef enum RPC_OMX_FXN_IDX_TYPE
    111 	{
    112 
    113 		RPC_OMX_FXN_IDX_GET_HANDLE = 0,
    114 		RPC_OMX_FXN_IDX_SET_PARAMETER = 1,
    115 		RPC_OMX_FXN_IDX_GET_PARAMETER = 2,
    116 		RPC_OMX_FXN_IDX_USE_BUFFER = 3,
    117 		RPC_OMX_FXN_IDX_FREE_HANDLE = 4,
    118 		RPC_OMX_FXN_IDX_SET_CONFIG = 5,
    119 		RPC_OMX_FXN_IDX_GET_CONFIG = 6,
    120 		RPC_OMX_FXN_IDX_GET_STATE = 7,
    121 		RPC_OMX_FXN_IDX_SEND_CMD = 8,
    122 		RPC_OMX_FXN_IDX_GET_VERSION = 9,
    123 		RPC_OMX_FXN_IDX_GET_EXT_INDEX = 10,
    124 		RPC_OMX_FXN_IDX_FILLTHISBUFFER = 11,
    125 		RPC_OMX_FXN_IDX_FILLBUFFERDONE = 12,
    126 		RPC_OMX_FXN_IDX_FREE_BUFFER = 13,
    127 		RPC_OMX_FXN_IDX_EMPTYTHISBUFFER = 14,
    128 		RPC_OMX_FXN_IDX_EMPTYBUFFERDONE = 15,
    129 		RPC_OMX_FXN_IDX_EVENTHANDLER = 16,
    130 		RPC_OMX_FXN_IDX_ALLOCATE_BUFFER = 17,
    131 		RPC_OMX_FXN_IDX_COMP_TUNNEL_REQUEST = 18,
    132 		RPC_OMX_FXN_IDX_MAX = RPC_OMX_MAX_FUNCTION_LIST
    133 	} RPC_OMX_FXN_IDX_TYPE;
    134 
    135 
    136 
    137 /*===============================================================*/
    138 /** RPC_OMX_MAP_INFO_TYPE   : Tells the no. of buffers that the kernel has to
    139                               map to remote core.
    140  */
    141 /*===============================================================*/
    142 	typedef enum RPC_OMX_MAP_INFO_TYPE
    143 	{
    144 		RPC_OMX_MAP_INFO_NONE = 0,
    145 		RPC_OMX_MAP_INFO_ONE_BUF = 1,
    146 		RPC_OMX_MAP_INFO_TWO_BUF = 2,
    147 		RPC_OMX_MAP_INFO_THREE_BUF = 3,
    148 		RPC_OMX_MAP_INFO_MAX = 0x7FFFFFFF
    149 	} RPC_OMX_MAP_INFO_TYPE;
    150 
    151 
    152 
    153 /*******************************************************************************
    154 * STRUCTURES
    155 *******************************************************************************/
    156 
    157 /*===============================================================*/
    158 /** RPC_OMX_CONTEXT                 : RPC context structure
    159  *
    160  *  @ param fd_omx                  : File descriptor corresponding to this
    161  *                                    instance on remote core.
    162  *  @ param fd_killcb               : File descriptor used to shut down the
    163  *                                    callback thread.
    164  *  @ param cbThread                : Callback thread.
    165  *  @ param pMsgPipe                : Array of message pipes. One for each OMX
    166  *                                    function. Used to post and receive the
    167  *                                    return messages of each function.
    168  *  @ param hRemoteHandle           : Handle to the context structure on the
    169  *                                    remote core.
    170  *  @ param hActualRemoteCompHandle : Actual component handle on remote core.
    171  *  @ param pAppData                : App data of RPC caller
    172  *
    173  */
    174 /*===============================================================*/
    175 	typedef struct RPC_OMX_CONTEXT
    176 	{
    177 		OMX_S32 fd_omx;
    178 		OMX_S32 fd_killcb;
    179 		pthread_t cbThread;
    180 		OMX_PTR pMsgPipe[RPC_OMX_MAX_FUNCTION_LIST];
    181 		OMX_HANDLETYPE hRemoteHandle;
    182 		OMX_HANDLETYPE hActualRemoteCompHandle;
    183 		OMX_PTR pAppData;
    184 	} RPC_OMX_CONTEXT;
    185 
    186 #ifdef __cplusplus
    187 }
    188 #endif
    189 #endif
    190