1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
17 \ standard open firmare method
22 \ standard open firmare method
28 \ -------------------------------------------------
30 \ ------------------------------------------------
33 8 chars alloc-mem VALUE setup-packet
36 \ --------------------------------------------------
37 \ signature --->4bytes offset --->0
38 \ tag --->4bytes offset --->4
39 \ trans-len --->4bytes offset --->8
40 \ dir-flag --->1byte offset --->c
41 \ lun --->1byte offset --->d
42 \ comm-len --->1byte offset --->e
43 \ --------------------------------------------------
47 : build-cbw ( address tag transfer-len direction lun command-len -- )
48 5 pick TO cbw-addr ( address tag transfer-len direction lun command-len )
49 cbw-addr 0f erase ( address tag transfer-len direction lun command-len )
50 cbw-addr e + c! ( address tag transfer-len direction lun )
51 cbw-addr d + c! ( address tag transfer-len direction )
52 cbw-addr c + c! ( address tag transfer-len )
53 cbw-addr 8 + l!-le ( address tag )
54 cbw-addr 4 + l!-le ( address )
55 43425355 cbw-addr l!-le ( address )
59 \ ---------------------------------------------------
60 \ signature --->4bytes offset --->0
61 \ tag --->4bytes offset --->4
62 \ residue --->4bytes offset --->8
63 \ status --->1byte offset --->c
64 \ ---------------------------------------------------
68 : analyze-csw ( address -- residue tag true|reason false )
70 csw-addr l@-le 53425355 = IF
71 csw-addr c + c@ dup 0= IF ( reason )
73 csw-addr 8 + l@-le ( residue )
74 csw-addr 4 + l@-le ( residue tag ) \ command block tag
75 TRUE ( residue tag TRUE )
77 FALSE ( reason FALSE )
85 : bulk-reset-recovery-procedure ( bulk-out-endp bulk-in-endp usb-addr -- )
86 s" bulk-reset-recovery-procedure" $call-parent