Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / usb2 / pkt-data.fth
\ ========== Copyright Header Begin ==========================================
\
\ Hypervisor Software File: pkt-data.fth
\
\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
\
\ - Do no alter or remove copyright notices
\
\ - Redistribution and use of this software in source and binary forms, with
\ or without modification, are permitted provided that the following
\ conditions are met:
\
\ - Redistribution of source code must retain the above copyright notice,
\ this list of conditions and the following disclaimer.
\
\ - Redistribution in binary form must reproduce the above copyright notice,
\ this list of conditions and the following disclaimer in the
\ documentation and/or other materials provided with the distribution.
\
\ Neither the name of Sun Microsystems, Inc. or the names of contributors
\ may be used to endorse or promote products derived from this software
\ without specific prior written permission.
\
\ This software is provided "AS IS," without a warranty of any kind.
\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
\
\ You acknowledge that this software is not designed, licensed or
\ intended for use in the design, construction, operation or maintenance of
\ any nuclear facility.
\
\ ========== Copyright Header End ============================================
id: @(#)pkt-data.fth 1.1 07/01/24
purpose: USB Data Packet Definitions
\ See license at end of file
hex
headers
d# 128 constant #max-dev
d# 16 constant #max-endpoint
0 constant speed-full
1 constant speed-low
2 constant speed-high
8 constant /pipe0
1.0000 constant /cfg
100 constant /str
\ Structure of devices requests as defined in USB spec.
struct ( standard device requests )
1 field >dr-rtype \ bmRequestType
1 field >dr-request \ bRequest
2 field >dr-value \ wValue
2 field >dr-index \ wIndex
2 field >dr-len \ wLength
\ Data
constant /dr
\ >dr-type constants
00 constant DR_OUT
80 constant DR_IN
00 constant DR_STANDARD
20 constant DR_CLASS
40 constant DR_VENDOR
00 constant DR_DEVICE
01 constant DR_INTERFACE
02 constant DR_ENDPOINT
03 constant DR_OTHERS
DR_CLASS DR_DEVICE or constant DR_HUB
DR_CLASS DR_OTHERS or constant DR_PORT
DR_CLASS DR_INTERFACE or constant DR_HIDD
\ >dr-request constants
01 constant CLEAR_FEATURE
08 constant GET_CONFIGURATION
06 constant GET_DESCRIPTOR
0a constant GET_INTERFACE
02 constant GET_STATE
00 constant GET_STATUS
05 constant SET_ADDRESS
09 constant SET_CONFIGURATION
07 constant SET_DESCRIPTOR
03 constant SET_FEATURE
0b constant SET_INTERFACE
0c constant SYNCH_FRAME
\ >dr-value (upper byte) for get-/set-descriptor constants
\ lower-byte is descriptor index
01 constant DEVICE
02 constant CONFIGURATION
03 constant STRING
04 constant INTERFACE
05 constant ENDPOINT
29 constant HUB
\ Hub Class Feature Selectors (dr-value)
00 constant C_HUB_LOCAL_POWER
01 constant C_HUB_OVER_CURRENT
00 constant PORT_CONNECTION
01 constant PORT_ENABLE
02 constant PORT_SUSPEND
03 constant PORT_OVER_CURRENT
04 constant PORT_RESET
08 constant PORT_POWER
09 constant PORT_LOW_SPEED
10 constant C_PORT_CONNECTION
11 constant C_PORT_ENABLE
12 constant C_PORT_SUSPEND
13 constant C_PORT_OVER_CURRENT
14 constant C_PORT_RESET
\ Use tmp-l to make sure that le-l! and le-w! are atomic writes
instance variable tmp-l
: le-w@ ( a -- w ) dup c@ swap ca1+ c@ bwjoin ;
: (le-w!) ( w a -- ) >r wbsplit r@ ca1+ c! r> c! ;
: le-w! ( w a -- ) swap tmp-l (le-w!) tmp-l w@ swap w! ;
: le-l@ ( a -- l ) >r r@ c@ r@ 1+ c@ r@ 2+ c@ r> 3 + c@ bljoin ;
: (le-l!) ( l a -- ) >r lbsplit r@ 3 + c! r@ 2+ c! r@ 1+ c! r> c! ;
: le-l! ( l a -- ) swap tmp-l (le-l!) tmp-l l@ swap l! ;
headers
\ LICENSE_BEGIN
\ Copyright (c) 2006 FirmWorks
\
\ Permission is hereby granted, free of charge, to any person obtaining
\ a copy of this software and associated documentation files (the
\ "Software"), to deal in the Software without restriction, including
\ without limitation the rights to use, copy, modify, merge, publish,
\ distribute, sublicense, and/or sell copies of the Software, and to
\ permit persons to whom the Software is furnished to do so, subject to
\ the following conditions:
\
\ The above copyright notice and this permission notice shall be
\ included in all copies or substantial portions of the Software.
\
\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\
\ LICENSE_END