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

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [include/] [ztex-conf.h] - Blame information for rev 3

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) 2008-2009 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). The Cypress Vendor ID may only be used during the
38
   develpoment process.
39
   Usage:
40
        SET_VPID(<Vendor ID>,<Pioduct ID>);
41
*/
42
#define[SET_VPID(][,$1);][#define[USB_VENDOR_ID][$0]
43
#define[USB_PRODUCT_ID][$1]]
44
 
45
 
46
/*
47
   This macro is called before FPGA Firmware is reset, e.g. to save some
48
   settings. After this macro is called the I/O ports are set to default
49
   states in order to avoid damage during / after the FPGA configuration.
50
   To append someting to this macro use the follwing definition:
51
#define[PRE_FPGA_RESET][PRE_FPGA_RESET
52
...]
53
*/
54
#define[PRE_FPGA_RESET][]
55
 
56
 
57
/*
58
   This macro is called after FPGA Firmware has been configured. This is
59
   usually used to configure the I/O ports.
60
   To append someting to this macro use the follwing definition:
61
#define[POST_FW_LOAD][POST_FW_LOAD
62
...]
63
*/
64
#define[POST_FPGA_CONFIG][]
65
 
66
 
67 3 ZTEX
 
68 2 ZTEX
/*
69
  Add a vedor request for endpoint 0,
70
 
71
   Usage:
72
     ADD_EP0_VENDOR_REQUEST((<request number>,,<code executed after setup package received>,,<code executed after data package received>''));
73
   Example:
74
     ADD_EP0_VENDOR_REQUEST((0x33,,initHSFPGAConfiguration();,,));;
75
...]
76
*/
77
#define[EP0_VENDOR_REQUESTS_SU;][]
78
#define[EP0_VENDOR_REQUESTS_DAT;][]
79
#define[ADD_EP0_VENDOR_REQUEST((][,,$1,,$2));;][#define[EP0_VENDOR_REQUESTS_SU;][EP0_VENDOR_REQUESTS_SU;
80
case $0:
81
    $1
82
    break;
83
]
84
#define[EP0_VENDOR_REQUESTS_DAT;][EP0_VENDOR_REQUESTS_DAT;
85
case $0:
86
    $2
87
    break;
88
]]
89
 
90
 
91
/*
92
   Add a vedor command for endpoint 0,
93
 
94
   Usage:
95
     ADD_EP0_VENDOR_COMMAND((<request number>,,<code executed after setup package received>,,<code executed after data package received>''));
96
   Example:
97
     ADD_EP0_VENDOR_COMMAND((0x33,,initHSFPGAConfiguration();,,));;
98
...]
99
*/
100
#define[EP0_VENDOR_COMMANDS_SU;][]
101
#define[EP0_VENDOR_COMMANDS_DAT;][]
102
#define[ADD_EP0_VENDOR_COMMAND((][,,$1,,$2));;][#define[EP0_VENDOR_COMMANDS_SU;][EP0_VENDOR_COMMANDS_SU;
103
case $0:
104
    $1
105
    break;
106
]
107
#define[EP0_VENDOR_COMMANDS_DAT;][EP0_VENDOR_COMMANDS_DAT;
108
case $0:
109
    $2
110
    break;
111
]]
112
 
113 3 ZTEX
/*
114
  This macro generates a EP0 stall and aborts the current loop. Stalls are usually used to indicate errors.
115
*/
116
#define[EP0_STALL;][{
117
    EP0CS |= 0x01;      // set stall
118
    ep0_payload_remaining = 0;
119
    break;
120
}]
121 2 ZTEX
 
122 3 ZTEX
 
