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

Subversion Repositories usb_fpga_1_11

[/] [usb_fpga_1_11/] [trunk/] [include/] [ztex-conf.h] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 ZTEX
/*!
2
   ZTEX Firmware Kit for EZ-USB Microcontrollers
3
   Copyright (C) 2009-2010 ZTEX e.K.
4
   http://www.ztex.de
5
 
6
   This program is free software; you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License version 3 as
8
   published by the Free Software Foundation.
9
 
10
   This program is distributed in the hope that it will be useful, but
11
   WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
   General Public License for more details.
14
 
15
   You should have received a copy of the GNU General Public License
16
   along with this program; if not, see http://www.gnu.org/licenses/.
17
!*/
18
 
19
/*
20
   Configuration macros
21
*/
22
 
23
#ifndef[ZTEX_CONF_H]
24
#define[ZTEX_CONF_H]
25
 
26
/*
27
   Don't expant macros in comments
28
*/
29
#define[//][
30
][#noexpand[!dnapxeon!]//$0!dnapxeon!
31
]
32
#define[/*][*/][#noexpand[!dnapxeon!]/*$0*/!dnapxeon!]
33
 
34
/*
35
   This macro defines the USB Vendor ID and USB Product ID  (not the product ID
36
   from the ZTEX descriptor). The Vendor ID must be purchased from the USB-IF
37
   (http://www.usb.org).
38
 
39
   The default vendor ID is the ZTEX vendor ID 0x221A, default product ID is
40
   0x100 which is assigned to ZTEX modules. These ID's can be shared by many
41
   differend products which are identified by the product ID of the ZTEX
42
   descriptor. According to the USB-IF rules these ID's must not be used by
43
   hardware which is not manufactured by ZTEX. (Of course, this ID's can be
44
   used during the development process or for internal purposes.)
45
 
46
   Please read the http://www.ztex.de/firmware-kit/usb_ids.e.html for more
47
   informations about this topic.
48
 
49
   Usage:
50
        SET_VPID(<Vendor ID>,<Pioduct ID>);
51
*/
52
#define[SET_VPID(][,$1);][#define[USB_VENDOR_ID][$0]
53
#define[USB_PRODUCT_ID][$1]]
54
SET_VPID(0x221a,0x100);
55
 
56
/*
57
   This macro is called before FPGA Firmware is reset, e.g. to save some
58
   settings. After this macro is called the I/O ports are set to default
59
   states in order to avoid damage during / after the FPGA configuration.
60
   To append someting to this macro use the follwing definition:
61
#define[PRE_FPGA_RESET][PRE_FPGA_RESET
62
...]
63
*/
64
#define[PRE_FPGA_RESET][]
65
 
66
 
67
/*
68
   This macro is called after FPGA Firmware has been configured. This is
69
   usually used to configure the I/O ports.
70
   To append someting to this macro use the follwing definition:
71
#define[POST_FW_LOAD][POST_FW_LOAD
72
...]
73
*/
74
#define[POST_FPGA_CONFIG][]
75
 
76
 
77
 
78
/*
79
  Add a vedor request for endpoint 0,
80
 
81
   Usage:
82
     ADD_EP0_VENDOR_REQUEST((<request number>,,<code executed after setup package received>,,<code executed after data package received>''));
83
   Example:
84
     ADD_EP0_VENDOR_REQUEST((0x33,,initHSFPGAConfiguration();,,));;
85
...]
86
*/
87
#define[EP0_VENDOR_REQUESTS_SU;][]
88
#define[EP0_VENDOR_REQUESTS_DAT;][]
89
#define[ADD_EP0_VENDOR_REQUEST((][,,$1,,$2));;][#define[EP0_VENDOR_REQUESTS_SU;][EP0_VENDOR_REQUESTS_SU;
90
case $0:
91
    $1
92
    break;
93
]
94
#define[EP0_VENDOR_REQUESTS_DAT;][EP0_VENDOR_REQUESTS_DAT;
95
case $0:
96
    $2
97
    break;
98
]]
99
 
100
 
101
/*
102
   Add a vedor command for endpoint 0,
103
 
104
   Usage:
105
     ADD_EP0_VENDOR_COMMAND((<request number>,,<code executed after setup package received>,,<code executed after data package received>''));
106
   Example:
107
     ADD_EP0_VENDOR_COMMAND((0x33,,initHSFPGAConfiguration();,,));;
108
...]
109
*/
110
#define[EP0_VENDOR_COMMANDS_SU;][]
111
#define[EP0_VENDOR_COMMANDS_DAT;][]
112
#define[ADD_EP0_VENDOR_COMMAND((][,,$1,,$2));;][#define[EP0_VENDOR_COMMANDS_SU;][EP0_VENDOR_COMMANDS_SU;
113
case $0:
114
    $1
