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

Subversion Repositories usb_fpga_1_11

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /usb_fpga_1_11/trunk/include
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

/ztex-xmega.h
0,0 → 1,29
/*!
ZTEX Firmware Kit for EZ-USB Microcontrollers
Copyright (C) 2009-2010 ZTEX e.K.
http://www.ztex.de
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, see http://www.gnu.org/licenses/.
!*/
 
/*
AVR XMEGA support
*/
 
#ifndef[ZTEX_XMEGA_H]
#define[ZTEX_XMEGA_H]
 
#define[@CAPABILITY_XMEGA;]
#define[XMEGA_ENABLED][1]
 
#endif /*ZTEX_XMEGA_H*/
/ztex-descriptors.h
49,8 → 49,9
1.*.*.* // may be used for experimental purposes
10.*.*.* // used for ZTEX products
10.11.*.* // ZTEX USB-FPGA-Module 1.2
10.12.*.* // ZTEX USB-FPGA-Module 1.10
10.12.*.* // ZTEX USB-FPGA-Module 1.11
10.20.*.* // ZTEX USB-Module 1.0
10.30.*.* // ZTEX USB-XMEGA-Module 1.0
Please contact me (http://www.ztex.de --> Impressum/Kontakt) if you want to register/reserve a Product ID (range).
*/
66,7 → 67,9
Standard interface capabilities:
0.0 : EEPROM read/write, see ztex-eeprom.h
0.1 : FPGA configuration, see ztex-fpga.h
0.2 : Flash memeory suport, see ztex-flash1.h
0.2 : Flash memory support, see ztex-flash1.h
0.3 : Debug helper, see ztex-debug.h
0.4 : AVR XMEGA support, see ztex-xmega.h
*/
xdata at ZTEX_DESCRIPTOR_OFFS+12 BYTE INTERFACE_CAPABILITIES[6];
 
152,6 → 155,14
#nolf
+ 4
#endif
#ifdef[@CAPABILITY_DEBUG;]
#nolf
+ 8
#endif
#ifdef[@CAPABILITY_XMEGA;]
#nolf
+ 16
#endif
.db 0
.db 0
.db 0
/ztex.h
30,9 → 30,8
********************************************************************* */
#include[ztex-utils.h]
 
 
/* *********************************************************************
***** EEPROM support and some I2c helper functions ******************
***** EEPROM support and some I2C helper functions ******************
********************************************************************* */
#ifneq[EEPROM_DISABLED][1]
#include[ztex-eeprom.h]
67,6 → 66,14
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
 
#elifeq[PRODUCT_IS][UM-1_0]
#define[MMC_PORT][C]
#define[MMC_BIT_CS][7]
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
 
#elifeq[PRODUCT_IS][UFM-1_10]
#define[MMC_PORT][A]
#define[MMC__PORT_DO][D]
85,8 → 92,16
#define[MMC_BIT_CLK][6]
#include[ztex-flash1.h]
 
#elifeq[PRODUCT_IS][UXM-1_0]
#define[MMC_PORT][C]
#define[MMC_BIT_CS][7]
#define[MMC_BIT_DI][6]
#define[MMC_BIT_DO][4]
#define[MMC_BIT_CLK][5]
#include[ztex-flash1.h]
 
#else
#warning[FLASH option is not supported by this product]
#warning[Flash memory access is not supported by this product]
#define[FLASH_ENABLED][0]
#endif
#endif
106,7 → 121,26
#include[ztex-fpga3.h]
#endif
 
 
/* *********************************************************************
***** DEBUG helper functions ****************************************
********************************************************************* */
#ifeq[DEBUG_ENABLED][1]
#include[ztex-debug.h]
#endif
 
 
/* *********************************************************************
***** XMEGA support *************************************************
********************************************************************* */
#ifneq[XMEGA_DISABLED][1]
#ifeq[PRODUCT_IS][UXM-1_0]
#include[ztex-xmega.h]
#endif
#endif
 
 
/* *********************************************************************
***** define the descriptors and the interrupt routines *************
********************************************************************* */
#include[ztex-descriptors.h]
225,7 → 259,14
#ifeq[FLASH_BITSTREAM_ENABLED][1]
fpga_configure_from_flash_init();
#endif
#ifeq[DEBUG_ENABLED][1]
debug_init();
#endif
#ifeq[XMEGA_ENABLED][1]
// xmega_init();
#endif
 
 
USBCS |= bmBIT7 | bmBIT1;
wait(250);
USBCS &= ~0x08;
/ztex-conf.h
24,7 → 24,7
#define[ZTEX_CONF_H]
 
/*
Don't expant macros in comments
Don't expand macros in comments
*/
#define[//][
][#noexpand[!dnapxeon!]//$0!dnapxeon!
38,7 → 38,7
The default vendor ID is the ZTEX vendor ID 0x221A, default product ID is
0x100 which is assigned to ZTEX modules. These ID's can be shared by many
differend products which are identified by the product ID of the ZTEX
different products which are identified by the product ID of the ZTEX
descriptor. According to the USB-IF rules these ID's must not be used by
hardware which is not manufactured by ZTEX. (Of course, this ID's can be
used during the development process or for internal purposes.)
47,7 → 47,7
informations about this topic.
Usage:
SET_VPID(<Vendor ID>,<Pioduct ID>);
SET_VPID(<Vendor ID>,<Product ID>);
*/
#define[SET_VPID(][,$1);][#define[USB_VENDOR_ID][$0]
#define[USB_PRODUCT_ID][$1]]
57,7 → 57,7
This macro is called before FPGA Firmware is reset, e.g. to save some
settings. After this macro is called the I/O ports are set to default
states in order to avoid damage during / after the FPGA configuration.
To append someting to this macro use the follwing definition:
To append something to this macro use the following definition:
#define[PRE_FPGA_RESET][PRE_FPGA_RESET
...]
*/
67,7 → 67,7
/*
This macro is called after FPGA Firmware has been configured. This is
usually used to configure the I/O ports.
To append someting to this macro use the follwing definition:
To append something to this macro use the following definition:
#define[POST_FW_LOAD][POST_FW_LOAD
...]
*/
134,7 → 134,7
Endoint 1,2,4,5,8 configuration:
 
