[openfirmware] r1448 - dev/usb2/hcd/ehci

svn at openfirmware.info svn at openfirmware.info
Fri Oct 30 08:46:16 CET 2009


Author: wmb
Date: 2009-10-30 08:46:16 +0100 (Fri, 30 Oct 2009)
New Revision: 1448

Modified:
   dev/usb2/hcd/ehci/control.fth
   dev/usb2/hcd/ehci/intr.fth
Log:
USB EHCI driver - minor factoring tweaks to make the code a little bit tidier.


Modified: dev/usb2/hcd/ehci/control.fth
===================================================================
--- dev/usb2/hcd/ehci/control.fth	2009-10-30 07:44:26 UTC (rev 1447)
+++ dev/usb2/hcd/ehci/control.fth	2009-10-30 07:46:16 UTC (rev 1448)
@@ -153,6 +153,18 @@
    usb-error					( actual usberr )
 ;
 
+: run-control  ( -- usberr )
+   \ Start control transaction
+   my-qh pt-ctrl fill-qh
+   my-qh insert-qh
+
+   \ Process results
+   my-qh done? 0=  if  my-qh error? drop  then
+
+   my-qh dup remove-qh  free-qhqtds
+   usb-error
+;
+
 : (control-set)  ( sbuf sphy slen buf phy len -- usberr )
    process-control-args				( sbuf sphy slen )
    2 alloc-control-qhqtds			( sbuf sphy slen )
@@ -167,15 +179,7 @@
    TD_TOGGLE_DATA1 TD_C_ERR3 or TD_PID_IN or TD_STAT_ACTIVE or
    swap >hcqtd-token le-l!			( )
 
-   \ Start control transaction
-   my-qh pt-ctrl fill-qh
-   my-qh insert-qh
-
-   \ Process results
-   my-qh done? 0=  if  my-qh error? drop  then
-
-   my-qh dup remove-qh  free-qhqtds
-   usb-error
+   run-control
 ;
 
 : (control-set-nostat)  ( sbuf sphy slen buf phy len -- usberr )
@@ -188,15 +192,7 @@
    \ OUT TD
    TD_PID_OUT fill-control-io-qtds drop		( )
 
-   \ Start control transaction
-   my-qh pt-ctrl fill-qh
-   my-qh insert-qh
-
-   \ Process results
-   my-qh done? 0=  if  my-qh error? drop  then
-
-   my-qh dup remove-qh  free-qhqtds
-   usb-error
+   run-control                                  ( usberr )
 ;
 
 headers

Modified: dev/usb2/hcd/ehci/intr.fth
===================================================================
--- dev/usb2/hcd/ehci/intr.fth	2009-10-30 07:44:26 UTC (rev 1447)
+++ dev/usb2/hcd/ehci/intr.fth	2009-10-30 07:46:16 UTC (rev 1448)
@@ -66,12 +66,11 @@
 : intr-in?  ( -- actual usberr )
    intr-in-qh 0=  if  0 USB_ERR_INV_OP exit  then
    clear-usb-error
-   process-hc-status
-   intr-in-qh dup sync-qhqtds
-   qh-done?  if
+   intr-in-qh qh-done?  if
       intr-in-qh error?  if
          0
       else
+         intr-in-qh dup sync-qhqtds
          intr-in-qtd  dup intr-in-qh >qh-#qtds l@ get-actual
          over >qtd-buf rot >qtd-pbuf l@ 2 pick dma-sync
       then




More information about the openfirmware mailing list