| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 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 are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | // OpenMAX IL Component Service definitions |
| 29 | |
| 30 | #ifndef VC_ILCS_DEFS_H |
| 31 | #define VC_ILCS_DEFS_H |
| 32 | |
| 33 | #define VC_ILCS_VERSION 1 |
| 34 | |
| 35 | #ifdef USE_VCHIQ_ARM |
| 36 | #include "interface/vchiq_arm/vchiq.h" |
| 37 | #else |
| 38 | #include "interface/vchiq/vchiq.h" |
| 39 | #endif |
| 40 | |
| 41 | typedef enum { |
| 42 | IL_RESPONSE, |
| 43 | IL_CREATE_COMPONENT, |
| 44 | |
| 45 | IL_GET_COMPONENT_VERSION, |
| 46 | IL_SEND_COMMAND, |
| 47 | IL_GET_PARAMETER, |
| 48 | IL_SET_PARAMETER, |
| 49 | IL_GET_CONFIG, |
| 50 | IL_SET_CONFIG, |
| 51 | IL_GET_EXTENSION_INDEX, |
| 52 | IL_GET_STATE, |
| 53 | IL_COMPONENT_TUNNEL_REQUEST, |
| 54 | IL_USE_BUFFER, |
| 55 | IL_USE_EGL_IMAGE, |
| 56 | IL_ALLOCATE_BUFFER, |
| 57 | IL_FREE_BUFFER, |
| 58 | IL_EMPTY_THIS_BUFFER, |
| 59 | IL_FILL_THIS_BUFFER, |
| 60 | IL_SET_CALLBACKS, |
| 61 | IL_COMPONENT_ROLE_ENUM, |
| 62 | |
| 63 | IL_COMPONENT_DEINIT, |
| 64 | |
| 65 | IL_EVENT_HANDLER, |
| 66 | IL_EMPTY_BUFFER_DONE, |
| 67 | IL_FILL_BUFFER_DONE, |
| 68 | |
| 69 | IL_COMPONENT_NAME_ENUM, |
| 70 | IL_GET_DEBUG_INFORMATION, |
| 71 | |
| 72 | IL_SERVICE_QUIT, |
| 73 | IL_FUNCTION_MAX_NUM, |
| 74 | IL_FUNCTION_MAX = 0x7fffffff |
| 75 | } IL_FUNCTION_T; |
| 76 | |
| 77 | |
| 78 | // size of the largest structure passed by get/set |
| 79 | // parameter/config |
| 80 | // this should be calculated at compile time from IL headers |
| 81 | // must be a multiple of VC_INTERFACE_BLOCK_SIZE |
| 82 | #define VC_ILCS_MAX_PARAM_SIZE 288 |
| 83 | |
| 84 | // size of the largest structure below |
| 85 | #define VC_ILCS_MAX_CMD_LENGTH (sizeof(IL_GET_EXECUTE_T)) |
| 86 | |
| 87 | #define VC_ILCS_MAX_INLINE (VCHIQ_SLOT_SIZE-8-16) |
| 88 | |
| 89 | // all structures should be padded to be multiples of |
| 90 | // VC_INTERFACE_BLOCK_SIZE in length (currently 16) |
| 91 | typedef struct { |
| 92 | void *reference; |
| 93 | } ; |
| 94 | |
| 95 | typedef struct { |
| 96 | IL_FUNCTION_T func; |
| 97 | OMX_ERRORTYPE err; |
| 98 | } ; |
| 99 | |
| 100 | // create instance |
| 101 | typedef struct { |
| 102 | OMX_PTR mark; |
| 103 | char name[256]; |
| 104 | } IL_CREATE_COMPONENT_EXECUTE_T; |
| 105 | |
| 106 | typedef struct { |
| 107 | IL_FUNCTION_T func; |
| 108 | OMX_ERRORTYPE err; |
| 109 | void *reference; |
| 110 | OMX_U32 numPorts; |
| 111 | OMX_U32 portDir; |
| 112 | OMX_U32 portIndex[32]; |
| 113 | } IL_CREATE_COMPONENT_RESPONSE_T; |
| 114 | |
| 115 | // set callbacks |
| 116 | typedef struct { |
| 117 | void *reference; |
| 118 | void *pAppData; |
| 119 | } IL_SET_CALLBACKS_EXECUTE_T; |
| 120 | |
| 121 | // get state |
| 122 | typedef struct { |
| 123 | IL_FUNCTION_T func; |
| 124 | OMX_ERRORTYPE err; |
| 125 | OMX_STATETYPE state; |
| 126 | } IL_GET_STATE_RESPONSE_T; |
| 127 | |
| 128 | // get parameter & get config |
| 129 | #define 8 |
| 130 | typedef struct { |
| 131 | void *reference; |
| 132 | OMX_INDEXTYPE index; |
| 133 | unsigned char param[VC_ILCS_MAX_PARAM_SIZE]; |
| 134 | } IL_GET_EXECUTE_T; |
| 135 | |
| 136 | #define 8 |
| 137 | typedef struct { |
| 138 | IL_FUNCTION_T func; |
| 139 | OMX_ERRORTYPE err; |
| 140 | unsigned char param[VC_ILCS_MAX_PARAM_SIZE]; |
| 141 | } IL_GET_RESPONSE_T; |
| 142 | |
| 143 | // set parameter & set config |
| 144 | #define 8 |
| 145 | typedef struct { |
| 146 | void *reference; |
| 147 | OMX_INDEXTYPE index; |
| 148 | unsigned char param[VC_ILCS_MAX_PARAM_SIZE]; |
| 149 | } IL_SET_EXECUTE_T; |
| 150 | |
| 151 | // send command |
| 152 | typedef struct { |
| 153 | void *reference; |
| 154 | OMX_COMMANDTYPE cmd; |
| 155 | OMX_U32 param; |
| 156 | OMX_MARKTYPE mark; |
| 157 | } IL_SEND_COMMAND_EXECUTE_T; |
| 158 | |
| 159 | // event handler callback |
| 160 | typedef struct { |
| 161 | void *reference; |
| 162 | OMX_EVENTTYPE event; |
| 163 | OMX_U32 data1; |
| 164 | OMX_U32 data2; |
| 165 | OMX_PTR eventdata; |
| 166 | } IL_EVENT_HANDLER_EXECUTE_T; |
| 167 | |
| 168 | // use/allocate buffer |
| 169 | typedef struct { |
| 170 | void *reference; |
| 171 | OMX_PTR bufferReference; |
| 172 | OMX_U32 port; |
| 173 | OMX_U32 size; |
| 174 | void *eglImage; |
| 175 | } IL_ADD_BUFFER_EXECUTE_T; |
| 176 | |
| 177 | typedef struct { |
| 178 | IL_FUNCTION_T func; |
| 179 | OMX_ERRORTYPE err; |
| 180 | OMX_PTR reference; |
| 181 | OMX_BUFFERHEADERTYPE ; |
| 182 | } IL_ADD_BUFFER_RESPONSE_T; |
| 183 | |
| 184 | // free buffer |
| 185 | typedef struct { |
| 186 | void *reference; |
| 187 | OMX_U32 port; |
| 188 | OMX_PTR bufferReference; |
| 189 | IL_FUNCTION_T func; |
| 190 | OMX_PTR inputPrivate; |
| 191 | OMX_PTR outputPrivate; |
| 192 | } IL_FREE_BUFFER_EXECUTE_T; |
| 193 | |
| 194 | // empty/fill this buffer |
| 195 | typedef enum { |
| 196 | IL_BUFFER_NONE, |
| 197 | IL_BUFFER_BULK, |
| 198 | IL_BUFFER_INLINE, |
| 199 | IL_BUFFER_MAX = 0x7fffffff |
| 200 | } IL_BUFFER_METHOD_T; |
| 201 | |
| 202 | #define IL_BUFFER_BULK_UNALIGNED_MAX (32) // This value needs to be the same on voth VC and HOST. |
| 203 | // Here, we just manually set it to the max of VCHI_BULK_ALIGN on VC and HOST. |
| 204 | #if ( VCHI_BULK_ALIGN > IL_BUFFER_BULK_UNALIGNED_MAX ) |
| 205 | #error "VCHI_BULK_ALIGN > IL_BUFFER_BULK_UNALIGNED_MAX. Just set max higher on both VC and HOST so there's space to put the unaligned bytes." |
| 206 | #endif |
| 207 | typedef struct { |
| 208 | OMX_U8 [IL_BUFFER_BULK_UNALIGNED_MAX-1]; |
| 209 | OMX_U8 ; |
| 210 | OMX_U8 trailer[IL_BUFFER_BULK_UNALIGNED_MAX-1]; |
| 211 | OMX_U8 trailerlen; |
| 212 | } IL_BUFFER_BULK_T; |
| 213 | |
| 214 | typedef struct { |
| 215 | OMX_U8 buffer[1]; |
| 216 | } IL_BUFFER_INLINE_T; |
| 217 | |
| 218 | typedef struct { |
| 219 | void *reference; |
| 220 | OMX_BUFFERHEADERTYPE ; |
| 221 | IL_BUFFER_METHOD_T method; |
| 222 | OMX_U32 bufferLen; |
| 223 | } IL_PASS_BUFFER_EXECUTE_T; |
| 224 | |
| 225 | // get component version |
| 226 | typedef struct { |
| 227 | IL_FUNCTION_T func; |
| 228 | OMX_ERRORTYPE err; |
| 229 | char name[128]; |
| 230 | OMX_VERSIONTYPE component_version; |
| 231 | OMX_VERSIONTYPE spec_version; |
| 232 | OMX_UUIDTYPE uuid; |
| 233 | } IL_GET_VERSION_RESPONSE_T; |
| 234 | |
| 235 | // get extension index |
| 236 | typedef struct { |
| 237 | void *reference; |
| 238 | char name[128]; |
| 239 | } IL_GET_EXTENSION_EXECUTE_T; |
| 240 | |
| 241 | typedef struct { |
| 242 | IL_FUNCTION_T func; |
| 243 | OMX_ERRORTYPE err; |
| 244 | OMX_INDEXTYPE index; |
| 245 | } IL_GET_EXTENSION_RESPONSE_T; |
| 246 | |
| 247 | // component role enum |
| 248 | typedef struct { |
| 249 | void *reference; |
| 250 | OMX_U32 index; |
| 251 | } IL_COMPONENT_ROLE_ENUM_EXECUTE_T; |
| 252 | |
| 253 | typedef struct { |
| 254 | IL_FUNCTION_T func; |
| 255 | OMX_ERRORTYPE err; |
| 256 | OMX_U8 role[128]; |
| 257 | } IL_COMPONENT_ROLE_ENUM_RESPONSE_T; |
| 258 | |
| 259 | typedef struct { |
| 260 | void *reference; |
| 261 | OMX_U32 port; |
| 262 | OMX_PTR tunnel_ref; // reference to use in requests - address of host/vc component |
| 263 | OMX_BOOL tunnel_host; // whether tunnel_ref is a host component |
| 264 | OMX_U32 tunnel_port; |
| 265 | OMX_TUNNELSETUPTYPE setup; |
| 266 | } IL_TUNNEL_REQUEST_EXECUTE_T; |
| 267 | |
| 268 | typedef struct { |
| 269 | IL_FUNCTION_T func; |
| 270 | OMX_ERRORTYPE err; |
| 271 | OMX_TUNNELSETUPTYPE setup; |
| 272 | } IL_TUNNEL_REQUEST_RESPONSE_T; |
| 273 | |
| 274 | typedef struct { |
| 275 | int index; |
| 276 | } IL_COMPONENT_NAME_ENUM_EXECUTE_T; |
| 277 | |
| 278 | typedef struct { |
| 279 | IL_FUNCTION_T func; |
| 280 | OMX_ERRORTYPE err; |
| 281 | OMX_U8 name[128]; |
| 282 | } IL_COMPONENT_NAME_ENUM_RESPONSE_T; |
| 283 | |
| 284 | typedef struct { |
| 285 | OMX_S32 len; |
| 286 | } IL_GET_DEBUG_INFORMATION_EXECUTE_T; |
| 287 | |
| 288 | #endif // VC_ILCS_DEFS_H |
| 289 | |