[openfirmware] r1704 - in dev/usb2: device/keyboard device/net device/serial device/storage device/userial device/wlan hcd hcd/uhci

svn at openfirmware.info svn at openfirmware.info
Tue Jan 26 09:18:18 CET 2010


Author: wmb
Date: 2010-01-26 09:18:17 +0100 (Tue, 26 Jan 2010)
New Revision: 1704

Modified:
   dev/usb2/device/keyboard/kbd.fth
   dev/usb2/device/net/ethernet.fth
   dev/usb2/device/serial/uart.fth
   dev/usb2/device/storage/scsi.fth
   dev/usb2/device/userial/userial.fth
   dev/usb2/device/wlan/wlan.fth
   dev/usb2/hcd/control.fth
   dev/usb2/hcd/hcd-call.fth
   dev/usb2/hcd/uhci/control.fth
Log:
OLPC trac 9997 - Propagate several new method calls through hub nodes,
add new "reset-bulk-toggles" method instead of doing it implicitly in
set-config (because the bulk pipe numbers are not always known at set-config
time, especially in probe-hub).


Modified: dev/usb2/device/keyboard/kbd.fth
===================================================================
--- dev/usb2/device/keyboard/kbd.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/keyboard/kbd.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -329,7 +329,7 @@
 : setup-hardware?  ( -- error? )
    set-device
    device set-target
-   " reset?" $call-parent  if
+   reset?  if
       configuration set-config  if
          ." Failed to set USB keyboard configuration" cr
          true exit

Modified: dev/usb2/device/net/ethernet.fth
===================================================================
--- dev/usb2/device/net/ethernet.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/net/ethernet.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -221,11 +221,12 @@
    device set-target
 
    opencount @ 0=  if
-      " reset?" $call-parent  if
+      reset?  if
          configuration set-config  if
             ." Failed to set configuration" cr
             false exit
          then
+         bulk-in-pipe bulk-out-pipe reset-bulk-toggles
          init-nic
       then
 

Modified: dev/usb2/device/serial/uart.fth
===================================================================
--- dev/usb2/device/serial/uart.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/serial/uart.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -56,11 +56,12 @@
    device set-target
    refcount @ 0=  if
 
-      " reset?" $call-parent  if
+      reset?  if
          configuration set-config  if
             ." Failed set serial port configuration" cr
             false exit
          then
+         bulk-in-pipe bulk-out-pipe reset-bulk-toggles
       then
 
       init-buf

Modified: dev/usb2/device/storage/scsi.fth
===================================================================
--- dev/usb2/device/storage/scsi.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/storage/scsi.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -183,10 +183,11 @@
    0 max max-lun min  to lun
    set-device  \ The device number may have changed if we recycled the node
    device set-target
-   " reset?" $call-parent  if
+   reset?  if
       configuration set-config  if
          ." USB storage scsi layer: Failed to set configuration" cr
       then
+      bulk-in-pipe bulk-out-pipe reset-bulk-toggles
    then
 ;
 : set-timeout  ( n -- )  bulk-timeout max set-bulk-in-timeout  ;

Modified: dev/usb2/device/userial/userial.fth
===================================================================
--- dev/usb2/device/userial/userial.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/userial/userial.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -19,11 +19,12 @@
 : open  ( -- flag )
    set-device
    device set-target
-   " reset?" $call-parent  if
+   reset?  if
       configuration set-config  if
          ." userial: set-config failed" cr
          false exit
       then
+      bulk-in-pipe bulk-out-pipe reset-bulk-toggles
    then
    alloc-buffers
    inbuf h# 10 bulk-in-pipe begin-bulk-in

Modified: dev/usb2/device/wlan/wlan.fth
===================================================================
--- dev/usb2/device/wlan/wlan.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/device/wlan/wlan.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -68,11 +68,12 @@
    my-args parse-args
    set-parent-channel
    opencount @ 0=  if
-      " reset?" $call-parent  if
+      reset?  if
          configuration set-config  if
             ." Failed to set USB configuration for wireless" cr
             false exit
          then
+         bulk-in-pipe bulk-out-pipe reset-bulk-toggles
       then
       init-buf
       /inbuf /outbuf setup-bus-io  if  free-buf false exit  then

Modified: dev/usb2/hcd/control.fth
===================================================================
--- dev/usb2/hcd/control.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/hcd/control.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -76,11 +76,15 @@
    0 swap DR_IN or GET_STATUS control-get
 ;
 
+\ Must be called after set-config for any device with bulk-in or
+\ bulk-out pipes.  Pass in 0 if one of the pipes is nonexistent.
+: reset-bulk-toggles  ( bulk-in-pipe bulk-out-pipe -- )
+   ?dup   if  0 swap  target  di-out-data!  then
+   ?dup   if  0 swap  target  di-in-data!   then
+;
+
 : set-config  ( cfg -- usberr )
    >r 0 0 0 r> DR_DEVICE DR_OUT or SET_CONFIGURATION control-set 
-   \ Setting the configuration initializes the endpoint's bulk data toggles
-   0 bulk-out-pipe target di-out-data!
-   0 bulk-in-pipe  target di-in-data!
 ;
 
 : set-interface  ( alt intf -- usberr )

Modified: dev/usb2/hcd/hcd-call.fth
===================================================================
--- dev/usb2/hcd/hcd-call.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/hcd/hcd-call.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -70,7 +70,24 @@
    " bulk-in-ready?" $call-parent
 ;
 
+: begin-in-ring  ( /buf #bufs pipe -- )
+   " begin-in-ring" $call-parent
+;
+\ : end-in-ring     " end-in-ring" $call-parent  ;
+: begin-out-ring  ( /buf #bufs pipe -- )
+   " begin-out-ring" $call-parent
+;
+: end-out-ring   ( -- )
+   " end-out-ring" $call-parent
+;
+: send-out  ( adr len -- qtd )
+   " send-out" $call-parent
+;
+: wait-out  ( qtd -- error? )
+   " wait-out" $call-parent
+;
 
+
 \ Interrupt pipe operations
 : begin-intr-in  ( buf len pipe interval -- )
    " begin-intr-in" $call-parent
@@ -84,7 +101,16 @@
 : end-intr-in  ( -- )
    " end-intr-in" $call-parent
 ;
+: reset-bulk-toggles  ( bulk-in-pipe bulk-out-pipe -- )
+   " reset-bulk-toggles" $call-parent
+;
 
+: reset?  ( -- flag )
+   " reset?" $call-parent
+;
+
+
+
 headers
 
 \ LICENSE_BEGIN

Modified: dev/usb2/hcd/uhci/control.fth
===================================================================
--- dev/usb2/hcd/uhci/control.fth	2010-01-26 08:00:30 UTC (rev 1703)
+++ dev/usb2/hcd/uhci/control.fth	2010-01-26 08:18:17 UTC (rev 1704)
@@ -51,8 +51,10 @@
 
 : alloc-control-qhtds  ( extra-tds -- )
    >r
-   my-maxpayload /my-buf over round-up swap / dup to my-#tds
-   dup  if  data-timeout  else  nodata-timeout  then  to timeout
+   my-maxpayload /my-buf    ( maxpayload /buf )
+   over round-up            ( maxpayload /buf-rounded )
+   swap /  dup to my-#tds   ( maxpayload #tds )
+   dup  if  data-timeout  else  nodata-timeout  then  to timeout  ( maxpayload #tds )
    r> + alloc-qhtds  to my-td  to my-qh
 ;
 




More information about the openfirmware mailing list