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