EP_CONFIG(<EP number>,<interface>,<type>,<direction>,<size>,<buffers>)
<EP number> = 1IN | 1OUT | 2 | 4 | 6 | 8 Endpoint numer
<EP number> = 1IN | 1OUT | 2 | 4 | 6 | 8 Endpoint number
<INTERFACE> = 0 | 1 | 2 | 3 To which interface this endpoint belongs
<type> = BULK | ISO | INT
<dir> = IN | OUT
141,10 → 141,10
<size> = 512 | 1024
<buffers> = 1 | 2 | 3 | 4
Example: EP_CONFIG(2,0,ISO,OUT,1024,4);
Importand note: No spaces next to the commas
Important note: No spaces next to the commas
 
 
Endoint 1 configuration:
Endpoint 1 configuration:
These Endpoints are defined by default as bulk endpoints and are assigned to interface 0.
Endpoint size is always 64 bytes, but reported Endpoint size will be 512 bytes for USB 2.0 compliance.
226,12 → 226,12
 
Default value is 1 for all endpoints.
 
EP_PPMF(<EP number>,<tansactions per microframe>)
EP_PPMF(<EP number>,<transactions per microframe>)
<EP number> = 1IN | 1OUT | 2 | 4 | 6 | 8 Endpoint
<tansactions per microframe> = 1 | 2 | 3 Transactions per microframe
<transactions per microframe> = 1 | 2 | 3 Transactions per microframe
Example: EP_PPMF(2,3);
Importand note: No spaces next to the commas
Important note: No spaces next to the commas
*/
#define[EP_PPMF(][,$1);][
#ifeq[$0][1IN]
266,7 → 266,7
<polling interval> = 1 | 2 | 3 Polling interval
Example: EP_POLL(2,1);
Importand note: No spaces next to the commas
Important note: No spaces next to the commas
*/
#define[EP_POLL(][,$1);][
#ifeq[$0][1IN]
390,25 → 390,38
 
 
/*
This macro defines the Manufacturer string. Limited to 31 charcters.
Identify as ZTEX USB XMEGA Module 1.0
Usage: IDENTITY_UM_1_0(<PRODUCT_ID_0>.<PRODUCT_ID_1><PRODUCT_ID_2>.<PRODUCT_ID_3>,<FW_VERSION>);
*/
#define[IDENTITY_UXM_1_0(][.$1.$2.$3,$4);][#define[PRODUCT_ID_0][$0]
#define[PRODUCT_ID_1][$1]
#define[PRODUCT_ID_2][$2]
#define[PRODUCT_ID_3][$3]
#define[FWVER][$4]
#define[PRODUCT_IS][UXM-1_0]
#define[PRODUCT_STRING]["USB XMEGA Module 1.0"]]
 
 
/*
This macro defines the Manufacturer string. Limited to 31 characters.
*/
#define[MANUFACTURER_STRING]["ZTEX"]
 
 
/*
This macro defines the Product string. Limited to 31 charcters.
This macro defines the Product string. Limited to 31 characters.
*/
#define[PRODUCT_STRING]["USB-FPGA Module"]
 
 
/*
This macro defines the Configuration string. Limited to 31 charcters.
This macro defines the Configuration string. Limited to 31 characters.
*/
#define[CONFIGURATION_STRING]["(unknown)"]
 
 
/*
This macro enables defines the Configuration string. Limited to 31 charcters.
This macro enables defines the Configuration string. Limited to 31 characters.
*/
#define[CONFIGURATION_STRING]["(unknown)"]
 