115
    break;
116
]
117
#define[EP0_VENDOR_COMMANDS_DAT;][EP0_VENDOR_COMMANDS_DAT;
118
case $0:
119
    $2
120
    break;
121
]]
122
 
123
/*
124
  This macro generates a EP0 stall and aborts the current loop. Stalls are usually used to indicate errors.
125
*/
126
#define[EP0_STALL;][{
127
    EP0CS |= 0x01;      // set stall
128
    ep0_payload_remaining = 0;
129
    break;
130
}]
131
 
132
 
133
/*
134
   Endoint 1,2,4,5,8 configuration:
135
 
136
   EP_CONFIG(<EP number>,<interface>,<type>,<direction>,<size>,<buffers>)
137
        <EP number> = 1IN | 1OUT | 2 | 4 | 6 | 8        Endpoint numer
138
        <INTERFACE> = 0 | 1 | 2 | 3                     To which interface this endpoint belongs
139
        <type>      = BULK  | ISO | INT
140
        <dir>       = IN | OUT
141
        <size>      = 512 | 1024
142
        <buffers>   = 1 | 2 | 3 | 4
143
   Example: EP_CONFIG(2,0,ISO,OUT,1024,4);
144
   Importand note: No spaces next to the commas
145
 
146
 
147
   Endoint 1 configuration:
148
 
149
   These Endpoints are defined by default as bulk endpoints and are assigned to interface 0.
150
   Endpoint size is always 64 bytes, but reported Endpoint size will be 512 bytes for USB 2.0 compliance.
151
 
152
   These Endpoints can be redefined using EP_CONFIG or using:
153
 
154
   EP1IN_CONFIG(<interface>);
155
           <INTERFACE> = 0 | 1 | 2 | 3          Interface to which EP1IN belongs; default: 0
156
   EP1OUT_CONFIG(<interface>);
157
           <INTERFACE> = 0 | 1 | 2 | 3          Interface to which EP1OUT belongs; default: 0
158
   EP1_CONFIG(<interface>);
159
           <INTERFACE> = 0 | 1 | 2 | 3          Interface to which EP1IN and EP1OUT belongs; default: 0
160
 
161
   The following (maximum) configurations are possible:
162
   EP2          EP4     EP6     EP8
163
   2x512        2x512   2x512   2x512
164
   2x512        2x512   4x512
165
   2x512        2x512   2x1024
166
   4x512                2x512   2x512
167
   4x512                4x512
168
   4x512                2x1024
169
   2x1024               2x512   2x512
170
   2x1024               4x512
171
   2x1024               2x1024
172
   3x512                3x512   2x512
173
   3x1024                       2x512
174
   4x1024
175
*/
176
#define[EP_CONFIG(][,$1,$2,$3,$4,$5);][
177
#ifeq[$0][1IN]
178
#elifeq[$0][1OUT]
179
#elifeq[$0][2]
180
#elifeq[$0][4]
181
#elifeq[$0][6]
182
#elifneq[$0][8]
183
#error[EP_CONFIG: Invalid 1st parameter: `$0'. Expected `2', `4', `6' or '8']
184
#endif
185
#ifeq[$1][0]
186
#elifeq[$1][1]
187
#elifeq[$1][2]
188
#elifneq[$1][3]
189
#error[EP_CONFIG: Invalid 2nd parameter: `$1'. Expected `0', `1', `2' or '3']
190
#endif
191
#ifeq[$2][BULK]
192
#elifeq[$2][ISO]
193
#elifneq[$2][INT]
194
#error[EP_CONFIG: Invalid 3nd parameter: `$2'. Expected `BULK', `ISO' or 'INT']
195
#endif
196
#ifeq[$3][IN]
197
#elifneq[$3][OUT]
198
#error[EP_CONFIG: Invalid 4th parameter: `$3'. Expected `IN' or 'OUT']
199
#endif
200
#ifeq[$4][512]
201
#elifneq[$4][1024]
202
#error[EP_CONFIG: Invalid 5th parameter: `$4'. Expected `512' or '1024']
203
#endif
204
#ifeq[$5][1]
205
#elifeq[$5][2]
206
#elifeq[$5][3]
207
#elifneq[$5][4]
208
#error[EP_CONFIG: Invalid 6th parameter: `$5'. Expected `1', `2', `3' or `4']
209
#endif
210
#define[EP$0_INTERFACE][$1]
211
#define[EP$0_TYPE][$2]
212
#define[EP$0_DIR][$3]
213
#define[EP$0_SIZE][$4]
214
#define[EP$0_BUFFERS][$5]]
215
 
