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 33 typedef pthread_mutex_t MOS_MUTEX, *PMOS_MUTEX; //!< mutex pointer 34 typedef sem_t MOS_SEMAPHORE, *PMOS_SEMAPHORE; //!< semaphore pointer 35 typedef pthread_t MOS_THREADHANDLE; //!< thread handle 36 typedef uint32_t UFKEY, *PUFKEY; //!< Handle of user feature key 37 38 #define _T(x) x 39 #define MAX_PATH 128 40 41 #include <va/va.h> // For VAStatus 42 typedef VAStatus MOS_OSRESULT; 43 #include <stdarg.h> 44 #define MOS_FUNC_EXPORT __attribute__((visibility("default"))) 45 #define MOS_DATA_EXPORT __attribute__((visibility("default"))) 46 #define MOS_FUNC_PRIVATE __attribute__((visibility("hidden"))) 47 #define MOS_DATA_PRIVATE __attribute__((visibility("hidden"))) 48 #define MOS_EXPORT_DECL 49 50 #ifndef __UFO_PORTABLE_DATATYPE_DEFINED__ 51 typedef struct tagRECT 52 { 53 int32_t left; 54 int32_t top; 55 int32_t right; 56 int32_t bottom; 57 } RECT, *PRECT, *LPRECT; 58 59 typedef union _LARGE_INTEGER { 60 struct { 61 uint32_t LowPart; 62 int32_t HighPart; 63 } DUMMYSTRUCTNAME; 64 struct { 65 uint32_t LowPart; 66 int32_t HighPart; 67 } u; 68 int64_t QuadPart; 69 } LARGE_INTEGER, *PLARGE_INTEGER; 70 71 typedef void* HANDLE; //!< Opaque handle comprehended only by the OS 72 typedef void** PHANDLE; //!< Opaque handle comprehended only by the OS 73 typedef void* HMODULE; //!< Opaque handle comprehended only by the OS 74 75 typedef uint32_t TP_WAIT_RESULT; 76 typedef struct _TP_WAIT TP_WAIT, *PTP_WAIT; 77 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; 78 79 #define INFINITE 0xFFFFFFFF 80 81 #endif 82 83 /* compile-time ASSERT */ 84 85 #ifndef C_ASSERT 86 #define __CONCATING( a1, a2 ) a1 ## a2 87 #define __UNIQUENAME( a1, a2 ) __CONCATING( a1, a2 ) 88 #define UNIQUENAME( __text ) __UNIQUENAME( __text, __COUNTER__ ) 89 #define C_ASSERT(e) typedef char UNIQUENAME(STATIC_ASSERT_)[(e)?1:-1] 90 #endif 91 92 #if __GNUC__ < 4 93 #error "Unsupported GCC version. Please use 4.0+" 94 #endif 95 96 #define __noop 97 #if defined __x86_64__ 98 #define __stdcall // deprecated for x86-64 99 #define __cdecl // deprecated for x86-64 100 #else 101 #define __cdecl __attribute__((__cdecl__)) 102 #define __stdcall __attribute__((__stdcall__)) 103 #endif 104 105 #define __declspec(x) __declspec_##x 106 107 #define __MEDIA_PORTABLE_DATAYPE_DEFINED__ 108 109 #define _stprintf sprintf 110 #define _sntprintf snprintf 111 112 #define vsprintf_s(pBuffer, size, format, arg) vsnprintf(pBuffer, size, format, arg) 113 #define sprintf_s(pBuffer, size, format, ...) snprintf(pBuffer, size, format, ##__VA_ARGS__) 114 115 enum SYNC_HAZARD 116 { 117 SYNC_RAW_HAZARD, 118 SYNC_WAR_HAZARD, 119 SYNC_WAW_HAZARD 120 }; 121 122 #endif // __MOS_DEFS_SPECIFIC_H__ 123