Changeset 2155
- Timestamp:
- Jan 27, 2011 2:16:42 AM (2 years ago)
- File:
-
- 1 edited
-
dev/usb2/hcd/probehub.fth (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dev/usb2/hcd/probehub.fth
r2152 r2155 14 14 : clear-status-change ( port -- ) C_PORT_CONNECTION DR_PORT " clear-feature" $call-parent drop ; 15 15 : parent-set-target ( dev -- ) " set-target" $call-parent ; 16 : hub-error? ( -- error? ) 17 hub-buf 4 0 DR_HUB " get-status" $call-parent ( actual usberror ) 18 nip if ( ) 19 ." Failed to get hub status" cr 20 true ( true ) 21 else ( ) 22 hub-buf 2+ c@ 2 and if ( ) 23 ." USB Hub shut down due to over-current" cr ( ) 24 true ( true ) 25 else ( ) 26 false ( false ) 27 then ( error? ) 28 then ( error? ) 29 ; 30 16 31 : get-port-status ( port -- error? ) 17 32 hub-buf 4 2 pick DR_PORT " get-status" $call-parent ( port actual usberror ) … … 28 43 drop false exit ( -- false ) 29 44 then ( port ) 45 46 hub-buf c@ 8 and if ( port ) 47 ." Hub port " . ." is over current" cr 48 false exit ( -- false ) 49 then 30 50 31 51 hub-buf 2+ c@ 1 and if ( port ) … … 59 79 ; 60 80 61 : hub-#ports ( -- n)81 : hub-#ports ( -- #ports ) 62 82 hub-buf 8 0 0 HUB DR_HUB " get-desc" $call-parent nip if 63 83 ." Failed to get hub descriptor" cr 64 84 0 exit 65 85 then 66 hub-buf 2 + c@ 1+( #ports )86 hub-buf 2 + c@ ( #ports ) 67 87 ; 68 88 : hub-delay ( -- #2ms ) hub-buf 5 + c@ ; 69 89 70 90 : power-hub-ports ( #ports -- ) 71 1 ?do i power-hub-port loop( )91 1+ 1 ?do i power-hub-port loop ( ) 72 92 73 93 hub-delay 2* ms ( ) … … 89 109 : probe-hub ( dev -- ) 90 110 dup parent-set-target ( hub-dev ) 91 hub-#ports ( hub-dev #ports ) 111 hub-#ports dup 0= if ( hub-dev #ports ) 112 2drop exit ( -- ) 113 then ( hub-dev #ports ) 92 114 93 " configuration#" get-int-property 115 " configuration#" get-int-property ( hub-dev #ports config# ) 94 116 " set-config" $call-parent ( hub-dev #ports usberr ) 95 117 if drop ." Failed to set config for hub at " u. cr exit then ( hub-dev #ports ) 96 118 97 dup power-hub-ports ( hub-dev #ports )119 dup power-hub-ports ( hub-dev #ports ) 98 120 99 1 ?do ( hub-dev ) 100 dup i safe-probe-hub-port ( hub-dev ) 101 loop ( hub-dev ) 102 drop ( ) 121 hub-error? if 2drop exit then ( hub-dev #ports ) 122 123 1+ 1 ?do ( hub-dev ) 124 dup i safe-probe-hub-port ( hub-dev ) 125 loop ( hub-dev ) 126 drop ( ) 103 127 ; 104 128 … … 107 131 : do-reprobe-hub ( dev -- ) 108 132 dup parent-set-target ( hub-dev ) 109 hub-#ports 1 ?do ( hub-dev ) 133 134 hub-#ports dup 0= if ( hub-dev #ports ) 135 2drop exit ( -- ) 136 then ( hub-dev #ports ) 137 138 hub-error? if 2drop exit then ( hub-dev #ports ) 139 140 1+ 1 ?do ( hub-dev ) 110 141 dup i port-status-changed? if ( hub-dev connected? ) 111 142 if ( hub-dev )
Note: See TracChangeset
for help on using the changeset viewer.