417,7 → 430,7
This macro disables EEPROM interface and certain I2C functions (enabled by default)
Usage: DISABLE_EEPROM;
*/
#define[DISBALE_EEPROM;][#define[EEPROM_DISBALED][1]]
#define[DISABLE_EEPROM;][#define[EEPROM_DISABLED][1]]
 
 
/*
432,4 → 445,21
*/
#define[ENABLE_FLASH_BITSTREAM;][#define[FLASH_BITSTREAM_ENABLED][1]]
 
/*
This enables the debug helper. The debug helper consists in a stack of messages which can be read out from host software.
See ../examples/all/debug/Readme.
Usage: ENABLE_DEBUG(<stack size>,<message_size>);
<stack size> number of messages in stack
<message size> message size in bytes
*/
#define[ENABLE_DEBUG(][,$1);][#define[DEBUG_ENABLED][1]
#define[DEBUG_STACK_SIZE][$0]
#define[DEBUG_MSG_SIZE][$1]]
 
/*
This macro disables XMEGA support, if available
Usage: ENABLE_FLASH;
*/
#define[XMEGA_DISABLED;][#define[XMEGA_DISABLED][1]]
 
#endif
/ztex-debug.h
0,0 → 1,90
/*!
ZTEX Firmware Kit for EZ-USB Microcontrollers
Copyright (C) 2009-2010 ZTEX e.K.
http://www.ztex.de
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
 
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, see http://www.gnu.org/licenses/.
!*/
 
/*
debug helper
*/
#ifndef[ZTEX_DEBUG_H]
#define[ZTEX_DEBUG_H]
 
#ifndef[DEBUG_STACK_SIZE]
#error[Macro `DEBUG_STACK_SIZE' is not defined.]
#endif
 
#ifndef[DEBUG_MSG_SIZE]
#error[Macro `DEBUG_MSG_SIZE' is not defined.]
#endif
 
#define[@CAPABILITY_DEBUG;]
 
xdata WORD debug_counter; // message number
xdata BYTE debug_stack_size; // stack size in messages
xdata BYTE debug_msg_size; // message size in bytes
xdata BYTE debug_stack[DEBUG_STACK_SIZE*DEBUG_MSG_SIZE]; // message stack
xdata BYTE* xdata debug_stack_ptr; // pointer to the last message added
 
