1 |
2 |
alfoltran |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// USB DEFINES ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// SystemC Version: usb_defines.h ////
|
6 |
|
|
//// Author: Alfredo Luiz Foltran Fialho ////
|
7 |
|
|
//// alfoltran@ig.com.br ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// ////
|
10 |
|
|
/////////////////////////////////////////////////////////////////////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Verilog Version: usb1_defines.v ////
|
13 |
|
|
//// Copyright (C) 2000-2002 Rudolf Usselmann ////
|
14 |
|
|
//// www.asics.ws ////
|
15 |
|
|
//// rudi@asics.ws ////
|
16 |
|
|
//// ////
|
17 |
|
|
//// This source file may be used and distributed without ////
|
18 |
|
|
//// restriction provided that this copyright statement is not ////
|
19 |
|
|
//// removed from the file and that any derivative work contains ////
|
20 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
21 |
|
|
//// ////
|
22 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
23 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
24 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
25 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
26 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
27 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
28 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
29 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
30 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
31 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
32 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
33 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
34 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
35 |
|
|
//// ////
|
36 |
|
|
/////////////////////////////////////////////////////////////////////
|
37 |
|
|
|
38 |
|
|
#ifndef USB_DEFINES_H
|
39 |
|
|
#define USB_DEFINES_H
|
40 |
|
|
|
41 |
|
|
//#define USBF_VERBOSE_DEBUG
|
42 |
|
|
|
43 |
|
|
// Device Descriptor Length
|
44 |
|
|
#define ROM_SIZE0 18
|
45 |
|
|
// Configuration Descriptor Length
|
46 |
|
|
#define ROM_SIZE1 60
|
47 |
|
|
// Language ID Descriptor Start Length
|
48 |
|
|
#define ROM_SIZE2A 8
|
49 |
|
|
// String 1 Descriptor Length
|
50 |
|
|
#define ROM_SIZE2B 26
|
51 |
|
|
// String 2 Descriptor Length
|
52 |
|
|
#define ROM_SIZE2C 28
|
53 |
|
|
// String 3 Descriptor Length
|
54 |
|
|
#define ROM_SIZE2D 54
|
55 |
|
|
|
56 |
|
|
// Device Descriptor Start Address
|
57 |
|
|
#define ROM_START0 0x00
|
58 |
|
|
// Configuration Descriptor Start Address
|
59 |
|
|
#define ROM_START1 0x12
|
60 |
|
|
// Language ID Descriptor Start Address
|
61 |
|
|
#define ROM_START2A 0x4e
|
62 |
|
|
// String 1 Descriptor Start Address
|
63 |
|
|
#define ROM_START2B 0x56
|
64 |
|
|
// String 2 Descriptor Start Address
|
65 |
|
|
#define ROM_START2C 0x70
|
66 |
|
|
// String 3 Descriptor Start Address
|
67 |
|
|
#define ROM_START2D 0x8c
|
68 |
|
|
|
69 |
|
|
// Endpoint Configuration Constants
|
70 |
|
|
#define IN 0x0200
|
71 |
|
|
#define OUT 0x0400
|
72 |
|
|
#define CTRL 0x2800
|
73 |
|
|
#define ISO 0x1000
|
74 |
|
|
#define BULK 0x2000
|
75 |
|
|
#define INT 0x0000
|
76 |
|
|
|
77 |
|
|
// PID Encodings
|
78 |
|
|
#define USBF_T_PID_OUT 0x1
|
79 |
|
|
#define USBF_T_PID_IN 0x9
|
80 |
|
|
#define USBF_T_PID_SOF 0x5
|
81 |
|
|
#define USBF_T_PID_SETUP 0xd
|
82 |
|
|
#define USBF_T_PID_DATA0 0x3
|
83 |
|
|
#define USBF_T_PID_DATA1 0xb
|
84 |
|
|
#define USBF_T_PID_DATA2 0x7
|
85 |
|
|
#define USBF_T_PID_MDATA 0xf
|
86 |
|
|
#define USBF_T_PID_ACK 0x2
|
87 |
|
|
#define USBF_T_PID_NACK 0xa
|
88 |
|
|
#define USBF_T_PID_STALL 0xe
|
89 |
|
|
#define USBF_T_PID_NYET 0x6
|
90 |
|
|
#define USBF_T_PID_PRE 0xc
|
91 |
|
|
#define USBF_T_PID_ERR 0xc
|
92 |
|
|
#define USBF_T_PID_SPLIT 0x8
|
93 |
|
|
#define USBF_T_PID_PING 0x4
|
94 |
|
|
#define USBF_T_PID_RES 0x0
|
95 |
|
|
|
96 |
|
|
// The HMS_DEL is a constant for the "Half Micro Second"
|
97 |
|
|
// Clock pulse generator. This constant specifies how many
|
98 |
|
|
// Phy clocks there are between two hms_clock pulses. This
|
99 |
|
|
// constant plus 2 represents the actual delay.
|
100 |
|
|
// Example: For a 60 Mhz (16.667 nS period) Phy Clock, the
|
101 |
|
|
// delay must be 30 phy clock: 500ns / 16.667nS = 30 clocks
|
102 |
|
|
#define USBF_HMS_DEL 0x16
|
103 |
|
|
|
104 |
|
|
// After sending Data in response to an IN token from host, the
|
105 |
|
|
// host must reply with an ack. The host has 622nS in Full Speed
|
106 |
|
|
// mode and 400nS in High Speed mode to reply. RX_ACK_TO_VAL_FS
|
107 |
|
|
// and RX_ACK_TO_VAL_HS are the numbers of UTMI clock cycles
|
108 |
|
|
// minus 2 for Full and High Speed modes.
|
109 |
|
|
// #define USBF_RX_ACK_TO_VAL_FS 36
|
110 |
|
|
#define USBF_RX_ACK_TO_VAL_FS 200
|
111 |
|
|
|
112 |
|
|
// After sending a OUT token the host must send a data packet.
|
113 |
|
|
// The host has 622nS in Full Speed mode and 400nS in High Speed
|
114 |
|
|
// mode to send the data packet.
|
115 |
|
|
// TX_DATA_TO_VAL_FS and TX_DATA_TO_VAL_HS are is the numbers of
|
116 |
|
|
// UTMI clock cycles minus 2.
|
117 |
|
|
// #define USBF_TX_DATA_TO_VAL_FS 36
|
118 |
|
|
#define USBF_TX_DATA_TO_VAL_FS 200
|
119 |
|
|
|
120 |
|
|
#endif
|
121 |
|
|
|