1b3a6c5adSopenharmony_ci/* 2b3a6c5adSopenharmony_ci * Copyright (c) 2011 The Khronos Group Inc. 3b3a6c5adSopenharmony_ci * 4b3a6c5adSopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining 5b3a6c5adSopenharmony_ci * a copy of this software and associated documentation files (the 6b3a6c5adSopenharmony_ci * "Software"), to deal in the Software without restriction, including 7b3a6c5adSopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 8b3a6c5adSopenharmony_ci * distribute, sublicense, and/or sell copies of the Software, and to 9b3a6c5adSopenharmony_ci * permit persons to whom the Software is furnished to do so, subject 10b3a6c5adSopenharmony_ci * to the following conditions: 11b3a6c5adSopenharmony_ci * The above copyright notice and this permission notice shall be included 12b3a6c5adSopenharmony_ci * in all copies or substantial portions of the Software. 13b3a6c5adSopenharmony_ci * 14b3a6c5adSopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15b3a6c5adSopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16b3a6c5adSopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17b3a6c5adSopenharmony_ci * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18b3a6c5adSopenharmony_ci * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19b3a6c5adSopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20b3a6c5adSopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21b3a6c5adSopenharmony_ci * 22b3a6c5adSopenharmony_ci*/ 23b3a6c5adSopenharmony_ci 24b3a6c5adSopenharmony_ci#ifndef CPA_ContentPipe_h 25b3a6c5adSopenharmony_ci#define CPA_ContentPipe_h 26b3a6c5adSopenharmony_ci 27b3a6c5adSopenharmony_ci#ifdef __cplusplus 28b3a6c5adSopenharmony_ciextern "C" { 29b3a6c5adSopenharmony_ci#endif /* __cplusplus 30b3a6c5adSopenharmony_ci /** CPA_IN is used to identify inputs to an CP function. This designation 31b3a6c5adSopenharmony_ci will also be used in the case of a pointer that points 32b3a6c5adSopenharmony_ci to a parameter that is used as an input. */ 33b3a6c5adSopenharmony_ci#ifndef CPA_IN 34b3a6c5adSopenharmony_ci#define CPA_IN 35b3a6c5adSopenharmony_ci#endif 36b3a6c5adSopenharmony_ci 37b3a6c5adSopenharmony_ci/** CPA_OUT is used to identify outputs from an CP function. This designation 38b3a6c5adSopenharmony_ci will also be used in the case of a pointer that points to a parameter 39b3a6c5adSopenharmony_ci that is used as an output. */ 40b3a6c5adSopenharmony_ci#ifndef CPA_OUT 41b3a6c5adSopenharmony_ci#define CPA_OUT 42b3a6c5adSopenharmony_ci#endif 43b3a6c5adSopenharmony_ci 44b3a6c5adSopenharmony_ci 45b3a6c5adSopenharmony_ci/** CPA_INOUT is used to identify parameters that may be either inputs or 46b3a6c5adSopenharmony_ci outputs from an CP function at the same time. This designation will 47b3a6c5adSopenharmony_ci also be used in the case of a pointer that points to a parameter that 48b3a6c5adSopenharmony_ci is used both as an input and an output. */ 49b3a6c5adSopenharmony_ci#ifndef CPA_INOUT 50b3a6c5adSopenharmony_ci#define CPA_INOUT 51b3a6c5adSopenharmony_ci#endif 52b3a6c5adSopenharmony_ci 53b3a6c5adSopenharmony_citypedef enum CPA_BOOL { 54b3a6c5adSopenharmony_ci CPA_FALSE = 0, 55b3a6c5adSopenharmony_ci CPA_TRUE = !CPA_FALSE, 56b3a6c5adSopenharmony_ci CPA_BOOL_MAX = 0x7FFFFFFF 57b3a6c5adSopenharmony_ci} CPA_BOOL; 58b3a6c5adSopenharmony_ci 59b3a6c5adSopenharmony_citypedef void* CPA_PTR; 60b3a6c5adSopenharmony_ci 61b3a6c5adSopenharmony_citypedef char* CPA_STRING; 62b3a6c5adSopenharmony_ci 63b3a6c5adSopenharmony_citypedef unsigned char CPA_BYTE; 64b3a6c5adSopenharmony_ci 65b3a6c5adSopenharmony_citypedef void* CPA_INTERFACE; 66b3a6c5adSopenharmony_ci 67b3a6c5adSopenharmony_citypedef void* CPA_HANDLE; 68b3a6c5adSopenharmony_ci 69b3a6c5adSopenharmony_citypedef unsigned char CPA_U8; 70b3a6c5adSopenharmony_ci 71b3a6c5adSopenharmony_citypedef signed char CPA_S8; 72b3a6c5adSopenharmony_ci 73b3a6c5adSopenharmony_citypedef unsigned short CPA_U16; 74b3a6c5adSopenharmony_ci 75b3a6c5adSopenharmony_citypedef signed short CPA_S16; 76b3a6c5adSopenharmony_ci 77b3a6c5adSopenharmony_citypedef unsigned long CPA_U32; 78b3a6c5adSopenharmony_ci 79b3a6c5adSopenharmony_citypedef signed long CPA_S32; 80b3a6c5adSopenharmony_ci 81b3a6c5adSopenharmony_ci/* Users with compilers that cannot accept 64 bits arithmetic shall not 82b3a6c5adSopenharmony_ci define the CPA_64BITSSUPPORTED macro. It should be noted that this may cause 83b3a6c5adSopenharmony_ci some components to fail to compile if the component was written to require 84b3a6c5adSopenharmony_ci 64 bit integral types. However, these components would NOT compile anyway 85b3a6c5adSopenharmony_ci since the compiler does not support the way the component was written. 86b3a6c5adSopenharmony_ci*/ 87b3a6c5adSopenharmony_ci#ifdef CPA_64BITSSUPPORTED 88b3a6c5adSopenharmony_ci 89b3a6c5adSopenharmony_citypedef uint64_t CPA_U64; 90b3a6c5adSopenharmony_ci 91b3a6c5adSopenharmony_citypedef int64_t CPA_S64; 92b3a6c5adSopenharmony_ci 93b3a6c5adSopenharmony_ci#else /* unknown*/ 94b3a6c5adSopenharmony_ci 95b3a6c5adSopenharmony_citypedef unsigned long long CPA_U64; 96b3a6c5adSopenharmony_ci 97b3a6c5adSopenharmony_citypedef signed long long CPA_S64; 98b3a6c5adSopenharmony_ci 99b3a6c5adSopenharmony_ci#endif /* CPA_64BITSSUPPORTED */ 100b3a6c5adSopenharmony_ci 101b3a6c5adSopenharmony_citypedef enum CPA_RESULTTYPE{ 102b3a6c5adSopenharmony_ci CPA_OK, 103b3a6c5adSopenharmony_ci CPA_OKEOS, 104b3a6c5adSopenharmony_ci CPA_OKPOSITIONEXCEED2GB, 105b3a6c5adSopenharmony_ci CPA_EPOSNOTAVAIL, 106b3a6c5adSopenharmony_ci CPA_EUNKNOWN, 107b3a6c5adSopenharmony_ci CPA_EACCESS, 108b3a6c5adSopenharmony_ci CPA_EAGAIN, 109b3a6c5adSopenharmony_ci CPA_EALREADY, 110b3a6c5adSopenharmony_ci CPA_EBUSY, 111b3a6c5adSopenharmony_ci CPA_ECONNREFUSED, 112b3a6c5adSopenharmony_ci CPA_ECONNRESET, 113b3a6c5adSopenharmony_ci CPA_EEXIST, 114b3a6c5adSopenharmony_ci CPA_EFBIG, 115b3a6c5adSopenharmony_ci CPA_EINVAL, 116b3a6c5adSopenharmony_ci CPA_EIO, 117b3a6c5adSopenharmony_ci CPA_ENOENT, 118b3a6c5adSopenharmony_ci CPA_EURINOTSUPP, 119b3a6c5adSopenharmony_ci CPA_ENOMEM, 120b3a6c5adSopenharmony_ci CPA_ENOSPC, 121b3a6c5adSopenharmony_ci CPA_ENO_RECOVERY, 122b3a6c5adSopenharmony_ci CPA_EOPNOTSUPP, 123b3a6c5adSopenharmony_ci CPA_ETIMEDOUT, 124b3a6c5adSopenharmony_ci CPA_EVERSION, 125b3a6c5adSopenharmony_ci CPA_RESULTKhronosExtensions = 0x6F000000, /* Reserved region for introducing Khronos Standard Extensions */ 126b3a6c5adSopenharmony_ci CPA_RESULTVendorStartUnused = 0x7F000000, /* Reserved region for introducing Vendor Extensions */ 127b3a6c5adSopenharmony_ci CPA_RESULTMax = 0x7FFFFFFF 128b3a6c5adSopenharmony_ci} CPA_RESULTTYPE; 129b3a6c5adSopenharmony_ci 130b3a6c5adSopenharmony_ci#define CPA_POSITION_NA -1 131b3a6c5adSopenharmony_ci 132b3a6c5adSopenharmony_ci#ifdef CPA_64BITSSUPPORTED 133b3a6c5adSopenharmony_ci#define CPA_POSITION_32_MAX 0x000000007FFFFFFF 134b3a6c5adSopenharmony_citypedef CPA_S64 CPA_POSITIONTYPE; 135b3a6c5adSopenharmony_ci#else 136b3a6c5adSopenharmony_ci#define CPA_POSITION_32_MAX 0x7FFFFFFF 137b3a6c5adSopenharmony_citypedef CPA_S32 CPA_POSITIONTYPE; 138b3a6c5adSopenharmony_ci#endif 139b3a6c5adSopenharmony_ci 140b3a6c5adSopenharmony_citypedef union CPA_VERSIONTYPE 141b3a6c5adSopenharmony_ci{ 142b3a6c5adSopenharmony_ci struct 143b3a6c5adSopenharmony_ci { 144b3a6c5adSopenharmony_ci CPA_U8 nVersionMajor; 145b3a6c5adSopenharmony_ci CPA_U8 nVersionMinor; 146b3a6c5adSopenharmony_ci CPA_U8 nRevision; 147b3a6c5adSopenharmony_ci }; 148b3a6c5adSopenharmony_ci CPA_U32 nVersionID; 149b3a6c5adSopenharmony_ci} CPA_VERSIONTYPE; 150b3a6c5adSopenharmony_ci 151b3a6c5adSopenharmony_citypedef enum CPA_ORIGINTYPE { 152b3a6c5adSopenharmony_ci CPA_OriginBegin, 153b3a6c5adSopenharmony_ci CPA_OriginFirst, 154b3a6c5adSopenharmony_ci CPA_OriginCur, 155b3a6c5adSopenharmony_ci CPA_OriginLast, 156b3a6c5adSopenharmony_ci CPA_OriginEnd, 157b3a6c5adSopenharmony_ci CPA_OriginKhronosExtensions = 0x6F000000, /* Reserved region for introducing Khronos Standard Extensions */ 158b3a6c5adSopenharmony_ci CPA_OriginVendorStartUnused = 0x7F000000, /* Reserved region for introducing Vendor Extensions */ 159b3a6c5adSopenharmony_ci CPA_OriginMax = 0X7FFFFFFF 160b3a6c5adSopenharmony_ci} CPA_ORIGINTYPE; 161b3a6c5adSopenharmony_ci 162b3a6c5adSopenharmony_citypedef struct CPA_POSITIONINFOTYPE { 163b3a6c5adSopenharmony_ci CPA_POSITIONTYPE nDataBegin; 164b3a6c5adSopenharmony_ci CPA_POSITIONTYPE nDataFirst; 165b3a6c5adSopenharmony_ci CPA_POSITIONTYPE nDataCur; 166b3a6c5adSopenharmony_ci CPA_POSITIONTYPE nDataLast; 167b3a6c5adSopenharmony_ci CPA_POSITIONTYPE nDataEnd; 168b3a6c5adSopenharmony_ci} CPA_POSITIONINFOTYPE; 169b3a6c5adSopenharmony_ci 170b3a6c5adSopenharmony_citypedef enum CPA_ACCESSTYPE { 171b3a6c5adSopenharmony_ci CPA_AccessRead, 172b3a6c5adSopenharmony_ci CPA_AccessWrite, 173b3a6c5adSopenharmony_ci CPA_AccessReadWrite , 174b3a6c5adSopenharmony_ci CPA_AccessKhronosExtensions = 0x6F000000, /* Reserved region for introducing Khronos Standard Extensions */ 175b3a6c5adSopenharmony_ci CPA_AccessVendorStartUnused = 0x7F000000, /* Reserved region for introducing Vendor Extensions */ 176b3a6c5adSopenharmony_ci CPA_AccessMax = 0X7FFFFFFF 177b3a6c5adSopenharmony_ci} CPA_ACCESSTYPE; 178b3a6c5adSopenharmony_ci 179b3a6c5adSopenharmony_citypedef enum CPA_CHECKBYTESRESULTTYPE 180b3a6c5adSopenharmony_ci{ 181b3a6c5adSopenharmony_ci CPA_CheckBytesOk, 182b3a6c5adSopenharmony_ci CPA_CheckBytesNotReady, 183b3a6c5adSopenharmony_ci CPA_CheckBytesInsufficientBytes, 184b3a6c5adSopenharmony_ci CPA_CheckBytesTooLargeRequest, 185b3a6c5adSopenharmony_ci CPA_CheckBytesKhronosExtensions = 0x6F000000, /* Reserved region for introducing Khronos Standard Extensions */ 186b3a6c5adSopenharmony_ci CPA_CheckBytesVendorStartUnused = 0x7F000000, /* Reserved region for introducing Vendor Extensions */ 187b3a6c5adSopenharmony_ci CPA_CheckBytesMax = 0X7FFFFFFF 188b3a6c5adSopenharmony_ci} CPA_CHECKBYTESRESULTTYPE; 189b3a6c5adSopenharmony_ci 190b3a6c5adSopenharmony_citypedef enum CPA_EVENTTYPE{ 191b3a6c5adSopenharmony_ci CPA_EventBytesToReadAvailable, 192b3a6c5adSopenharmony_ci CPA_EventBytesToWriteAvailable, 193b3a6c5adSopenharmony_ci CPA_EventPipeDisconnected, 194b3a6c5adSopenharmony_ci CPA_EventEndOfStream, 195b3a6c5adSopenharmony_ci CPA_EventKhronosExtensions = 0x6F000000, /* Reserved region for introducing Khronos Standard Extensions. */ 196b3a6c5adSopenharmony_ci CPA_EventVendorStartUnused = 0x7F000000, /* Reserved region for introducing Vendor Extensions. */ 197b3a6c5adSopenharmony_ci CPA_EventMax = 0X7FFFFFFF 198b3a6c5adSopenharmony_ci} CPA_EVENTTYPE; 199b3a6c5adSopenharmony_ci 200b3a6c5adSopenharmony_citypedef CPA_RESULTTYPE (*CPA_CALLBACKTYPE)(CPA_HANDLE hPipe, CPA_EVENTTYPE eEvent, CPA_PTR ClientContext); 201b3a6c5adSopenharmony_ci 202b3a6c5adSopenharmony_ciCPA_RESULTTYPE CPA_GetContentPipe( CPA_OUT CPA_HANDLE *hPipe); 203b3a6c5adSopenharmony_ci 204b3a6c5adSopenharmony_citypedef struct CPA_PIPETYPE 205b3a6c5adSopenharmony_ci{ 206b3a6c5adSopenharmony_ci CPA_VERSIONTYPE nApiVersion; 207b3a6c5adSopenharmony_ci 208b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_ReleaseContentPipeType)( CPA_INOUT CPA_HANDLE *hPipe); 209b3a6c5adSopenharmony_ci 210b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_SetConfig)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent,CPA_IN CPA_STRING szKey, CPA_IN CPA_PTR value); 211b3a6c5adSopenharmony_ci 212b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_GetConfig)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent,CPA_IN CPA_STRING szKey, CPA_OUT CPA_PTR value); 213b3a6c5adSopenharmony_ci 214b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_Open)( CPA_IN CPA_HANDLE hPipe, CPA_OUT CPA_HANDLE *hContent, CPA_IN CPA_STRING szURI, CPA_IN CPA_ACCESSTYPE eAccess ); 215b3a6c5adSopenharmony_ci 216b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_Create)( CPA_IN CPA_HANDLE hPipe, CPA_OUT CPA_HANDLE *hContent, CPA_IN CPA_STRING szURI ); 217b3a6c5adSopenharmony_ci 218b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_Close)( CPA_IN CPA_HANDLE hPipe, CPA_INOUT CPA_HANDLE *hContent ); 219b3a6c5adSopenharmony_ci 220b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_CheckAvailableBytesToRead)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_IN CPA_U32 nBytesRequested, CPA_OUT CPA_CHECKBYTESRESULTTYPE* peResult ); 221b3a6c5adSopenharmony_ci 222b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_CheckAvailableBytesToWrite)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_IN CPA_U32 nBytesRequested, CPA_OUT CPA_CHECKBYTESRESULTTYPE* peResult ); 223b3a6c5adSopenharmony_ci 224b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_SetPosition)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_IN CPA_POSITIONTYPE nOffset, CPA_IN CPA_ORIGINTYPE eOrigin ); 225b3a6c5adSopenharmony_ci 226b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_GetPositions)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_OUT CPA_POSITIONINFOTYPE* pPosition ); 227b3a6c5adSopenharmony_ci 228b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_GetCurrentPosition)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_OUT CPA_POSITIONINFOTYPE* pPosition ); 229b3a6c5adSopenharmony_ci 230b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_Read)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_OUT CPA_BYTE* pData, CPA_INOUT CPA_U32* pSize ); 231b3a6c5adSopenharmony_ci 232b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_ReadBuffer)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_OUT CPA_BYTE** ppBuffer, CPA_INOUT CPA_U32* pSize, CPA_IN CPA_BOOL bForbidCopy ); 233b3a6c5adSopenharmony_ci 234b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_ReleaseReadBuffer)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_IN CPA_BYTE* pBuffer ); 235b3a6c5adSopenharmony_ci 236b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_Write)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_HANDLE hContent, CPA_IN CPA_BYTE *pData, CPA_INOUT CPA_U32* pSize ); 237b3a6c5adSopenharmony_ci 238b3a6c5adSopenharmony_ci CPA_RESULTTYPE (*CPA_RegisterCallback)( CPA_IN CPA_HANDLE hPipe, CPA_IN CPA_CALLBACKTYPE ClientCallback, CPA_IN CPA_PTR ClientContext ); 239b3a6c5adSopenharmony_ci 240b3a6c5adSopenharmony_ci} CPA_PIPETYPE; 241b3a6c5adSopenharmony_ci 242b3a6c5adSopenharmony_ci#define CP_GetApiVersion( hPipe ) \ 243b3a6c5adSopenharmony_ci ((CP_PIPETYPE*)hPipe)->nApiVersion 244b3a6c5adSopenharmony_ci 245b3a6c5adSopenharmony_ci#ifdef __cplusplus 246b3a6c5adSopenharmony_ci} 247b3a6c5adSopenharmony_ci#endif /* __cplusplus */ 248b3a6c5adSopenharmony_ci#endif /* CPA_ContentPipe_h */ 249