OpenCores
URL https://opencores.org/ocsvn/usb11/usb11/trunk

Subversion Repositories usb11

[/] [usb11/] [trunk/] [rtl/] [systemc/] [usb_rom.h] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfoltran
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  USB Descriptor ROM                                         ////
4
////                                                             ////
5
////  SystemC Version: usb_rom.h                                 ////
6
////  Author: Alfredo Luiz Foltran Fialho                        ////
7
////          alfoltran@ig.com.br                                ////
8
////                                                             ////
9
////                                                             ////
10
/////////////////////////////////////////////////////////////////////
11
////                                                             ////
12
//// Verilog Version: usb1_rom1.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_ROM_H
39
#define USB_ROM_H
40
 
41
#include "systemc.h"
42
 
43
SC_MODULE(usb_rom) {
44
 
45
  public:
46
 
47
        sc_in<bool>                     clk;
48
        sc_in<sc_uint<8> >      adr;
49
        sc_out<sc_uint<8> >     dout;
50
 
51
        void dout_update(void) {
52
                switch (adr.read()) {// synopsys full_case parallel_case
53
                        // ====================================
54
                        // =====    DEVICE Descriptor     =====
55
                        // ====================================
56
                        case 0x00:      dout.write(  18); break;        // this descriptor length
57
                        case 0x01:      dout.write(0x01); break;        // descriptor type
58
                        case 0x02:      dout.write(0x10); break;        // USB version low byte
59
                        case 0x03:      dout.write(0x01); break;        // USB version high byte
60
                        case 0x04:      dout.write(0xff); break;        // device class
61
                        case 0x05:      dout.write(0x00); break;        // device sub class
62
                        case 0x06:      dout.write(0xff); break;        // device protocol
63
                        case 0x07:      dout.write(  64); break;        // max packet size
64
                        case 0x08:      dout.write(0x34); break;        // vendor ID low byte
65
                        case 0x09:      dout.write(0x12); break;        // vendor ID high byte
66
                        case 0x0a:      dout.write(0x78); break;        // product ID low byte
67
                        case 0x0b:      dout.write(0x56); break;        // product ID high byte
68
                        case 0x0c:      dout.write(0x10); break;        // device rel. number low byte
69
                        case 0x0d:      dout.write(0x00); break;        // device rel. number high byte
70
                        case 0x0e:      dout.write(0x01); break;        // Manufacturer String Index
71
                        case 0x0f:      dout.write(0x02); break;        // Product Descr. String Index
72
                        case 0x10:      dout.write(0x03); break;        // S/N String Index
73
                        case 0x11:      dout.write(0x01); break;        // Number of possible config.
74
 
75
                        // ====================================
76
                        // ===== Configuration Descriptor =====
77
                        // ====================================
78
                        case 0x12:      dout.write(0x09); break;        // this descriptor length
79
                        case 0x13:      dout.write(0x02); break;        // descriptor type
80
                        case 0x14:      dout.write(  60); break;        // total data length low byte
81
                        case 0x15:      dout.write(   0); break; // total data length high byte
82
                        case 0x16:      dout.write(0x01); break;        // number of interfaces
83
                        case 0x17:      dout.write(0x01); break;        // number of configurations
84
                        case 0x18:      dout.write(0x00); break;        // Conf. String Index
85
                        case 0x19:      dout.write(0x40); break;        // Config. Characteristics
86
                        case 0x1a:      dout.write(0x00); break;        // Max. Power Consumption
87
 
88
                        // ====================================
89
                        // =====   Interface Descriptor   =====
90
                        // ====================================
91
                        case 0x1b:      dout.write(0x09); break;        // this descriptor length
92
                        case 0x1c:      dout.write(0x04); break;        // descriptor type
93
                        case 0x1d:      dout.write(0x00); break;        // interface number
94
                        case 0x1e:      dout.write(0x00); break;        // alternate setting
95
                        case 0x1f:      dout.write(0x06); break;        // number of endpoints
96
                        case 0x20:      dout.write(0xff); break;        // interface class
97
                        case 0x21:      dout.write(0x01); break;        // interface sub class
98
                        case 0x22:      dout.write(0xff); break;        // interface protocol
99
                        case 0x23:      dout.write(0x00); break;        // interface string index
100
 
101
                        // ====================================
102
                        // =====   Endpoint 1 Descriptor  =====
103
                        // ====================================
104
                        case 0x24:      dout.write(0x07); break;        // this descriptor length
105
                        case 0x25:      dout.write(0x05); break;        // descriptor type
106
                        case 0x26:      dout.write(0x81); break;        // endpoint address
107
                        case 0x27:      dout.write(0x01); break;        // endpoint attributes
108
                        case 0x28:      dout.write(0x00); break;        // max packet size low byte
109
                        case 0x29:      dout.write(0x01); break;        // max packet size high byte
110
                        case 0x2a:      dout.write(0x01); break;        // polling interval
111
 
112
                        // ====================================
113
                        // =====   Endpoint 2 Descriptor  =====
114
                        // ====================================
115
                        case 0x2b:      dout.write(0x07); break;        // this descriptor length
116
                        case 0x2c:      dout.write(0x05); break;        // descriptor type
117
                        case 0x2d:      dout.write(0x02); break;        // endpoint address
118
                        case 0x2e:      dout.write(0x01); break;        // endpoint attributes
119
                        case 0x2f:      dout.write(0x00); break;        // max packet size low byte
120
                        case 0x30:      dout.write(0x01); break;        // max packet size high byte
121
                        case 0x31:      dout.write(0x01); break;        // polling interval
122
 
123
                        // ====================================
124
                        // =====   Endpoint 3 Descriptor  =====
125
                        // ====================================
126
                        case 0x32:      dout.write(0x07); break;        // this descriptor length
127
                        case 0x33:      dout.write(0x05); break;        // descriptor type
128
                        case 0x34:      dout.write(0x83); break;        // endpoint address
129
                        case 0x35:      dout.write(0x02); break;        // endpoint attributes
130
                        case 0x36:      dout.write(  64); break;        // max packet size low byte
131
                        case 0x37:      dout.write(   0); break; // max packet size high byte
132
                        case 0x38:      dout.write(0x01); break;        // polling interval
133
 
134
                        // ====================================
135
                        // =====   Endpoint 4 Descriptor  =====
136
                        // ====================================
137
                        case 0x39:      dout.write(0x07); break;        // this descriptor length
138
                        case 0x3a:      dout.write(0x05); break;        // descriptor type
139
                        case 0x3b:      dout.write(0x04); break;        // endpoint address
140
                        case 0x3c:      dout.write(0x02); break;        // endpoint attributes
141
                        case 0x3d:      dout.write(  64); break;        // max packet size low byte
142
                        case 0x3e:      dout.write(   0); break; // max packet size high byte
143
                        case 0x3f:      dout.write(0x01); break;        // polling interval
144
 
145
                        // ====================================
146
                        // =====   Endpoint 5 Descriptor  =====
147
                        // ====================================
148
                        case 0x40:      dout.write(0x07); break;        // this descriptor length
149
                        case 0x41:      dout.write(0x05); break;        // descriptor type
150
                        case 0x42:      dout.write(0x85); break;        // endpoint address
151
                        case 0x43:      dout.write(0x03); break;        // endpoint attributes
152
                        case 0x44:      dout.write(  64); break;        // max packet size low byte
153
                        case 0x45:      dout.write(   0); break; // max packet size high byte
154
                        case 0x46:      dout.write(0x01); break;        // polling interval
155
 
156
                        // ====================================
157
                        // =====   Endpoint 6 Descriptor  =====
158
                        // ====================================
159
                        case 0x47:      dout.write(0x07); break;        // this descriptor length
160
                        case 0x48:      dout.write(0x05); break;        // descriptor type
161
                        case 0x49:      dout.write(0x06); break;        // endpoint address
162
                        case 0x4a:      dout.write(0x03); break;        // endpoint attributes
163
                        case 0x4b:      dout.write(  64); break;        // max packet size low byte
164
                        case 0x4c:      dout.write(   0); break; // max packet size high byte
165
                        case 0x4d:      dout.write(0x01); break;        // polling interval
166
 
167
                        // ====================================
168
                        // ===== String Descriptor Lang ID=====
169
                        // ====================================
170
                        case 0x4e:      dout.write(0x06); break;        // this descriptor length
171
                        case 0x4f:      dout.write(0x03); break;        // descriptor type
172
 
173
                                                // Brazilian Portuguese
174
                        case 0x50:      dout.write(0x16); break;        // Language ID 0 low byte
175
                        case 0x51:      dout.write(0x04); break;        // Language ID 0 high byte
176
 
177
                                                // Brazilian Portuguese
178
                        case 0x52:      dout.write(0x16); break;        // Language ID 1 low byte
179
                        case 0x53:      dout.write(0x04); break;        // Language ID 1 high byte
180
 
181
                                                // Brazilian Portuguese
182
                        case 0x54:      dout.write(0x16); break;        // Language ID 2 low byte
183
                        case 0x55:      dout.write(0x04); break;        // Language ID 2 high byte
184
 
185
                        // ====================================
186
                        // =====   String Descriptor 1    =====
187
                        // ====================================
188
                        case 0x56:      dout.write(  26); break;        // this descriptor length
189
                        case 0x57:      dout.write(0x03); break;        // descriptor type
190
 
191
                                                // "BrazilIP.org"
192
                        case 0x58:      dout.write(   0); break;
193
                        case 0x59:      dout.write( 'g'); break;
194
                        case 0x5a:      dout.write(   0); break;
195
                        case 0x5b:      dout.write( 'r'); break;
196
                        case 0x5c:      dout.write(   0); break;
197
                        case 0x5d:      dout.write( 'o'); break;
198
                        case 0x5e:      dout.write(   0); break;
199
                        case 0x5f:      dout.write( '.'); break;
200
                        case 0x60:      dout.write(   0); break;
201
                        case 0x61:      dout.write( 'P'); break;
202
                        case 0x62:      dout.write(   0); break;
203
                        case 0x63:      dout.write( 'I'); break;
204
                        case 0x64:      dout.write(   0); break;
205
                        case 0x65:      dout.write( 'l'); break;
206
                        case 0x66:      dout.write(   0); break;
207
                        case 0x67:      dout.write( 'i'); break;
208
                        case 0x68:      dout.write(   0); break;
209
                        case 0x69:      dout.write( 'z'); break;
210
                        case 0x6a:      dout.write(   0); break;
211
                        case 0x6b:      dout.write( 'a'); break;
212
                        case 0x6c:      dout.write(   0); break;
213
                        case 0x6d:      dout.write( 'r'); break;
214
                        case 0x6e:      dout.write(   0); break;
215
                        case 0x6f:      dout.write( 'B'); break;
216
 
217
                        // ====================================
218
                        // =====   String Descriptor 2    =====
219
                        // ====================================
220
                        case 0x70:      dout.write(  28); break;        // this descriptor length
221
                        case 0x71:      dout.write(0x03); break;        // descriptor type
222
 
223
                                                // "Projeto Fênix"
224
                        case 0x72:      dout.write(   0); break;
225
                        case 0x73:      dout.write( 'x'); break;
226
                        case 0x74:      dout.write(   0); break;
227
                        case 0x75:      dout.write( 'i'); break;
228
                        case 0x76:      dout.write(   0); break;
229
                        case 0x77:      dout.write( 'n'); break;
230
                        case 0x78:      dout.write(   0); break;
231
                        case 0x79:      dout.write(0xea); break;        //e-circumflex
232
                        case 0x7a:      dout.write(   0); break;
233
                        case 0x7b:      dout.write( 'F'); break;
234
                        case 0x7c:      dout.write(   0); break;
235
                        case 0x7d:      dout.write( ' '); break;
236
                        case 0x7e:      dout.write(   0); break;
237
                        case 0x7f:      dout.write( 'o'); break;
238
                        case 0x80:      dout.write(   0); break;
239
                        case 0x81:      dout.write( 't'); break;
240
                        case 0x82:      dout.write(   0); break;
241
                        case 0x83:      dout.write( 'e'); break;
242
                        case 0x84:      dout.write(   0); break;
243
                        case 0x85:      dout.write( 'j'); break;
244
                        case 0x86:      dout.write(   0); break;
245
                        case 0x87:      dout.write( 'o'); break;
246
                        case 0x88:      dout.write(   0); break;
247
                        case 0x89:      dout.write( 'r'); break;
248
                        case 0x8a:      dout.write(   0); break;
249
                        case 0x8b:      dout.write( 'P'); break;
250
 
251
                        // ====================================
252
                        // =====   String Descriptor 3    =====
253
                        // ====================================
254
                        case 0x8c:      dout.write(  54); break;        // this descriptor length
255
                        case 0x8d:      dout.write(0x03); break;        // descriptor type
256
 
257
                                                // "Versão Experimental (2003)"
258
                        case 0x8e:      dout.write(   0); break;
259
                        case 0x8f:      dout.write( ')'); break;
260
                        case 0x90:      dout.write(   0); break;
261
                        case 0x91:      dout.write( '3'); break;
262
                        case 0x92:      dout.write(   0); break;
263
                        case 0x93:      dout.write( '0'); break;
264
                        case 0x94:      dout.write(   0); break;
265
                        case 0x95:      dout.write( '0'); break;
266
                        case 0x96:      dout.write(   0); break;
267
                        case 0x97:      dout.write( '2'); break;
268
                        case 0x98:      dout.write(   0); break;
269
                        case 0x99:      dout.write( '('); break;
270
                        case 0x9a:      dout.write(   0); break;
271
                        case 0x9b:      dout.write( ' '); break;
272
                        case 0x9c:      dout.write(   0); break;
273
                        case 0x9d:      dout.write( 'l'); break;
274
                        case 0x9e:      dout.write(   0); break;
275
                        case 0x9f:      dout.write( 'a'); break;
276
                        case 0xa0:      dout.write(   0); break;
277
                        case 0xa1:      dout.write( 't'); break;
278
                        case 0xa2:      dout.write(   0); break;
279
                        case 0xa3:      dout.write( 'n'); break;
280
                        case 0xa4:      dout.write(   0); break;
281
                        case 0xa5:      dout.write( 'e'); break;
282
                        case 0xa6:      dout.write(   0); break;
283
                        case 0xa7:      dout.write( 'm'); break;
284
                        case 0xa8:      dout.write(   0); break;
285
                        case 0xa9:      dout.write( 'i'); break;
286
                        case 0xaa:      dout.write(   0); break;
287
                        case 0xab:      dout.write( 'r'); break;
288
                        case 0xac:      dout.write(   0); break;
289
                        case 0xad:      dout.write( 'e'); break;
290
                        case 0xae:      dout.write(   0); break;
291
                        case 0xaf:      dout.write( 'p'); break;
292
                        case 0xb0:      dout.write(   0); break;
293
                        case 0xb1:      dout.write( 'x'); break;
294
                        case 0xb2:      dout.write(   0); break;
295
                        case 0xb3:      dout.write( 'E'); break;
296
                        case 0xb4:      dout.write(   0); break;
297
                        case 0xb5:      dout.write( ' '); break;
298
                        case 0xb6:      dout.write(   0); break;
299
                        case 0xb7:      dout.write( 'o'); break;
300
                        case 0xb8:      dout.write(   0); break;
301
                        case 0xb9:      dout.write(0xe3); break;        //a-tilde
302
                        case 0xba:      dout.write(   0); break;
303
                        case 0xbb:      dout.write( 's'); break;
304
                        case 0xbc:      dout.write(   0); break;
305
                        case 0xbd:      dout.write( 'r'); break;
306
                        case 0xbe:      dout.write(   0); break;
307
                        case 0xbf:      dout.write( 'e'); break;
308
                        case 0xc0:      dout.write(   0); break;
309
                        case 0xc1:      dout.write( 'V'); break;
310
 
311
                        default:        dout.write(0x00); break;
312
                }
313
        }
314
 
315
        SC_CTOR(usb_rom) {
316
                SC_METHOD(dout_update);
317
                sensitive << clk.pos();
318
        }
319
 
320
};
321
 
322
#endif
323
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.