mirror of
https://github.com/reactos/reactos.git
synced 2024-08-23 19:58:25 +00:00
![Johannes Anderwald](/assets/img/avatar_default.png)
- Remove function declaration [USBSTOR] - Start on usbstor driver (USB Mass Storage Driver) - Implement reading device descriptor / configuration descriptor - Implement scanning of configuration descriptor for bulk in / bulk out endpoints - Implement selecting configuration and interface and verify selected interface - Implement reading max lun and create child device object for each lun - Handle PnP requests for functional device object - Implement support routines to send urb's to lower device object (usbhub) - Start implementing PDO routines svn path=/branches/usb-bringup/; revision=51563
135 lines
3.1 KiB
C++
135 lines
3.1 KiB
C++
/*
|
|
* PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* FILE: drivers/usb/usbehci/misc.cpp
|
|
* PURPOSE: USB EHCI device driver.
|
|
* PROGRAMMERS:
|
|
* Michael Martin (michael.martin@reactos.org)
|
|
* Johannes Anderwald (johannes.anderwald@reactos.org)
|
|
*/
|
|
|
|
#include "usbehci.h"
|
|
|
|
//
|
|
// driver verifier
|
|
//
|
|
IO_COMPLETION_ROUTINE SyncForwardIrpCompletionRoutine;
|
|
|
|
NTSTATUS
|
|
NTAPI
|
|
SyncForwardIrpCompletionRoutine(
|
|
PDEVICE_OBJECT DeviceObject,
|
|
PIRP Irp,
|
|
PVOID Context)
|
|
{
|
|
if (Irp->PendingReturned)
|
|
{
|
|
KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE);
|
|
}
|
|
return STATUS_MORE_PROCESSING_REQUIRED;
|
|
}
|
|
|
|
NTSTATUS
|
|
NTAPI
|
|
SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
|
{
|
|
KEVENT Event;
|
|
NTSTATUS Status;
|
|
|
|
//
|
|
// initialize event
|
|
//
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
//
|
|
// copy irp stack location
|
|
//
|
|
IoCopyCurrentIrpStackLocationToNext(Irp);
|
|
|
|
//
|
|
// set completion routine
|
|
//
|
|
IoSetCompletionRoutine(Irp, SyncForwardIrpCompletionRoutine, &Event, TRUE, TRUE, TRUE);
|
|
|
|
|
|
//
|
|
// call driver
|
|
//
|
|
Status = IoCallDriver(DeviceObject, Irp);
|
|
|
|
|
|
//
|
|
// check if pending
|
|
//
|
|
if (Status == STATUS_PENDING)
|
|
{
|
|
//
|
|
// wait for the request to finish
|
|
//
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
//
|
|
// copy status code
|
|
//
|
|
Status = Irp->IoStatus.Status;
|
|
}
|
|
|
|
//
|
|
// done
|
|
//
|
|
return Status;
|
|
}
|
|
|
|
NTSTATUS
|
|
NTAPI
|
|
GetBusInterface(
|
|
PDEVICE_OBJECT DeviceObject,
|
|
PBUS_INTERFACE_STANDARD busInterface)
|
|
{
|
|
KEVENT Event;
|
|
NTSTATUS Status;
|
|
PIRP Irp;
|
|
IO_STATUS_BLOCK IoStatus;
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
if ((!DeviceObject) || (!busInterface))
|
|
return STATUS_UNSUCCESSFUL;
|
|
|
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
|
|
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP,
|
|
DeviceObject,
|
|
NULL,
|
|
0,
|
|
NULL,
|
|
&Event,
|
|
&IoStatus);
|
|
|
|
if (Irp == NULL)
|
|
{
|
|
return STATUS_INSUFFICIENT_RESOURCES;
|
|
}
|
|
|
|
Stack=IoGetNextIrpStackLocation(Irp);
|
|
Stack->MajorFunction = IRP_MJ_PNP;
|
|
Stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
|
|
Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
|
|
Stack->Parameters.QueryInterface.InterfaceType = (LPGUID)&GUID_BUS_INTERFACE_STANDARD;
|
|
Stack->Parameters.QueryInterface.Version = 1;
|
|
Stack->Parameters.QueryInterface.Interface = (PINTERFACE)busInterface;
|
|
Stack->Parameters.QueryInterface.InterfaceSpecificData = NULL;
|
|
Irp->IoStatus.Status=STATUS_NOT_SUPPORTED ;
|
|
|
|
Status=IoCallDriver(DeviceObject, Irp);
|
|
|
|
if (Status == STATUS_PENDING)
|
|
{
|
|
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
|
|
|
|
Status=IoStatus.Status;
|
|
}
|
|
|
|
return Status;
|
|
}
|
|
|