ReactOS  0.4.15-dev-1397-g19779b3
adapter.cpp File Reference
#include <ntddk.h>
#include <portcls.h>
#include <debug.h>
Include dependency graph for adapter.cpp:

Go to the source code of this file.

Macros

#define MAX_MINIPORTS   1
 
#define PUT_GUIDS_HERE
 
#define INITGUID
 

Functions

NTSTATUS NTAPI StartDevice (IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp, IN PRESOURCELIST ResourceList)
 
NTSTATUS NTAPI AddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 
NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 

Variables

WCHAR DeviceName [] = L"Uart"
 

Macro Definition Documentation

◆ INITGUID

#define INITGUID

Definition at line 15 of file adapter.cpp.

◆ MAX_MINIPORTS

#define MAX_MINIPORTS   1

Definition at line 13 of file adapter.cpp.

◆ PUT_GUIDS_HERE

#define PUT_GUIDS_HERE

Definition at line 14 of file adapter.cpp.

Function Documentation

◆ AddDevice()

NTSTATUS NTAPI AddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 92 of file adapter.cpp.

95 {
96  DPRINT1("MPU401_KS AddDevice called\n");
101  0);
102 }
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1155
NTSTATUS NTAPI PcAddAdapterDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject, IN PCPFNSTARTDEVICE StartDevice, IN ULONG MaxObjects, IN ULONG DeviceExtensionSize)
Definition: adapter.cpp:76
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
NTSTATUS(NTAPI * PCPFNSTARTDEVICE)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PRESOURCELIST ResourceList)
Definition: portcls.h:2231
#define DPRINT1
Definition: precomp.h:8
#define MAX_MINIPORTS
Definition: adapter.cpp:13
NTSTATUS NTAPI StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST ResourceList)
Definition: adapter.cpp:115

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 107 of file adapter.cpp.

110 {
112  DPRINT1("MPU401_KS DriverEntry\n");
113 
115  RegistryPath,
116  AddDevice);
117 
118  DPRINT1("PcInitializeAdapterDriver result 0x%08x\n", Status);
119 
120  return Status;
121 };
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI PcInitializeAdapterDriver(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPathName, IN PDRIVER_ADD_DEVICE AddDevice)
Definition: adapter.cpp:32
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
Definition: adapter.cpp:259

◆ StartDevice()

NTSTATUS NTAPI StartDevice ( IN PDEVICE_OBJECT  pDeviceObject,
IN PIRP  pIrp,
IN PRESOURCELIST  ResourceList 
)

Definition at line 25 of file adapter.cpp.

29 {
30  PPORT port;
31  PMINIPORT miniport;
33 
34  DPRINT1("MPU401_KS StartDevice called\n");
35 
36  if (!ResourceList)
38 
39  if (ResourceList->NumberOfEntries() == 0 )
40  {
42  }
43 
44 
45  DPRINT1("Calling PcNewPort with CLSID_PortMidi\n");
46  Status = PcNewPort(&port, CLSID_PortMidi);
47 
48  if (!NT_SUCCESS(Status))
49  {
50  DPRINT("PcNewPort FAILED with status 0x%08x\n", Status);
51  return Status;
52  }
53 
54  DPRINT1("Calling PcNewMiniport with CLSID_MiniportDriverUart\n");
55  Status = PcNewMiniport(&miniport, CLSID_MiniportDriverUart);
56 
57  if (!NT_SUCCESS(Status))
58  {
59  DPRINT1("PcNewMiniport FAILED with status 0x%08x\n", Status);
60  return Status;
61  }
62 
63  DPRINT1("Calling Init of port object\n");
64  Status = port->Init(pDeviceObject, pIrp, miniport, NULL, ResourceList);
65 
66  if (!NT_SUCCESS(Status))
67  {
68  DPRINT1("Init FAILED with status 0x%08x\n", Status);
69  return Status;
70  }
71 
72  DPRINT1("Registering subdevice via PcRegisterSubdevice\n");
74 
75  if (!NT_SUCCESS(Status))
76  {
77  /* just print an error here */
78  DPRINT1("PcRegisterSubdevice FAILED with status 0x%08x\n", Status);
79  }
80 
81  miniport->Release();
82  port->Release();
83 
84  DPRINT1("Device started\n");
85 
86  return Status;
87 }
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
LONG NTSTATUS
Definition: precomp.h:26
FxIrp * pIrp
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:304
NTSTATUS NTAPI PcNewMiniport(OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
Definition: miniport.cpp:48
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
IPort * PPORT
Definition: portcls.h:1093
void DPRINT(...)
Definition: polytest.cpp:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI PcNewPort(OUT PPORT *OutPort, IN REFCLSID ClassId)
Definition: port.cpp:20
USHORT port
Definition: uri.c:228
NTSTATUS NTAPI PcRegisterSubdevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR Name, IN PUNKNOWN Unknown)
Definition: adapter.cpp:210

Variable Documentation

◆ DeviceName

WCHAR DeviceName[] = L"Uart"

Definition at line 21 of file adapter.cpp.