123 2 ZTEX
/*
124
   Endoint 2,4,5,8 configuration:
125
 
126
   EP_CONFIG(<EP number>,<interface>,<type>,<direction>,<size>,<buffers>)
127
        <EP number> = 2 | 4 | 6 | 8             Endpoint numer
128
        <INTERFACE> = 0 | 1 | 2 | 3             To which interface this endpoint belongs
129
        <type>      = BULK  | ISO | INT
130
        <dir>       = IN | OUT
131
        <size>      = 512 | 1024
132
        <buffers>   = 1 | 2 | 3 | 4
133
   Example: EP2_CONFIG(2,0,ISO,OUT,1024,4);
134
   Importand note: No spaces next to the commas
135
 
136
   Endoint 1 configuration. These Endpoints are defined by default and assigned to interface 0.
137
   EP1IN_CONFIG(<interface>);
138
           <INTERFACE> = 0 | 1 | 2 | 3          To which interface EP1IN belongs; default: 0
139
   EP1OUT_CONFIG(<interface>);
140
           <INTERFACE> = 0 | 1 | 2 | 3          To which interface EP1OUT belongs; default: 0
141
   EP1_CONFIG(<interface>);
142
           <INTERFACE> = 0 | 1 | 2 | 3          To which interface EP1IN and EP1OUT belongs; default: 0
143
 
144
   The following (maximum) configurations are possible:
145
   EP2          EP4     EP6     EP8
146
   2x512        2x512   2x512   2x512
147
   2x512        2x512   4x512
148
   2x512        2x512   2x1024
149
   4x512                2x512   2x512
150
   4x512                4x512
151
   4x512                2x1024
152
   2x1024               2x512   2x512
153
   2x1024               4x512
154
   2x1024               2x1024
155
   3x512                3x512   2x512
156
   3x1024                       2x512
157
   4x1024
158
*/
159
#define[EP_CONFIG(][,$1,$2,$3,$4,$5);][
160
#ifeq[$0][1IN]
161
#elifeq[$0][1OUT]
162
#elifeq[$0][2]
163
#elifeq[$0][4]
164
#elifeq[$0][6]
165
#elifneq[$0][8]
166
#error[EP_CONFIG: Invalid 1st parameter: `$0'. Expected `2', `4', `6' or '8']
167
#endif
168
#ifeq[$1][0]
169
#elifeq[$1][1]
170
#elifeq[$1][2]
171
#elifneq[$1][3]
172
#error[EP_CONFIG: Invalid 2nd parameter: `$1'. Expected `0', `1', `2' or '3']
173
#endif
174
#ifeq[$2][BULK]
175
#elifeq[$2][ISO]
176
#elifneq[$2][INT]
177
#error[EP_CONFIG: Invalid 3nd parameter: `$2'. Expected `BULK', `ISO' or 'INT']
178
#endif
179
#ifeq[$3][IN]
180
#elifneq[$3][OUT]
181
#error[EP_CONFIG: Invalid 4th parameter: `$3'. Expected `IN' or 'OUT']
182
#endif
183
#ifeq[$4][64]
184
#elifeq[$4][512]
185
#elifneq[$4][1024]
186
#error[EP_CONFIG: Invalid 5th parameter: `$4'. Expected `512' or '1024']
187
#endif
188
#ifeq[$5][1]
189
#elifeq[$5][2]
190
#elifeq[$5][3]
191
#elifneq[$5][4]
192
#error[EP_CONFIG: Invalid 6th parameter: `$5'. Expected `1', `2', `3' or `4']
193
#endif
194
#define[EP$0_INTERFACE][$1]
195
#define[EP$0_TYPE][$2]
196
#define[EP$0_DIR][$3]
197
#define[EP$0_SIZE][$4]
198
#define[EP$0_BUFFERS][$5]]
199
 
200
#define[EP1IN_CONFIG(][);][#define[EP1IN_INTERFACE][$0]]
201
#define[EP1OUT_CONFIG(][);][#define[EP1OUT_INTERFACE][$0]]
202
#define[EP1_CONFIG(][);][#define[EP1IN_INTERFACE][$0]
203
#define[EP1OUT_INTERFACE][$0]]
204
 
205
EP_CONFIG(1IN,0,BULK,IN,64,1);
206
EP_CONFIG(1OUT,0,BULK,OUT,64,1);
207
 
208
 
209
/*
210
   Settings which depends PRODUCT_ID, e.g extra capabilities.
211
   Overwrite this macros as desired.
212
*/
213
#define[MODULE_RESERVED_00][0]
214
#define[MODULE_RESERVED_01][0]
215
#define[MODULE_RESERVED_02][0]
216
#define[MODULE_RESERVED_03][0]
217
#define[MODULE_RESERVED_04][0]
218
#define[MODULE_RESERVED_05][0]
219
#define[MODULE_RESERVED_06][0]
220
#define[MODULE_RESERVED_07][0]
221
#define[MODULE_RESERVED_08][0]
222
#define[MODULE_RESERVED_09][0]
223
#define[MODULE_RESERVED_10][0]
224
#define[MODULE_RESERVED_11][0]
225
 