xdata BYTE debug_msg_buf[DEBUG_MSG_SIZE]; // user buffer: user should write data to this buffer
xdata BYTE* xdata debug_read_addr;
 
/* *********************************************************************
***** debug_add_msg *************************************************
********************************************************************* */
// adds the current message (stored in debug_msg_buf) to the message stack
void debug_add_msg () {
BYTE i;
i = debug_counter % DEBUG_STACK_SIZE;
debug_stack_ptr = &debug_stack[i*DEBUG_MSG_SIZE];
MEM_COPY1(debug_msg_buf,*debug_stack_ptr,DEBUG_MSG_SIZE);
debug_counter += 1;
}
 
/* *********************************************************************
***** debug_add_msg *************************************************
********************************************************************* */
// init the variables
void debug_init () {
debug_counter = 0; // message number
debug_stack_size = DEBUG_STACK_SIZE;
debug_msg_size = DEBUG_MSG_SIZE;
debug_stack_ptr = debug_stack;
}
 
/* *********************************************************************
***** EP0 vendor request 0x28 ***************************************
********************************************************************* */
// read the debug data
BYTE debug_read_ep0 () {
BYTE b;
b = ep0_payload_transfer;
if ( b != 0) {
MEM_COPY1(*debug_read_addr,EP0BUF,b);
}
debug_read_addr += b;
return b;
}
 
ADD_EP0_VENDOR_REQUEST((0x28,, // read the debug data
debug_read_addr = (__xdata BYTE*)&debug_counter;
EP0BCH = 0;
EP0BCL = debug_read_ep0();
,,
EP0BCH = 0;
EP0BCL = debug_read_ep0();
));;
 
#endif /*ZTEX_DEBUG_H*/
/ztex-eeprom.h
131,6 → 131,9
BYTE eeprom_read ( __xdata BYTE *buf, WORD addr, BYTE length ) {
BYTE bytes = 0,i;
if ( length == 0 )
return 0;
if ( eeprom_select(100,0) )
goto eeprom_read_end;
/ztex-isr.h
127,7 → 127,7
EP0BCL = 2;
break;
case 0x81: // interface (reserved)
EP0BUF[0] = 0; // Always return zeros
EP0BUF[0] = 0; // always return zeros
EP0BUF[1] = 0;
EP0BCH = 0;
EP0BCL = 2;
301,7 → 301,7
case 0x40: // vendor command
/* vendor commands may overlap if they are send without pause. To avoid
synchronization problems the setup sequences are executed in EP0OUT_ISR, i.e.
after the first packet of payload date received. */
after the first packet of payload data received. */
if ( SETUPDAT[7]!=0 || SETUPDAT[6]!=0 ) {
ep0_vendor_cmd_setup = 1;
EP0BCL = 0;
/ztex-utils.h
37,9 → 37,9
_endasm;
]
 
#define[MSB(][)][((BYTE)(((unsigned short)($0)) >> 8))]
#define[MSB(][)][((BYTE)((((unsigned short)($0)) >> 8) & 0xff)) ]
#define[LSB(][)][((BYTE)($0))]
#define[HI(][)][((BYTE)(((unsigned short)($0)) >> 8))]
#define[HI(][)][((BYTE)((((unsigned short)($0)) >> 8) & 0xff)) ]
#define[LO(][)][((BYTE)($0))]
 
typedef unsigned char BYTE;
117,12 → 117,12
*/
 
#define[MEM_COPY1(][,$1,$2);][{
AUTOPTRL1=LO(&($0));
AUTOPTRH1=HI(&($0));
AUTOPTRL2=LO(&($1));
AUTOPTRH2=HI(&($1));
_asm
push ar2
mov _AUTOPTRL1,#(_$0)
mov _AUTOPTRH1,#((_$0) >> 8)
mov _AUTOPTRL2,#(_$1)
mov _AUTOPTRH2,#((_$1) >> 8)
mov r2,#($2);
lcall _MEM_COPY1_int
pop ar2

powered by: WebSVN 2.1.0

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