ReactOS  0.4.14-dev-384-g5b37caa
pnpdma.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
#include <wdmguid.h>
Include dependency graph for pnpdma.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PDMA_ADAPTER NTAPI IoGetDmaAdapter (IN PDEVICE_OBJECT PhysicalDeviceObject, IN PDEVICE_DESCRIPTION DeviceDescription, IN OUT PULONG NumberOfMapRegisters)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file pnpdma.c.

Function Documentation

◆ IoGetDmaAdapter()

PDMA_ADAPTER NTAPI IoGetDmaAdapter ( IN PDEVICE_OBJECT  PhysicalDeviceObject,
IN PDEVICE_DESCRIPTION  DeviceDescription,
IN OUT PULONG  NumberOfMapRegisters 
)

Definition at line 23 of file pnpdma.c.

26 {
29  BUS_INTERFACE_STANDARD BusInterface;
31  IO_STACK_LOCATION Stack;
32  DEVICE_DESCRIPTION PrivateDeviceDescription;
33  PDMA_ADAPTER Adapter = NULL;
34 
35  DPRINT("IoGetDmaAdapter called\n");
36 
37 
38  /* Try to create DMA adapter through bus driver */
40  {
43  {
44  RtlCopyMemory(&PrivateDeviceDescription,
46  sizeof(DEVICE_DESCRIPTION));
47 
50  sizeof(INTERFACE_TYPE),
51  &PrivateDeviceDescription.InterfaceType,
52  &ResultLength);
53 
54  if (!NT_SUCCESS(Status))
55  PrivateDeviceDescription.InterfaceType = Internal;
56 
57  DeviceDescription = &PrivateDeviceDescription;
58  }
59 
61  Stack.Parameters.QueryInterface.Version = 1;
62  Stack.Parameters.QueryInterface.Interface = (PINTERFACE)&BusInterface;
63  Stack.Parameters.QueryInterface.InterfaceType =
64  &GUID_BUS_INTERFACE_STANDARD;
65 
69  &Stack);
70 
71  if (NT_SUCCESS(Status))
72  {
73  Adapter = BusInterface.GetDmaAdapter(BusInterface.Context,
76 
77  BusInterface.InterfaceDereference(BusInterface.Context);
78  if (Adapter) return Adapter;
79  }
80  }
81 
82  /* Fall back to HAL */
86 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define HalGetDmaAdapter
Definition: haltypes.h:291
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
enum _INTERFACE_TYPE INTERFACE_TYPE
PGET_DMA_ADAPTER GetDmaAdapter
Definition: iotypes.h:882
_Out_ PULONG NumberOfMapRegisters
Definition: halfuncs.h:209
LONG NTSTATUS
Definition: precomp.h:26
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1122
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:4228
void DPRINT(...)
Definition: polytest.cpp:61
struct _INTERFACE * PINTERFACE
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IRP_MN_QUERY_INTERFACE
Status
Definition: gdiplustypes.h:24
struct _BUS_INTERFACE_STANDARD BUS_INTERFACE_STANDARD
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
PINTERFACE_DEREFERENCE InterfaceDereference
Definition: iotypes.h:880
INTERFACE_TYPE InterfaceType
Definition: iotypes.h:2036
unsigned int ULONG
Definition: retypes.h:1
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
NTSTATUS NTAPI IopInitiatePnpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIO_STATUS_BLOCK IoStatusBlock, IN UCHAR MinorFunction, IN PIO_STACK_LOCATION Stack)

Referenced by NdisMAllocateMapRegisters(), NdisMInitializeScatterGatherDma(), NdisMRegisterDmaChannel(), StreamClassStartDevice(), USBPORT_StartDevice(), and VideoPortGetDmaAdapter().