1 |
8 |
alfoltran |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// USB 1.1 function defines file ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// Author: Rudolf Usselmann ////
|
7 |
|
|
//// rudi@asics.ws ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// Modifications: Alfredo Luiz Foltran Fialho ////
|
10 |
|
|
//// alfoltran@opencores.org ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Downloaded from: http://www.opencores.org/cores/usb1_funct/////
|
13 |
|
|
//// ////
|
14 |
|
|
/////////////////////////////////////////////////////////////////////
|
15 |
|
|
//// ////
|
16 |
|
|
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
|
17 |
|
|
//// www.asics.ws ////
|
18 |
|
|
//// rudi@asics.ws ////
|
19 |
|
|
//// ////
|
20 |
|
|
//// This source file may be used and distributed without ////
|
21 |
|
|
//// restriction provided that this copyright statement is not ////
|
22 |
|
|
//// removed from the file and that any derivative work contains ////
|
23 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
24 |
|
|
//// ////
|
25 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
26 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
27 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
28 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
29 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
30 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
31 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
32 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
33 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
34 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
35 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
36 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
37 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
38 |
|
|
//// ////
|
39 |
|
|
/////////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
|
|
// CVS Log
|
42 |
|
|
//
|
43 |
|
|
// $Id: usb_defines.v,v 1.1 2004-05-14 16:19:43 alfoltran Exp $
|
44 |
|
|
//
|
45 |
|
|
// $Date: 2004-05-14 16:19:43 $
|
46 |
|
|
// $Revision: 1.1 $
|
47 |
|
|
// $Author: alfoltran $
|
48 |
|
|
// $Locker: $
|
49 |
|
|
// $State: Exp $
|
50 |
|
|
//
|
51 |
|
|
// Change History:
|
52 |
|
|
// $Log: not supported by cvs2svn $
|
53 |
|
|
// Revision 1.3 2002/09/25 06:06:49 rudi
|
54 |
|
|
// - Added New Top Level
|
55 |
|
|
// - Remove old top level and associated files
|
56 |
|
|
// - Moved FIFOs to "Generic FIFOs" project
|
57 |
|
|
//
|
58 |
|
|
// Revision 1.2 2002/09/20 11:46:54 rudi
|
59 |
|
|
// fixed a type 'define' was missing ...
|
60 |
|
|
//
|
61 |
|
|
// Revision 1.1.1.1 2002/09/19 12:07:40 rudi
|
62 |
|
|
// Initial Checkin
|
63 |
|
|
//
|
64 |
|
|
//
|
65 |
|
|
//
|
66 |
|
|
//
|
67 |
|
|
//
|
68 |
|
|
//
|
69 |
|
|
//
|
70 |
|
|
//
|
71 |
|
|
|
72 |
|
|
`define USBF_DEBUG
|
73 |
|
|
`define USBF_VERBOSE_DEBUG
|
74 |
|
|
|
75 |
|
|
// Enable or disable Block Frames
|
76 |
|
|
//`define USB1_BF_ENABLE
|
77 |
|
|
|
78 |
|
|
/////////////////////////////////////////////////////////////////////
|
79 |
|
|
//
|
80 |
|
|
// Items below this point should NOT be modified by the end user
|
81 |
|
|
// UNLESS you know exactly what you are doing !
|
82 |
|
|
// Modify at you own risk !!!
|
83 |
|
|
//
|
84 |
|
|
/////////////////////////////////////////////////////////////////////
|
85 |
|
|
|
86 |
|
|
`define ROM_SIZE0 7'd018 // Device Descriptor Length
|
87 |
|
|
`define ROM_SIZE1 7'd060 // Configuration Descriptor Length
|
88 |
|
|
`define ROM_SIZE2A 7'd008 // Language ID Descriptor Start Length
|
89 |
|
|
`define ROM_SIZE2B 7'd026 // String 1 Descriptor Length
|
90 |
|
|
`define ROM_SIZE2C 7'd028 // String 2 Descriptor Length
|
91 |
|
|
`define ROM_SIZE2D 7'd054 // String 3 Descriptor Length
|
92 |
|
|
|
93 |
|
|
`define ROM_START0 8'h00 // Device Descriptor Start Address
|
94 |
|
|
`define ROM_START1 8'h12 // Configuration Descriptor Start Address
|
95 |
|
|
`define ROM_START2A 8'h4e // Language ID Descriptor Start Address
|
96 |
|
|
`define ROM_START2B 8'h56 // String 1 Descriptor Start Address
|
97 |
|
|
`define ROM_START2C 8'h70 // String 2 Descriptor Start Address
|
98 |
|
|
`define ROM_START2D 8'h8c // String 3 Descriptor Start Address
|
99 |
|
|
|
100 |
|
|
// Endpoint Configuration Constants
|
101 |
|
|
`define IN 14'b00_001_000000000
|
102 |
|
|
`define OUT 14'b00_010_000000000
|
103 |
|
|
`define CTRL 14'b10_100_000000000
|
104 |
|
|
`define ISO 14'b01_000_000000000
|
105 |
|
|
`define BULK 14'b10_000_000000000
|
106 |
|
|
`define INT 14'b00_000_000000000
|
107 |
|
|
|
108 |
|
|
// PID Encodings
|
109 |
|
|
`define USBF_T_PID_OUT 4'b0001
|
110 |
|
|
`define USBF_T_PID_IN 4'b1001
|
111 |
|
|
`define USBF_T_PID_SOF 4'b0101
|
112 |
|
|
`define USBF_T_PID_SETUP 4'b1101
|
113 |
|
|
`define USBF_T_PID_DATA0 4'b0011
|
114 |
|
|
`define USBF_T_PID_DATA1 4'b1011
|
115 |
|
|
`define USBF_T_PID_DATA2 4'b0111
|
116 |
|
|
`define USBF_T_PID_MDATA 4'b1111
|
117 |
|
|
`define USBF_T_PID_ACK 4'b0010
|
118 |
|
|
`define USBF_T_PID_NACK 4'b1010
|
119 |
|
|
`define USBF_T_PID_STALL 4'b1110
|
120 |
|
|
`define USBF_T_PID_NYET 4'b0110
|
121 |
|
|
`define USBF_T_PID_PRE 4'b1100
|
122 |
|
|
`define USBF_T_PID_ERR 4'b1100
|
123 |
|
|
`define USBF_T_PID_SPLIT 4'b1000
|
124 |
|
|
`define USBF_T_PID_PING 4'b0100
|
125 |
|
|
`define USBF_T_PID_RES 4'b0000
|
126 |
|
|
|
127 |
|
|
// The HMS_DEL is a constant for the "Half Micro Second"
|
128 |
|
|
// Clock pulse generator. This constant specifies how many
|
129 |
|
|
// Phy clocks there are between two hms_clock pulses. This
|
130 |
|
|
// constant plus 2 represents the actual delay.
|
131 |
|
|
// Example: For a 60 Mhz (16.667 nS period) Phy Clock, the
|
132 |
|
|
// delay must be 30 phy clock: 500ns / 16.667nS = 30 clocks
|
133 |
|
|
`define USBF_HMS_DEL 5'h16
|
134 |
|
|
|
135 |
|
|
// After sending Data in response to an IN token from host, the
|
136 |
|
|
// host must reply with an ack. The host has 622nS in Full Speed
|
137 |
|
|
// mode and 400nS in High Speed mode to reply. RX_ACK_TO_VAL_FS
|
138 |
|
|
// and RX_ACK_TO_VAL_HS are the numbers of UTMI clock cycles
|
139 |
|
|
// minus 2 for Full and High Speed modes.
|
140 |
|
|
//`define USBF_RX_ACK_TO_VAL_FS 8'd36
|
141 |
|
|
`define USBF_RX_ACK_TO_VAL_FS 8'd200
|
142 |
|
|
|
143 |
|
|
// After sending a OUT token the host must send a data packet.
|
144 |
|
|
// The host has 622nS in Full Speed mode and 400nS in High Speed
|
145 |
|
|
// mode to send the data packet.
|
146 |
|
|
// TX_DATA_TO_VAL_FS and TX_DATA_TO_VAL_HS are is the numbers of
|
147 |
|
|
// UTMI clock cycles minus 2.
|
148 |
|
|
//`define USBF_TX_DATA_TO_VAL_FS 8'd36
|
149 |
|
|
`define USBF_TX_DATA_TO_VAL_FS 8'd200
|