199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright (c) 2020 Dmitry Kozlyuk 399a2dd95SBruce Richardson */ 499a2dd95SBruce Richardson 599a2dd95SBruce Richardson #ifndef _RTE_WINDOWS_H_ 699a2dd95SBruce Richardson #define _RTE_WINDOWS_H_ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson /** 999a2dd95SBruce Richardson * @file Windows-specific facilities 1099a2dd95SBruce Richardson * 1199a2dd95SBruce Richardson * This file should be included by DPDK libraries and applications 1299a2dd95SBruce Richardson * that need access to Windows API. It includes platform SDK headers 1399a2dd95SBruce Richardson * in compatible order with proper options and defines error-handling macros. 1499a2dd95SBruce Richardson */ 1599a2dd95SBruce Richardson 1699a2dd95SBruce Richardson /* Disable excessive libraries. */ 1799a2dd95SBruce Richardson #ifndef WIN32_LEAN_AND_MEAN 1899a2dd95SBruce Richardson #define WIN32_LEAN_AND_MEAN 1999a2dd95SBruce Richardson #endif 2099a2dd95SBruce Richardson 2199a2dd95SBruce Richardson /* Override Windows SDK definition of _m_prefetchw to avoid conflicting types */ 2299a2dd95SBruce Richardson #ifdef RTE_TOOLCHAIN_CLANG 2399a2dd95SBruce Richardson #undef _m_prefetchw 2499a2dd95SBruce Richardson #define _m_prefetchw __m_prefetchw 2599a2dd95SBruce Richardson #endif 2699a2dd95SBruce Richardson 2799a2dd95SBruce Richardson /* Must come first. */ 2899a2dd95SBruce Richardson #include <windows.h> 2999a2dd95SBruce Richardson 3099a2dd95SBruce Richardson #include <basetsd.h> 3199a2dd95SBruce Richardson #include <psapi.h> 3299a2dd95SBruce Richardson #include <setupapi.h> 3399a2dd95SBruce Richardson #include <winioctl.h> 3499a2dd95SBruce Richardson 3599a2dd95SBruce Richardson /* Have GUIDs defined. */ 3699a2dd95SBruce Richardson #ifndef INITGUID 3799a2dd95SBruce Richardson #define INITGUID 3899a2dd95SBruce Richardson #endif 3999a2dd95SBruce Richardson #include <initguid.h> 4099a2dd95SBruce Richardson #include <devguid.h> 4199a2dd95SBruce Richardson #include <rte_log.h> 4299a2dd95SBruce Richardson 4399a2dd95SBruce Richardson /** 4499a2dd95SBruce Richardson * Log GetLastError() with context, usually a Win32 API function and arguments. 4599a2dd95SBruce Richardson */ 4699a2dd95SBruce Richardson #define RTE_LOG_WIN32_ERR(...) \ 47*0f1dc8cbSTyler Retzlaff RTE_LOG_LINE_PREFIX(DEBUG, EAL, \ 48*0f1dc8cbSTyler Retzlaff "GetLastError()=%lu: ", GetLastError(), __VA_ARGS__) 4999a2dd95SBruce Richardson 5099a2dd95SBruce Richardson #endif /* _RTE_WINDOWS_H_ */ 51