Author: janderwald
Date: Thu Apr 28 13:13:13 2011
New Revision: 51474

URL: http://svn.reactos.org/svn/reactos?rev=51474&view=rev
Log:
[USBEHCI_NEW]
- Check if the current request type is supported (currently only control is 
supported, bulk will be implemented soon)
- Fix bug in IUSBRequest::CreateQueueHead
- Code runs now until first device descriptor get request (async / periodic 
queue not yet enabled)
- mjmartin usbehci status not yet reached
- Let the fun now begin ;)

Modified:
    branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp
    branches/usb-bringup/drivers/usb/usbehci_new/usb_queue.cpp
    branches/usb-bringup/drivers/usb/usbehci_new/usb_request.cpp

Modified: branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp?rev=51474&r1=51473&r2=51474&view=diff
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] 
(original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] 
Thu Apr 28 13:13:13 2011
@@ -550,7 +550,6 @@
         return Status;
     }
 
-
     //
     // now add the request
     //

Modified: branches/usb-bringup/drivers/usb/usbehci_new/usb_queue.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci_new/usb_queue.cpp?rev=51474&r1=51473&r2=51474&view=diff
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] 
(original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] Thu 
Apr 28 13:13:13 2011
@@ -157,19 +157,81 @@
     IUSBRequest * Request)
 {
     PQUEUE_HEAD QueueHead;
+    NTSTATUS Status;
+    ULONG Type;
+
+    //
+    // sanity check
+    //
     ASSERT(Request != NULL);
 
-    Request->GetQueueHead(&QueueHead);
-
-    //
-    // Add it to the pending list
-    //
-    LinkQueueHead(PendingListQueueHead, QueueHead);
+    //
+    // get request type
+    //
+    Type = Request->GetTransferType();
+
+    //
+    // check if supported
+    //
+    switch(Type)
+    {
+        case USB_ENDPOINT_TYPE_ISOCHRONOUS:
+        case USB_ENDPOINT_TYPE_INTERRUPT:
+            /* NOT IMPLEMENTED IN QUEUE */
+            Status = STATUS_NOT_SUPPORTED;
+            break;
+        case USB_ENDPOINT_TYPE_BULK:
+        case USB_ENDPOINT_TYPE_CONTROL:
+            Status = STATUS_SUCCESS;
+            break;
+        default:
+            /* BUG */
+            PC_ASSERT(FALSE);
+    }
+
+    //
+    // check for success
+    //
+    if (!NT_SUCCESS(Status))
+    {
+        //
+        // request not supported, please try later
+        //
+        return Status;
+    }
+
+    if (Type == USB_ENDPOINT_TYPE_BULK || Type == USB_ENDPOINT_TYPE_CONTROL)
+    {
+        //
+        // get queue head
+        //
+        Status = Request->GetQueueHead(&QueueHead);
+
+        //
+        // check for success
+        //
+        if (!NT_SUCCESS(Status))
+        {
+            //
+            // failed to get queue head
+            //
+           return Status;
+        }
+
+        DPRINT1("Request %p QueueHead %p inserted into AsyncQueue\n", Request, 
QueueHead);
+
+        //
+        // Add it to the pending list
+        //
+        LinkQueueHead(PendingListQueueHead, QueueHead);
+    }
+
 
     //
     // add extra reference which is released when the request is completed
     //
     Request->AddRef();
+
 
     return STATUS_SUCCESS;
 }

Modified: branches/usb-bringup/drivers/usb/usbehci_new/usb_request.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci_new/usb_request.cpp?rev=51474&r1=51473&r2=51474&view=diff
==============================================================================
--- branches/usb-bringup/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] 
(original)
+++ branches/usb-bringup/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] 
Thu Apr 28 13:13:13 2011
@@ -539,6 +539,11 @@
     }
 
     //
+    // sanity check
+    //
+    PC_ASSERT(QueueHead);
+
+    //
     // create setup packet
     //
     Status = BuildSetupPacket();
@@ -772,6 +777,11 @@
     // FIXME check if that is really needed
     //
     QueueHead->PhysicalAddr = QueueHeadPhysicalAddress.LowPart;
+
+    //
+    // output queue head
+    //
+    *OutQueueHead = QueueHead;
 
     //
     // done


Reply via email to