216
#define[EP1IN_CONFIG(][);][#define[EP1IN_INTERFACE][$0]]
217
#define[EP1OUT_CONFIG(][);][#define[EP1OUT_INTERFACE][$0]]
218
#define[EP1_CONFIG(][);][#define[EP1IN_INTERFACE][$0]
219
#define[EP1OUT_INTERFACE][$0]]
220
 
221
EP_CONFIG(1IN,0,BULK,IN,512,1);
222
EP_CONFIG(1OUT,0,BULK,OUT,512,1);
223
 
224
/*
225
   ISO and INT Transactions per microframe:
226
 
227
   Default value is 1 for all endpoints.
228
 
229
   EP_PPMF(<EP number>,<tansactions per microframe>)
230
        <EP number>                  = 1IN | 1OUT | 2 | 4 | 6 | 8       Endpoint
231
        <tansactions per microframe> = 1 | 2 | 3                        Transactions per microframe
232
 
233
   Example: EP_PPMF(2,3);
234
   Importand note: No spaces next to the commas
235
*/
236
#define[EP_PPMF(][,$1);][
237
#ifeq[$0][1IN]
238
#elifeq[$0][1OUT]
239
#elifeq[$0][2]
240
#elifeq[$0][4]
241
#elifeq[$0][6]
242
#elifneq[$0][8]
243
#error[EP_CONFIG: Invalid 1st parameter: `$0'. Expected `1IN', `1OUT', `2', `4', `6' or '8']
244
#endif
245
#ifeq[$1][1]
246
#elifeq[$1][2]
247
#elifneq[$1][3]
248
#error[EP_CONFIG: Invalid 2nd parameter: `$1'. Expected `1', `2' or '3']
249
#endif
250
#define[EP$0_PPMF][$1]]
251
 
252
EP_PPMF(1IN,1);
253
EP_PPMF(1OUT,1);
254
EP_PPMF(2,1);
255
EP_PPMF(4,1);
256
EP_PPMF(6,1);
257
EP_PPMF(8,1);
258
 
259
/*
260
   Polling interval in microframes for INT transactions:
261
 
262
   Default value is 1 for all endpoints.
263
 
264
   EP_POLL(<EP number>,<polling interval>)
265
        <EP number>        = 1IN | 1OUT | 2 | 4 | 6 | 8         Endpoint
266
        <polling interval> = 1 | 2 | 3                          Polling interval
267
 
268
   Example: EP_POLL(2,1);
269
   Importand note: No spaces next to the commas
270
*/
271
#define[EP_POLL(][,$1);][
272
#ifeq[$0][1IN]
273
#elifeq[$0][1OUT]
274
#elifeq[$0][2]
275
#elifeq[$0][4]
276
#elifeq[$0][6]
277
#elifneq[$0][8]
278
#error[EP_CONFIG: Invalid 1st parameter: `$0'. Expected `1IN', `1OUT', `2', `4', `6' or '8']
279
#endif
280
#define[EP$0_POLL][$1]]
281
 
282
EP_POLL(1IN,1);
283
EP_POLL(1OUT,1);
284
EP_POLL(2,1);
285
EP_POLL(4,1);
286
EP_POLL(6,1);
287
EP_POLL(8,1);
288
 
289
 
290
 
291
/*
292
   Settings which depends PRODUCT_ID, e.g extra capabilities.
293
   Overwrite this macros as desired.
294
*/
295
#define[MODULE_RESERVED_00][0]
296
#define[MODULE_RESERVED_01][0]
297
#define[MODULE_RESERVED_02][0]
298
#define[MODULE_RESERVED_03][0]
299
#define[MODULE_RESERVED_04][0]
300
#define[MODULE_RESERVED_05][0]
301
#define[MODULE_RESERVED_06][0]
302
#define[MODULE_RESERVED_07][0]
303
#define[MODULE_RESERVED_08][0]
304
#define[MODULE_RESERVED_09][0]
305
#define[MODULE_RESERVED_10][0]
306
#define[MODULE_RESERVED_11][0]
307
 
308
#define[FWVER][0]
309
 
310
#define[PRODUCT_ID_0][0]
311
#define[PRODUCT_ID_1][0]
312
#define[PRODUCT_ID_2][0]
313
#define[PRODUCT_ID_3][0]
314
 
315
 
