1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) 2020 Dmitry Kozlyuk 3 */ 4 5 #ifndef _RTE_WINDOWS_H_ 6 #define _RTE_WINDOWS_H_ 7 8 #ifdef __cplusplus 9 extern "C" { 10 #endif 11 12 /** 13 * @file Windows-specific facilities 14 * 15 * This file should be included by DPDK libraries and applications 16 * that need access to Windows API. It includes platform SDK headers 17 * in compatible order with proper options and defines error-handling macros. 18 */ 19 20 /* Disable excessive libraries. */ 21 #ifndef WIN32_LEAN_AND_MEAN 22 #define WIN32_LEAN_AND_MEAN 23 #endif 24 25 /* Override Windows SDK definition of _m_prefetchw to avoid conflicting types */ 26 #ifdef RTE_TOOLCHAIN_CLANG 27 #undef _m_prefetchw 28 #define _m_prefetchw __m_prefetchw 29 #endif 30 31 /* Must come first. */ 32 #include <windows.h> 33 34 #include <basetsd.h> 35 #include <psapi.h> 36 #include <setupapi.h> 37 #include <winioctl.h> 38 39 /* Have GUIDs defined. */ 40 #ifndef INITGUID 41 #define INITGUID 42 #endif 43 #include <initguid.h> 44 #include <devguid.h> 45 #include <rte_log.h> 46 47 /** 48 * Log GetLastError() with context, usually a Win32 API function and arguments. 49 */ 50 #define RTE_LOG_WIN32_ERR(...) \ 51 RTE_LOG(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \ 52 RTE_FMT_HEAD(__VA_ARGS__,) "\n", GetLastError(), \ 53 RTE_FMT_TAIL(__VA_ARGS__,))) 54 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif /* _RTE_WINDOWS_H_ */ 60