xref: /dpdk/lib/eal/windows/include/rte_windows.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
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 /**
9  * @file Windows-specific facilities
10  *
11  * This file should be included by DPDK libraries and applications
12  * that need access to Windows API. It includes platform SDK headers
13  * in compatible order with proper options and defines error-handling macros.
14  */
15 
16 /* Disable excessive libraries. */
17 #ifndef WIN32_LEAN_AND_MEAN
18 #define WIN32_LEAN_AND_MEAN
19 #endif
20 
21 /* Override Windows SDK definition of _m_prefetchw to avoid conflicting types */
22 #ifdef RTE_TOOLCHAIN_CLANG
23 #undef _m_prefetchw
24 #define _m_prefetchw __m_prefetchw
25 #endif
26 
27 /* Must come first. */
28 #include <windows.h>
29 
30 #include <basetsd.h>
31 #include <psapi.h>
32 #include <setupapi.h>
33 #include <winioctl.h>
34 
35 /* Have GUIDs defined. */
36 #ifndef INITGUID
37 #define INITGUID
38 #endif
39 #include <initguid.h>
40 #include <devguid.h>
41 #include <rte_log.h>
42 
43 /**
44  * Log GetLastError() with context, usually a Win32 API function and arguments.
45  */
46 #define RTE_LOG_WIN32_ERR(...) \
47 	RTE_LOG_LINE_PREFIX(DEBUG, EAL, \
48 		"GetLastError()=%lu: ", GetLastError(), __VA_ARGS__)
49 
50 #endif /* _RTE_WINDOWS_H_ */
51