316
/*
317
   Identify as ZTEX USB FPGA Module 1.0
318
   Usage: IDENTITY_UFM_1_0(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
319
*/
320
#define[IDENTITY_UFM_1_0(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
321
#define[PRODUCT_ID_1][$1]
322
#define[PRODUCT_ID_2][$2]
323
#define[PRODUCT_ID_3][$3]
324
#define[FWVER][$4]
325
#define[PRODUCT_IS][UFM-1_0]
326
#define[PRODUCT_STRING]["USB-FPGA Module 1.0"]]
327
 
328
 
329
/*
330
   Identify as ZTEX USB FPGA Module 1.1
331
   Usage: IDENTITY_UFM_1_1(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
332
*/
333
#define[IDENTITY_UFM_1_1(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
334
#define[PRODUCT_ID_1][$1]
335
#define[PRODUCT_ID_2][$2]
336
#define[PRODUCT_ID_3][$3]
337
#define[FWVER][$4]
338
#define[PRODUCT_IS][UFM-1_1]
339
#define[PRODUCT_STRING]["USB-FPGA Module 1.1"]]
340
 
341
 
342
/*
343
   Identify as ZTEX USB FPGA Module 1.2
344
   Usage: IDENTITY_UFM_1_2(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
345
*/
346
#define[IDENTITY_UFM_1_2(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
347
#define[PRODUCT_ID_1][$1]
348
#define[PRODUCT_ID_2][$2]
349
#define[PRODUCT_ID_3][$3]
350
#define[FWVER][$4]
351
#define[PRODUCT_IS][UFM-1_2]
352
#define[PRODUCT_STRING]["USB-FPGA Module 1.2"]]
353
 
354
/*
355
   Identify as ZTEX USB FPGA Module 1.10
356
   Usage: IDENTITY_UFM_1_10(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
357
*/
358
#define[IDENTITY_UFM_1_10(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
359
#define[PRODUCT_ID_1][$1]
360
#define[PRODUCT_ID_2][$2]
361
#define[PRODUCT_ID_3][$3]
362
#define[FWVER][$4]
363
#define[PRODUCT_IS][UFM-1_10]
364
#define[PRODUCT_STRING]["USB-FPGA Module 1.10"]]
365
 
366
/*
367
   Identify as ZTEX USB FPGA Module 1.11
368
   Usage: IDENTITY_UFM_1_10(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
369
*/
370
#define[IDENTITY_UFM_1_11(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
371
#define[PRODUCT_ID_1][$1]
372
#define[PRODUCT_ID_2][$2]
373
#define[PRODUCT_ID_3][$3]
374
#define[FWVER][$4]
375
#define[PRODUCT_IS][UFM-1_11]
376
#define[PRODUCT_STRING]["USB-FPGA Module 1.11"]]
377
 
378
 
379
/*
380
   Identify as ZTEX USB Module 1.0
381
   Usage: IDENTITY_UM_1_0(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
382
*/
383
#define[IDENTITY_UM_1_0(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
384
#define[PRODUCT_ID_1][$1]
385
#define[PRODUCT_ID_2][$2]
386
#define[PRODUCT_ID_3][$3]
387
#define[FWVER][$4]
388
#define[PRODUCT_IS][UM-1_0]
389
#define[PRODUCT_STRING]["USB Module 1.0"]]
390
 
391
 
392
/*
393
   This macro defines the Manufacturer string. Limited to 31 charcters.
394
*/
395
#define[MANUFACTURER_STRING]["ZTEX"]
396
 
397
 
398
/*
399
   This macro defines the Product string. Limited to 31 charcters.
400
*/
401
#define[PRODUCT_STRING]["USB-FPGA Module"]
402
 
403
 
404
/*
405
   This macro defines the Configuration string. Limited to 31 charcters.
406
*/
407
#define[CONFIGURATION_STRING]["(unknown)"]
408
 
409
 
410
/*
411
   This macro enables defines the Configuration string. Limited to 31 charcters.
412
*/
413
#define[CONFIGURATION_STRING]["(unknown)"]
414
 
415
 
416
/*
417
   This macro disables EEPROM interface and certain I2C functions (enabled by default)
418
   Usage: DISABLE_EEPROM;
419
*/
420
#define[DISBALE_EEPROM;][#define[EEPROM_DISBALED][1]]
421
 
422
 
423
/*
424
   This macro enables the Flash interface, if available
425
   Usage: ENABLE_FLASH;
426
*/
427
#define[ENABLE_FLASH;][#define[FLASH_ENABLED][1]]
428
 
429
/*
430
   This macro enables the FPGA configuration using a bitstream from the Flash memory
431
   Usage: ENABLE_FLASH_BITSTREAM;
432
*/
433
#define[ENABLE_FLASH_BITSTREAM;][#define[FLASH_BITSTREAM_ENABLED][1]]
434
 
435
#endif

powered by: WebSVN 2.1.0

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