Changeset 3444
- Timestamp:
- Nov 20, 2012 11:27:07 PM (6 months ago)
- Location:
- dev/usb2/hcd
- Files:
-
- 4 edited
-
device.fth (modified) (1 diff)
-
ehci/probe.fth (modified) (3 diffs)
-
hcd.fth (modified) (2 diffs)
-
probehub.fth (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dev/usb2/hcd/device.fth
r3015 r3444 358 358 ; 359 359 360 : find-port-node ( port -- true | phandle false) 361 my-self ihandle>phandle child ( port phandle ) 362 begin ?dup while ( port phandle ) 363 " reg" 2 pick get-package-property 0= if ( port phandle adr len ) 364 decode-int nip nip ( port phandle port1 ) 365 2 pick = if ( port phandle ) 366 \ Check if the node has been disabled 367 " assigned-address" ( port phandle propname$ ) 368 2 pick get-package-property 0= if ( port phandle adr len ) 369 decode-int nip nip ( port phandle assigned-address ) 370 -1 <> if ( port phandle ) 371 nip false exit 372 then 373 then ( port phandle ) 374 then ( port phandle ) 375 then ( port phandle ) 376 peer ( port phandle' ) 377 repeat ( port ) 378 drop ( ) 379 true 380 ; 381 382 : .phandle-property ( phandle prop-name$ -- ) 383 rot get-package-property 0= if ( adr len ) 384 decode-string type 2drop 385 then 386 ; 387 : .usb-device ( port -- ) 388 find-port-node if 389 ." Can't find device node for USB port!" cr 390 else ( phandle ) 391 dup " device_type" .phandle-property ( phandle ) 392 ." ," 393 dup " vendor$" .phandle-property ( phandle ) 394 ." ," 395 dup " device$" .phandle-property ( phandle ) 396 drop ( ) 397 then 398 ; 399 360 400 : (make-device-node) ( dev port intf -- ) 361 401 swap ( dev intf port ) -
dev/usb2/hcd/ehci/probe.fth
r3325 r3444 85 85 : power-usb-ports ( -- ) ; 86 86 87 : port-changed? ( port# -- flag ) portsc@ 2 and 0<> ; 87 88 : ports-changed? ( -- flag ) 88 89 #ports 0 ?do 89 i port sc@ 2 andif true unloop exit then90 i port-changed? if true unloop exit then 90 91 loop 91 92 false … … 96 97 97 98 #ports 0 ?do \ For each port 98 i port sc@ 2 andif \ Connection changed99 i port-changed? if \ Connection changed 99 100 \ i rm-obsolete-children \ Remove obsolete device nodes 100 101 i probe-root-hub-port \ Probe it … … 155 156 ; 156 157 157 : .occupied ( port -- ) ." USB 2.0 port " u. ." in use" cr ;158 158 : regs{ ( -- prev ) ehci-reg dup 0= if map-regs then ; 159 159 : }regs ( prev -- ) 0= if unmap-regs then ; 160 160 161 : fisheye ( --)162 regs{161 : selftest ( -- error? ) 162 open 0= if true exit then 163 163 #testable-ports 0 ?do 164 ." USB port " i u. ." : " 164 165 i port-connected? if 165 i .occupied 166 ." In use - " 167 i .usb-device cr 166 168 else 167 ." Fisheye pattern out to USB 2.0 port " i u. cr 168 i test-port-begin 169 d# 2,000 ms 170 i test-port-end 171 0 i portsc! i reset-port i power-port 172 then 173 loop 174 }regs 175 ; 176 177 : thorough ( -- error? ) 178 #testable-ports 0 ?do 179 i port-connected? if 180 i .occupied 181 else 182 ." Please connect a device to USB port " i u. cr 183 i wait-connect if true unloop exit then 169 diagnostic-mode? if 170 ." Please connect a device" cr 171 i wait-connect if true unloop exit then 172 i .usb-device cr 173 else 174 fisheye? if 175 ." Fisheye pattern" cr 176 i test-port-begin 177 d# 2,000 ms 178 i test-port-end 179 0 i portsc! i reset-port i power-port 180 else 181 ." Empty" cr 182 then 183 then 184 184 then 185 185 loop 186 186 false 187 ; 188 189 : sagacity ( -- error? ) 190 #testable-ports 0 ?do 191 ." USB port " i u. ." ... " 192 i port-connected? if 193 i wait-connect if true unloop exit then 194 else 195 ." Empty" cr 196 then 197 loop 198 false 199 ; 200 201 : selftest ( -- error? ) 202 regs{ ( prev ) 203 diagnostic-mode? if 204 thorough 205 else 206 sagacity 207 then ( prev error? ) 208 swap }regs ( error? ) 187 close 209 188 ; 210 189 -
dev/usb2/hcd/hcd.fth
r1987 r3444 117 117 \ ; 118 118 119 false instance value fisheye? 120 119 121 : parse-my-args ( -- ) 120 122 my-args … … 123 125 2dup " debug" $= if debug-on then 124 126 2dup " noprobe" $= if true to noprobe? then 127 2dup " fisheye" $= if true to fisheye? then 125 128 2drop ( rem$ ) 126 129 repeat ( rem$ ) -
dev/usb2/hcd/probehub.fth
r3391 r3444 196 196 r> drop true exit ( -- true ) 197 197 then ( ) 198 ." Hub port " r@ u. ." : " ( ) 198 199 hub-buf c@ 8 and if \ Connected ( ) 199 ." Hub port " r@ u. ." in over current" cr200 ." In over current" cr ( ) 200 201 r> drop true exit ( -- true ) 201 202 then ( ) 202 203 hub-buf c@ 1 and if \ Connected ( ) 203 ." Hub port " r@ u. ." in use" cr ( ) 204 ." In use - " ( ) 205 r@ .usb-device cr ( ) 204 206 else ( ) 205 207 diagnostic-mode? if ( ) 206 ." Please connect a device to USB hub port " r@ u. cr ( ) 207 r@ wait-hub-connect if r> drop true exit then ( ) 208 else ( ) 209 ." Fisheye pattern out to USB hub port " r@ u. cr ( ) 210 r@ 4 test-hub-port ( ) 211 d# 2,000 ms ( ) 212 r@ untest-hub-port ( ) 213 r@ reset-hub-port r@ power-hub-port ( ) 214 then ( ) 215 then ( ) 208 ." Please connect a device" cr ( ) 209 r@ wait-hub-connect if r> drop true exit then ( ) 210 r@ .usb-device cr ( ) 211 else ( ) 212 " fisheye?" $call-parent if ( ) 213 ." Fisheye pattern" cr ( ) 214 r@ 4 test-hub-port ( ) 215 d# 2,000 ms ( ) 216 r@ untest-hub-port ( ) 217 r@ reset-hub-port r@ power-hub-port ( ) 218 else ( ) 219 ." Empty" cr ( ) 220 then ( ) 221 then ( ) 222 then ( ) 216 223 r> drop false 217 224 ;
Note: See TracChangeset
for help on using the changeset viewer.
