Debian Codegraph @

windows/netuio/netuio_dev.h

raw symbols SCIP
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Microsoft Corporation.
3 */
4
5 #ifndef NETUIO_DEV_H
6 #define NETUIO_DEV_H
7
8 #include "netuio_interface.h"
9
10 struct pci_bar {
11 PHYSICAL_ADDRESS base_addr;
12 PVOID virt_addr;
13 UINT64 size;
14 };
15
16 struct mem_map_region {
17 PMDL mdl; /**< MDL describing the memory region */
18 struct mem_region mem; /**< Memory region details */
19 };
20
21 struct dev_addr {
22 ULONG bus_num;
23 USHORT dev_num;
24 USHORT func_num;
25 };
26
27 /**
28 * The device context performs the same job as a WDM device extension in the driver frameworks
29 */
30 typedef struct _NETUIO_CONTEXT_DATA
31 {
32 WDFDEVICE wdf_device; /**< WDF device handle to the FDO */
33 BUS_INTERFACE_STANDARD bus_interface; /**< Bus interface for config space access */
34 struct pci_bar bar[PCI_MAX_BAR]; /**< device BARs */
35 struct dev_addr addr; /**< B:D:F details of device */
36 struct mem_map_region dpdk_hw[PCI_MAX_BAR]; /**< mapped region for the device's register space */
37 } NETUIO_CONTEXT_DATA, *PNETUIO_CONTEXT_DATA;
38
39
40 /**
41 * This macro will generate an inline function called DeviceGetContext
42 * which will be used to get a pointer to the device context memory in a
43 * type safe manner.
44 */
45 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(NETUIO_CONTEXT_DATA, netuio_get_context_data)
46
47 typedef struct
48 {
49 BOOLEAN bMapped; /**< value is set to TRUE if the User-mode mapping was done for this file object. */
50 } NETUIO_FILE_CONTEXT_DATA, * PNETUIO_FILE_CONTEXT_DATA;
51
52
53 /**
54 * This macro will generate an inline function which will be used to get
55 * a pointer to the file object's context memory in a type safe manner.
56 */
57 WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(NETUIO_FILE_CONTEXT_DATA, netuio_get_file_object_context_data)
58
59 /**
60 * Functions to initialize the device and its callbacks
61 */
62 NTSTATUS netuio_create_device(_Inout_ PWDFDEVICE_INIT DeviceInit);
63 NTSTATUS netuio_map_hw_resources(_In_ WDFDEVICE Device, _In_ WDFCMRESLIST Resources, _In_ WDFCMRESLIST ResourcesTranslated);
64 VOID netuio_free_hw_resources(_In_ WDFDEVICE Device);
65
66 #endif // NETUIO_DEV_H