226
#define[FWVER][0]
227
 
228
#define[PRODUCT_ID_0][0]
229
#define[PRODUCT_ID_1][0]
230
#define[PRODUCT_ID_2][0]
231
#define[PRODUCT_ID_3][0]
232
 
233
 
234
/*
235
   Identify as ZTEX USB FPGA Module 1.0
236
   Usage: IDENTITY_UFM_1_0(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
237
*/
238
#define[IDENTITY_UFM_1_0(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
239
#define[PRODUCT_ID_1][$1]
240
#define[PRODUCT_ID_2][$2]
241
#define[PRODUCT_ID_3][$3]
242
#define[FWVER][$4]
243
#define[PRODUCT_IS][UFM-1_0]
244
#define[PRODUCT_STRING]["USB-FPGA Module 1.0"]]
245
 
246
 
247
/*
248
   Identify as ZTEX USB FPGA Module 1.1
249
   Usage: IDENTITY_UFM_1_1(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
250
*/
251
#define[IDENTITY_UFM_1_1(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
252
#define[PRODUCT_ID_1][$1]
253
#define[PRODUCT_ID_2][$2]
254
#define[PRODUCT_ID_3][$3]
255
#define[FWVER][$4]
256
#define[PRODUCT_IS][UFM-1_1]
257
#define[PRODUCT_STRING]["USB-FPGA Module 1.1"]]
258
 
259
 
260
/*
261
   Identify as ZTEX USB FPGA Module 1.2
262
   Usage: IDENTITY_UFM_1_2(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
263
*/
264
#define[IDENTITY_UFM_1_2(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
265
#define[PRODUCT_ID_1][$1]
266
#define[PRODUCT_ID_2][$2]
267
#define[PRODUCT_ID_3][$3]
268
#define[FWVER][$4]
269
#define[PRODUCT_IS][UFM-1_2]
270
#define[PRODUCT_STRING]["USB-FPGA Module 1.2"]]
271
 
272
 
273
/*
274
   Identify as ZTEX USB Module 1.0
275
   Usage: IDENTITY_UM_1_0(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
276
*/
277
#define[IDENTITY_UM_1_0(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
278
#define[PRODUCT_ID_1][$1]
279
#define[PRODUCT_ID_2][$2]
280
#define[PRODUCT_ID_3][$3]
281
#define[FWVER][$4]
282
#define[PRODUCT_IS][UM-1_0]
283
#define[PRODUCT_STRING]["USB Module 1.0"]]
284
 
285
 
286
/*
287
   This macro defines the Manufacturer string. Limited to 31 charcters.
288
*/
289
#define[MANUFACTURER_STRING]["ZTEX"]
290
 
291
 
292
/*
293
   This macro defines the Product string. Limited to 31 charcters.
294
*/
295
#define[PRODUCT_STRING]["USB-FPGA Module"]
296
 
297
 
298
/*
299
   This macro defines the Configuration string. Limited to 31 charcters.
300
*/
301
#define[CONFIGURATION_STRING]["(unknown)"]
302
 
303
 
304
/*
305
   This macro enables defines the Configuration string. Limited to 31 charcters.
306
*/
307
#define[CONFIGURATION_STRING]["(unknown)"]
308
 
309
 
310
/*
311
   This macro disables EEPROM interface and certain I2C functions (enabled by default)
312
   Usage: DISABLE_EEPROM;
313
*/
314
#define[DISBALE_EEPROM;][#define[EEPROM_DISBALED][1]]
315
 
316
 
317
/*
318
   This macro enables the Flash interface, if available
319
   Usage: ENABLE_FLASH;
320
*/
321
#define[ENABLE_FLASH;][#define[FLASH_ENABLED][1]]
322
 
323 3 ZTEX
/*
324
   This macro enables the FPGA configuration using a bitstream from the Flash memory
325
   Usage: ENABLE_FLASH_BITSTREAM;
326
*/
327
#define[ENABLE_FLASH_BITSTREAM;][#define[FLASH_BITSTREAM_ENABLED][1]]
328
 
329 2 ZTEX
#endif

powered by: WebSVN 2.1.0

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