1 /* 2 * Copyright (c) 2013-2017, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file mos_defs_specific.h 24 //! \brief Defines common types and macros across different platform on Linux 25 //! \details Defines common types and macros across different platform on Linux 26 //! 27 #ifndef __MOS_DEFS_SPECIFIC_H__ 28 #define __MOS_DEFS_SPECIFIC_H__ 29 30 #include <pthread.h> 31 #include <semaphore.h> 32 #include <string> 33 34 typedef pthread_mutex_t MOS_MUTEX, *PMOS_MUTEX; //!< mutex pointer 35 typedef sem_t MOS_SEMAPHORE, *PMOS_SEMAPHORE; //!< semaphore pointer 36 typedef pthread_t MOS_THREADHANDLE; //!< thread handle 37 typedef uint32_t UFKEY, *PUFKEY; //!< Handle of user feature key 38 typedef std::string UFKEY_NEXT, *PUFKEY_NEXT; 39 40 #define _T(x) x 41 #define MAX_PATH 128 42 43 #include <va/va.h> // For VAStatus 44 typedef VAStatus MOS_OSRESULT; 45 #include <stdarg.h> 46 #define MOS_FUNC_EXPORT __attribute__((visibility("default"))) 47 #define MOS_DATA_EXPORT __attribute__((visibility("default"))) 48 #define MOS_FUNC_PRIVATE __attribute__((visibility("hidden"))) 49 #define MOS_DATA_PRIVATE __attribute__((visibility("hidden"))) 50 #define MOS_EXPORT_DECL 51 52 #ifndef __UFO_PORTABLE_DATATYPE_DEFINED__ 53 typedef struct tagRECT 54 { 55 int32_t left; 56 int32_t top; 57 int32_t right; 58 int32_t bottom; 59 } RECT, *PRECT, *LPRECT; 60 61 typedef union _LARGE_INTEGER { 62 struct { 63 uint32_t LowPart; 64 int32_t HighPart; 65 } DUMMYSTRUCTNAME; 66 struct { 67 uint32_t LowPart; 68 int32_t HighPart; 69 } u; 70 int64_t QuadPart; 71 } LARGE_INTEGER, *PLARGE_INTEGER; 72 73 typedef void* HANDLE; //!< Opaque handle comprehended only by the OS 74 typedef void** PHANDLE; //!< Opaque handle comprehended only by the OS 75 typedef void* HMODULE; //!< Opaque handle comprehended only by the OS 76 77 typedef uint32_t TP_WAIT_RESULT; 78 typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT; 79 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; 80 81 #define INFINITE 0xFFFFFFFF 82 83 #endif 84 85 /* compile-time ASSERT */ 86 87 #ifndef C_ASSERT 88 #define __CONCATING( a1, a2 ) a1 ## a2 89 #define __UNIQUENAME( a1, a2 ) __CONCATING( a1, a2 ) 90 #define UNIQUENAME( __text ) __UNIQUENAME( __text, __COUNTER__ ) 91 #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1] 92 #endif 93 94 #if __GNUC__ < 4 95 #error "Unsupported GCC version. Please use 4.0+" 96 #endif 97 98 #define __noop 99 #if defined __x86_64__ 100 #define __stdcall // deprecated for x86-64 101 #define __cdecl // deprecated for x86-64 102 #else 103 #define __cdecl __attribute__((__cdecl__)) 104 #define __stdcall __attribute__((__stdcall__)) 105 #endif 106 107 #define __declspec(x) __declspec_##x 108 109 #define __MEDIA_PORTABLE_DATAYPE_DEFINED__ 110 111 #define _stprintf sprintf 112 #define _sntprintf snprintf 113 114 #define vsprintf_s(pBuffer, size, format, arg) vsnprintf(pBuffer, size, format, arg) 115 #define sprintf_s(pBuffer, size, format, ...) snprintf(pBuffer, size, format, ##__VA_ARGS__) 116 117 enum SYNC_HAZARD 118 { 119 SYNC_RAW_HAZARD, 120 SYNC_WAR_HAZARD, 121 SYNC_WAW_HAZARD 122 }; 123 124 #endif // __MOS_DEFS_SPECIFIC_H__ 125